jsimd_set_ycc_rgb:
  241|     12|{
  242|     12|  init_simd((j_common_ptr)cinfo);
  243|       |
  244|     12|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|     12|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (244:7): [Folded, False: 12]
  ------------------
  245|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  246|     12|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (246:7): [Folded, False: 12]
  ------------------
  247|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  248|     12|  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
  ------------------
  |  |  302|     12|#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: 12]
  |  Branch (248:31): [True: 0, Folded]
  ------------------
  249|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  250|     12|  if (!cinfo->cconvert)
  ------------------
  |  Branch (250:7): [True: 0, False: 12]
  ------------------
  251|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  252|       |
  253|     12|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  254|     12|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|     12|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (254:7): [True: 0, False: 12]
  ------------------
  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|     12|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|     12|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (259:7): [True: 0, False: 12]
  ------------------
  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|     12|  return JSIMD_NONE;
  ------------------
  |  |   38|     12|#define JSIMD_NONE       0x00
  ------------------
  293|     12|}
jsimd_set_h2v1_upsample:
  456|      7|{
  457|      7|  init_simd((j_common_ptr)cinfo);
  458|       |
  459|      7|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|      7|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (459:7): [Folded, False: 7]
  ------------------
  460|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  461|      7|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (461:7): [Folded, False: 7]
  ------------------
  462|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  463|      7|  if (!cinfo->upsample)
  ------------------
  |  Branch (463:7): [True: 0, False: 7]
  ------------------
  464|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  465|       |
  466|      7|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  467|      7|  if (cinfo->master->simd_support & JSIMD_AVX2) {
  ------------------
  |  |   46|      7|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (467:7): [True: 0, False: 7]
  ------------------
  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|      7|  if (cinfo->master->simd_support & JSIMD_SSE2) {
  ------------------
  |  |   42|      7|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (471:7): [True: 0, False: 7]
  ------------------
  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|      7|  return JSIMD_NONE;
  ------------------
  |  |   38|      7|#define JSIMD_NONE       0x00
  ------------------
  499|      7|}
jsimd_set_h2v2_upsample:
  514|      7|{
  515|      7|  init_simd((j_common_ptr)cinfo);
  516|       |
  517|      7|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|      7|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (517:7): [Folded, False: 7]
  ------------------
  518|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  519|      7|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (519:7): [Folded, False: 7]
  ------------------
  520|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  521|      7|  if (!cinfo->upsample)
  ------------------
  |  Branch (521:7): [True: 0, False: 7]
  ------------------
  522|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  523|       |
  524|      7|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  525|      7|  if (cinfo->master->simd_support & JSIMD_AVX2) {
  ------------------
  |  |   46|      7|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (525:7): [True: 0, False: 7]
  ------------------
  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|      7|  if (cinfo->master->simd_support & JSIMD_SSE2) {
  ------------------
  |  |   42|      7|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (529:7): [True: 0, False: 7]
  ------------------
  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|      7|  return JSIMD_NONE;
  ------------------
  |  |   38|      7|#define JSIMD_NONE       0x00
  ------------------
  557|      7|}
jsimd_set_h2v1_fancy_upsample:
  572|      3|{
  573|      3|  init_simd((j_common_ptr)cinfo);
  574|       |
  575|      3|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|      3|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (575:7): [Folded, False: 3]
  ------------------
  576|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  577|      3|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (577:7): [Folded, False: 3]
  ------------------
  578|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  579|      3|  if (!cinfo->upsample)
  ------------------
  |  Branch (579:7): [True: 0, False: 3]
  ------------------
  580|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  581|       |
  582|      3|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  583|      3|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|      3|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (583:7): [True: 0, False: 3]
  ------------------
  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|      3|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|      3|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (588:7): [True: 0, False: 3]
  ------------------
  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|      3|  return JSIMD_NONE;
  ------------------
  |  |   38|      3|#define JSIMD_NONE       0x00
  ------------------
  622|      3|}
jsimd_set_h2v2_fancy_upsample:
  637|      5|{
  638|      5|  init_simd((j_common_ptr)cinfo);
  639|       |
  640|      5|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|      5|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (640:7): [Folded, False: 5]
  ------------------
  641|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  642|      5|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (642:7): [Folded, False: 5]
  ------------------
  643|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  644|      5|  if (!cinfo->upsample)
  ------------------
  |  Branch (644:7): [True: 0, False: 5]
  ------------------
  645|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  646|       |
  647|      5|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  648|      5|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|      5|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (648:7): [True: 0, False: 5]
  ------------------
  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|      5|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|      5|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (653:7): [True: 0, False: 5]
  ------------------
  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|      5|  return JSIMD_NONE;
  ------------------
  |  |   38|      5|#define JSIMD_NONE       0x00
  ------------------
  687|      5|}
jsimd_set_idct_islow:
 1153|  1.36k|{
 1154|  1.36k|  init_simd((j_common_ptr)cinfo);
 1155|       |
 1156|  1.36k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (1156:7): [Folded, False: 1.36k]
  ------------------
 1157|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1158|  1.36k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  1.36k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (1158:7): [Folded, False: 1.36k]
  ------------------
 1159|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1160|  1.36k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (1160:7): [Folded, False: 1.36k]
  ------------------
 1161|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1162|  1.36k|  if (sizeof(ISLOW_MULT_TYPE) != 2)
  ------------------
  |  Branch (1162:7): [Folded, False: 1.36k]
  ------------------
 1163|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1164|  1.36k|  if (!cinfo->idct)
  ------------------
  |  Branch (1164:7): [True: 0, False: 1.36k]
  ------------------
 1165|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1166|       |
 1167|  1.36k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
 1168|  1.36k|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|  1.36k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (1168:7): [True: 0, False: 1.36k]
  ------------------
 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|  1.36k|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|  1.36k|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (1173:7): [True: 0, False: 1.36k]
  ------------------
 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|  1.36k|  return JSIMD_NONE;
  ------------------
  |  |   38|  1.36k|#define JSIMD_NONE       0x00
  ------------------
 1207|  1.36k|}
jsimd.c:init_simd:
   56|  1.39k|{
   57|  1.39k|#ifndef NO_GETENV
   58|  1.39k|  char env[2] = { 0 };
   59|  1.39k|#endif
   60|  1.39k|  unsigned int simd_support = cinfo->is_decompressor ?
  ------------------
  |  Branch (60:31): [True: 1.39k, False: 0]
  ------------------
   61|  1.39k|                              ((j_decompress_ptr)cinfo)->master->simd_support :
   62|  1.39k|                              ((j_compress_ptr)cinfo)->master->simd_support;
   63|  1.39k|  unsigned int simd_huffman = cinfo->is_decompressor ?
  ------------------
  |  Branch (63:31): [True: 1.39k, False: 0]
  ------------------
   64|  1.39k|                              ((j_decompress_ptr)cinfo)->master->simd_huffman :
   65|  1.39k|                              ((j_compress_ptr)cinfo)->master->simd_huffman;
   66|       |
   67|  1.39k|  if (simd_support != JSIMD_UNDEFINED)
  ------------------
  |  |   49|  1.39k|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|  1.39k|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  |  Branch (67:7): [True: 18, False: 1.37k]
  ------------------
   68|     18|    return;
   69|       |
   70|  1.37k|  simd_support = jpeg_simd_cpu_support();
   71|       |
   72|  1.37k|#ifndef NO_GETENV
   73|       |  /* Force different settings through environment variables */
   74|  1.37k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
   75|  1.37k|  if (!GETENV_S(env, 2, "JSIMD_FORCESSE2") && !strcmp(env, "1"))
  ------------------
  |  Branch (75:7): [True: 1.37k, False: 0]
  |  Branch (75:47): [True: 0, False: 1.37k]
  ------------------
   76|      0|    simd_support &= JSIMD_SSE2 | JSIMD_SSE;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
                  simd_support &= JSIMD_SSE2 | JSIMD_SSE;
  ------------------
  |  |   41|      0|#define JSIMD_SSE        0x04
  ------------------
   77|       |#if SIMD_ARCHITECTURE == I386
   78|       |  if (!GETENV_S(env, 2, "JSIMD_FORCESSE") && !strcmp(env, "1"))
   79|       |    simd_support &= JSIMD_SSE | JSIMD_MMX;
   80|       |  if (!GETENV_S(env, 2, "JSIMD_FORCEMMX") && !strcmp(env, "1"))
   81|       |    simd_support &= JSIMD_MMX;
   82|       |  if (!GETENV_S(env, 2, "JSIMD_FORCE3DNOW") && !strcmp(env, "1"))
   83|       |    simd_support &= JSIMD_3DNOW | JSIMD_MMX;
   84|       |#endif
   85|       |#elif SIMD_ARCHITECTURE == ARM
   86|       |  if (!GETENV_S(env, 2, "JSIMD_FORCENEON") && !strcmp(env, "1"))
   87|       |    simd_support = JSIMD_NEON;
   88|       |#elif SIMD_ARCHITECTURE == RISCV64
   89|       |  if (!GETENV_S(env, 2, "JSIMD_FORCERVV") && !strcmp(env, "1"))
   90|       |    simd_support = JSIMD_RVV;
   91|       |#elif SIMD_ARCHITECTURE == MIPS64
   92|       |  if (!GETENV_S(env, 2, "JSIMD_FORCEMMI") && !strcmp(env, "1"))
   93|       |    simd_support = JSIMD_MMI;
   94|       |#endif
   95|  1.37k|  if (!GETENV_S(env, 2, "JSIMD_FORCENONE") && !strcmp(env, "1"))
  ------------------
  |  Branch (95:7): [True: 1.37k, False: 0]
  |  Branch (95:47): [True: 1.37k, False: 0]
  ------------------
   96|  1.37k|    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|  1.37k|  if (!GETENV_S(env, 2, "JSIMD_NOHUFFENC") && !strcmp(env, "1"))
  ------------------
  |  Branch (101:7): [True: 1.37k, False: 0]
  |  Branch (101:47): [True: 0, False: 1.37k]
  ------------------
  102|      0|    simd_huffman = 0;
  103|  1.37k|#endif
  104|  1.37k|#endif
  105|       |
  106|  1.37k|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (106:7): [True: 1.37k, False: 0]
  ------------------
  107|  1.37k|    ((j_decompress_ptr)cinfo)->master->simd_support = simd_support;
  108|  1.37k|    ((j_decompress_ptr)cinfo)->master->simd_huffman = simd_huffman;
  109|  1.37k|  } 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|  1.37k|}

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

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

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

jinit_arith_decoder:
  751|  1.06k|{
  752|  1.06k|  arith_entropy_ptr entropy;
  753|  1.06k|  int i;
  754|       |
  755|  1.06k|  entropy = (arith_entropy_ptr)
  756|  1.06k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.06k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  757|  1.06k|                                sizeof(arith_entropy_decoder));
  758|  1.06k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  759|  1.06k|  entropy->pub.start_pass = start_pass;
  760|       |
  761|       |  /* Mark tables unallocated */
  762|  18.1k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|  18.1k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (762:15): [True: 17.0k, False: 1.06k]
  ------------------
  763|  17.0k|    entropy->dc_stats[i] = NULL;
  764|  17.0k|    entropy->ac_stats[i] = NULL;
  765|  17.0k|  }
  766|       |
  767|       |  /* Initialize index for fixed probability estimation */
  768|  1.06k|  entropy->fixed_bin[0] = 113;
  769|       |
  770|  1.06k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (770:7): [True: 856, False: 211]
  ------------------
  771|       |    /* Create progression status table */
  772|    856|    int *coef_bit_ptr, ci;
  773|    856|    cinfo->coef_bits = (int (*)[DCTSIZE2])
  774|    856|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    856|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  775|    856|                                  cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|    856|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  776|    856|                                  sizeof(int));
  777|    856|    coef_bit_ptr = &cinfo->coef_bits[0][0];
  778|  1.75k|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (778:18): [True: 894, False: 856]
  ------------------
  779|  58.1k|      for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|  58.1k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (779:19): [True: 57.2k, False: 894]
  ------------------
  780|  57.2k|        *coef_bit_ptr++ = -1;
  781|    856|  }
  782|  1.06k|}
jdarith.c:start_pass:
  633|  2.33k|{
  634|  2.33k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  635|  2.33k|  int ci, tbl;
  636|  2.33k|  jpeg_component_info *compptr;
  637|       |
  638|  2.33k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (638:7): [True: 2.12k, False: 211]
  ------------------
  639|       |    /* Validate progressive scan parameters */
  640|  2.12k|    if (cinfo->Ss == 0) {
  ------------------
  |  Branch (640:9): [True: 1.36k, False: 758]
  ------------------
  641|  1.36k|      if (cinfo->Se != 0)
  ------------------
  |  Branch (641:11): [True: 2, False: 1.36k]
  ------------------
  642|      2|        goto bad;
  643|  1.36k|    } else {
  644|       |      /* need not check Ss/Se < 0 since they came from unsigned bytes */
  645|    758|      if (cinfo->Se < cinfo->Ss || cinfo->Se > DCTSIZE2 - 1)
  ------------------
  |  |   67|    757|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (645:11): [True: 1, False: 757]
  |  Branch (645:36): [True: 1, False: 756]
  ------------------
  646|      2|        goto bad;
  647|       |      /* AC scans may have only one component */
  648|    756|      if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (648:11): [True: 0, False: 756]
  ------------------
  649|      0|        goto bad;
  650|    756|    }
  651|  2.11k|    if (cinfo->Ah != 0) {
  ------------------
  |  Branch (651:9): [True: 72, False: 2.04k]
  ------------------
  652|       |      /* Successive approximation refinement scan: must have Al = Ah-1. */
  653|     72|      if (cinfo->Ah - 1 != cinfo->Al)
  ------------------
  |  Branch (653:11): [True: 2, False: 70]
  ------------------
  654|      2|        goto bad;
  655|     72|    }
  656|  2.11k|    if (cinfo->Al > 13) {       /* need not check for < 0 */
  ------------------
  |  Branch (656:9): [True: 1, False: 2.11k]
  ------------------
  657|      7|bad:
  658|      7|      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      7|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      7|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      7|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      7|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  659|      7|               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  660|      7|    }
  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|  4.23k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (665:18): [True: 2.11k, False: 2.12k]
  ------------------
  666|  2.11k|      int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
  667|  2.11k|      int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  668|  2.11k|      int *prev_coef_bit_ptr =
  669|  2.11k|        &cinfo->coef_bits[cindex + cinfo->num_components][0];
  670|  2.11k|      if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (670:11): [True: 755, False: 1.36k]
  |  Branch (670:24): [True: 1, False: 754]
  ------------------
  671|      1|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      1|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      1|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  672|  34.2k|      for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|  2.11k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 1.36k, False: 755]
  |  |  ------------------
  ------------------
                    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  513|  34.2k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 19.1k, False: 15.0k]
  |  |  ------------------
  ------------------
  |  Branch (672:39): [True: 32.1k, False: 2.11k]
  ------------------
  673|  32.1k|        if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (673:13): [True: 23.8k, False: 8.33k]
  ------------------
  674|  23.8k|          prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  675|  8.33k|        else
  676|  8.33k|          prev_coef_bit_ptr[coefi] = 0;
  677|  32.1k|      }
  678|  21.1k|      for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (678:31): [True: 19.0k, False: 2.11k]
  ------------------
  679|  19.0k|        int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (679:24): [True: 9.66k, False: 9.39k]
  ------------------
  680|  19.0k|        if (cinfo->Ah != expected)
  ------------------
  |  Branch (680:13): [True: 3, False: 19.0k]
  ------------------
  681|      3|          WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  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))
  ------------------
  682|  19.0k|        coef_bit_ptr[coefi] = cinfo->Al;
  683|  19.0k|      }
  684|  2.11k|    }
  685|       |    /* Select MCU decoding routine */
  686|  2.12k|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (686:9): [True: 2.04k, False: 79]
  ------------------
  687|  2.04k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (687:11): [True: 1.36k, False: 684]
  ------------------
  688|  1.36k|        entropy->pub.decode_mcu = decode_mcu_DC_first;
  689|    684|      else
  690|    684|        entropy->pub.decode_mcu = decode_mcu_AC_first;
  691|  2.04k|    } else {
  692|     79|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (692:11): [True: 0, False: 79]
  ------------------
  693|      0|        entropy->pub.decode_mcu = decode_mcu_DC_refine;
  694|     79|      else
  695|     79|        entropy->pub.decode_mcu = decode_mcu_AC_refine;
  696|     79|    }
  697|  2.12k|  } 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|    211|    if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|    210|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (701:9): [True: 1, False: 210]
  |  Branch (701:27): [True: 1, False: 209]
  ------------------
  702|    209|        cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (702:9): [True: 1, False: 208]
  |  Branch (702:27): [True: 1, False: 207]
  ------------------
  703|      4|      WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      4|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  704|       |    /* Select MCU decoding routine */
  705|    211|    entropy->pub.decode_mcu = decode_mcu;
  706|    211|  }
  707|       |
  708|       |  /* Allocate & initialize requested statistics areas */
  709|  4.65k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (709:16): [True: 2.31k, False: 2.33k]
  ------------------
  710|  2.31k|    compptr = cinfo->cur_comp_info[ci];
  711|  2.31k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (711:9): [True: 207, False: 2.11k]
  |  Branch (711:38): [True: 1.36k, False: 752]
  |  Branch (711:56): [True: 1.36k, False: 0]
  ------------------
  712|  1.56k|      tbl = compptr->dc_tbl_no;
  713|  1.56k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  1.56k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (713:11): [True: 0, False: 1.56k]
  |  Branch (713:22): [True: 0, False: 1.56k]
  ------------------
  714|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  715|  1.56k|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (715:11): [True: 1.13k, False: 430]
  ------------------
  716|  1.13k|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  717|  1.13k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  889|  1.13k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|  1.13k|#define DC_STAT_BINS  64
  ------------------
  718|  1.56k|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  1.56k|#define DC_STAT_BINS  64
  ------------------
  719|       |      /* Initialize DC predictions to 0 */
  720|  1.56k|      entropy->last_dc_val[ci] = 0;
  721|  1.56k|      entropy->dc_context[ci] = 0;
  722|  1.56k|    }
  723|  2.31k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (723:9): [True: 207, False: 2.11k]
  |  Branch (723:37): [True: 752, False: 1.36k]
  ------------------
  724|    959|      tbl = compptr->ac_tbl_no;
  725|    959|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|    959|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (725:11): [True: 0, False: 959]
  |  Branch (725:22): [True: 0, False: 959]
  ------------------
  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|    959|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (727:11): [True: 663, False: 296]
  ------------------
  728|    663|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  729|    663|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  889|    663|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|    663|#define AC_STAT_BINS  256
  ------------------
  730|    959|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|    959|#define AC_STAT_BINS  256
  ------------------
  731|    959|    }
  732|  2.31k|  }
  733|       |
  734|       |  /* Initialize arithmetic decoding variables */
  735|  2.33k|  entropy->c = 0;
  736|  2.33k|  entropy->a = 0;
  737|  2.33k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  738|  2.33k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  2.33k|#define FALSE   0               /* values of boolean */
  ------------------
  739|       |
  740|       |  /* Initialize restart counter */
  741|  2.33k|  entropy->restarts_to_go = cinfo->restart_interval;
  742|  2.33k|}
jdarith.c:decode_mcu_DC_first:
  251|  3.27M|{
  252|  3.27M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  253|  3.27M|  JBLOCKROW block;
  254|  3.27M|  unsigned char *st;
  255|  3.27M|  int blkn, ci, tbl, sign;
  256|  3.27M|  int v, m;
  257|       |
  258|       |  /* Process restart marker if needed */
  259|  3.27M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (259:7): [True: 0, False: 3.27M]
  ------------------
  260|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (260:9): [True: 0, False: 0]
  ------------------
  261|      0|      process_restart(cinfo);
  262|      0|    entropy->restarts_to_go--;
  263|      0|  }
  264|       |
  265|  3.27M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (265:7): [True: 0, False: 3.27M]
  ------------------
  266|       |
  267|       |  /* Outer loop handles each block in the MCU */
  268|       |
  269|  6.55M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (269:18): [True: 3.27M, False: 3.27M]
  ------------------
  270|  3.27M|    block = MCU_data[blkn];
  271|  3.27M|    ci = cinfo->MCU_membership[blkn];
  272|  3.27M|    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|  3.27M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  278|       |
  279|       |    /* Figure F.19: Decode_DC_DIFF */
  280|  3.27M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (280:9): [True: 1.57M, False: 1.70M]
  ------------------
  281|  1.57M|      entropy->dc_context[ci] = 0;
  282|  1.70M|    else {
  283|       |      /* Figure F.21: Decoding nonzero value v */
  284|       |      /* Figure F.22: Decoding the sign of v */
  285|  1.70M|      sign = arith_decode(cinfo, st + 1);
  286|  1.70M|      st += 2;  st += sign;
  287|       |      /* Figure F.23: Decoding the magnitude category of v */
  288|  1.70M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (288:11): [True: 997k, False: 703k]
  ------------------
  289|   997k|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  290|  2.98M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (290:16): [True: 1.98M, False: 997k]
  ------------------
  291|  1.98M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (291:15): [True: 11, False: 1.98M]
  ------------------
  292|     11|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|     11|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     11|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  293|     11|            entropy->ct = -1;                   /* magnitude overflow */
  294|     11|            return TRUE;
  ------------------
  |  |  210|     11|#define TRUE    1
  ------------------
  295|     11|          }
  296|  1.98M|          st += 1;
  297|  1.98M|        }
  298|   997k|      }
  299|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  300|  1.70M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (300:11): [True: 0, False: 1.70M]
  ------------------
  301|      0|        entropy->dc_context[ci] = 0;               /* zero diff category */
  302|  1.70M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (302:16): [True: 823k, False: 877k]
  ------------------
  303|   823k|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  304|   877k|      else
  305|   877k|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  306|  1.70M|      v = m;
  307|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  308|  1.70M|      st += 14;
  309|  3.68M|      while (m >>= 1)
  ------------------
  |  Branch (309:14): [True: 1.98M, False: 1.70M]
  ------------------
  310|  1.98M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (310:13): [True: 923k, False: 1.06M]
  ------------------
  311|  1.70M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (311:20): [True: 1.08M, False: 611k]
  ------------------
  312|  1.70M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  313|  1.70M|    }
  314|       |
  315|       |    /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
  316|  3.27M|    (*block)[0] = (JCOEF)LEFT_SHIFT(entropy->last_dc_val[ci], cinfo->Al);
  ------------------
  |  |   85|  3.27M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  317|  3.27M|  }
  318|       |
  319|  3.27M|  return TRUE;
  ------------------
  |  |  210|  3.27M|#define TRUE    1
  ------------------
  320|  3.27M|}
jdarith.c:arith_decode:
  116|  41.0M|{
  117|  41.0M|  register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  118|  41.0M|  register unsigned char nl, nm;
  119|  41.0M|  register JLONG qe, temp;
  120|  41.0M|  register int sv, data;
  121|       |
  122|       |  /* Renormalization & data input per section D.2.6 */
  123|  58.3M|  while (e->a < 0x8000L) {
  ------------------
  |  Branch (123:10): [True: 17.3M, False: 41.0M]
  ------------------
  124|  17.3M|    if (--e->ct < 0) {
  ------------------
  |  Branch (124:9): [True: 2.17M, False: 15.1M]
  ------------------
  125|       |      /* Need to fetch next data byte */
  126|  2.17M|      if (cinfo->unread_marker)
  ------------------
  |  Branch (126:11): [True: 1.81M, False: 357k]
  ------------------
  127|  1.81M|        data = 0;               /* stuff zero data */
  128|   357k|      else {
  129|   357k|        data = get_byte(cinfo); /* read next input byte */
  130|   357k|        if (data == 0xFF) {     /* zero stuff or marker code */
  ------------------
  |  Branch (130:13): [True: 4.55k, False: 352k]
  ------------------
  131|  12.6k|          do data = get_byte(cinfo);
  132|  12.6k|          while (data == 0xFF); /* swallow extra 0xFF bytes */
  ------------------
  |  Branch (132:18): [True: 8.10k, False: 4.55k]
  ------------------
  133|  4.55k|          if (data == 0)
  ------------------
  |  Branch (133:15): [True: 2.38k, False: 2.17k]
  ------------------
  134|  2.38k|            data = 0xFF;        /* discard stuffed zero byte */
  135|  2.17k|          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.17k|            cinfo->unread_marker = data;
  143|  2.17k|            data = 0;
  144|  2.17k|          }
  145|  4.55k|        }
  146|   357k|      }
  147|  2.17M|      e->c = (e->c << 8) | data; /* insert data into C register */
  148|  2.17M|      if ((e->ct += 8) < 0)      /* update bit shift counter */
  ------------------
  |  Branch (148:11): [True: 4.63k, False: 2.16M]
  ------------------
  149|       |        /* Need more initial bytes */
  150|  4.63k|        if (++e->ct == 0)
  ------------------
  |  Branch (150:13): [True: 2.31k, False: 2.31k]
  ------------------
  151|       |          /* Got 2 initial bytes -> re-init A and exit loop */
  152|  2.31k|          e->a = 0x8000L; /* => e->a = 0x10000L after loop exit */
  153|  2.17M|    }
  154|  17.3M|    e->a <<= 1;
  155|  17.3M|  }
  156|       |
  157|       |  /* Fetch values from our compact representation of Table D.2:
  158|       |   * Qe values and probability estimation state machine
  159|       |   */
  160|  41.0M|  sv = *st;
  161|  41.0M|  qe = jpeg_aritab[sv & 0x7F];  /* => Qe_Value */
  162|  41.0M|  nl = qe & 0xFF;  qe >>= 8;    /* Next_Index_LPS + Switch_MPS */
  163|  41.0M|  nm = qe & 0xFF;  qe >>= 8;    /* Next_Index_MPS */
  164|       |
  165|       |  /* Decode & estimation procedures per sections D.2.4 & D.2.5 */
  166|  41.0M|  temp = e->a - qe;
  167|  41.0M|  e->a = temp;
  168|  41.0M|  temp <<= e->ct;
  169|  41.0M|  if (e->c >= temp) {
  ------------------
  |  Branch (169:7): [True: 5.81M, False: 35.2M]
  ------------------
  170|  5.81M|    e->c -= temp;
  171|       |    /* Conditional LPS (less probable symbol) exchange */
  172|  5.81M|    if (e->a < qe) {
  ------------------
  |  Branch (172:9): [True: 1.65M, False: 4.15M]
  ------------------
  173|  1.65M|      e->a = qe;
  174|  1.65M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  175|  4.15M|    } else {
  176|  4.15M|      e->a = qe;
  177|  4.15M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  178|  4.15M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  179|  4.15M|    }
  180|  35.2M|  } else if (e->a < 0x8000L) {
  ------------------
  |  Branch (180:14): [True: 6.96M, False: 28.2M]
  ------------------
  181|       |    /* Conditional MPS (more probable symbol) exchange */
  182|  6.96M|    if (e->a < qe) {
  ------------------
  |  Branch (182:9): [True: 2.04M, False: 4.92M]
  ------------------
  183|  2.04M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  184|  2.04M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  185|  4.92M|    } else {
  186|  4.92M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  187|  4.92M|    }
  188|  6.96M|  }
  189|       |
  190|  41.0M|  return sv >> 7;
  191|  41.0M|}
jdarith.c:get_byte:
   76|   369k|{
   77|   369k|  struct jpeg_source_mgr *src = cinfo->src;
   78|       |
   79|   369k|  if (src->bytes_in_buffer == 0)
  ------------------
  |  Branch (79:7): [True: 95, False: 369k]
  ------------------
   80|     95|    if (!(*src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (80:9): [True: 0, False: 95]
  ------------------
   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|   369k|  src->bytes_in_buffer--;
   83|   369k|  return *src->next_input_byte++;
   84|   369k|}
jdarith.c:decode_mcu_AC_first:
  330|  2.54M|{
  331|  2.54M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  332|  2.54M|  JBLOCKROW block;
  333|  2.54M|  unsigned char *st;
  334|  2.54M|  int tbl, sign, k;
  335|  2.54M|  int v, m;
  336|       |
  337|       |  /* Process restart marker if needed */
  338|  2.54M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (338:7): [True: 0, False: 2.54M]
  ------------------
  339|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (339:9): [True: 0, False: 0]
  ------------------
  340|      0|      process_restart(cinfo);
  341|      0|    entropy->restarts_to_go--;
  342|      0|  }
  343|       |
  344|  2.54M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (344:7): [True: 0, False: 2.54M]
  ------------------
  345|       |
  346|       |  /* There is always only one block per MCU */
  347|  2.54M|  block = MCU_data[0];
  348|  2.54M|  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|  5.48M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (353:23): [True: 5.48M, False: 1.15k]
  ------------------
  354|  5.48M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  355|  5.48M|    if (arith_decode(cinfo, st)) break;         /* EOB flag */
  ------------------
  |  Branch (355:9): [True: 2.54M, False: 2.93M]
  ------------------
  356|  5.50M|    while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (356:12): [True: 2.56M, False: 2.93M]
  ------------------
  357|  2.56M|      st += 3;  k++;
  358|  2.56M|      if (k > cinfo->Se) {
  ------------------
  |  Branch (358:11): [True: 23, False: 2.56M]
  ------------------
  359|     23|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|     23|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     23|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  360|     23|        entropy->ct = -1;                       /* spectral overflow */
  361|     23|        return TRUE;
  ------------------
  |  |  210|     23|#define TRUE    1
  ------------------
  362|     23|      }
  363|  2.56M|    }
  364|       |    /* Figure F.21: Decoding nonzero value v */
  365|       |    /* Figure F.22: Decoding the sign of v */
  366|  2.93M|    sign = arith_decode(cinfo, entropy->fixed_bin);
  367|  2.93M|    st += 2;
  368|       |    /* Figure F.23: Decoding the magnitude category of v */
  369|  2.93M|    if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (369:9): [True: 1.57M, False: 1.35M]
  ------------------
  370|  1.57M|      if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (370:11): [True: 1.30M, False: 275k]
  ------------------
  371|  1.30M|        m <<= 1;
  372|  1.30M|        st = entropy->ac_stats[tbl] +
  373|  1.30M|             (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (373:15): [True: 701k, False: 600k]
  ------------------
  374|  2.37M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (374:16): [True: 1.07M, False: 1.30M]
  ------------------
  375|  1.07M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (375:15): [True: 3, False: 1.07M]
  ------------------
  376|      3|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      3|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  377|      3|            entropy->ct = -1;                   /* magnitude overflow */
  378|      3|            return TRUE;
  ------------------
  |  |  210|      3|#define TRUE    1
  ------------------
  379|      3|          }
  380|  1.07M|          st += 1;
  381|  1.07M|        }
  382|  1.30M|      }
  383|  1.57M|    }
  384|  2.93M|    v = m;
  385|       |    /* Figure F.24: Decoding the magnitude bit pattern of v */
  386|  2.93M|    st += 14;
  387|  5.31M|    while (m >>= 1)
  ------------------
  |  Branch (387:12): [True: 2.37M, False: 2.93M]
  ------------------
  388|  2.37M|      if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (388:11): [True: 1.24M, False: 1.13M]
  ------------------
  389|  2.93M|    v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (389:18): [True: 1.41M, False: 1.51M]
  ------------------
  390|       |    /* Scale and output coefficient in natural (dezigzagged) order */
  391|  2.93M|    (*block)[jpeg_natural_order[k]] = (JCOEF)((unsigned)v << cinfo->Al);
  392|  2.93M|  }
  393|       |
  394|  2.54M|  return TRUE;
  ------------------
  |  |  210|  2.54M|#define TRUE    1
  ------------------
  395|  2.54M|}
jdarith.c:decode_mcu_AC_refine:
  437|  48.7k|{
  438|  48.7k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  439|  48.7k|  JBLOCKROW block;
  440|  48.7k|  JCOEFPTR thiscoef;
  441|  48.7k|  unsigned char *st;
  442|  48.7k|  int tbl, k, kex;
  443|  48.7k|  int p1, m1;
  444|       |
  445|       |  /* Process restart marker if needed */
  446|  48.7k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (446:7): [True: 0, False: 48.7k]
  ------------------
  447|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (447:9): [True: 0, False: 0]
  ------------------
  448|      0|      process_restart(cinfo);
  449|      0|    entropy->restarts_to_go--;
  450|      0|  }
  451|       |
  452|  48.7k|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (452:7): [True: 0, False: 48.7k]
  ------------------
  453|       |
  454|       |  /* There is always only one block per MCU */
  455|  48.7k|  block = MCU_data[0];
  456|  48.7k|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  457|       |
  458|  48.7k|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  459|  48.7k|  m1 = (NEG_1) << cinfo->Al;    /* -1 in the bit position being coded */
  ------------------
  |  |   27|  48.7k|#define NEG_1  ((unsigned int)-1)
  ------------------
  460|       |
  461|       |  /* Establish EOBx (previous stage end-of-block) index */
  462|   810k|  for (kex = cinfo->Se; kex > 0; kex--)
  ------------------
  |  Branch (462:25): [True: 801k, False: 9.24k]
  ------------------
  463|   801k|    if ((*block)[jpeg_natural_order[kex]]) break;
  ------------------
  |  Branch (463:9): [True: 39.4k, False: 762k]
  ------------------
  464|       |
  465|   164k|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (465:23): [True: 164k, False: 847]
  ------------------
  466|   164k|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  467|   164k|    if (k > kex)
  ------------------
  |  Branch (467:9): [True: 74.4k, False: 89.6k]
  ------------------
  468|  74.4k|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (468:11): [True: 47.8k, False: 26.5k]
  ------------------
  469|   168k|    for (;;) {
  470|   168k|      thiscoef = *block + jpeg_natural_order[k];
  471|   168k|      if (*thiscoef) {                          /* previously nonzero coef */
  ------------------
  |  Branch (471:11): [True: 64.0k, False: 104k]
  ------------------
  472|  64.0k|        if (arith_decode(cinfo, st + 2)) {
  ------------------
  |  Branch (472:13): [True: 31.5k, False: 32.5k]
  ------------------
  473|  31.5k|          if (*thiscoef < 0)
  ------------------
  |  Branch (473:15): [True: 13.9k, False: 17.6k]
  ------------------
  474|  13.9k|            *thiscoef += (JCOEF)m1;
  475|  17.6k|          else
  476|  17.6k|            *thiscoef += (JCOEF)p1;
  477|  31.5k|        }
  478|  64.0k|        break;
  479|  64.0k|      }
  480|   104k|      if (arith_decode(cinfo, st + 1)) {        /* newly nonzero coef */
  ------------------
  |  Branch (480:11): [True: 52.1k, False: 51.8k]
  ------------------
  481|  52.1k|        if (arith_decode(cinfo, entropy->fixed_bin))
  ------------------
  |  Branch (481:13): [True: 22.9k, False: 29.2k]
  ------------------
  482|  22.9k|          *thiscoef = (JCOEF)m1;
  483|  29.2k|        else
  484|  29.2k|          *thiscoef = (JCOEF)p1;
  485|  52.1k|        break;
  486|  52.1k|      }
  487|  51.8k|      st += 3;  k++;
  488|  51.8k|      if (k > cinfo->Se) {
  ------------------
  |  Branch (488:11): [True: 20, False: 51.8k]
  ------------------
  489|     20|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|     20|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     20|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  490|     20|        entropy->ct = -1;                       /* spectral overflow */
  491|     20|        return TRUE;
  ------------------
  |  |  210|     20|#define TRUE    1
  ------------------
  492|     20|      }
  493|  51.8k|    }
  494|   116k|  }
  495|       |
  496|  48.7k|  return TRUE;
  ------------------
  |  |  210|  48.7k|#define TRUE    1
  ------------------
  497|  48.7k|}
jdarith.c:decode_mcu:
  506|   401k|{
  507|   401k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  508|   401k|  jpeg_component_info *compptr;
  509|   401k|  JBLOCKROW block;
  510|   401k|  unsigned char *st;
  511|   401k|  int blkn, ci, tbl, sign, k;
  512|   401k|  int v, m;
  513|       |
  514|       |  /* Process restart marker if needed */
  515|   401k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (515:7): [True: 0, False: 401k]
  ------------------
  516|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (516:9): [True: 0, False: 0]
  ------------------
  517|      0|      process_restart(cinfo);
  518|      0|    entropy->restarts_to_go--;
  519|      0|  }
  520|       |
  521|   401k|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (521:7): [True: 0, False: 401k]
  ------------------
  522|       |
  523|       |  /* Outer loop handles each block in the MCU */
  524|       |
  525|   801k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (525:18): [True: 401k, False: 400k]
  ------------------
  526|   401k|    block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (526:13): [True: 401k, False: 0]
  ------------------
  527|   401k|    ci = cinfo->MCU_membership[blkn];
  528|   401k|    compptr = cinfo->cur_comp_info[ci];
  529|       |
  530|       |    /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */
  531|       |
  532|   401k|    tbl = compptr->dc_tbl_no;
  533|       |
  534|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  535|   401k|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  536|       |
  537|       |    /* Figure F.19: Decode_DC_DIFF */
  538|   401k|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (538:9): [True: 174k, False: 226k]
  ------------------
  539|   174k|      entropy->dc_context[ci] = 0;
  540|   226k|    else {
  541|       |      /* Figure F.21: Decoding nonzero value v */
  542|       |      /* Figure F.22: Decoding the sign of v */
  543|   226k|      sign = arith_decode(cinfo, st + 1);
  544|   226k|      st += 2;  st += sign;
  545|       |      /* Figure F.23: Decoding the magnitude category of v */
  546|   226k|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (546:11): [True: 133k, False: 93.4k]
  ------------------
  547|   133k|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  548|   370k|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (548:16): [True: 237k, False: 133k]
  ------------------
  549|   237k|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (549:15): [True: 6, False: 237k]
  ------------------
  550|      6|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      6|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      6|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  551|      6|            entropy->ct = -1;                   /* magnitude overflow */
  552|      6|            return TRUE;
  ------------------
  |  |  210|      6|#define TRUE    1
  ------------------
  553|      6|          }
  554|   237k|          st += 1;
  555|   237k|        }
  556|   133k|      }
  557|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  558|   226k|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (558:11): [True: 0, False: 226k]
  ------------------
  559|      0|        entropy->dc_context[ci] = 0;               /* zero diff category */
  560|   226k|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (560:16): [True: 103k, False: 123k]
  ------------------
  561|   103k|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  562|   123k|      else
  563|   123k|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  564|   226k|      v = m;
  565|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  566|   226k|      st += 14;
  567|   463k|      while (m >>= 1)
  ------------------
  |  Branch (567:14): [True: 237k, False: 226k]
  ------------------
  568|   237k|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (568:13): [True: 99.3k, False: 137k]
  ------------------
  569|   226k|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (569:20): [True: 164k, False: 61.8k]
  ------------------
  570|   226k|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  571|   226k|    }
  572|       |
  573|   400k|    if (block)
  ------------------
  |  Branch (573:9): [True: 400k, False: 3]
  ------------------
  574|   400k|      (*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|   400k|    tbl = compptr->ac_tbl_no;
  579|       |
  580|       |    /* Figure F.20: Decode_AC_coefficients */
  581|   919k|    for (k = 1; k <= DCTSIZE2 - 1; k++) {
  ------------------
  |  |   67|   919k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (581:17): [True: 919k, False: 103]
  ------------------
  582|   919k|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  583|   919k|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (583:11): [True: 400k, False: 518k]
  ------------------
  584|  1.35M|      while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (584:14): [True: 835k, False: 518k]
  ------------------
  585|   835k|        st += 3;  k++;
  586|   835k|        if (k > DCTSIZE2 - 1) {
  ------------------
  |  |   67|   835k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (586:13): [True: 1, False: 835k]
  ------------------
  587|      1|          WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      1|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  588|      1|          entropy->ct = -1;                     /* spectral overflow */
  589|      1|          return TRUE;
  ------------------
  |  |  210|      1|#define TRUE    1
  ------------------
  590|      1|        }
  591|   835k|      }
  592|       |      /* Figure F.21: Decoding nonzero value v */
  593|       |      /* Figure F.22: Decoding the sign of v */
  594|   518k|      sign = arith_decode(cinfo, entropy->fixed_bin);
  595|   518k|      st += 2;
  596|       |      /* Figure F.23: Decoding the magnitude category of v */
  597|   518k|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (597:11): [True: 238k, False: 280k]
  ------------------
  598|   238k|        if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (598:13): [True: 169k, False: 68.8k]
  ------------------
  599|   169k|          m <<= 1;
  600|   169k|          st = entropy->ac_stats[tbl] +
  601|   169k|               (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (601:17): [True: 107k, False: 61.4k]
  ------------------
  602|   445k|          while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (602:18): [True: 276k, False: 169k]
  ------------------
  603|   276k|            if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (603:17): [True: 5, False: 276k]
  ------------------
  604|      5|              WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      5|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  605|      5|              entropy->ct = -1;                 /* magnitude overflow */
  606|      5|              return TRUE;
  ------------------
  |  |  210|      5|#define TRUE    1
  ------------------
  607|      5|            }
  608|   276k|            st += 1;
  609|   276k|          }
  610|   169k|        }
  611|   238k|      }
  612|   518k|      v = m;
  613|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  614|   518k|      st += 14;
  615|   964k|      while (m >>= 1)
  ------------------
  |  Branch (615:14): [True: 445k, False: 518k]
  ------------------
  616|   445k|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (616:13): [True: 200k, False: 244k]
  ------------------
  617|   518k|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (617:20): [True: 222k, False: 295k]
  ------------------
  618|   518k|      if (block)
  ------------------
  |  Branch (618:11): [True: 518k, False: 14]
  ------------------
  619|   518k|        (*block)[jpeg_natural_order[k]] = (JCOEF)v;
  620|   518k|    }
  621|   400k|  }
  622|       |
  623|   400k|  return TRUE;
  ------------------
  |  |  210|   400k|#define TRUE    1
  ------------------
  624|   401k|}

jinit_d_coef_controller:
  869|  1.67k|{
  870|  1.67k|  my_coef_ptr coef;
  871|       |
  872|  1.67k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.67k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (872:7): [True: 0, False: 1.67k]
  ------------------
  873|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  874|       |
  875|  1.67k|  coef = (my_coef_ptr)
  876|  1.67k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.67k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|  1.67k|                                sizeof(my_coef_controller));
  878|  1.67k|  memset(coef, 0, sizeof(my_coef_controller));
  879|  1.67k|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|  1.67k|  coef->pub.start_input_pass = start_input_pass;
  881|  1.67k|  coef->pub.start_output_pass = start_output_pass;
  882|  1.67k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|  1.67k|  coef->coef_bits_latch = NULL;
  884|  1.67k|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|  1.67k|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 889, False: 788]
  ------------------
  888|    889|#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|    889|    int ci, access_rows;
  893|    889|    jpeg_component_info *compptr;
  894|       |
  895|  1.80k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 913, False: 889]
  ------------------
  896|    913|         ci++, compptr++) {
  897|    913|      access_rows = compptr->v_samp_factor;
  898|    913|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|    913|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 901, False: 12]
  ------------------
  901|    901|        access_rows *= 5;
  902|    913|#endif
  903|    913|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|    913|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|    913|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|    913|#define TRUE    1
  ------------------
  905|    913|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|    913|                               (long)compptr->h_samp_factor),
  907|    913|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|    913|                               (long)compptr->v_samp_factor),
  909|    913|         (JDIMENSION)access_rows);
  910|    913|    }
  911|    889|    coef->pub.consume_data = consume_data;
  912|    889|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|    889|#define _decompress_data  decompress_data
  ------------------
  913|    889|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|    889|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|    788|    JBLOCKROW buffer;
  920|    788|    int i;
  921|       |
  922|    788|    buffer = (JBLOCKROW)
  923|    788|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    788|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|    788|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|    788|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|  8.66k|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|  8.66k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 7.88k, False: 788]
  ------------------
  926|  7.88k|      coef->MCU_buffer[i] = buffer + i;
  927|  7.88k|    }
  928|    788|    coef->pub.consume_data = dummy_consume_data;
  929|    788|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  258|    788|#define _decompress_data  decompress_data
  ------------------
  930|    788|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|    788|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|  1.67k|  coef->workspace = (JCOEF *)
  935|  1.67k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.67k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|  1.67k|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|  1.67k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|  1.67k|}
jdcoefct-8.c:start_input_pass:
   50|  2.83k|{
   51|  2.83k|  cinfo->input_iMCU_row = 0;
   52|  2.83k|  start_iMCU_row(cinfo);
   53|  2.83k|}
jdcoefct-8.c:start_output_pass:
   62|  1.36k|{
   63|  1.36k|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|  1.36k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   65|       |
   66|       |  /* If multipass, check to see whether to use block smoothing on this pass */
   67|  1.36k|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 601, False: 762]
  ------------------
   68|    601|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 601, False: 0]
  |  Branch (68:38): [True: 461, False: 140]
  ------------------
   69|    461|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  258|    461|#define _decompress_data  decompress_data
  ------------------
   70|    140|    else
   71|    140|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|    140|#define _decompress_data  decompress_data
  ------------------
   72|    601|  }
   73|  1.36k|#endif
   74|  1.36k|  cinfo->output_iMCU_row = 0;
   75|  1.36k|}
jdcoefct-8.c:smoothing_ok:
  405|    601|{
  406|    601|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|    601|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|    601|#define FALSE   0               /* values of boolean */
  ------------------
  408|    601|  int ci, coefi;
  409|    601|  jpeg_component_info *compptr;
  410|    601|  JQUANT_TBL *qtable;
  411|    601|  int *coef_bits, *prev_coef_bits;
  412|    601|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|    601|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 0, False: 601]
  |  Branch (414:35): [True: 0, False: 601]
  ------------------
  415|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|    601|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 601, False: 0]
  ------------------
  419|    601|    coef->coef_bits_latch = (int *)
  420|    601|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    601|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|    601|                                  cinfo->num_components * 2 *
  422|    601|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|    601|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|    601|  coef_bits_latch = coef->coef_bits_latch;
  424|    601|  prev_coef_bits_latch =
  425|    601|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|    601|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|  1.08k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 601, False: 481]
  ------------------
  428|    601|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|    601|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 0, False: 601]
  ------------------
  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|    601|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 14, False: 587]
  ------------------
  434|    587|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|    587|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 9, False: 578]
  ------------------
  435|    578|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|    578|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 14, False: 564]
  ------------------
  436|    564|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|    564|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 17, False: 547]
  ------------------
  437|    547|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|    547|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 11, False: 536]
  ------------------
  438|    536|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|    536|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 11, False: 525]
  ------------------
  439|    525|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|    525|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 10, False: 515]
  ------------------
  440|    515|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|    515|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 9, False: 506]
  ------------------
  441|    506|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|    506|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 12, False: 494]
  ------------------
  442|    494|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|    494|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 13, False: 481]
  ------------------
  443|    120|      return FALSE;
  ------------------
  |  |  207|    120|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|    481|    coef_bits = cinfo->coef_bits[ci];
  446|    481|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|    481|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 0, False: 481]
  ------------------
  448|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  449|    481|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|  4.81k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|  4.81k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 4.32k, False: 481]
  ------------------
  452|  4.32k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 2.50k, False: 1.82k]
  ------------------
  453|  2.50k|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|  1.82k|      else
  455|  1.82k|        prev_coef_bits_latch[coefi] = -1;
  456|  4.32k|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|  4.32k|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 3.84k, False: 489]
  ------------------
  458|  3.84k|        smoothing_useful = TRUE;
  ------------------
  |  |  210|  3.84k|#define TRUE    1
  ------------------
  459|  4.32k|    }
  460|    481|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    481|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|    481|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    481|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|    481|  }
  463|       |
  464|    481|  return smoothing_useful;
  465|    601|}
jdcoefct-8.c:decompress_smooth_data:
  474|  13.7k|{
  475|  13.7k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  476|  13.7k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  477|  13.7k|  JDIMENSION block_num, last_block_column;
  478|  13.7k|  int ci, block_row, block_rows, access_rows, image_block_row,
  479|  13.7k|    image_block_rows;
  480|  13.7k|  JBLOCKARRAY buffer;
  481|  13.7k|  JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
  482|  13.7k|  JBLOCKROW next_block_row, next_next_block_row;
  483|  13.7k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  13.7k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  484|  13.7k|  JDIMENSION output_col;
  485|  13.7k|  jpeg_component_info *compptr;
  486|  13.7k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  13.7k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  487|  13.7k|  boolean change_dc;
  488|  13.7k|  JCOEF *workspace;
  489|  13.7k|  int *coef_bits;
  490|  13.7k|  JQUANT_TBL *quanttbl;
  491|  13.7k|  JLONG Q00, Q01, Q02, Q03 = 0, Q10, Q11, Q12 = 0, Q20, Q21 = 0, Q30 = 0, num;
  492|  13.7k|  int DC01, DC02, DC03, DC04, DC05, DC06, DC07, DC08, DC09, DC10, DC11, DC12,
  493|  13.7k|      DC13, DC14, DC15, DC16, DC17, DC18, DC19, DC20, DC21, DC22, DC23, DC24,
  494|  13.7k|      DC25;
  495|  13.7k|  int Al, pred;
  496|       |
  497|       |  /* Keep a local variable to avoid looking it up more than once */
  498|  13.7k|  workspace = coef->workspace;
  499|       |
  500|       |  /* Force some input to be done if we are getting ahead of the input. */
  501|  13.7k|  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
  ------------------
  |  Branch (501:10): [True: 13.7k, False: 0]
  ------------------
  502|  13.7k|         !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (502:10): [True: 0, False: 13.7k]
  ------------------
  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|  27.5k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (518:44): [True: 13.7k, False: 13.7k]
  ------------------
  519|  13.7k|       ci++, compptr++) {
  520|       |    /* Don't bother to IDCT an uninteresting component. */
  521|  13.7k|    if (!compptr->component_needed)
  ------------------
  |  Branch (521:9): [True: 0, False: 13.7k]
  ------------------
  522|      0|      continue;
  523|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  524|  13.7k|    if (cinfo->output_iMCU_row + 1 < last_iMCU_row) {
  ------------------
  |  Branch (524:9): [True: 12.8k, False: 886]
  ------------------
  525|  12.8k|      block_rows = compptr->v_samp_factor;
  526|  12.8k|      access_rows = block_rows * 3; /* this and next two iMCU rows */
  527|  12.8k|    } else if (cinfo->output_iMCU_row < last_iMCU_row) {
  ------------------
  |  Branch (527:16): [True: 425, False: 461]
  ------------------
  528|    425|      block_rows = compptr->v_samp_factor;
  529|    425|      access_rows = block_rows * 2; /* this and next iMCU row */
  530|    461|    } else {
  531|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  532|    461|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  533|    461|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (533:11): [True: 311, False: 150]
  ------------------
  534|    461|      access_rows = block_rows; /* this iMCU row only */
  535|    461|    }
  536|       |    /* Align the virtual buffer for this component. */
  537|  13.7k|    if (cinfo->output_iMCU_row > 1) {
  ------------------
  |  Branch (537:9): [True: 12.8k, False: 886]
  ------------------
  538|  12.8k|      access_rows += 2 * compptr->v_samp_factor; /* prior two iMCU rows too */
  539|  12.8k|      buffer = (*cinfo->mem->access_virt_barray)
  540|  12.8k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  541|  12.8k|         (cinfo->output_iMCU_row - 2) * compptr->v_samp_factor,
  542|  12.8k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  12.8k|#define FALSE   0               /* values of boolean */
  ------------------
  543|  12.8k|      buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
  544|  12.8k|    } else if (cinfo->output_iMCU_row > 0) {
  ------------------
  |  Branch (544:16): [True: 425, False: 461]
  ------------------
  545|    425|      access_rows += compptr->v_samp_factor; /* prior iMCU row too */
  546|    425|      buffer = (*cinfo->mem->access_virt_barray)
  547|    425|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  548|    425|         (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
  549|    425|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    425|#define FALSE   0               /* values of boolean */
  ------------------
  550|    425|      buffer += compptr->v_samp_factor; /* point to current iMCU row */
  551|    461|    } else {
  552|    461|      buffer = (*cinfo->mem->access_virt_barray)
  553|    461|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  554|    461|         (JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    461|#define FALSE   0               /* values of boolean */
  ------------------
  555|    461|    }
  556|       |    /* Fetch component-dependent info.
  557|       |     * If the current scan is incomplete, then we use the component-dependent
  558|       |     * info from the previous scan.
  559|       |     */
  560|  13.7k|    if (cinfo->output_iMCU_row > cinfo->master->last_good_iMCU_row)
  ------------------
  |  Branch (560:9): [True: 0, False: 13.7k]
  ------------------
  561|      0|      coef_bits =
  562|      0|        coef->coef_bits_latch + ((ci + cinfo->num_components) * SAVED_COEFS);
  ------------------
  |  |   58|      0|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  563|  13.7k|    else
  564|  13.7k|      coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
  ------------------
  |  |   58|  13.7k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  565|       |
  566|       |    /* We only do DC interpolation if no AC coefficient data is available. */
  567|  13.7k|    change_dc =
  568|  13.7k|      coef_bits[1] == -1 && coef_bits[2] == -1 && coef_bits[3] == -1 &&
  ------------------
  |  Branch (568:7): [True: 9.96k, False: 3.80k]
  |  Branch (568:29): [True: 9.85k, False: 115]
  |  Branch (568:51): [True: 9.77k, False: 79]
  ------------------
  569|  9.77k|      coef_bits[4] == -1 && coef_bits[5] == -1 && coef_bits[6] == -1 &&
  ------------------
  |  Branch (569:7): [True: 9.68k, False: 90]
  |  Branch (569:29): [True: 9.39k, False: 289]
  |  Branch (569:51): [True: 9.31k, False: 81]
  ------------------
  570|  9.31k|      coef_bits[7] == -1 && coef_bits[8] == -1 && coef_bits[9] == -1;
  ------------------
  |  Branch (570:7): [True: 9.23k, False: 78]
  |  Branch (570:29): [True: 9.13k, False: 100]
  |  Branch (570:51): [True: 9.02k, False: 115]
  ------------------
  571|       |
  572|  13.7k|    quanttbl = compptr->quant_table;
  573|  13.7k|    Q00 = quanttbl->quantval[0];
  574|  13.7k|    Q01 = quanttbl->quantval[Q01_POS];
  ------------------
  |  |  385|  13.7k|#define Q01_POS  1
  ------------------
  575|  13.7k|    Q10 = quanttbl->quantval[Q10_POS];
  ------------------
  |  |  386|  13.7k|#define Q10_POS  8
  ------------------
  576|  13.7k|    Q20 = quanttbl->quantval[Q20_POS];
  ------------------
  |  |  387|  13.7k|#define Q20_POS  16
  ------------------
  577|  13.7k|    Q11 = quanttbl->quantval[Q11_POS];
  ------------------
  |  |  388|  13.7k|#define Q11_POS  9
  ------------------
  578|  13.7k|    Q02 = quanttbl->quantval[Q02_POS];
  ------------------
  |  |  389|  13.7k|#define Q02_POS  2
  ------------------
  579|  13.7k|    if (change_dc) {
  ------------------
  |  Branch (579:9): [True: 9.02k, False: 4.75k]
  ------------------
  580|  9.02k|      Q03 = quanttbl->quantval[Q03_POS];
  ------------------
  |  |  390|  9.02k|#define Q03_POS  3
  ------------------
  581|  9.02k|      Q12 = quanttbl->quantval[Q12_POS];
  ------------------
  |  |  391|  9.02k|#define Q12_POS  10
  ------------------
  582|  9.02k|      Q21 = quanttbl->quantval[Q21_POS];
  ------------------
  |  |  392|  9.02k|#define Q21_POS  17
  ------------------
  583|  9.02k|      Q30 = quanttbl->quantval[Q30_POS];
  ------------------
  |  |  393|  9.02k|#define Q30_POS  24
  ------------------
  584|  9.02k|    }
  585|  13.7k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|  13.7k|#define _inverse_DCT  inverse_DCT
  ------------------
  586|  13.7k|    output_ptr = output_buf[ci];
  587|       |    /* Loop over all DCT blocks to be processed. */
  588|  13.7k|    image_block_rows = block_rows * cinfo->total_iMCU_rows;
  589|  41.3k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (589:25): [True: 27.5k, False: 13.7k]
  ------------------
  590|  27.5k|      image_block_row = cinfo->output_iMCU_row * block_rows + block_row;
  591|  27.5k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  592|       |
  593|  27.5k|      if (image_block_row > 0)
  ------------------
  |  Branch (593:11): [True: 27.0k, False: 461]
  ------------------
  594|  27.0k|        prev_block_row =
  595|  27.0k|          buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
  596|    461|      else
  597|    461|        prev_block_row = buffer_ptr;
  598|       |
  599|  27.5k|      if (image_block_row > 1)
  ------------------
  |  Branch (599:11): [True: 26.6k, False: 891]
  ------------------
  600|  26.6k|        prev_prev_block_row =
  601|  26.6k|          buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
  602|    891|      else
  603|    891|        prev_prev_block_row = prev_block_row;
  604|       |
  605|  27.5k|      if (image_block_row < image_block_rows - 1)
  ------------------
  |  Branch (605:11): [True: 27.0k, False: 461]
  ------------------
  606|  27.0k|        next_block_row =
  607|  27.0k|          buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
  608|    461|      else
  609|    461|        next_block_row = buffer_ptr;
  610|       |
  611|  27.5k|      if (image_block_row < image_block_rows - 2)
  ------------------
  |  Branch (611:11): [True: 26.7k, False: 784]
  ------------------
  612|  26.7k|        next_next_block_row =
  613|  26.7k|          buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
  614|    784|      else
  615|    784|        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|  27.5k|      DC01 = DC02 = DC03 = DC04 = DC05 = (int)prev_prev_block_row[0][0];
  621|  27.5k|      DC06 = DC07 = DC08 = DC09 = DC10 = (int)prev_block_row[0][0];
  622|  27.5k|      DC11 = DC12 = DC13 = DC14 = DC15 = (int)buffer_ptr[0][0];
  623|  27.5k|      DC16 = DC17 = DC18 = DC19 = DC20 = (int)next_block_row[0][0];
  624|  27.5k|      DC21 = DC22 = DC23 = DC24 = DC25 = (int)next_next_block_row[0][0];
  625|  27.5k|      output_col = 0;
  626|  27.5k|      last_block_column = compptr->width_in_blocks - 1;
  627|  27.5k|      for (block_num = cinfo->master->first_MCU_col[ci];
  628|  1.21M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (628:12): [True: 1.18M, False: 27.5k]
  ------------------
  629|       |        /* Fetch current DCT block into workspace so we can modify it. */
  630|  1.18M|        jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
  631|       |        /* Update DC values */
  632|  1.18M|        if (block_num == cinfo->master->first_MCU_col[ci] &&
  ------------------
  |  Branch (632:13): [True: 27.5k, False: 1.16M]
  ------------------
  633|  27.5k|            block_num < last_block_column) {
  ------------------
  |  Branch (633:13): [True: 19.4k, False: 8.07k]
  ------------------
  634|  19.4k|          DC04 = DC05 = (int)prev_prev_block_row[1][0];
  635|  19.4k|          DC09 = DC10 = (int)prev_block_row[1][0];
  636|  19.4k|          DC14 = DC15 = (int)buffer_ptr[1][0];
  637|  19.4k|          DC19 = DC20 = (int)next_block_row[1][0];
  638|  19.4k|          DC24 = DC25 = (int)next_next_block_row[1][0];
  639|  19.4k|        }
  640|  1.18M|        if (block_num + 1 < last_block_column) {
  ------------------
  |  Branch (640:13): [True: 1.14M, False: 46.9k]
  ------------------
  641|  1.14M|          DC05 = (int)prev_prev_block_row[2][0];
  642|  1.14M|          DC10 = (int)prev_block_row[2][0];
  643|  1.14M|          DC15 = (int)buffer_ptr[2][0];
  644|  1.14M|          DC20 = (int)next_block_row[2][0];
  645|  1.14M|          DC25 = (int)next_next_block_row[2][0];
  646|  1.14M|        }
  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.18M|        if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
  ------------------
  |  Branch (658:13): [True: 1.17M, False: 10.0k]
  |  Branch (658:41): [True: 1.04M, False: 133k]
  ------------------
  659|  1.04M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (659:24): [True: 512k, False: 533k]
  ------------------
  660|   512k|                (-DC01 - DC02 + DC04 + DC05 - 3 * DC06 + 13 * DC07 -
  661|   512k|                 13 * DC09 + 3 * DC10 - 3 * DC11 + 38 * DC12 - 38 * DC14 +
  662|   512k|                 3 * DC15 - 3 * DC16 + 13 * DC17 - 13 * DC19 + 3 * DC20 -
  663|   512k|                 DC21 - DC22 + DC24 + DC25) :
  664|  1.04M|                (-7 * DC11 + 50 * DC12 - 50 * DC14 + 7 * DC15));
  665|  1.04M|          if (num >= 0) {
  ------------------
  |  Branch (665:15): [True: 681k, False: 363k]
  ------------------
  666|   681k|            pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
  667|   681k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (667:17): [True: 164k, False: 517k]
  |  Branch (667:27): [True: 38.5k, False: 126k]
  ------------------
  668|  38.5k|              pred = (1 << Al) - 1;
  669|   681k|          } else {
  670|   363k|            pred = (int)(((Q01 << 7) - num) / (Q01 << 8));
  671|   363k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (671:17): [True: 63.5k, False: 300k]
  |  Branch (671:27): [True: 14.8k, False: 48.7k]
  ------------------
  672|  14.8k|              pred = (1 << Al) - 1;
  673|   363k|            pred = -pred;
  674|   363k|          }
  675|  1.04M|          workspace[1] = (JCOEF)pred;
  676|  1.04M|        }
  677|       |        /* AC10 */
  678|  1.18M|        if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
  ------------------
  |  Branch (678:13): [True: 1.08M, False: 104k]
  |  Branch (678:41): [True: 1.04M, False: 36.9k]
  ------------------
  679|  1.04M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (679:24): [True: 512k, False: 534k]
  ------------------
  680|   512k|                (-DC01 - 3 * DC02 - 3 * DC03 - 3 * DC04 - DC05 - DC06 +
  681|   512k|                 13 * DC07 + 38 * DC08 + 13 * DC09 - DC10 + DC16 -
  682|   512k|                 13 * DC17 - 38 * DC18 - 13 * DC19 + DC20 + DC21 +
  683|   512k|                 3 * DC22 + 3 * DC23 + 3 * DC24 + DC25) :
  684|  1.04M|                (-7 * DC03 + 50 * DC08 - 50 * DC18 + 7 * DC23));
  685|  1.04M|          if (num >= 0) {
  ------------------
  |  Branch (685:15): [True: 817k, False: 229k]
  ------------------
  686|   817k|            pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
  687|   817k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (687:17): [True: 263k, False: 554k]
  |  Branch (687:27): [True: 207k, False: 55.8k]
  ------------------
  688|   207k|              pred = (1 << Al) - 1;
  689|   817k|          } else {
  690|   229k|            pred = (int)(((Q10 << 7) - num) / (Q10 << 8));
  691|   229k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (691:17): [True: 63.5k, False: 166k]
  |  Branch (691:27): [True: 53.8k, False: 9.68k]
  ------------------
  692|  53.8k|              pred = (1 << Al) - 1;
  693|   229k|            pred = -pred;
  694|   229k|          }
  695|  1.04M|          workspace[8] = (JCOEF)pred;
  696|  1.04M|        }
  697|       |        /* AC20 */
  698|  1.18M|        if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
  ------------------
  |  Branch (698:13): [True: 1.01M, False: 171k]
  |  Branch (698:41): [True: 986k, False: 31.0k]
  ------------------
  699|   986k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (699:24): [True: 512k, False: 473k]
  ------------------
  700|   512k|                (DC03 + 2 * DC07 + 7 * DC08 + 2 * DC09 - 5 * DC12 - 14 * DC13 -
  701|   512k|                 5 * DC14 + 2 * DC17 + 7 * DC18 + 2 * DC19 + DC23) :
  702|   986k|                (-DC03 + 13 * DC08 - 24 * DC13 + 13 * DC18 - DC23));
  703|   986k|          if (num >= 0) {
  ------------------
  |  Branch (703:15): [True: 566k, False: 420k]
  ------------------
  704|   566k|            pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
  705|   566k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (705:17): [True: 199k, False: 367k]
  |  Branch (705:27): [True: 93.6k, False: 105k]
  ------------------
  706|  93.6k|              pred = (1 << Al) - 1;
  707|   566k|          } else {
  708|   420k|            pred = (int)(((Q20 << 7) - num) / (Q20 << 8));
  709|   420k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (709:17): [True: 135k, False: 284k]
  |  Branch (709:27): [True: 93.5k, False: 42.2k]
  ------------------
  710|  93.5k|              pred = (1 << Al) - 1;
  711|   420k|            pred = -pred;
  712|   420k|          }
  713|   986k|          workspace[16] = (JCOEF)pred;
  714|   986k|        }
  715|       |        /* AC11 */
  716|  1.18M|        if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
  ------------------
  |  Branch (716:13): [True: 964k, False: 225k]
  |  Branch (716:41): [True: 942k, False: 21.2k]
  ------------------
  717|   942k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (717:24): [True: 512k, False: 430k]
  ------------------
  718|   512k|                (-DC01 + DC05 + 9 * DC07 - 9 * DC09 - 9 * DC17 +
  719|   512k|                 9 * DC19 + DC21 - DC25) :
  720|   942k|                (DC10 + DC16 - 10 * DC17 + 10 * DC19 - DC02 - DC20 + DC22 -
  721|   430k|                 DC24 + DC04 - DC06 + 10 * DC07 - 10 * DC09));
  722|   942k|          if (num >= 0) {
  ------------------
  |  Branch (722:15): [True: 563k, False: 379k]
  ------------------
  723|   563k|            pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
  724|   563k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (724:17): [True: 213k, False: 349k]
  |  Branch (724:27): [True: 5.97k, False: 207k]
  ------------------
  725|  5.97k|              pred = (1 << Al) - 1;
  726|   563k|          } else {
  727|   379k|            pred = (int)(((Q11 << 7) - num) / (Q11 << 8));
  728|   379k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (728:17): [True: 130k, False: 248k]
  |  Branch (728:27): [True: 5.93k, False: 124k]
  ------------------
  729|  5.93k|              pred = (1 << Al) - 1;
  730|   379k|            pred = -pred;
  731|   379k|          }
  732|   942k|          workspace[9] = (JCOEF)pred;
  733|   942k|        }
  734|       |        /* AC02 */
  735|  1.18M|        if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
  ------------------
  |  Branch (735:13): [True: 964k, False: 225k]
  |  Branch (735:41): [True: 940k, False: 23.6k]
  ------------------
  736|   940k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (736:24): [True: 512k, False: 427k]
  ------------------
  737|   512k|                (2 * DC07 - 5 * DC08 + 2 * DC09 + DC11 + 7 * DC12 - 14 * DC13 +
  738|   512k|                 7 * DC14 + DC15 + 2 * DC17 - 5 * DC18 + 2 * DC19) :
  739|   940k|                (-DC11 + 13 * DC12 - 24 * DC13 + 13 * DC14 - DC15));
  740|   940k|          if (num >= 0) {
  ------------------
  |  Branch (740:15): [True: 511k, False: 428k]
  ------------------
  741|   511k|            pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
  742|   511k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (742:17): [True: 206k, False: 305k]
  |  Branch (742:27): [True: 3.58k, False: 202k]
  ------------------
  743|  3.58k|              pred = (1 << Al) - 1;
  744|   511k|          } else {
  745|   428k|            pred = (int)(((Q02 << 7) - num) / (Q02 << 8));
  746|   428k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (746:17): [True: 153k, False: 275k]
  |  Branch (746:27): [True: 3.56k, False: 149k]
  ------------------
  747|  3.56k|              pred = (1 << Al) - 1;
  748|   428k|            pred = -pred;
  749|   428k|          }
  750|   940k|          workspace[2] = (JCOEF)pred;
  751|   940k|        }
  752|  1.18M|        if (change_dc) {
  ------------------
  |  Branch (752:13): [True: 512k, False: 676k]
  ------------------
  753|       |          /* AC03 */
  754|   512k|          if ((Al = coef_bits[6]) != 0 && workspace[3] == 0) {
  ------------------
  |  Branch (754:15): [True: 512k, False: 0]
  |  Branch (754:43): [True: 512k, False: 0]
  ------------------
  755|   512k|            num = Q00 * (DC07 - DC09 + 2 * DC12 - 2 * DC14 + DC17 - DC19);
  756|   512k|            if (num >= 0) {
  ------------------
  |  Branch (756:17): [True: 382k, False: 129k]
  ------------------
  757|   382k|              pred = (int)(((Q03 << 7) + num) / (Q03 << 8));
  758|   382k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (758:19): [True: 0, False: 382k]
  |  Branch (758:29): [True: 0, False: 0]
  ------------------
  759|      0|                pred = (1 << Al) - 1;
  760|   382k|            } else {
  761|   129k|              pred = (int)(((Q03 << 7) - num) / (Q03 << 8));
  762|   129k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (762:19): [True: 0, False: 129k]
  |  Branch (762:29): [True: 0, False: 0]
  ------------------
  763|      0|                pred = (1 << Al) - 1;
  764|   129k|              pred = -pred;
  765|   129k|            }
  766|   512k|            workspace[3] = (JCOEF)pred;
  767|   512k|          }
  768|       |          /* AC12 */
  769|   512k|          if ((Al = coef_bits[7]) != 0 && workspace[10] == 0) {
  ------------------
  |  Branch (769:15): [True: 512k, False: 0]
  |  Branch (769:43): [True: 512k, False: 0]
  ------------------
  770|   512k|            num = Q00 * (DC07 - 3 * DC08 + DC09 - DC17 + 3 * DC18 - DC19);
  771|   512k|            if (num >= 0) {
  ------------------
  |  Branch (771:17): [True: 159k, False: 353k]
  ------------------
  772|   159k|              pred = (int)(((Q12 << 7) + num) / (Q12 << 8));
  773|   159k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (773:19): [True: 0, False: 159k]
  |  Branch (773:29): [True: 0, False: 0]
  ------------------
  774|      0|                pred = (1 << Al) - 1;
  775|   353k|            } else {
  776|   353k|              pred = (int)(((Q12 << 7) - num) / (Q12 << 8));
  777|   353k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (777:19): [True: 0, False: 353k]
  |  Branch (777:29): [True: 0, False: 0]
  ------------------
  778|      0|                pred = (1 << Al) - 1;
  779|   353k|              pred = -pred;
  780|   353k|            }
  781|   512k|            workspace[10] = (JCOEF)pred;
  782|   512k|          }
  783|       |          /* AC21 */
  784|   512k|          if ((Al = coef_bits[8]) != 0 && workspace[17] == 0) {
  ------------------
  |  Branch (784:15): [True: 512k, False: 0]
  |  Branch (784:43): [True: 512k, False: 0]
  ------------------
  785|   512k|            num = Q00 * (DC07 - DC09 - 3 * DC12 + 3 * DC14 + DC17 - DC19);
  786|   512k|            if (num >= 0) {
  ------------------
  |  Branch (786:17): [True: 263k, False: 248k]
  ------------------
  787|   263k|              pred = (int)(((Q21 << 7) + num) / (Q21 << 8));
  788|   263k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (788:19): [True: 0, False: 263k]
  |  Branch (788:29): [True: 0, False: 0]
  ------------------
  789|      0|                pred = (1 << Al) - 1;
  790|   263k|            } else {
  791|   248k|              pred = (int)(((Q21 << 7) - num) / (Q21 << 8));
  792|   248k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (792:19): [True: 0, False: 248k]
  |  Branch (792:29): [True: 0, False: 0]
  ------------------
  793|      0|                pred = (1 << Al) - 1;
  794|   248k|              pred = -pred;
  795|   248k|            }
  796|   512k|            workspace[17] = (JCOEF)pred;
  797|   512k|          }
  798|       |          /* AC30 */
  799|   512k|          if ((Al = coef_bits[9]) != 0 && workspace[24] == 0) {
  ------------------
  |  Branch (799:15): [True: 512k, False: 0]
  |  Branch (799:43): [True: 512k, False: 0]
  ------------------
  800|   512k|            num = Q00 * (DC07 + 2 * DC08 + DC09 - DC17 - 2 * DC18 - DC19);
  801|   512k|            if (num >= 0) {
  ------------------
  |  Branch (801:17): [True: 377k, False: 134k]
  ------------------
  802|   377k|              pred = (int)(((Q30 << 7) + num) / (Q30 << 8));
  803|   377k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (803:19): [True: 0, False: 377k]
  |  Branch (803:29): [True: 0, False: 0]
  ------------------
  804|      0|                pred = (1 << Al) - 1;
  805|   377k|            } else {
  806|   134k|              pred = (int)(((Q30 << 7) - num) / (Q30 << 8));
  807|   134k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (807:19): [True: 0, False: 134k]
  |  Branch (807:29): [True: 0, False: 0]
  ------------------
  808|      0|                pred = (1 << Al) - 1;
  809|   134k|              pred = -pred;
  810|   134k|            }
  811|   512k|            workspace[24] = (JCOEF)pred;
  812|   512k|          }
  813|       |          /* coef_bits[0] is non-negative.  Otherwise this function would not
  814|       |           * be called.
  815|       |           */
  816|   512k|          num = Q00 *
  817|   512k|                (-2 * DC01 - 6 * DC02 - 8 * DC03 - 6 * DC04 - 2 * DC05 -
  818|   512k|                 6 * DC06 + 6 * DC07 + 42 * DC08 + 6 * DC09 - 6 * DC10 -
  819|   512k|                 8 * DC11 + 42 * DC12 + 152 * DC13 + 42 * DC14 - 8 * DC15 -
  820|   512k|                 6 * DC16 + 6 * DC17 + 42 * DC18 + 6 * DC19 - 6 * DC20 -
  821|   512k|                 2 * DC21 - 6 * DC22 - 8 * DC23 - 6 * DC24 - 2 * DC25);
  822|   512k|          if (num >= 0) {
  ------------------
  |  Branch (822:15): [True: 163k, False: 348k]
  ------------------
  823|   163k|            pred = (int)(((Q00 << 7) + num) / (Q00 << 8));
  824|   348k|          } else {
  825|   348k|            pred = (int)(((Q00 << 7) - num) / (Q00 << 8));
  826|   348k|            pred = -pred;
  827|   348k|          }
  828|   512k|          workspace[0] = (JCOEF)pred;
  829|   512k|        }  /* change_dc */
  830|       |
  831|       |        /* OK, do the IDCT */
  832|       |#ifdef WITH_PROFILE
  833|       |        cinfo->master->start = getTime();
  834|       |#endif
  835|  1.18M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
  836|  1.18M|                        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.18M|        DC01 = DC02;  DC02 = DC03;  DC03 = DC04;  DC04 = DC05;
  843|  1.18M|        DC06 = DC07;  DC07 = DC08;  DC08 = DC09;  DC09 = DC10;
  844|  1.18M|        DC11 = DC12;  DC12 = DC13;  DC13 = DC14;  DC14 = DC15;
  845|  1.18M|        DC16 = DC17;  DC17 = DC18;  DC18 = DC19;  DC19 = DC20;
  846|  1.18M|        DC21 = DC22;  DC22 = DC23;  DC23 = DC24;  DC24 = DC25;
  847|  1.18M|        buffer_ptr++, prev_block_row++, next_block_row++,
  848|  1.18M|          prev_prev_block_row++, next_next_block_row++;
  849|  1.18M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  1.18M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  850|  1.18M|      }
  851|  27.5k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  27.5k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  852|  27.5k|    }
  853|  13.7k|  }
  854|       |
  855|  13.7k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (855:7): [True: 13.3k, False: 461]
  ------------------
  856|  13.3k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  13.3k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  857|    461|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    461|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  858|  13.7k|}
jdcoefct-8.c:consume_data:
  218|  42.0k|{
  219|  42.0k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|  42.0k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|  42.0k|  int blkn, ci, xindex, yindex, yoffset;
  222|  42.0k|  JDIMENSION start_col;
  223|  42.0k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|  42.0k|  JBLOCKROW buffer_ptr;
  225|  42.0k|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|  84.1k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 42.0k, False: 42.0k]
  ------------------
  229|  42.0k|    compptr = cinfo->cur_comp_info[ci];
  230|  42.0k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|  42.0k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|  42.0k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|  42.0k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  42.0k|#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|  42.0k|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|   125k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 83.5k, False: 42.0k]
  ------------------
  242|  83.5k|       yoffset++) {
  243|  5.75M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 5.67M, False: 83.5k]
  ------------------
  244|  5.67M|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|  5.67M|      blkn = 0;                 /* index of current DCT block within MCU */
  247|  11.3M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 5.67M, False: 5.67M]
  ------------------
  248|  5.67M|        compptr = cinfo->cur_comp_info[ci];
  249|  5.67M|        start_col = MCU_col_num * compptr->MCU_width;
  250|  11.3M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 5.67M, False: 5.67M]
  ------------------
  251|  5.67M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|  11.3M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 5.67M, False: 5.67M]
  ------------------
  253|  5.67M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|  5.67M|          }
  255|  5.67M|        }
  256|  5.67M|      }
  257|  5.67M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 5.67M, False: 0]
  ------------------
  258|  5.67M|        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|  5.67M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 5.67M]
  ------------------
  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|  5.67M|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|  83.5k|    coef->MCU_ctr = 0;
  282|  83.5k|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|  42.0k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 40.0k, False: 2.06k]
  ------------------
  285|  40.0k|    start_iMCU_row(cinfo);
  286|  40.0k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  40.0k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|  40.0k|  }
  288|       |  /* Completed the scan */
  289|  2.06k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|  2.06k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  2.06k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|  42.0k|}
jdcoefct-8.c:decompress_data:
  304|  3.34k|{
  305|  3.34k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  306|  3.34k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  307|  3.34k|  JDIMENSION block_num;
  308|  3.34k|  int ci, block_row, block_rows;
  309|  3.34k|  JBLOCKARRAY buffer;
  310|  3.34k|  JBLOCKROW buffer_ptr;
  311|  3.34k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  3.34k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  312|  3.34k|  JDIMENSION output_col;
  313|  3.34k|  jpeg_component_info *compptr;
  314|  3.34k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  3.34k|#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|  3.34k|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (317:10): [True: 0, False: 3.34k]
  ------------------
  318|  3.34k|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (318:11): [True: 3.34k, False: 0]
  ------------------
  319|  3.34k|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (319:11): [True: 0, False: 3.34k]
  ------------------
  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|  6.68k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (325:44): [True: 3.34k, False: 3.34k]
  ------------------
  326|  3.34k|       ci++, compptr++) {
  327|       |    /* Don't bother to IDCT an uninteresting component. */
  328|  3.34k|    if (!compptr->component_needed)
  ------------------
  |  Branch (328:9): [True: 0, False: 3.34k]
  ------------------
  329|      0|      continue;
  330|       |    /* Align the virtual buffer for this component. */
  331|  3.34k|    buffer = (*cinfo->mem->access_virt_barray)
  332|  3.34k|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  333|  3.34k|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  334|  3.34k|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|  3.34k|#define FALSE   0               /* values of boolean */
  ------------------
  335|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  336|  3.34k|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (336:9): [True: 3.20k, False: 140]
  ------------------
  337|  3.20k|      block_rows = compptr->v_samp_factor;
  338|    140|    else {
  339|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  340|    140|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  341|    140|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (341:11): [True: 116, False: 24]
  ------------------
  342|    140|    }
  343|  3.34k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|  3.34k|#define _inverse_DCT  inverse_DCT
  ------------------
  344|  3.34k|    output_ptr = output_buf[ci];
  345|       |    /* Loop over all DCT blocks to be processed. */
  346|  9.91k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (346:25): [True: 6.57k, False: 3.34k]
  ------------------
  347|  6.57k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  348|  6.57k|      output_col = 0;
  349|  6.57k|      for (block_num = cinfo->master->first_MCU_col[ci];
  350|   342k|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (350:12): [True: 336k, False: 6.57k]
  ------------------
  351|       |#ifdef WITH_PROFILE
  352|       |        cinfo->master->start = getTime();
  353|       |#endif
  354|   336k|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
  355|   336k|                        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|   336k|        buffer_ptr++;
  361|   336k|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   336k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  362|   336k|      }
  363|  6.57k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  6.57k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  364|  6.57k|    }
  365|  3.34k|  }
  366|       |
  367|  3.34k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (367:7): [True: 3.20k, False: 140]
  ------------------
  368|  3.20k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  3.20k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  369|    140|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    140|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  370|  3.34k|}
jdcoefct-8.c:decompress_onepass:
   90|  6.75k|{
   91|  6.75k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   92|  6.75k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   93|  6.75k|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   94|  6.75k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   95|  6.75k|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   96|  6.75k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  6.75k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
   97|  6.75k|  JDIMENSION start_col, output_col;
   98|  6.75k|  jpeg_component_info *compptr;
   99|  6.75k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  6.75k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  100|       |
  101|       |  /* Loop to process as much as one whole iMCU row */
  102|  19.9k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (102:41): [True: 13.1k, False: 6.75k]
  ------------------
  103|  13.1k|       yoffset++) {
  104|   606k|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (104:39): [True: 592k, False: 13.1k]
  ------------------
  105|   592k|         MCU_col_num++) {
  106|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  107|   592k|      jzero_far((void *)coef->MCU_buffer[0],
  108|   592k|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  109|   592k|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (109:11): [True: 592k, False: 0]
  ------------------
  110|   592k|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  111|       |#ifdef WITH_PROFILE
  112|       |      cinfo->master->start = getTime();
  113|       |#endif
  114|   592k|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (114:11): [True: 0, False: 592k]
  ------------------
  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|   592k|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (134:11): [True: 592k, False: 554]
  ------------------
  135|   592k|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (135:11): [True: 592k, 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|   592k|        blkn = 0;               /* index of current DCT block within MCU */
  142|  1.18M|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (142:22): [True: 592k, False: 592k]
  ------------------
  143|   592k|          compptr = cinfo->cur_comp_info[ci];
  144|       |          /* Don't bother to IDCT an uninteresting component. */
  145|   592k|          if (!compptr->component_needed) {
  ------------------
  |  Branch (145:15): [True: 0, False: 592k]
  ------------------
  146|      0|            blkn += compptr->MCU_blocks;
  147|      0|            continue;
  148|      0|          }
  149|   592k|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  263|   592k|#define _inverse_DCT  inverse_DCT
  ------------------
  150|   592k|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (150:26): [True: 579k, False: 12.6k]
  ------------------
  151|   579k|                         compptr->MCU_width : compptr->last_col_width;
  152|   592k|          output_ptr = output_buf[compptr->component_index] +
  153|   592k|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   592k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  154|   592k|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  155|   592k|                      compptr->MCU_sample_width;
  156|  1.18M|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (156:28): [True: 592k, False: 592k]
  ------------------
  157|   592k|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (157:17): [True: 573k, False: 19.0k]
  ------------------
  158|   592k|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (158:17): [True: 19.0k, False: 0]
  ------------------
  159|   592k|              output_col = start_col;
  160|  1.18M|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (160:32): [True: 592k, False: 592k]
  ------------------
  161|       |#ifdef WITH_PROFILE
  162|       |                cinfo->master->start = getTime();
  163|       |#endif
  164|   592k|                (*inverse_DCT) (cinfo, compptr,
  165|   592k|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  166|   592k|                                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|   592k|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   592k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  173|   592k|              }
  174|   592k|            }
  175|   592k|            blkn += compptr->MCU_width;
  176|   592k|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   592k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  177|   592k|          }
  178|   592k|        }
  179|   592k|      }
  180|   592k|    }
  181|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  182|  13.1k|    coef->MCU_ctr = 0;
  183|  13.1k|  }
  184|       |  /* Completed the iMCU row, advance counters for next one */
  185|  6.75k|  cinfo->output_iMCU_row++;
  186|  6.75k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (186:7): [True: 5.99k, False: 762]
  ------------------
  187|  5.99k|    start_iMCU_row(cinfo);
  188|  5.99k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  5.99k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  189|  5.99k|  }
  190|       |  /* Completed the scan */
  191|    762|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  192|    762|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    762|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  193|  6.75k|}
j12init_d_coef_controller:
  869|     62|{
  870|     62|  my_coef_ptr coef;
  871|       |
  872|     62|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|     62|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (872:7): [True: 0, False: 62]
  ------------------
  873|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  874|       |
  875|     62|  coef = (my_coef_ptr)
  876|     62|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     62|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|     62|                                sizeof(my_coef_controller));
  878|     62|  memset(coef, 0, sizeof(my_coef_controller));
  879|     62|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|     62|  coef->pub.start_input_pass = start_input_pass;
  881|     62|  coef->pub.start_output_pass = start_output_pass;
  882|     62|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|     62|  coef->coef_bits_latch = NULL;
  884|     62|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|     62|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 60, False: 2]
  ------------------
  888|     60|#ifdef D_MULTISCAN_FILES_SUPPORTED
  889|       |    /* Allocate a full-image virtual array for each component, */
  890|       |    /* padded to a multiple of samp_factor DCT blocks in each direction. */
  891|       |    /* Note we ask for a pre-zeroed array. */
  892|     60|    int ci, access_rows;
  893|     60|    jpeg_component_info *compptr;
  894|       |
  895|    148|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 88, False: 60]
  ------------------
  896|     88|         ci++, compptr++) {
  897|     88|      access_rows = compptr->v_samp_factor;
  898|     88|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|     88|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 85, False: 3]
  ------------------
  901|     85|        access_rows *= 5;
  902|     88|#endif
  903|     88|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|     88|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|     88|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|     88|#define TRUE    1
  ------------------
  905|     88|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|     88|                               (long)compptr->h_samp_factor),
  907|     88|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|     88|                               (long)compptr->v_samp_factor),
  909|     88|         (JDIMENSION)access_rows);
  910|     88|    }
  911|     60|    coef->pub.consume_data = consume_data;
  912|     60|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|     60|#define _decompress_data  decompress_data_12
  ------------------
  913|     60|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|     60|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|      2|    JBLOCKROW buffer;
  920|      2|    int i;
  921|       |
  922|      2|    buffer = (JBLOCKROW)
  923|      2|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|      2|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|      2|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|     22|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|     22|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 20, False: 2]
  ------------------
  926|     20|      coef->MCU_buffer[i] = buffer + i;
  927|     20|    }
  928|      2|    coef->pub.consume_data = dummy_consume_data;
  929|      2|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  142|      2|#define _decompress_data  decompress_data_12
  ------------------
  930|      2|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|      2|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|     62|  coef->workspace = (JCOEF *)
  935|     62|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     62|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|     62|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|     62|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|     62|}
jdcoefct-12.c:start_input_pass:
   50|    117|{
   51|    117|  cinfo->input_iMCU_row = 0;
   52|    117|  start_iMCU_row(cinfo);
   53|    117|}
jdcoefct-12.c:start_output_pass:
   62|     15|{
   63|     15|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|     15|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   65|       |
   66|       |  /* If multipass, check to see whether to use block smoothing on this pass */
   67|     15|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 14, False: 1]
  ------------------
   68|     14|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 14, False: 0]
  |  Branch (68:38): [True: 3, False: 11]
  ------------------
   69|      3|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  142|      3|#define _decompress_data  decompress_data_12
  ------------------
   70|     11|    else
   71|     11|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|     11|#define _decompress_data  decompress_data_12
  ------------------
   72|     14|  }
   73|     15|#endif
   74|     15|  cinfo->output_iMCU_row = 0;
   75|     15|}
jdcoefct-12.c:smoothing_ok:
  405|     14|{
  406|     14|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|     14|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|     14|#define FALSE   0               /* values of boolean */
  ------------------
  408|     14|  int ci, coefi;
  409|     14|  jpeg_component_info *compptr;
  410|     14|  JQUANT_TBL *qtable;
  411|     14|  int *coef_bits, *prev_coef_bits;
  412|     14|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|     14|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 0, False: 14]
  |  Branch (414:35): [True: 0, False: 14]
  ------------------
  415|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|     14|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 14, False: 0]
  ------------------
  419|     14|    coef->coef_bits_latch = (int *)
  420|     14|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     14|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|     14|                                  cinfo->num_components * 2 *
  422|     14|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|     14|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|     14|  coef_bits_latch = coef->coef_bits_latch;
  424|     14|  prev_coef_bits_latch =
  425|     14|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|     14|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|     18|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 14, False: 4]
  ------------------
  428|     14|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|     14|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 0, False: 14]
  ------------------
  431|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  432|       |    /* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
  433|     14|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 1, False: 13]
  ------------------
  434|     13|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|     13|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 1, False: 12]
  ------------------
  435|     12|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|     12|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 1, False: 11]
  ------------------
  436|     11|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|     11|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 1, False: 10]
  ------------------
  437|     10|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|     10|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 1, False: 9]
  ------------------
  438|      9|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|      9|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 1, False: 8]
  ------------------
  439|      8|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|      8|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 1, False: 7]
  ------------------
  440|      7|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|      7|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 1, False: 6]
  ------------------
  441|      6|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|      6|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 1, False: 5]
  ------------------
  442|      5|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|      5|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 1, False: 4]
  ------------------
  443|     10|      return FALSE;
  ------------------
  |  |  207|     10|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|      4|    coef_bits = cinfo->coef_bits[ci];
  446|      4|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|      4|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 0, False: 4]
  ------------------
  448|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  449|      4|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|     40|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|     40|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 36, False: 4]
  ------------------
  452|     36|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 27, False: 9]
  ------------------
  453|     27|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|      9|      else
  455|      9|        prev_coef_bits_latch[coefi] = -1;
  456|     36|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|     36|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 21, False: 15]
  ------------------
  458|     21|        smoothing_useful = TRUE;
  ------------------
  |  |  210|     21|#define TRUE    1
  ------------------
  459|     36|    }
  460|      4|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|      4|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|      4|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|      4|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|      4|  }
  463|       |
  464|      4|  return smoothing_useful;
  465|     14|}
jdcoefct-12.c:consume_data:
  218|  2.51k|{
  219|  2.51k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|  2.51k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|  2.51k|  int blkn, ci, xindex, yindex, yoffset;
  222|  2.51k|  JDIMENSION start_col;
  223|  2.51k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|  2.51k|  JBLOCKROW buffer_ptr;
  225|  2.51k|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|  5.02k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 2.51k, False: 2.51k]
  ------------------
  229|  2.51k|    compptr = cinfo->cur_comp_info[ci];
  230|  2.51k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|  2.51k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|  2.51k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|  2.51k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  2.51k|#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|  2.51k|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|  7.44k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 4.93k, False: 2.51k]
  ------------------
  242|  4.93k|       yoffset++) {
  243|   232k|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 227k, False: 4.93k]
  ------------------
  244|   227k|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|   227k|      blkn = 0;                 /* index of current DCT block within MCU */
  247|   455k|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 227k, False: 227k]
  ------------------
  248|   227k|        compptr = cinfo->cur_comp_info[ci];
  249|   227k|        start_col = MCU_col_num * compptr->MCU_width;
  250|   455k|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 227k, False: 227k]
  ------------------
  251|   227k|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|   455k|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 227k, False: 227k]
  ------------------
  253|   227k|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|   227k|          }
  255|   227k|        }
  256|   227k|      }
  257|   227k|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 227k, False: 0]
  ------------------
  258|   227k|        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|   227k|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 227k]
  ------------------
  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|   227k|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|  4.93k|    coef->MCU_ctr = 0;
  282|  4.93k|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|  2.51k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 2.39k, False: 116]
  ------------------
  285|  2.39k|    start_iMCU_row(cinfo);
  286|  2.39k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  2.39k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|  2.39k|  }
  288|       |  /* Completed the scan */
  289|    116|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|    116|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    116|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|  2.51k|}

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

jinit_color_deconverter:
  625|  2.03k|{
  626|  2.03k|  my_cconvert_ptr cconvert;
  627|  2.03k|  int ci;
  628|       |
  629|  2.03k|#ifdef D_LOSSLESS_SUPPORTED
  630|  2.03k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 355, False: 1.67k]
  ------------------
  631|    355|#if BITS_IN_JSAMPLE == 8
  632|    355|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|    710|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (632:9): [True: 0, False: 355]
  |  Branch (632:52): [True: 0, False: 355]
  ------------------
  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|    355|  } else
  639|  1.67k|#endif
  640|  1.67k|  {
  641|  1.67k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.67k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (641:9): [True: 0, False: 1.67k]
  ------------------
  642|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  643|  1.67k|  }
  644|       |
  645|  2.03k|  cconvert = (my_cconvert_ptr)
  646|  2.03k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  2.03k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|  2.03k|                                sizeof(my_color_deconverter));
  648|  2.03k|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|  2.03k|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|  2.03k|  switch (cinfo->jpeg_color_space) {
  653|  2.00k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 2.00k, False: 27]
  ------------------
  654|  2.00k|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 2.00k]
  ------------------
  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|  2.00k|    break;
  657|       |
  658|     14|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 14, False: 2.01k]
  ------------------
  659|     27|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 13, False: 2.01k]
  ------------------
  660|     27|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 27]
  ------------------
  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|     27|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 2.03k]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 2.03k]
  ------------------
  666|      0|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (666:9): [True: 0, False: 0]
  ------------------
  667|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  668|      0|    break;
  669|       |
  670|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 0, False: 2.03k]
  ------------------
  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|  2.03k|  }
  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|  2.03k|  switch (cinfo->out_color_space) {
  684|  2.00k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 2.00k, False: 27]
  ------------------
  685|  2.00k|#ifdef D_LOSSLESS_SUPPORTED
  686|  2.00k|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 340, False: 1.66k]
  ------------------
  687|    340|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 340]
  ------------------
  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|  2.00k|#endif
  690|  2.00k|    cinfo->out_color_components = 1;
  691|  2.00k|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 2.00k, False: 0]
  ------------------
  692|  2.00k|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|  2.00k|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  267|  2.00k|#define _color_convert  color_convert
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|  2.00k|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 2.00k]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|  2.00k|    } 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|  2.00k|    break;
  703|       |
  704|     27|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 27, False: 2.00k]
  ------------------
  705|     27|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 2.03k]
  ------------------
  706|     27|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 2.03k]
  ------------------
  707|     27|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 2.03k]
  ------------------
  708|     27|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 2.03k]
  ------------------
  709|     27|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 2.03k]
  ------------------
  710|     27|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 2.03k]
  ------------------
  711|     27|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 2.03k]
  ------------------
  712|     27|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 2.03k]
  ------------------
  713|     27|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 2.03k]
  ------------------
  714|     27|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 2.03k]
  ------------------
  715|     27|#ifdef D_LOSSLESS_SUPPORTED
  716|     27|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 15, False: 12]
  |  Branch (716:36): [True: 1, False: 14]
  ------------------
  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|     27|#endif
  719|     27|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|     27|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 12, False: 15]
  ------------------
  721|     12|#ifdef WITH_SIMD
  722|     12|      if (jsimd_set_ycc_rgb(cinfo))
  ------------------
  |  Branch (722:11): [True: 0, False: 12]
  ------------------
  723|      0|        cconvert->pub._color_convert = jsimd_color_deconvert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  724|     12|      else
  725|     12|#endif
  726|     12|      {
  727|     12|        switch (cinfo->out_color_space) {
  728|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (728:9): [True: 0, False: 12]
  ------------------
  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: 12]
  ------------------
  732|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (732:9): [True: 0, False: 12]
  ------------------
  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: 12]
  ------------------
  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: 12]
  ------------------
  739|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (739:9): [True: 0, False: 12]
  ------------------
  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: 12]
  ------------------
  743|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (743:9): [True: 0, False: 12]
  ------------------
  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: 12]
  ------------------
  747|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (747:9): [True: 0, False: 12]
  ------------------
  748|      0|          cconvert->pub._color_convert = ycc_extxrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  749|      0|          break;
  750|     12|        default:
  ------------------
  |  Branch (750:9): [True: 12, False: 0]
  ------------------
  751|     12|          cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  267|     12|#define _color_convert  color_convert
  ------------------
  752|     12|        }
  753|     12|        build_ycc_rgb_table(cinfo);
  754|     12|      }
  755|     15|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 15]
  ------------------
  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|     15|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 14, False: 1]
  ------------------
  783|     14|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 14, False: 0]
  ------------------
  784|     14|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 14, False: 0]
  ------------------
  785|     14|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 14, False: 0]
  ------------------
  786|     14|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 14, False: 0]
  ------------------
  787|     14|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|     14|#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|     14|    } 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|     27|    break;
  819|       |
  820|     27|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 2.03k]
  ------------------
  821|      0|#ifdef D_LOSSLESS_SUPPORTED
  822|      0|    if (cinfo->master->lossless)
  ------------------
  |  Branch (822:9): [True: 0, False: 0]
  ------------------
  823|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  824|      0|#endif
  825|      0|    cinfo->out_color_components = 3;
  826|      0|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (826:9): [True: 0, False: 0]
  ------------------
  827|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (827:11): [True: 0, False: 0]
  ------------------
  828|      0|#ifdef WITH_SIMD
  829|      0|        if (jsimd_set_ycc_rgb565(cinfo))
  ------------------
  |  Branch (829:13): [True: 0, False: 0]
  ------------------
  830|      0|          cconvert->pub._color_convert = jsimd_color_deconvert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  831|      0|        else
  832|      0|#endif
  833|      0|        {
  834|      0|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  835|      0|          build_ycc_rgb_table(cinfo);
  836|      0|        }
  837|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (837:18): [True: 0, False: 0]
  ------------------
  838|      0|        cconvert->pub._color_convert = gray_rgb565_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  839|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (839:18): [True: 0, False: 0]
  ------------------
  840|      0|        cconvert->pub._color_convert = rgb_rgb565_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  841|      0|      } else
  842|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  843|      0|    } else {
  844|       |      /* only ordered dithering is supported */
  845|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (845:11): [True: 0, False: 0]
  ------------------
  846|      0|        cconvert->pub._color_convert = ycc_rgb565D_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  847|      0|        build_ycc_rgb_table(cinfo);
  848|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (848:18): [True: 0, False: 0]
  ------------------
  849|      0|        cconvert->pub._color_convert = gray_rgb565D_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  850|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (850:18): [True: 0, False: 0]
  ------------------
  851|      0|        cconvert->pub._color_convert = rgb_rgb565D_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  852|      0|      } else
  853|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  854|      0|    }
  855|      0|    break;
  856|       |
  857|      0|  case JCS_CMYK:
  ------------------
  |  Branch (857:3): [True: 0, False: 2.03k]
  ------------------
  858|      0|#ifdef D_LOSSLESS_SUPPORTED
  859|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (859:9): [True: 0, False: 0]
  ------------------
  860|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (860:9): [True: 0, False: 0]
  ------------------
  861|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  862|      0|#endif
  863|      0|    cinfo->out_color_components = 4;
  864|      0|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (864:9): [True: 0, False: 0]
  ------------------
  865|      0|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  866|      0|      build_ycc_rgb_table(cinfo);
  867|      0|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (867:16): [True: 0, False: 0]
  ------------------
  868|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  869|      0|    } else
  870|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  871|      0|    break;
  872|       |
  873|      0|  default:
  ------------------
  |  Branch (873:3): [True: 0, False: 2.03k]
  ------------------
  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|  2.03k|  }
  882|       |
  883|  2.03k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 2.03k]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|  2.03k|  else
  886|  2.03k|    cinfo->output_components = cinfo->out_color_components;
  887|  2.03k|}
jdcolor-8.c:start_pass_dcolor:
  614|  1.69k|{
  615|       |  /* no work needed */
  616|  1.69k|}
jdcolor-8.c:grayscale_convert:
  397|   400k|{
  398|   400k|  _jcopy_sample_rows(input_buf[0], (int)input_row, output_buf, 0, num_rows,
  ------------------
  |  |  297|   400k|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  399|   400k|                     cinfo->output_width);
  400|   400k|}
jdcolor-8.c:build_ycc_rgb_table:
  218|     12|{
  219|     12|#if BITS_IN_JSAMPLE != 16
  220|     12|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  221|     12|  int i;
  222|     12|  JLONG x;
  223|     12|  SHIFT_TEMPS
  224|       |
  225|     12|  cconvert->Cr_r_tab = (int *)
  226|     12|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     12|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  227|     12|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  226|     12|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|     12|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  228|     12|  cconvert->Cb_b_tab = (int *)
  229|     12|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     12|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  230|     12|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  226|     12|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|     12|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  231|     12|  cconvert->Cr_g_tab = (JLONG *)
  232|     12|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     12|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  233|     12|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  226|     12|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|     12|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  234|     12|  cconvert->Cb_g_tab = (JLONG *)
  235|     12|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     12|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  236|     12|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  226|     12|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|     12|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  237|       |
  238|  3.08k|  for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  227|     12|#define _CENTERJSAMPLE   CENTERJSAMPLE
  |  |  ------------------
  |  |  |  |   53|     12|#define CENTERJSAMPLE    128
  |  |  ------------------
  ------------------
                for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  226|  3.08k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  3.08k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  |  Branch (238:36): [True: 3.07k, False: 12]
  ------------------
  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|  3.07k|    cconvert->Cr_r_tab[i] = (int)
  243|  3.07k|                    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|  3.07k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  244|       |    /* Cb=>B value is nearest int to 1.77200 * x */
  245|  3.07k|    cconvert->Cb_b_tab[i] = (int)
  246|  3.07k|                    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|  3.07k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  247|       |    /* Cr=>G value is scaled-up -0.71414 * x */
  248|  3.07k|    cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
  ------------------
  |  |   84|  3.07k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|  3.07k|#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|  3.07k|    cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   84|  3.07k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|  3.07k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   83|  3.07k|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   82|  3.07k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  252|  3.07k|  }
  253|       |#else
  254|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  255|       |#endif
  256|     12|}
j12init_color_deconverter:
  625|     81|{
  626|     81|  my_cconvert_ptr cconvert;
  627|     81|  int ci;
  628|       |
  629|     81|#ifdef D_LOSSLESS_SUPPORTED
  630|     81|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 17, False: 64]
  ------------------
  631|       |#if BITS_IN_JSAMPLE == 8
  632|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  633|       |#else
  634|     17|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     34|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (634:9): [True: 0, False: 17]
  ------------------
  635|     17|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     17|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (635:9): [True: 0, False: 17]
  ------------------
  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|     17|  } else
  639|     64|#endif
  640|     64|  {
  641|     64|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|     64|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (641:9): [True: 0, False: 64]
  ------------------
  642|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  643|     64|  }
  644|       |
  645|     81|  cconvert = (my_cconvert_ptr)
  646|     81|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     81|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|     81|                                sizeof(my_color_deconverter));
  648|     81|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|     81|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|     81|  switch (cinfo->jpeg_color_space) {
  653|     56|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 56, False: 25]
  ------------------
  654|     56|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 56]
  ------------------
  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|     56|    break;
  657|       |
  658|      8|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 8, False: 73]
  ------------------
  659|     25|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 17, False: 64]
  ------------------
  660|     25|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 25]
  ------------------
  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|     25|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 81]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 81]
  ------------------
  666|      0|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (666:9): [True: 0, False: 0]
  ------------------
  667|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  668|      0|    break;
  669|       |
  670|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 0, False: 81]
  ------------------
  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|     81|  }
  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|     81|  switch (cinfo->out_color_space) {
  684|     56|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 56, False: 25]
  ------------------
  685|     56|#ifdef D_LOSSLESS_SUPPORTED
  686|     56|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 8, False: 48]
  ------------------
  687|      8|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 8]
  ------------------
  688|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  689|     56|#endif
  690|     56|    cinfo->out_color_components = 1;
  691|     56|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 56, False: 0]
  ------------------
  692|     56|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|     56|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  151|     56|#define _color_convert  color_convert_12
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|     56|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 56]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|     56|    } 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|     56|    break;
  703|       |
  704|     25|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 25, False: 56]
  ------------------
  705|     25|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 81]
  ------------------
  706|     25|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 81]
  ------------------
  707|     25|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 81]
  ------------------
  708|     25|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 81]
  ------------------
  709|     25|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 81]
  ------------------
  710|     25|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 81]
  ------------------
  711|     25|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 81]
  ------------------
  712|     25|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 81]
  ------------------
  713|     25|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 81]
  ------------------
  714|     25|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 81]
  ------------------
  715|     25|#ifdef D_LOSSLESS_SUPPORTED
  716|     25|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 9, False: 16]
  |  Branch (716:36): [True: 1, False: 8]
  ------------------
  717|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  718|     25|#endif
  719|     25|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|     25|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 16, False: 9]
  ------------------
  721|       |#ifdef WITH_SIMD
  722|       |      if (jsimd_set_ycc_rgb(cinfo))
  723|       |        cconvert->pub._color_convert = jsimd_color_deconvert;
  724|       |      else
  725|       |#endif
  726|     16|      {
  727|     16|        switch (cinfo->out_color_space) {
  728|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (728:9): [True: 0, False: 16]
  ------------------
  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: 16]
  ------------------
  732|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (732:9): [True: 0, False: 16]
  ------------------
  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: 16]
  ------------------
  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: 16]
  ------------------
  739|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (739:9): [True: 0, False: 16]
  ------------------
  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: 16]
  ------------------
  743|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (743:9): [True: 0, False: 16]
  ------------------
  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: 16]
  ------------------
  747|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (747:9): [True: 0, False: 16]
  ------------------
  748|      0|          cconvert->pub._color_convert = ycc_extxrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  749|      0|          break;
  750|     16|        default:
  ------------------
  |  Branch (750:9): [True: 16, False: 0]
  ------------------
  751|     16|          cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  151|     16|#define _color_convert  color_convert_12
  ------------------
  752|     16|        }
  753|     16|        build_ycc_rgb_table(cinfo);
  754|     16|      }
  755|     16|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 9]
  ------------------
  756|      0|      switch (cinfo->out_color_space) {
  757|      0|      case JCS_EXT_RGB:
  ------------------
  |  Branch (757:7): [True: 0, False: 0]
  ------------------
  758|      0|        cconvert->pub._color_convert = gray_extrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  759|      0|        break;
  760|      0|      case JCS_EXT_RGBX:
  ------------------
  |  Branch (760:7): [True: 0, False: 0]
  ------------------
  761|      0|      case JCS_EXT_RGBA:
  ------------------
  |  Branch (761:7): [True: 0, False: 0]
  ------------------
  762|      0|        cconvert->pub._color_convert = gray_extrgbx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  763|      0|        break;
  764|      0|      case JCS_EXT_BGR:
  ------------------
  |  Branch (764:7): [True: 0, False: 0]
  ------------------
  765|      0|        cconvert->pub._color_convert = gray_extbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  766|      0|        break;
  767|      0|      case JCS_EXT_BGRX:
  ------------------
  |  Branch (767:7): [True: 0, False: 0]
  ------------------
  768|      0|      case JCS_EXT_BGRA:
  ------------------
  |  Branch (768:7): [True: 0, False: 0]
  ------------------
  769|      0|        cconvert->pub._color_convert = gray_extbgrx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  770|      0|        break;
  771|      0|      case JCS_EXT_XBGR:
  ------------------
  |  Branch (771:7): [True: 0, False: 0]
  ------------------
  772|      0|      case JCS_EXT_ABGR:
  ------------------
  |  Branch (772:7): [True: 0, False: 0]
  ------------------
  773|      0|        cconvert->pub._color_convert = gray_extxbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  774|      0|        break;
  775|      0|      case JCS_EXT_XRGB:
  ------------------
  |  Branch (775:7): [True: 0, False: 0]
  ------------------
  776|      0|      case JCS_EXT_ARGB:
  ------------------
  |  Branch (776:7): [True: 0, False: 0]
  ------------------
  777|      0|        cconvert->pub._color_convert = gray_extxrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  778|      0|        break;
  779|      0|      default:
  ------------------
  |  Branch (779:7): [True: 0, False: 0]
  ------------------
  780|      0|        cconvert->pub._color_convert = gray_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  781|      0|      }
  782|      9|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 8, False: 1]
  ------------------
  783|      8|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 8, False: 0]
  ------------------
  784|      8|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 8, False: 0]
  ------------------
  785|      8|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 8, False: 0]
  ------------------
  786|      8|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 8, False: 0]
  ------------------
  787|      8|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|      8|#define _color_convert  color_convert_12
  ------------------
  788|      0|      else {
  789|      0|        switch (cinfo->out_color_space) {
  790|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (790:9): [True: 0, False: 0]
  ------------------
  791|      0|          cconvert->pub._color_convert = rgb_extrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  792|      0|          break;
  793|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (793:9): [True: 0, False: 0]
  ------------------
  794|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (794:9): [True: 0, False: 0]
  ------------------
  795|      0|          cconvert->pub._color_convert = rgb_extrgbx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  796|      0|          break;
  797|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (797:9): [True: 0, False: 0]
  ------------------
  798|      0|          cconvert->pub._color_convert = rgb_extbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  799|      0|          break;
  800|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (800:9): [True: 0, False: 0]
  ------------------
  801|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (801:9): [True: 0, False: 0]
  ------------------
  802|      0|          cconvert->pub._color_convert = rgb_extbgrx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  803|      0|          break;
  804|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (804:9): [True: 0, False: 0]
  ------------------
  805|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (805:9): [True: 0, False: 0]
  ------------------
  806|      0|          cconvert->pub._color_convert = rgb_extxbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  807|      0|          break;
  808|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (808:9): [True: 0, False: 0]
  ------------------
  809|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (809:9): [True: 0, False: 0]
  ------------------
  810|      0|          cconvert->pub._color_convert = rgb_extxrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  811|      0|          break;
  812|      0|        default:
  ------------------
  |  Branch (812:9): [True: 0, False: 0]
  ------------------
  813|      0|          cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  814|      0|        }
  815|      0|      }
  816|      8|    } else
  817|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  818|     25|    break;
  819|       |
  820|     25|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 81]
  ------------------
  821|      0|#ifdef D_LOSSLESS_SUPPORTED
  822|      0|    if (cinfo->master->lossless)
  ------------------
  |  Branch (822:9): [True: 0, False: 0]
  ------------------
  823|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  824|      0|#endif
  825|      0|    cinfo->out_color_components = 3;
  826|      0|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (826:9): [True: 0, False: 0]
  ------------------
  827|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (827:11): [True: 0, False: 0]
  ------------------
  828|       |#ifdef WITH_SIMD
  829|       |        if (jsimd_set_ycc_rgb565(cinfo))
  830|       |          cconvert->pub._color_convert = jsimd_color_deconvert;
  831|       |        else
  832|       |#endif
  833|      0|        {
  834|      0|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  835|      0|          build_ycc_rgb_table(cinfo);
  836|      0|        }
  837|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (837:18): [True: 0, False: 0]
  ------------------
  838|      0|        cconvert->pub._color_convert = gray_rgb565_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  839|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (839:18): [True: 0, False: 0]
  ------------------
  840|      0|        cconvert->pub._color_convert = rgb_rgb565_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  841|      0|      } else
  842|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  843|      0|    } else {
  844|       |      /* only ordered dithering is supported */
  845|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (845:11): [True: 0, False: 0]
  ------------------
  846|      0|        cconvert->pub._color_convert = ycc_rgb565D_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  847|      0|        build_ycc_rgb_table(cinfo);
  848|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (848:18): [True: 0, False: 0]
  ------------------
  849|      0|        cconvert->pub._color_convert = gray_rgb565D_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  850|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (850:18): [True: 0, False: 0]
  ------------------
  851|      0|        cconvert->pub._color_convert = rgb_rgb565D_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  852|      0|      } else
  853|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  854|      0|    }
  855|      0|    break;
  856|       |
  857|      0|  case JCS_CMYK:
  ------------------
  |  Branch (857:3): [True: 0, False: 81]
  ------------------
  858|      0|#ifdef D_LOSSLESS_SUPPORTED
  859|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (859:9): [True: 0, False: 0]
  ------------------
  860|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (860:9): [True: 0, False: 0]
  ------------------
  861|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  862|      0|#endif
  863|      0|    cinfo->out_color_components = 4;
  864|      0|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (864:9): [True: 0, False: 0]
  ------------------
  865|      0|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  866|      0|      build_ycc_rgb_table(cinfo);
  867|      0|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (867:16): [True: 0, False: 0]
  ------------------
  868|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  869|      0|    } else
  870|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  871|      0|    break;
  872|       |
  873|      0|  default:
  ------------------
  |  Branch (873:3): [True: 0, False: 81]
  ------------------
  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|     81|  }
  882|       |
  883|     80|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 80]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|     80|  else
  886|     80|    cinfo->output_components = cinfo->out_color_components;
  887|     80|}
jdcolor-12.c:start_pass_dcolor:
  614|     18|{
  615|       |  /* no work needed */
  616|     18|}
jdcolor-12.c:build_ycc_rgb_table:
  218|     16|{
  219|     16|#if BITS_IN_JSAMPLE != 16
  220|     16|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  221|     16|  int i;
  222|     16|  JLONG x;
  223|     16|  SHIFT_TEMPS
  224|       |
  225|     16|  cconvert->Cr_r_tab = (int *)
  226|     16|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     16|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  227|     16|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  110|     16|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     16|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  228|     16|  cconvert->Cb_b_tab = (int *)
  229|     16|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     16|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  230|     16|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  110|     16|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     16|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  231|     16|  cconvert->Cr_g_tab = (JLONG *)
  232|     16|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     16|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  233|     16|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  110|     16|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     16|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  234|     16|  cconvert->Cb_g_tab = (JLONG *)
  235|     16|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     16|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  236|     16|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  110|     16|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     16|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  237|       |
  238|  65.5k|  for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  111|     16|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   61|     16|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
                for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  110|  65.5k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|  65.5k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  |  Branch (238:36): [True: 65.5k, False: 16]
  ------------------
  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|  65.5k|    cconvert->Cr_r_tab[i] = (int)
  243|  65.5k|                    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|  65.5k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  244|       |    /* Cb=>B value is nearest int to 1.77200 * x */
  245|  65.5k|    cconvert->Cb_b_tab[i] = (int)
  246|  65.5k|                    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|  65.5k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  247|       |    /* Cr=>G value is scaled-up -0.71414 * x */
  248|  65.5k|    cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
  ------------------
  |  |   84|  65.5k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|  65.5k|#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|  65.5k|    cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   84|  65.5k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|  65.5k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   83|  65.5k|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   82|  65.5k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  252|  65.5k|  }
  253|       |#else
  254|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  255|       |#endif
  256|     16|}
j16init_color_deconverter:
  625|     22|{
  626|     22|  my_cconvert_ptr cconvert;
  627|     22|  int ci;
  628|       |
  629|     22|#ifdef D_LOSSLESS_SUPPORTED
  630|     22|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 22, False: 0]
  ------------------
  631|       |#if BITS_IN_JSAMPLE == 8
  632|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  633|       |#else
  634|     22|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     44|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (634:9): [True: 0, False: 22]
  ------------------
  635|     22|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     22|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (635:9): [True: 0, False: 22]
  ------------------
  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|     22|  } 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|     22|  cconvert = (my_cconvert_ptr)
  646|     22|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     22|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|     22|                                sizeof(my_color_deconverter));
  648|     22|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|     22|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|     22|  switch (cinfo->jpeg_color_space) {
  653|      8|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 8, False: 14]
  ------------------
  654|      8|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 8]
  ------------------
  655|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  656|      8|    break;
  657|       |
  658|     13|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 13, False: 9]
  ------------------
  659|     14|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 1, False: 21]
  ------------------
  660|     14|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 14]
  ------------------
  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|     14|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 22]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 22]
  ------------------
  666|      0|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (666:9): [True: 0, False: 0]
  ------------------
  667|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  668|      0|    break;
  669|       |
  670|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 0, False: 22]
  ------------------
  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|     22|  }
  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|     22|  switch (cinfo->out_color_space) {
  684|      8|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 8, False: 14]
  ------------------
  685|      8|#ifdef D_LOSSLESS_SUPPORTED
  686|      8|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 8, False: 0]
  ------------------
  687|      8|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 8]
  ------------------
  688|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  689|      8|#endif
  690|      8|    cinfo->out_color_components = 1;
  691|      8|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 8, False: 0]
  ------------------
  692|      8|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|      8|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |   59|      8|#define _color_convert  color_convert_16
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|      8|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 8]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|      8|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (697:16): [True: 0, False: 0]
  ------------------
  698|      0|      cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  699|      0|      build_rgb_y_table(cinfo);
  700|      0|    } else
  701|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  702|      8|    break;
  703|       |
  704|     14|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 14, False: 8]
  ------------------
  705|     14|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 22]
  ------------------
  706|     14|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 22]
  ------------------
  707|     14|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 22]
  ------------------
  708|     14|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 22]
  ------------------
  709|     14|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 22]
  ------------------
  710|     14|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 22]
  ------------------
  711|     14|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 22]
  ------------------
  712|     14|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 22]
  ------------------
  713|     14|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 22]
  ------------------
  714|     14|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 22]
  ------------------
  715|     14|#ifdef D_LOSSLESS_SUPPORTED
  716|     14|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 14, False: 0]
  |  Branch (716:36): [True: 1, False: 13]
  ------------------
  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|     14|#endif
  719|     14|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|     14|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 0, False: 14]
  ------------------
  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|     14|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 14]
  ------------------
  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|     14|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 13, False: 1]
  ------------------
  783|     13|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 13, False: 0]
  ------------------
  784|     13|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 13, False: 0]
  ------------------
  785|     13|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 13, False: 0]
  ------------------
  786|     13|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 13, False: 0]
  ------------------
  787|     13|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |   59|     13|#define _color_convert  color_convert_16
  ------------------
  788|      0|      else {
  789|      0|        switch (cinfo->out_color_space) {
  790|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (790:9): [True: 0, False: 0]
  ------------------
  791|      0|          cconvert->pub._color_convert = rgb_extrgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  792|      0|          break;
  793|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (793:9): [True: 0, False: 0]
  ------------------
  794|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (794:9): [True: 0, False: 0]
  ------------------
  795|      0|          cconvert->pub._color_convert = rgb_extrgbx_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  796|      0|          break;
  797|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (797:9): [True: 0, False: 0]
  ------------------
  798|      0|          cconvert->pub._color_convert = rgb_extbgr_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  799|      0|          break;
  800|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (800:9): [True: 0, False: 0]
  ------------------
  801|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (801:9): [True: 0, False: 0]
  ------------------
  802|      0|          cconvert->pub._color_convert = rgb_extbgrx_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  803|      0|          break;
  804|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (804:9): [True: 0, False: 0]
  ------------------
  805|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (805:9): [True: 0, False: 0]
  ------------------
  806|      0|          cconvert->pub._color_convert = rgb_extxbgr_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  807|      0|          break;
  808|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (808:9): [True: 0, False: 0]
  ------------------
  809|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (809:9): [True: 0, False: 0]
  ------------------
  810|      0|          cconvert->pub._color_convert = rgb_extxrgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  811|      0|          break;
  812|      0|        default:
  ------------------
  |  Branch (812:9): [True: 0, False: 0]
  ------------------
  813|      0|          cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  814|      0|        }
  815|      0|      }
  816|     13|    } else
  817|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  818|     14|    break;
  819|       |
  820|     14|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 22]
  ------------------
  821|      0|#ifdef D_LOSSLESS_SUPPORTED
  822|      0|    if (cinfo->master->lossless)
  ------------------
  |  Branch (822:9): [True: 0, False: 0]
  ------------------
  823|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  824|      0|#endif
  825|      0|    cinfo->out_color_components = 3;
  826|      0|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (826:9): [True: 0, False: 0]
  ------------------
  827|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (827:11): [True: 0, False: 0]
  ------------------
  828|       |#ifdef WITH_SIMD
  829|       |        if (jsimd_set_ycc_rgb565(cinfo))
  830|       |          cconvert->pub._color_convert = jsimd_color_deconvert;
  831|       |        else
  832|       |#endif
  833|      0|        {
  834|      0|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  835|      0|          build_ycc_rgb_table(cinfo);
  836|      0|        }
  837|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (837:18): [True: 0, False: 0]
  ------------------
  838|      0|        cconvert->pub._color_convert = gray_rgb565_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  839|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (839:18): [True: 0, False: 0]
  ------------------
  840|      0|        cconvert->pub._color_convert = rgb_rgb565_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  841|      0|      } else
  842|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  843|      0|    } else {
  844|       |      /* only ordered dithering is supported */
  845|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (845:11): [True: 0, False: 0]
  ------------------
  846|      0|        cconvert->pub._color_convert = ycc_rgb565D_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  847|      0|        build_ycc_rgb_table(cinfo);
  848|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (848:18): [True: 0, False: 0]
  ------------------
  849|      0|        cconvert->pub._color_convert = gray_rgb565D_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  850|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (850:18): [True: 0, False: 0]
  ------------------
  851|      0|        cconvert->pub._color_convert = rgb_rgb565D_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  852|      0|      } else
  853|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  854|      0|    }
  855|      0|    break;
  856|       |
  857|      0|  case JCS_CMYK:
  ------------------
  |  Branch (857:3): [True: 0, False: 22]
  ------------------
  858|      0|#ifdef D_LOSSLESS_SUPPORTED
  859|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (859:9): [True: 0, False: 0]
  ------------------
  860|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (860:9): [True: 0, False: 0]
  ------------------
  861|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  862|      0|#endif
  863|      0|    cinfo->out_color_components = 4;
  864|      0|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (864:9): [True: 0, False: 0]
  ------------------
  865|      0|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  866|      0|      build_ycc_rgb_table(cinfo);
  867|      0|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (867:16): [True: 0, False: 0]
  ------------------
  868|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  869|      0|    } else
  870|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  871|      0|    break;
  872|       |
  873|      0|  default:
  ------------------
  |  Branch (873:3): [True: 0, False: 22]
  ------------------
  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|     22|  }
  882|       |
  883|     21|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 21]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|     21|  else
  886|     21|    cinfo->output_components = cinfo->out_color_components;
  887|     21|}
jdcolor-16.c:start_pass_dcolor:
  614|      3|{
  615|       |  /* no work needed */
  616|      3|}

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

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

jpeg_make_d_derived_tbl:
  145|  1.56k|{
  146|  1.56k|  JHUFF_TBL *htbl;
  147|  1.56k|  d_derived_tbl *dtbl;
  148|  1.56k|  int p, i, l, si, numsymbols;
  149|  1.56k|  int lookbits, ctr;
  150|  1.56k|  char huffsize[257];
  151|  1.56k|  unsigned int huffcode[257];
  152|  1.56k|  unsigned int code;
  153|       |
  154|       |  /* Note that huffsize[] and huffcode[] are filled in code-length order,
  155|       |   * paralleling the order of the symbols themselves in htbl->huffval[].
  156|       |   */
  157|       |
  158|       |  /* Find the input Huffman table */
  159|  1.56k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  1.56k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (159:7): [True: 0, False: 1.56k]
  |  Branch (159:20): [True: 2, False: 1.56k]
  ------------------
  160|      2|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  161|  1.56k|  htbl =
  162|  1.56k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (162:5): [True: 1.00k, False: 561]
  ------------------
  163|  1.56k|  if (htbl == NULL)
  ------------------
  |  Branch (163:7): [True: 1, False: 1.56k]
  ------------------
  164|      1|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  165|       |
  166|       |  /* Allocate a workspace if we haven't already done so. */
  167|  1.56k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (167:7): [True: 1.56k, False: 3]
  ------------------
  168|  1.56k|    *pdtbl = (d_derived_tbl *)
  169|  1.56k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.56k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  170|  1.56k|                                  sizeof(d_derived_tbl));
  171|  1.56k|  dtbl = *pdtbl;
  172|  1.56k|  dtbl->pub = htbl;             /* fill in back link */
  173|       |
  174|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  175|       |
  176|  1.56k|  p = 0;
  177|  26.6k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (177:15): [True: 25.0k, False: 1.56k]
  ------------------
  178|  25.0k|    i = (int)htbl->bits[l];
  179|  25.0k|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (179:9): [True: 0, False: 25.0k]
  |  Branch (179:18): [True: 0, False: 25.0k]
  ------------------
  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|   111k|    while (i--)
  ------------------
  |  Branch (181:12): [True: 86.8k, False: 25.0k]
  ------------------
  182|  86.8k|      huffsize[p++] = (char)l;
  183|  25.0k|  }
  184|  1.56k|  huffsize[p] = 0;
  185|  1.56k|  numsymbols = p;
  186|       |
  187|       |  /* Figure C.2: generate the codes themselves */
  188|       |  /* We also validate that the counts represent a legal Huffman code tree. */
  189|       |
  190|  1.56k|  code = 0;
  191|  1.56k|  si = huffsize[0];
  192|  1.56k|  p = 0;
  193|  18.0k|  while (huffsize[p]) {
  ------------------
  |  Branch (193:10): [True: 16.5k, False: 1.56k]
  ------------------
  194|   102k|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (194:12): [True: 86.2k, False: 16.5k]
  ------------------
  195|  86.2k|      huffcode[p++] = code;
  196|  86.2k|      code++;
  197|  86.2k|    }
  198|       |    /* code is now 1 more than the last code used for codelength si; but
  199|       |     * it must still fit in si bits, since no code is allowed to be all ones.
  200|       |     */
  201|  16.5k|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (201:9): [True: 11, False: 16.5k]
  ------------------
  202|     11|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|     11|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     11|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|  16.5k|    code <<= 1;
  204|  16.5k|    si++;
  205|  16.5k|  }
  206|       |
  207|       |  /* Figure F.15: generate decoding tables for bit-sequential decoding */
  208|       |
  209|  1.56k|  p = 0;
  210|  26.4k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (210:15): [True: 24.8k, False: 1.56k]
  ------------------
  211|  24.8k|    if (htbl->bits[l]) {
  ------------------
  |  Branch (211:9): [True: 16.0k, False: 8.80k]
  ------------------
  212|       |      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
  213|       |       * minus the minimum code of length l
  214|       |       */
  215|  16.0k|      dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
  216|  16.0k|      p += htbl->bits[l];
  217|  16.0k|      dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
  218|  16.0k|    } else {
  219|  8.80k|      dtbl->maxcode[l] = -1;    /* -1 if no codes of this length */
  220|  8.80k|    }
  221|  24.8k|  }
  222|  1.56k|  dtbl->valoffset[17] = 0;
  223|  1.56k|  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|   399k|  for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
  ------------------
  |  |   25|   399k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (232:15): [True: 398k, False: 1.56k]
  ------------------
  233|   398k|    dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|   398k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
                  dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|   398k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  234|       |
  235|  1.56k|  p = 0;
  236|  14.0k|  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
  ------------------
  |  |   25|  14.0k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (236:15): [True: 12.4k, False: 1.56k]
  ------------------
  237|  33.3k|    for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
  ------------------
  |  Branch (237:17): [True: 20.8k, False: 12.4k]
  ------------------
  238|       |      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
  239|       |      /* Generate left-justified code followed by all possible bit sequences */
  240|  20.8k|      lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
  ------------------
  |  |   25|  20.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  241|   408k|      for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
  ------------------
  |  |   25|  20.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (241:45): [True: 388k, False: 20.8k]
  ------------------
  242|   388k|        dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
  ------------------
  |  |   25|   388k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  243|   388k|        lookbits++;
  244|   388k|      }
  245|  20.8k|    }
  246|  12.4k|  }
  247|       |
  248|       |  /* Validate symbols as being reasonable.
  249|       |   * For AC tables, we make no check, but accept all byte values 0..255.
  250|       |   * For DC tables, we require the symbols to be in range 0..15 in lossy mode
  251|       |   * and 0..16 in lossless mode.  (Tighter bounds could be applied depending on
  252|       |   * the data depth and mode, but this is sufficient to ensure safe decoding.)
  253|       |   */
  254|  1.56k|  if (isDC) {
  ------------------
  |  Branch (254:7): [True: 999, False: 570]
  ------------------
  255|  12.9k|    for (i = 0; i < numsymbols; i++) {
  ------------------
  |  Branch (255:17): [True: 11.9k, False: 999]
  ------------------
  256|  11.9k|      int sym = htbl->huffval[i];
  257|  11.9k|      if (sym < 0 || sym > (cinfo->master->lossless ? 16 : 15))
  ------------------
  |  Branch (257:11): [True: 0, False: 11.9k]
  |  Branch (257:22): [True: 12, False: 11.8k]
  |  Branch (257:29): [True: 4.25k, False: 7.64k]
  ------------------
  258|     12|        ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|     12|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     12|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  259|  11.9k|    }
  260|    999|  }
  261|  1.56k|}
jpeg_fill_bit_buffer:
  291|   162k|{
  292|       |  /* Copy heavily used state fields into locals (hopefully registers) */
  293|   162k|  register const JOCTET *next_input_byte = state->next_input_byte;
  294|   162k|  register size_t bytes_in_buffer = state->bytes_in_buffer;
  295|   162k|  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|   162k|  if (cinfo->unread_marker == 0) {      /* cannot advance past a marker */
  ------------------
  |  Branch (301:7): [True: 160k, False: 1.33k]
  ------------------
  302|  1.28M|    while (bits_left < MIN_GET_BITS) {
  ------------------
  |  |  282|  1.28M|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|  1.28M|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  |  Branch (302:12): [True: 1.12M, False: 160k]
  ------------------
  303|  1.12M|      register int c;
  304|       |
  305|       |      /* Attempt to read a byte */
  306|  1.12M|      if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (306:11): [True: 252, False: 1.12M]
  ------------------
  307|    252|        if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (307:13): [True: 0, False: 252]
  ------------------
  308|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  309|    252|        next_input_byte = cinfo->src->next_input_byte;
  310|    252|        bytes_in_buffer = cinfo->src->bytes_in_buffer;
  311|    252|      }
  312|  1.12M|      bytes_in_buffer--;
  313|  1.12M|      c = *next_input_byte++;
  314|       |
  315|       |      /* If it's 0xFF, check and discard stuffed zero byte */
  316|  1.12M|      if (c == 0xFF) {
  ------------------
  |  Branch (316:11): [True: 5.59k, False: 1.12M]
  ------------------
  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|  49.1k|        do {
  323|  49.1k|          if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (323:15): [True: 3, False: 49.1k]
  ------------------
  324|      3|            if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (324:17): [True: 0, False: 3]
  ------------------
  325|      0|              return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  326|      3|            next_input_byte = cinfo->src->next_input_byte;
  327|      3|            bytes_in_buffer = cinfo->src->bytes_in_buffer;
  328|      3|          }
  329|  49.1k|          bytes_in_buffer--;
  330|  49.1k|          c = *next_input_byte++;
  331|  49.1k|        } while (c == 0xFF);
  ------------------
  |  Branch (331:18): [True: 43.5k, False: 5.59k]
  ------------------
  332|       |
  333|  5.59k|        if (c == 0) {
  ------------------
  |  Branch (333:13): [True: 5.02k, False: 569]
  ------------------
  334|       |          /* Found FF/00, which represents an FF data byte */
  335|  5.02k|          c = 0xFF;
  336|  5.02k|        } 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|    569|          cinfo->unread_marker = c;
  346|       |          /* See if we need to insert some fake zero bits. */
  347|    569|          goto no_more_bytes;
  348|    569|        }
  349|  5.59k|      }
  350|       |
  351|       |      /* OK, load c into get_buffer */
  352|  1.12M|      get_buffer = (get_buffer << 8) | c;
  353|  1.12M|      bits_left += 8;
  354|  1.12M|    } /* end while */
  355|   160k|  } else {
  356|  1.89k|no_more_bytes:
  357|       |    /* We get here if we've read the marker that terminates the compressed
  358|       |     * data segment.  There should be enough bits in the buffer register
  359|       |     * to satisfy the request; if so, no problem.
  360|       |     */
  361|  1.89k|    if (nbits > bits_left) {
  ------------------
  |  Branch (361:9): [True: 549, False: 1.35k]
  ------------------
  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|    549|      if (!cinfo->entropy->insufficient_data) {
  ------------------
  |  Branch (367:11): [True: 549, False: 0]
  ------------------
  368|    549|        WARNMS(cinfo, JWRN_HIT_MARKER);
  ------------------
  |  |  283|    549|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    549|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  369|    549|        cinfo->entropy->insufficient_data = TRUE;
  ------------------
  |  |  210|    549|#define TRUE    1
  ------------------
  370|    549|      }
  371|       |      /* Fill the buffer with zero bits */
  372|    549|      get_buffer <<= MIN_GET_BITS - bits_left;
  ------------------
  |  |  282|    549|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|    549|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  373|    549|      bits_left = MIN_GET_BITS;
  ------------------
  |  |  282|    549|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|    549|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  374|    549|    }
  375|  1.89k|  }
  376|       |
  377|       |  /* Unload the local registers */
  378|   162k|  state->next_input_byte = next_input_byte;
  379|   162k|  state->bytes_in_buffer = bytes_in_buffer;
  380|   162k|  state->get_buffer = get_buffer;
  381|   162k|  state->bits_left = bits_left;
  382|       |
  383|   162k|  return TRUE;
  ------------------
  |  |  210|   162k|#define TRUE    1
  ------------------
  384|   162k|}
jpeg_huff_decode:
  439|  9.96k|{
  440|  9.96k|  register int l = min_bits;
  441|  9.96k|  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|  9.96k|  CHECK_BIT_BUFFER(*state, l, return -1);
  ------------------
  |  |  160|  9.96k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  9.96k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 346, False: 9.62k]
  |  |  ------------------
  |  |  162|    346|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 346]
  |  |  ------------------
  |  |  163|    346|      { action; } \
  |  |  164|    346|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    346|  } \
  |  |  166|  9.96k|}
  ------------------
  447|  9.96k|  code = GET_BITS(l);
  ------------------
  |  |  169|  9.96k|  (((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|  30.1k|  while (code > htbl->maxcode[l]) {
  ------------------
  |  Branch (452:10): [True: 20.2k, False: 9.96k]
  ------------------
  453|  20.2k|    code <<= 1;
  454|  20.2k|    CHECK_BIT_BUFFER(*state, 1, return -1);
  ------------------
  |  |  160|  20.2k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  20.2k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 500, False: 19.7k]
  |  |  ------------------
  |  |  162|    500|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 500]
  |  |  ------------------
  |  |  163|    500|      { action; } \
  |  |  164|    500|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    500|  } \
  |  |  166|  20.2k|}
  ------------------
  455|  20.2k|    code |= GET_BITS(1);
  ------------------
  |  |  169|  20.2k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  456|  20.2k|    l++;
  457|  20.2k|  }
  458|       |
  459|       |  /* Unload the local registers */
  460|  9.96k|  state->get_buffer = get_buffer;
  461|  9.96k|  state->bits_left = bits_left;
  462|       |
  463|       |  /* With garbage input we may reach the sentinel value l = 17. */
  464|       |
  465|  9.96k|  if (l > 16) {
  ------------------
  |  Branch (465:7): [True: 120, False: 9.84k]
  ------------------
  466|    120|    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|    120|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    120|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  467|    120|    return 0;                   /* fake a zero as the safest result */
  468|    120|  }
  469|       |
  470|  9.84k|  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
  471|  9.96k|}
jinit_huff_decoder:
  815|    584|{
  816|    584|  huff_entropy_ptr entropy;
  817|    584|  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|    584|  std_huff_tables((j_common_ptr)cinfo);
  824|       |
  825|    584|  entropy = (huff_entropy_ptr)
  826|    584|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    584|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  827|    584|                                sizeof(huff_entropy_decoder));
  828|    584|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  829|    584|  entropy->pub.start_pass = start_pass_huff_decoder;
  830|    584|  entropy->pub.decode_mcu = decode_mcu;
  831|       |
  832|       |  /* Mark tables unallocated */
  833|  2.92k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  2.92k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (833:15): [True: 2.33k, False: 584]
  ------------------
  834|       |    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
  835|  2.33k|  }
  836|    584|}
jdhuff.c:start_pass_huff_decoder:
   80|    579|{
   81|    579|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   82|    579|  int ci, blkn, dctbl, actbl;
   83|    579|  d_derived_tbl **pdtbl;
   84|    579|  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|    579|  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|    578|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (90:7): [True: 1, False: 578]
  |  Branch (90:25): [True: 2, False: 576]
  ------------------
   91|    576|      cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (91:7): [True: 1, False: 575]
  |  Branch (91:25): [True: 1, False: 574]
  ------------------
   92|      5|    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      5|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
   93|       |
   94|  1.15k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (94:16): [True: 574, False: 579]
  ------------------
   95|    574|    compptr = cinfo->cur_comp_info[ci];
   96|    574|    dctbl = compptr->dc_tbl_no;
   97|    574|    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|    574|    pdtbl = (d_derived_tbl **)(entropy->dc_derived_tbls) + dctbl;
  101|    574|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
  ------------------
  |  |  210|    574|#define TRUE    1
  ------------------
  102|    574|    pdtbl = (d_derived_tbl **)(entropy->ac_derived_tbls) + actbl;
  103|    574|    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
  ------------------
  |  |  207|    574|#define FALSE   0               /* values of boolean */
  ------------------
  104|       |    /* Initialize DC predictions to 0 */
  105|    574|    entropy->saved.last_dc_val[ci] = 0;
  106|    574|  }
  107|       |
  108|       |  /* Precalculate decoding info for each block in an MCU of this scan */
  109|  1.13k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (109:18): [True: 556, False: 579]
  ------------------
  110|    556|    ci = cinfo->MCU_membership[blkn];
  111|    556|    compptr = cinfo->cur_comp_info[ci];
  112|       |    /* Precalculate which table to use for each block */
  113|    556|    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
  114|    556|    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
  115|       |    /* Decide whether we really care about the coefficient values */
  116|    556|    if (compptr->component_needed) {
  ------------------
  |  Branch (116:9): [True: 556, False: 0]
  ------------------
  117|    556|      entropy->dc_needed[blkn] = TRUE;
  ------------------
  |  |  210|    556|#define TRUE    1
  ------------------
  118|       |      /* we don't need the ACs if producing a 1/8th-size image */
  119|    556|      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
  ------------------
  |  |   24|    556|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  120|    556|    } else {
  121|      0|      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  122|      0|    }
  123|    556|  }
  124|       |
  125|       |  /* Initialize bitread state variables */
  126|    579|  entropy->bitstate.bits_left = 0;
  127|    579|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  128|    579|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|    579|#define FALSE   0               /* values of boolean */
  ------------------
  129|       |
  130|       |  /* Initialize restart counter */
  131|    579|  entropy->restarts_to_go = cinfo->restart_interval;
  132|    579|}
jdhuff.c:decode_mcu:
  771|   191k|{
  772|   191k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  773|   191k|  int usefast = 1;
  774|       |
  775|       |  /* Process restart marker if needed; may have to suspend */
  776|   191k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (776:7): [True: 0, False: 191k]
  ------------------
  777|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (777:9): [True: 0, False: 0]
  ------------------
  778|      0|      if (!process_restart(cinfo))
  ------------------
  |  Branch (778:11): [True: 0, False: 0]
  ------------------
  779|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  780|      0|    usefast = 0;
  781|      0|  }
  782|       |
  783|   191k|  if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
  ------------------
  |  |  767|   191k|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  ------------------
  |  |  |  |   67|   191k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  ------------------
  |  Branch (783:7): [True: 35.2k, False: 156k]
  ------------------
  784|   156k|      cinfo->unread_marker != 0)
  ------------------
  |  Branch (784:7): [True: 55, False: 156k]
  ------------------
  785|  35.3k|    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|   191k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (790:7): [True: 191k, False: 0]
  ------------------
  791|       |
  792|   191k|    if (usefast) {
  ------------------
  |  Branch (792:9): [True: 156k, False: 35.3k]
  ------------------
  793|   156k|      if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
  ------------------
  |  Branch (793:11): [True: 2.65k, False: 153k]
  ------------------
  794|   156k|    } else {
  795|  37.9k|use_slow:
  796|  37.9k|      if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (796:11): [True: 0, False: 37.9k]
  ------------------
  797|  37.9k|    }
  798|       |
  799|   191k|  }
  800|       |
  801|       |  /* Account for restart interval (no-op if not using restarts) */
  802|   191k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (802:7): [True: 0, False: 191k]
  ------------------
  803|      0|    entropy->restarts_to_go--;
  804|       |
  805|   191k|  return TRUE;
  ------------------
  |  |  210|   191k|#define TRUE    1
  ------------------
  806|   191k|}
jdhuff.c:decode_mcu_fast:
  664|   156k|{
  665|   156k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  666|   156k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   156k|  register bit_buf_type get_buffer; \
  |  |  126|   156k|  register int bits_left; \
  |  |  127|   156k|  bitread_working_state br_state
  ------------------
  667|   156k|  JOCTET *buffer;
  668|   156k|  int blkn;
  669|   156k|  savable_state state;
  670|       |  /* Outer loop handles each block in the MCU */
  671|       |
  672|       |  /* Load up working state */
  673|   156k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   156k|  br_state.cinfo = cinfop; \
  |  |  131|   156k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   156k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   156k|  get_buffer = permstate.get_buffer; \
  |  |  134|   156k|  bits_left = permstate.bits_left;
  ------------------
  674|   156k|  buffer = (JOCTET *)br_state.next_input_byte;
  675|   156k|  state = entropy->saved;
  676|       |
  677|   313k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (677:18): [True: 156k, False: 156k]
  ------------------
  678|   156k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (678:23): [True: 156k, False: 0]
  ------------------
  679|   156k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  680|   156k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  681|   156k|    register int s, k, r, l;
  682|       |
  683|   156k|    HUFF_DECODE_FAST(s, l, dctbl);
  ------------------
  |  |  224|   156k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   156k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 14.0k, False: 142k]
  |  |  |  |  ------------------
  |  |  |  |  416|  14.0k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  14.0k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  14.0k|  register int c0, c1; \
  |  |  |  |  |  |  393|  14.0k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  14.0k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  14.0k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  14.0k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  14.0k|  bits_left += 8; \
  |  |  |  |  |  |  398|  14.0k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 915, False: 13.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    915|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    915|    buffer++; \
  |  |  |  |  |  |  401|    915|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 281, False: 634]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    281|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    281|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    281|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    281|      buffer -= 2; \
  |  |  |  |  |  |  406|    281|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    281|    } \
  |  |  |  |  |  |  408|    915|  } \
  |  |  |  |  |  |  409|  14.0k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  14.0k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  14.0k|  register int c0, c1; \
  |  |  |  |  |  |  393|  14.0k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  14.0k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  14.0k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  14.0k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  14.0k|  bits_left += 8; \
  |  |  |  |  |  |  398|  14.0k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.32k, False: 12.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.32k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.32k|    buffer++; \
  |  |  |  |  |  |  401|  1.32k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 566, False: 757]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    566|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    566|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    566|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    566|      buffer -= 2; \
  |  |  |  |  |  |  406|    566|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    566|    } \
  |  |  |  |  |  |  408|  1.32k|  } \
  |  |  |  |  |  |  409|  14.0k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  14.0k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  14.0k|  register int c0, c1; \
  |  |  |  |  |  |  393|  14.0k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  14.0k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  14.0k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  14.0k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  14.0k|  bits_left += 8; \
  |  |  |  |  |  |  398|  14.0k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.35k, False: 12.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.35k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.35k|    buffer++; \
  |  |  |  |  |  |  401|  1.35k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 743, False: 610]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    743|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    743|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    743|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    743|      buffer -= 2; \
  |  |  |  |  |  |  406|    743|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    743|    } \
  |  |  |  |  |  |  408|  1.35k|  } \
  |  |  |  |  |  |  409|  14.0k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  14.0k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  14.0k|  register int c0, c1; \
  |  |  |  |  |  |  393|  14.0k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  14.0k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  14.0k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  14.0k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  14.0k|  bits_left += 8; \
  |  |  |  |  |  |  398|  14.0k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.48k, False: 12.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.48k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.48k|    buffer++; \
  |  |  |  |  |  |  401|  1.48k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 872, False: 612]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    872|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    872|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    872|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    872|      buffer -= 2; \
  |  |  |  |  |  |  406|    872|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    872|    } \
  |  |  |  |  |  |  408|  1.48k|  } \
  |  |  |  |  |  |  409|  14.0k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  14.0k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  14.0k|  register int c0, c1; \
  |  |  |  |  |  |  393|  14.0k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  14.0k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  14.0k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  14.0k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  14.0k|  bits_left += 8; \
  |  |  |  |  |  |  398|  14.0k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.65k, False: 12.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.65k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.65k|    buffer++; \
  |  |  |  |  |  |  401|  1.65k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 993, False: 662]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    993|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    993|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    993|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    993|      buffer -= 2; \
  |  |  |  |  |  |  406|    993|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    993|    } \
  |  |  |  |  |  |  408|  1.65k|  } \
  |  |  |  |  |  |  409|  14.0k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  14.0k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  14.0k|  register int c0, c1; \
  |  |  |  |  |  |  393|  14.0k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  14.0k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  14.0k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  14.0k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  14.0k|  bits_left += 8; \
  |  |  |  |  |  |  398|  14.0k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.61k, False: 12.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.61k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.61k|    buffer++; \
  |  |  |  |  |  |  401|  1.61k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.14k, False: 472]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.14k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.14k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.14k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.14k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.14k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.14k|    } \
  |  |  |  |  |  |  408|  1.61k|  } \
  |  |  |  |  |  |  409|  14.0k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  14.0k|  }
  |  |  ------------------
  |  |  225|   156k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   156k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   156k|  s = htbl->lookup[s]; \
  |  |  227|   156k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   156k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   156k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   156k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   156k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   156k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   156k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   156k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   313k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 3.48k, False: 153k]
  |  |  ------------------
  |  |  232|  3.48k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  3.48k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  3.48k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|  14.0k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 10.5k, False: 3.48k]
  |  |  ------------------
  |  |  236|  10.5k|      s <<= 1; \
  |  |  237|  10.5k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|  10.5k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|  10.5k|      nb++; \
  |  |  239|  10.5k|    } \
  |  |  240|  3.48k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 1.25k, False: 2.22k]
  |  |  ------------------
  |  |  241|  3.48k|      s = 0; \
  |  |  242|  3.48k|    else \
  |  |  243|  3.48k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  3.48k|  }
  ------------------
  684|   156k|    if (s) {
  ------------------
  |  Branch (684:9): [True: 100k, False: 56.1k]
  ------------------
  685|   100k|      FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|   100k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 7.65k, False: 92.8k]
  |  |  ------------------
  |  |  416|  7.65k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  7.65k|#define GET_BYTE { \
  |  |  |  |  392|  7.65k|  register int c0, c1; \
  |  |  |  |  393|  7.65k|  c0 = *buffer++; \
  |  |  |  |  394|  7.65k|  c1 = *buffer; \
  |  |  |  |  395|  7.65k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  7.65k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  7.65k|  bits_left += 8; \
  |  |  |  |  398|  7.65k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 473, False: 7.18k]
  |  |  |  |  ------------------
  |  |  |  |  399|    473|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    473|    buffer++; \
  |  |  |  |  401|    473|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 99, False: 374]
  |  |  |  |  ------------------
  |  |  |  |  402|     99|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     99|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     99|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     99|      buffer -= 2; \
  |  |  |  |  406|     99|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     99|    } \
  |  |  |  |  408|    473|  } \
  |  |  |  |  409|  7.65k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  7.65k|#define GET_BYTE { \
  |  |  |  |  392|  7.65k|  register int c0, c1; \
  |  |  |  |  393|  7.65k|  c0 = *buffer++; \
  |  |  |  |  394|  7.65k|  c1 = *buffer; \
  |  |  |  |  395|  7.65k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  7.65k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  7.65k|  bits_left += 8; \
  |  |  |  |  398|  7.65k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 551, False: 7.10k]
  |  |  |  |  ------------------
  |  |  |  |  399|    551|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    551|    buffer++; \
  |  |  |  |  401|    551|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 175, False: 376]
  |  |  |  |  ------------------
  |  |  |  |  402|    175|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    175|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    175|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    175|      buffer -= 2; \
  |  |  |  |  406|    175|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    175|    } \
  |  |  |  |  408|    551|  } \
  |  |  |  |  409|  7.65k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  7.65k|#define GET_BYTE { \
  |  |  |  |  392|  7.65k|  register int c0, c1; \
  |  |  |  |  393|  7.65k|  c0 = *buffer++; \
  |  |  |  |  394|  7.65k|  c1 = *buffer; \
  |  |  |  |  395|  7.65k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  7.65k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  7.65k|  bits_left += 8; \
  |  |  |  |  398|  7.65k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 617, False: 7.03k]
  |  |  |  |  ------------------
  |  |  |  |  399|    617|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    617|    buffer++; \
  |  |  |  |  401|    617|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 193, False: 424]
  |  |  |  |  ------------------
  |  |  |  |  402|    193|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    193|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    193|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    193|      buffer -= 2; \
  |  |  |  |  406|    193|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    193|    } \
  |  |  |  |  408|    617|  } \
  |  |  |  |  409|  7.65k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  7.65k|#define GET_BYTE { \
  |  |  |  |  392|  7.65k|  register int c0, c1; \
  |  |  |  |  393|  7.65k|  c0 = *buffer++; \
  |  |  |  |  394|  7.65k|  c1 = *buffer; \
  |  |  |  |  395|  7.65k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  7.65k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  7.65k|  bits_left += 8; \
  |  |  |  |  398|  7.65k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 623, False: 7.03k]
  |  |  |  |  ------------------
  |  |  |  |  399|    623|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    623|    buffer++; \
  |  |  |  |  401|    623|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 227, False: 396]
  |  |  |  |  ------------------
  |  |  |  |  402|    227|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    227|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    227|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    227|      buffer -= 2; \
  |  |  |  |  406|    227|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    227|    } \
  |  |  |  |  408|    623|  } \
  |  |  |  |  409|  7.65k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  7.65k|#define GET_BYTE { \
  |  |  |  |  392|  7.65k|  register int c0, c1; \
  |  |  |  |  393|  7.65k|  c0 = *buffer++; \
  |  |  |  |  394|  7.65k|  c1 = *buffer; \
  |  |  |  |  395|  7.65k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  7.65k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  7.65k|  bits_left += 8; \
  |  |  |  |  398|  7.65k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 542, False: 7.11k]
  |  |  |  |  ------------------
  |  |  |  |  399|    542|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    542|    buffer++; \
  |  |  |  |  401|    542|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 344, False: 198]
  |  |  |  |  ------------------
  |  |  |  |  402|    344|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    344|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    344|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    344|      buffer -= 2; \
  |  |  |  |  406|    344|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    344|    } \
  |  |  |  |  408|    542|  } \
  |  |  |  |  409|  7.65k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  7.65k|#define GET_BYTE { \
  |  |  |  |  392|  7.65k|  register int c0, c1; \
  |  |  |  |  393|  7.65k|  c0 = *buffer++; \
  |  |  |  |  394|  7.65k|  c1 = *buffer; \
  |  |  |  |  395|  7.65k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  7.65k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  7.65k|  bits_left += 8; \
  |  |  |  |  398|  7.65k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 847, False: 6.80k]
  |  |  |  |  ------------------
  |  |  |  |  399|    847|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    847|    buffer++; \
  |  |  |  |  401|    847|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 372, False: 475]
  |  |  |  |  ------------------
  |  |  |  |  402|    372|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    372|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    372|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    372|      buffer -= 2; \
  |  |  |  |  406|    372|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    372|    } \
  |  |  |  |  408|    847|  } \
  |  |  |  |  409|  7.65k|}
  |  |  ------------------
  |  |  417|  7.65k|  }
  ------------------
  686|   100k|      r = GET_BITS(s);
  ------------------
  |  |  169|   100k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  687|   100k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   100k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   100k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  688|   100k|    }
  689|       |
  690|   156k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (690:9): [True: 156k, False: 0]
  ------------------
  691|   156k|      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|   156k|      s += state.last_dc_val[ci];
  696|   156k|      state.last_dc_val[ci] = s;
  697|   156k|      if (block)
  ------------------
  |  Branch (697:11): [True: 156k, False: 0]
  ------------------
  698|   156k|        (*block)[0] = (JCOEF)s;
  699|   156k|    }
  700|       |
  701|   156k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (701:9): [True: 156k, False: 0]
  |  Branch (701:37): [True: 156k, False: 0]
  ------------------
  702|       |
  703|  1.19M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  1.19M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (703:19): [True: 1.17M, False: 24.0k]
  ------------------
  704|  1.17M|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|  1.17M|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|  1.17M|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 73.3k, False: 1.09M]
  |  |  |  |  ------------------
  |  |  |  |  416|  73.3k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  73.3k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  73.3k|  register int c0, c1; \
  |  |  |  |  |  |  393|  73.3k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  73.3k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  73.3k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  73.3k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  73.3k|  bits_left += 8; \
  |  |  |  |  |  |  398|  73.3k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3.78k, False: 69.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  3.78k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  3.78k|    buffer++; \
  |  |  |  |  |  |  401|  3.78k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.17k, False: 2.60k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.17k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.17k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.17k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.17k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.17k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.17k|    } \
  |  |  |  |  |  |  408|  3.78k|  } \
  |  |  |  |  |  |  409|  73.3k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  73.3k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  73.3k|  register int c0, c1; \
  |  |  |  |  |  |  393|  73.3k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  73.3k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  73.3k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  73.3k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  73.3k|  bits_left += 8; \
  |  |  |  |  |  |  398|  73.3k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 4.18k, False: 69.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  4.18k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  4.18k|    buffer++; \
  |  |  |  |  |  |  401|  4.18k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.31k, False: 2.87k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.31k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.31k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.31k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.31k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.31k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.31k|    } \
  |  |  |  |  |  |  408|  4.18k|  } \
  |  |  |  |  |  |  409|  73.3k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  73.3k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  73.3k|  register int c0, c1; \
  |  |  |  |  |  |  393|  73.3k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  73.3k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  73.3k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  73.3k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  73.3k|  bits_left += 8; \
  |  |  |  |  |  |  398|  73.3k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 4.70k, False: 68.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  4.70k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  4.70k|    buffer++; \
  |  |  |  |  |  |  401|  4.70k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.39k, False: 3.31k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.39k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.39k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.39k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.39k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.39k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.39k|    } \
  |  |  |  |  |  |  408|  4.70k|  } \
  |  |  |  |  |  |  409|  73.3k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  73.3k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  73.3k|  register int c0, c1; \
  |  |  |  |  |  |  393|  73.3k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  73.3k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  73.3k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  73.3k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  73.3k|  bits_left += 8; \
  |  |  |  |  |  |  398|  73.3k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3.67k, False: 69.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  3.67k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  3.67k|    buffer++; \
  |  |  |  |  |  |  401|  3.67k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.46k, False: 2.20k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.46k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.46k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.46k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.46k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.46k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.46k|    } \
  |  |  |  |  |  |  408|  3.67k|  } \
  |  |  |  |  |  |  409|  73.3k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  73.3k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  73.3k|  register int c0, c1; \
  |  |  |  |  |  |  393|  73.3k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  73.3k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  73.3k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  73.3k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  73.3k|  bits_left += 8; \
  |  |  |  |  |  |  398|  73.3k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 4.64k, False: 68.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  4.64k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  4.64k|    buffer++; \
  |  |  |  |  |  |  401|  4.64k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.52k, False: 3.12k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.52k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.52k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.52k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.52k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.52k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.52k|    } \
  |  |  |  |  |  |  408|  4.64k|  } \
  |  |  |  |  |  |  409|  73.3k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  73.3k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  73.3k|  register int c0, c1; \
  |  |  |  |  |  |  393|  73.3k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  73.3k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  73.3k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  73.3k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  73.3k|  bits_left += 8; \
  |  |  |  |  |  |  398|  73.3k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 4.32k, False: 69.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  4.32k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  4.32k|    buffer++; \
  |  |  |  |  |  |  401|  4.32k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.57k, False: 2.74k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.57k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.57k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.57k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.57k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.57k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.57k|    } \
  |  |  |  |  |  |  408|  4.32k|  } \
  |  |  |  |  |  |  409|  73.3k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  73.3k|  }
  |  |  ------------------
  |  |  225|  1.17M|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  1.17M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|  1.17M|  s = htbl->lookup[s]; \
  |  |  227|  1.17M|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|  1.17M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|  1.17M|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|  1.17M|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  1.17M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|  1.17M|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  1.17M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|  1.17M|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.34M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 88.5k, False: 1.08M]
  |  |  ------------------
  |  |  232|  88.5k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  88.5k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  88.5k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|   290k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 201k, False: 88.5k]
  |  |  ------------------
  |  |  236|   201k|      s <<= 1; \
  |  |  237|   201k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|   201k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|   201k|      nb++; \
  |  |  239|   201k|    } \
  |  |  240|  88.5k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 2.02k, False: 86.5k]
  |  |  ------------------
  |  |  241|  88.5k|      s = 0; \
  |  |  242|  88.5k|    else \
  |  |  243|  88.5k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  88.5k|  }
  ------------------
  705|  1.17M|        r = s >> 4;
  706|  1.17M|        s &= 15;
  707|       |
  708|  1.17M|        if (s) {
  ------------------
  |  Branch (708:13): [True: 1.03M, False: 133k]
  ------------------
  709|  1.03M|          k += r;
  710|  1.03M|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  1.03M|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 75.8k, False: 961k]
  |  |  ------------------
  |  |  416|  75.8k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  75.8k|#define GET_BYTE { \
  |  |  |  |  392|  75.8k|  register int c0, c1; \
  |  |  |  |  393|  75.8k|  c0 = *buffer++; \
  |  |  |  |  394|  75.8k|  c1 = *buffer; \
  |  |  |  |  395|  75.8k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  75.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  75.8k|  bits_left += 8; \
  |  |  |  |  398|  75.8k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.61k, False: 71.2k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.61k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.61k|    buffer++; \
  |  |  |  |  401|  4.61k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 2.15k, False: 2.46k]
  |  |  |  |  ------------------
  |  |  |  |  402|  2.15k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  2.15k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  2.15k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  2.15k|      buffer -= 2; \
  |  |  |  |  406|  2.15k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  2.15k|    } \
  |  |  |  |  408|  4.61k|  } \
  |  |  |  |  409|  75.8k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  75.8k|#define GET_BYTE { \
  |  |  |  |  392|  75.8k|  register int c0, c1; \
  |  |  |  |  393|  75.8k|  c0 = *buffer++; \
  |  |  |  |  394|  75.8k|  c1 = *buffer; \
  |  |  |  |  395|  75.8k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  75.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  75.8k|  bits_left += 8; \
  |  |  |  |  398|  75.8k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.71k, False: 71.1k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.71k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.71k|    buffer++; \
  |  |  |  |  401|  4.71k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 2.20k, False: 2.51k]
  |  |  |  |  ------------------
  |  |  |  |  402|  2.20k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  2.20k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  2.20k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  2.20k|      buffer -= 2; \
  |  |  |  |  406|  2.20k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  2.20k|    } \
  |  |  |  |  408|  4.71k|  } \
  |  |  |  |  409|  75.8k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  75.8k|#define GET_BYTE { \
  |  |  |  |  392|  75.8k|  register int c0, c1; \
  |  |  |  |  393|  75.8k|  c0 = *buffer++; \
  |  |  |  |  394|  75.8k|  c1 = *buffer; \
  |  |  |  |  395|  75.8k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  75.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  75.8k|  bits_left += 8; \
  |  |  |  |  398|  75.8k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 5.25k, False: 70.5k]
  |  |  |  |  ------------------
  |  |  |  |  399|  5.25k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  5.25k|    buffer++; \
  |  |  |  |  401|  5.25k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 2.28k, False: 2.97k]
  |  |  |  |  ------------------
  |  |  |  |  402|  2.28k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  2.28k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  2.28k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  2.28k|      buffer -= 2; \
  |  |  |  |  406|  2.28k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  2.28k|    } \
  |  |  |  |  408|  5.25k|  } \
  |  |  |  |  409|  75.8k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  75.8k|#define GET_BYTE { \
  |  |  |  |  392|  75.8k|  register int c0, c1; \
  |  |  |  |  393|  75.8k|  c0 = *buffer++; \
  |  |  |  |  394|  75.8k|  c1 = *buffer; \
  |  |  |  |  395|  75.8k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  75.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  75.8k|  bits_left += 8; \
  |  |  |  |  398|  75.8k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 5.02k, False: 70.8k]
  |  |  |  |  ------------------
  |  |  |  |  399|  5.02k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  5.02k|    buffer++; \
  |  |  |  |  401|  5.02k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 2.42k, False: 2.60k]
  |  |  |  |  ------------------
  |  |  |  |  402|  2.42k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  2.42k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  2.42k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  2.42k|      buffer -= 2; \
  |  |  |  |  406|  2.42k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  2.42k|    } \
  |  |  |  |  408|  5.02k|  } \
  |  |  |  |  409|  75.8k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  75.8k|#define GET_BYTE { \
  |  |  |  |  392|  75.8k|  register int c0, c1; \
  |  |  |  |  393|  75.8k|  c0 = *buffer++; \
  |  |  |  |  394|  75.8k|  c1 = *buffer; \
  |  |  |  |  395|  75.8k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  75.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  75.8k|  bits_left += 8; \
  |  |  |  |  398|  75.8k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.40k, False: 71.4k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.40k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.40k|    buffer++; \
  |  |  |  |  401|  4.40k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 2.46k, False: 1.94k]
  |  |  |  |  ------------------
  |  |  |  |  402|  2.46k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  2.46k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  2.46k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  2.46k|      buffer -= 2; \
  |  |  |  |  406|  2.46k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  2.46k|    } \
  |  |  |  |  408|  4.40k|  } \
  |  |  |  |  409|  75.8k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  75.8k|#define GET_BYTE { \
  |  |  |  |  392|  75.8k|  register int c0, c1; \
  |  |  |  |  393|  75.8k|  c0 = *buffer++; \
  |  |  |  |  394|  75.8k|  c1 = *buffer; \
  |  |  |  |  395|  75.8k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  75.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  75.8k|  bits_left += 8; \
  |  |  |  |  398|  75.8k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 5.28k, False: 70.5k]
  |  |  |  |  ------------------
  |  |  |  |  399|  5.28k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  5.28k|    buffer++; \
  |  |  |  |  401|  5.28k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 2.57k, False: 2.70k]
  |  |  |  |  ------------------
  |  |  |  |  402|  2.57k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  2.57k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  2.57k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  2.57k|      buffer -= 2; \
  |  |  |  |  406|  2.57k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  2.57k|    } \
  |  |  |  |  408|  5.28k|  } \
  |  |  |  |  409|  75.8k|}
  |  |  ------------------
  |  |  417|  75.8k|  }
  ------------------
  711|  1.03M|          r = GET_BITS(s);
  ------------------
  |  |  169|  1.03M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  712|  1.03M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  1.03M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  1.03M|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  713|  1.03M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  714|  1.03M|        } else {
  715|   133k|          if (r != 15) break;
  ------------------
  |  Branch (715:15): [True: 132k, False: 559]
  ------------------
  716|    559|          k += 15;
  717|    559|        }
  718|  1.17M|      }
  719|       |
  720|   156k|    } 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|   156k|  }
  738|       |
  739|   156k|  if (cinfo->unread_marker != 0) {
  ------------------
  |  Branch (739:7): [True: 2.65k, False: 153k]
  ------------------
  740|  2.65k|    cinfo->unread_marker = 0;
  741|  2.65k|    return FALSE;
  ------------------
  |  |  207|  2.65k|#define FALSE   0               /* values of boolean */
  ------------------
  742|  2.65k|  }
  743|       |
  744|   153k|  br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
  745|   153k|  br_state.next_input_byte = buffer;
  746|   153k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   153k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   153k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   153k|  permstate.get_buffer = get_buffer; \
  |  |  140|   153k|  permstate.bits_left = bits_left
  ------------------
  747|   153k|  entropy->saved = state;
  748|   153k|  return TRUE;
  ------------------
  |  |  210|   153k|#define TRUE    1
  ------------------
  749|   156k|}
jdhuff.c:decode_mcu_slow:
  553|  37.9k|{
  554|  37.9k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  555|  37.9k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  37.9k|  register bit_buf_type get_buffer; \
  |  |  126|  37.9k|  register int bits_left; \
  |  |  127|  37.9k|  bitread_working_state br_state
  ------------------
  556|  37.9k|  int blkn;
  557|  37.9k|  savable_state state;
  558|       |  /* Outer loop handles each block in the MCU */
  559|       |
  560|       |  /* Load up working state */
  561|  37.9k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  37.9k|  br_state.cinfo = cinfop; \
  |  |  131|  37.9k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  37.9k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  37.9k|  get_buffer = permstate.get_buffer; \
  |  |  134|  37.9k|  bits_left = permstate.bits_left;
  ------------------
  562|  37.9k|  state = entropy->saved;
  563|       |
  564|  75.8k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (564:18): [True: 37.9k, False: 37.8k]
  ------------------
  565|  37.9k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (565:23): [True: 37.9k, False: 0]
  ------------------
  566|  37.9k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  567|  37.9k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  568|  37.9k|    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|  37.9k|    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
  ------------------
  |  |  200|  37.9k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  37.9k|  register int nb, look; \
  |  |  202|  37.9k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  37.9k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 2.40k, False: 35.5k]
  |  |  ------------------
  |  |  203|  2.40k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 2.40k]
  |  |  ------------------
  |  |  204|  2.40k|      { failaction; } \
  |  |  205|  2.40k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  2.40k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.40k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 95, False: 2.31k]
  |  |  ------------------
  |  |  207|     95|      nb = 1;  goto slowlabel; \
  |  |  208|     95|    } \
  |  |  209|  2.40k|  } \
  |  |  210|  37.9k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  37.8k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  37.8k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  37.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  37.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 37.4k, False: 481]
  |  |  ------------------
  |  |  212|  37.4k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  37.4k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  37.4k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  37.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  37.4k|  } else { \
  |  |  215|    558|slowlabel: \
  |  |  216|    558|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 558]
  |  |  ------------------
  |  |  217|    558|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|    558|      { failaction; } \
  |  |  219|    558|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|    558|  } \
  |  |  221|  37.8k|}
  ------------------
  574|  37.9k|    if (s) {
  ------------------
  |  Branch (574:9): [True: 27.9k, False: 10.0k]
  ------------------
  575|  27.9k|      CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  27.9k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  27.9k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 482, False: 27.4k]
  |  |  ------------------
  |  |  162|    482|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 482]
  |  |  ------------------
  |  |  163|    482|      { action; } \
  |  |  164|    482|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    482|  } \
  |  |  166|  27.9k|}
  ------------------
  576|  27.9k|      r = GET_BITS(s);
  ------------------
  |  |  169|  27.9k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  577|  27.9k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  27.9k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  27.9k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  578|  27.9k|    }
  579|       |
  580|  37.9k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (580:9): [True: 37.8k, False: 123]
  ------------------
  581|       |      /* Convert DC difference to actual value, update last_dc_val */
  582|  37.8k|      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|  37.8k|      s += state.last_dc_val[ci];
  592|  37.8k|      state.last_dc_val[ci] = s;
  593|  37.8k|      if (block) {
  ------------------
  |  Branch (593:11): [True: 37.8k, False: 0]
  ------------------
  594|       |        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
  595|  37.8k|        (*block)[0] = (JCOEF)s;
  596|  37.8k|      }
  597|  37.8k|    }
  598|       |
  599|  37.9k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (599:9): [True: 37.8k, False: 123]
  |  Branch (599:37): [True: 37.8k, 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|   165k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|   165k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (603:19): [True: 162k, False: 3.75k]
  ------------------
  604|   162k|        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
  ------------------
  |  |  200|   162k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   162k|  register int nb, look; \
  |  |  202|   162k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   162k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 14.6k, False: 147k]
  |  |  ------------------
  |  |  203|  14.6k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 14.6k]
  |  |  ------------------
  |  |  204|  14.6k|      { failaction; } \
  |  |  205|  14.6k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  14.6k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  14.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 440, False: 14.2k]
  |  |  ------------------
  |  |  207|    440|      nb = 1;  goto slowlabel; \
  |  |  208|    440|    } \
  |  |  209|  14.6k|  } \
  |  |  210|   162k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   161k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   161k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   161k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   161k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 153k, False: 8.40k]
  |  |  ------------------
  |  |  212|   153k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   153k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   153k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   153k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   153k|  } else { \
  |  |  215|  8.75k|slowlabel: \
  |  |  216|  8.75k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 8.75k]
  |  |  ------------------
  |  |  217|  8.75k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  8.75k|      { failaction; } \
  |  |  219|  8.75k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  8.75k|  } \
  |  |  221|   161k|}
  ------------------
  605|       |
  606|   161k|        r = s >> 4;
  607|   161k|        s &= 15;
  608|       |
  609|   161k|        if (s) {
  ------------------
  |  Branch (609:13): [True: 127k, False: 34.5k]
  ------------------
  610|   127k|          k += r;
  611|   127k|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|   127k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   127k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 2.96k, False: 124k]
  |  |  ------------------
  |  |  162|  2.96k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 2.96k]
  |  |  ------------------
  |  |  163|  2.96k|      { action; } \
  |  |  164|  2.96k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  2.96k|  } \
  |  |  166|   127k|}
  ------------------
  612|   127k|          r = GET_BITS(s);
  ------------------
  |  |  169|   127k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  613|   127k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   127k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   127k|#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|   127k|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  619|   127k|        } else {
  620|  34.5k|          if (r != 15)
  ------------------
  |  Branch (620:15): [True: 34.0k, False: 530]
  ------------------
  621|  34.0k|            break;
  622|    530|          k += 15;
  623|    530|        }
  624|   161k|      }
  625|       |
  626|  37.8k|    } else {
  627|       |
  628|       |      /* Section F.2.2.2: decode the AC coefficients */
  629|       |      /* In this path we just discard the values */
  630|    123|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|    123|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (630:19): [True: 0, False: 123]
  ------------------
  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|    123|    }
  647|  37.9k|  }
  648|       |
  649|       |  /* Completed MCU, so update state */
  650|  37.8k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  37.8k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  37.8k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  37.8k|  permstate.get_buffer = get_buffer; \
  |  |  140|  37.8k|  permstate.bits_left = bits_left
  ------------------
  651|  37.8k|  entropy->saved = state;
  652|  37.8k|  return TRUE;
  ------------------
  |  |  210|  37.8k|#define TRUE    1
  ------------------
  653|  37.9k|}

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

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

jinit_lossless_decompressor:
  281|    352|{
  282|    352|  lossless_decomp_ptr losslessd;
  283|       |
  284|    352|#if BITS_IN_JSAMPLE == 8
  285|    352|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|    704|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (285:7): [True: 0, False: 352]
  |  Branch (285:50): [True: 0, False: 352]
  ------------------
  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|    352|  losslessd = (lossless_decomp_ptr)
  294|    352|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    352|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|    352|                                sizeof(jpeg_lossless_decompressor));
  296|    352|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|    352|  losslessd->pub.start_pass = start_pass_lossless;
  298|    352|}
jdlossls-8.c:start_pass_lossless:
  243|    671|{
  244|    671|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|    671|  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|    671|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 1, False: 670]
  |  Branch (257:24): [True: 1, False: 669]
  ------------------
  258|    669|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 1, False: 668]
  |  Branch (258:25): [True: 1, False: 667]
  ------------------
  259|    667|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 667]
  |  Branch (259:24): [True: 1, False: 666]
  ------------------
  260|      5|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      5|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      5|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      5|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|    671|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|  1.33k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 666, False: 671]
  ------------------
  265|    666|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|    671|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 236, False: 435]
  ------------------
  269|    236|    losslessd->scaler_scale = simple_upscale;
  270|    435|  else
  271|    435|    losslessd->scaler_scale = noscale;
  272|    671|}
jdlossls-8.c:jpeg_undifference_first_row:
  177|    324|{
  178|    324|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|    324|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|    324|  int Ra; \
  |  |   60|    324|  \
  |  |   61|    324|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|    324|  *undiff_buf++ = Ra; \
  |  |   63|    324|  \
  |  |   64|  30.1k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 29.8k, False: 324]
  |  |  ------------------
  |  |   65|  29.8k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  29.8k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  29.8k|    *undiff_buf++ = Ra; \
  |  |   67|  29.8k|  }
  ------------------
  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|    324|  switch (cinfo->Ss) {
  188|     45|  case 1:
  ------------------
  |  Branch (188:3): [True: 45, False: 279]
  ------------------
  189|     45|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|     45|    break;
  191|     67|  case 2:
  ------------------
  |  Branch (191:3): [True: 67, False: 257]
  ------------------
  192|     67|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|     67|    break;
  194|     57|  case 3:
  ------------------
  |  Branch (194:3): [True: 57, False: 267]
  ------------------
  195|     57|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|     57|    break;
  197|     32|  case 4:
  ------------------
  |  Branch (197:3): [True: 32, False: 292]
  ------------------
  198|     32|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|     32|    break;
  200|     45|  case 5:
  ------------------
  |  Branch (200:3): [True: 45, False: 279]
  ------------------
  201|     45|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|     45|    break;
  203|     34|  case 6:
  ------------------
  |  Branch (203:3): [True: 34, False: 290]
  ------------------
  204|     34|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|     34|    break;
  206|     44|  case 7:
  ------------------
  |  Branch (206:3): [True: 44, False: 280]
  ------------------
  207|     44|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|     44|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 324]
  ------------------
  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|    324|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|    324|  }
  213|    324|}
jdlossls-8.c:jpeg_undifference1:
  111|  4.07k|{
  112|  4.07k|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|  4.07k|  int Ra; \
  |  |   60|  4.07k|  \
  |  |   61|  4.07k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  4.07k|  *undiff_buf++ = Ra; \
  |  |   63|  4.07k|  \
  |  |   64|   340k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 336k, False: 4.07k]
  |  |  ------------------
  |  |   65|   336k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|   336k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|   336k|    *undiff_buf++ = Ra; \
  |  |   67|   336k|  }
  ------------------
  113|  4.07k|}
jdlossls-8.c:jpeg_undifference2:
  119|  5.38k|{
  120|  5.38k|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|  5.38k|  int Ra, Rb, Rc; \
  |  |   87|  5.38k|  \
  |  |   88|  5.38k|  Rb = *prev_row++; \
  |  |   89|  5.38k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  5.38k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  5.38k|  *undiff_buf++ = Ra; \
  |  |   91|  5.38k|  \
  |  |   92|   606k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 601k, False: 5.38k]
  |  |  ------------------
  |  |   93|   601k|    Rc = Rb; \
  |  |   94|   601k|    Rb = *prev_row++; \
  |  |   95|   601k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|   601k|    *undiff_buf++ = Ra; \
  |  |   97|   601k|  }
  ------------------
  121|  5.38k|  (void)(Rc);
  122|  5.38k|}
jdlossls-8.c:jpeg_undifference3:
  128|  4.88k|{
  129|  4.88k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  4.88k|  int Ra, Rb, Rc; \
  |  |   87|  4.88k|  \
  |  |   88|  4.88k|  Rb = *prev_row++; \
  |  |   89|  4.88k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  4.88k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  4.88k|  *undiff_buf++ = Ra; \
  |  |   91|  4.88k|  \
  |  |   92|   165k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 160k, False: 4.88k]
  |  |  ------------------
  |  |   93|   160k|    Rc = Rb; \
  |  |   94|   160k|    Rb = *prev_row++; \
  |  |   95|   160k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|   160k|    *undiff_buf++ = Ra; \
  |  |   97|   160k|  }
  ------------------
  130|  4.88k|}
jdlossls-8.c:jpeg_undifference4:
  136|  2.71k|{
  137|  2.71k|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|  2.71k|  int Ra, Rb, Rc; \
  |  |   87|  2.71k|  \
  |  |   88|  2.71k|  Rb = *prev_row++; \
  |  |   89|  2.71k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  2.71k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  2.71k|  *undiff_buf++ = Ra; \
  |  |   91|  2.71k|  \
  |  |   92|  81.7k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 79.0k, False: 2.71k]
  |  |  ------------------
  |  |   93|  79.0k|    Rc = Rb; \
  |  |   94|  79.0k|    Rb = *prev_row++; \
  |  |   95|  79.0k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  79.0k|    *undiff_buf++ = Ra; \
  |  |   97|  79.0k|  }
  ------------------
  138|  2.71k|}
jdlossls-8.c:jpeg_undifference5:
  144|  6.32k|{
  145|  6.32k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|  6.32k|  int Ra, Rb, Rc; \
  |  |   87|  6.32k|  \
  |  |   88|  6.32k|  Rb = *prev_row++; \
  |  |   89|  6.32k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  6.32k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  6.32k|  *undiff_buf++ = Ra; \
  |  |   91|  6.32k|  \
  |  |   92|  13.6k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 7.35k, False: 6.32k]
  |  |  ------------------
  |  |   93|  7.35k|    Rc = Rb; \
  |  |   94|  7.35k|    Rb = *prev_row++; \
  |  |   95|  7.35k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  7.35k|    *undiff_buf++ = Ra; \
  |  |   97|  7.35k|  }
  ------------------
  146|  6.32k|}
jdlossls-8.c:jpeg_undifference6:
  152|  3.53k|{
  153|  3.53k|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|  3.53k|  int Ra, Rb, Rc; \
  |  |   87|  3.53k|  \
  |  |   88|  3.53k|  Rb = *prev_row++; \
  |  |   89|  3.53k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  3.53k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  3.53k|  *undiff_buf++ = Ra; \
  |  |   91|  3.53k|  \
  |  |   92|   217k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 213k, False: 3.53k]
  |  |  ------------------
  |  |   93|   213k|    Rc = Rb; \
  |  |   94|   213k|    Rb = *prev_row++; \
  |  |   95|   213k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|   213k|    *undiff_buf++ = Ra; \
  |  |   97|   213k|  }
  ------------------
  154|  3.53k|}
jdlossls-8.c:jpeg_undifference7:
  160|  4.89k|{
  161|  4.89k|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|  4.89k|  int Ra, Rb, Rc; \
  |  |   87|  4.89k|  \
  |  |   88|  4.89k|  Rb = *prev_row++; \
  |  |   89|  4.89k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  4.89k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  4.89k|  *undiff_buf++ = Ra; \
  |  |   91|  4.89k|  \
  |  |   92|  73.5k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 68.6k, False: 4.89k]
  |  |  ------------------
  |  |   93|  68.6k|    Rc = Rb; \
  |  |   94|  68.6k|    Rb = *prev_row++; \
  |  |   95|  68.6k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  68.6k|    *undiff_buf++ = Ra; \
  |  |   97|  68.6k|  }
  ------------------
  162|  4.89k|  (void)(Rc);
  163|  4.89k|}
jdlossls-8.c:simple_upscale:
  221|  6.61k|{
  222|   351k|  do {
  223|   351k|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|   351k|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 345k, False: 6.61k]
  ------------------
  225|  6.61k|}
jdlossls-8.c:noscale:
  230|  25.5k|{
  231|  1.17M|  do {
  232|  1.17M|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|  1.17M|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 1.15M, False: 25.5k]
  ------------------
  234|  25.5k|}
j12init_lossless_decompressor:
  281|     15|{
  282|     15|  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|     15|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     30|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (287:7): [True: 0, False: 15]
  ------------------
  288|     15|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     15|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (288:7): [True: 0, False: 15]
  ------------------
  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|     15|  losslessd = (lossless_decomp_ptr)
  294|     15|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|     15|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|     15|                                sizeof(jpeg_lossless_decompressor));
  296|     15|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|     15|  losslessd->pub.start_pass = start_pass_lossless;
  298|     15|}
jdlossls-12.c:start_pass_lossless:
  243|     11|{
  244|     11|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|     11|  int ci;
  246|       |
  247|       |  /* Check that the scan parameters Ss, Se, Ah, Al are OK for lossless JPEG.
  248|       |   *
  249|       |   * Ss is the predictor selection value (psv).  Legal values for sequential
  250|       |   * lossless JPEG are: 1 <= psv <= 7.
  251|       |   *
  252|       |   * Se and Ah are not used and should be zero.
  253|       |   *
  254|       |   * Al specifies the point transform (Pt).
  255|       |   * Legal values are: 0 <= Pt <= (data precision - 1).
  256|       |   */
  257|     11|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 1, False: 10]
  |  Branch (257:24): [True: 1, False: 9]
  ------------------
  258|      9|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 1, False: 8]
  |  Branch (258:25): [True: 1, False: 7]
  ------------------
  259|      7|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 7]
  |  Branch (259:24): [True: 1, False: 6]
  ------------------
  260|      5|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      5|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      5|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      5|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|     11|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|     17|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 6, False: 11]
  ------------------
  265|      6|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|     11|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 4, False: 7]
  ------------------
  269|      4|    losslessd->scaler_scale = simple_upscale;
  270|      7|  else
  271|      7|    losslessd->scaler_scale = noscale;
  272|     11|}
j16init_lossless_decompressor:
  281|     16|{
  282|     16|  lossless_decomp_ptr losslessd;
  283|       |
  284|       |#if BITS_IN_JSAMPLE == 8
  285|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  286|       |#else
  287|     16|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     32|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (287:7): [True: 0, False: 16]
  ------------------
  288|     16|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     16|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (288:7): [True: 0, False: 16]
  ------------------
  289|      0|#endif
  290|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  291|       |
  292|       |  /* Create subobject in permanent pool */
  293|     16|  losslessd = (lossless_decomp_ptr)
  294|     16|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|     16|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|     16|                                sizeof(jpeg_lossless_decompressor));
  296|     16|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|     16|  losslessd->pub.start_pass = start_pass_lossless;
  298|     16|}
jdlossls-16.c:start_pass_lossless:
  243|     11|{
  244|     11|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|     11|  int ci;
  246|       |
  247|       |  /* Check that the scan parameters Ss, Se, Ah, Al are OK for lossless JPEG.
  248|       |   *
  249|       |   * Ss is the predictor selection value (psv).  Legal values for sequential
  250|       |   * lossless JPEG are: 1 <= psv <= 7.
  251|       |   *
  252|       |   * Se and Ah are not used and should be zero.
  253|       |   *
  254|       |   * Al specifies the point transform (Pt).
  255|       |   * Legal values are: 0 <= Pt <= (data precision - 1).
  256|       |   */
  257|     11|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 1, False: 10]
  |  Branch (257:24): [True: 1, False: 9]
  ------------------
  258|      9|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 1, False: 8]
  |  Branch (258:25): [True: 1, False: 7]
  ------------------
  259|      7|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 7]
  |  Branch (259:24): [True: 1, False: 6]
  ------------------
  260|      5|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      5|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      5|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      5|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|     11|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|     17|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 6, False: 11]
  ------------------
  265|      6|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|     11|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 4, False: 7]
  ------------------
  269|      4|    losslessd->scaler_scale = simple_upscale;
  270|      7|  else
  271|      7|    losslessd->scaler_scale = noscale;
  272|     11|}

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

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

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

jinit_phuff_decoder:
  654|     88|{
  655|     88|  phuff_entropy_ptr entropy;
  656|     88|  int *coef_bit_ptr;
  657|     88|  int ci, i;
  658|       |
  659|     88|  entropy = (phuff_entropy_ptr)
  660|     88|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     88|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  661|     88|                                sizeof(phuff_entropy_decoder));
  662|     88|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  663|     88|  entropy->pub.start_pass = start_pass_phuff_decoder;
  664|       |
  665|       |  /* Mark derived tables unallocated */
  666|    440|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|    440|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (666:15): [True: 352, False: 88]
  ------------------
  667|    352|    entropy->derived_tbls[i] = NULL;
  668|    352|  }
  669|       |
  670|       |  /* Create progression status table */
  671|     88|  cinfo->coef_bits = (int (*)[DCTSIZE2])
  672|     88|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     88|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  673|     88|                                cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|     88|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  674|     88|                                sizeof(int));
  675|     88|  coef_bit_ptr = &cinfo->coef_bits[0][0];
  676|    180|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (676:16): [True: 92, False: 88]
  ------------------
  677|  5.98k|    for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|  5.98k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (677:17): [True: 5.88k, False: 92]
  ------------------
  678|  5.88k|      *coef_bit_ptr++ = -1;
  679|     88|}
jdphuff.c:start_pass_phuff_decoder:
   83|     85|{
   84|     85|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
   85|     85|  boolean is_DC_band, bad;
   86|     85|  int ci, coefi, tbl;
   87|     85|  d_derived_tbl **pdtbl;
   88|     85|  int *coef_bit_ptr, *prev_coef_bit_ptr;
   89|     85|  jpeg_component_info *compptr;
   90|       |
   91|     85|  is_DC_band = (cinfo->Ss == 0);
   92|       |
   93|       |  /* Validate scan parameters */
   94|     85|  bad = FALSE;
  ------------------
  |  |  207|     85|#define FALSE   0               /* values of boolean */
  ------------------
   95|     85|  if (is_DC_band) {
  ------------------
  |  Branch (95:7): [True: 81, False: 4]
  ------------------
   96|     81|    if (cinfo->Se != 0)
  ------------------
  |  Branch (96:9): [True: 1, False: 80]
  ------------------
   97|      1|      bad = TRUE;
  ------------------
  |  |  210|      1|#define TRUE    1
  ------------------
   98|     81|  } else {
   99|       |    /* need not check Ss/Se < 0 since they came from unsigned bytes */
  100|      4|    if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2)
  ------------------
  |  |   67|      3|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (100:9): [True: 1, False: 3]
  |  Branch (100:34): [True: 1, False: 2]
  ------------------
  101|      2|      bad = TRUE;
  ------------------
  |  |  210|      2|#define TRUE    1
  ------------------
  102|       |    /* AC scans may have only one component */
  103|      4|    if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (103:9): [True: 0, False: 4]
  ------------------
  104|      0|      bad = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  105|      4|  }
  106|     85|  if (cinfo->Ah != 0) {
  ------------------
  |  Branch (106:7): [True: 5, False: 80]
  ------------------
  107|       |    /* Successive approximation refinement scan: must have Al = Ah-1. */
  108|      5|    if (cinfo->Al != cinfo->Ah - 1)
  ------------------
  |  Branch (108:9): [True: 3, False: 2]
  ------------------
  109|      3|      bad = TRUE;
  ------------------
  |  |  210|      3|#define TRUE    1
  ------------------
  110|      5|  }
  111|     85|  if (cinfo->Al > 13)           /* need not check for < 0 */
  ------------------
  |  Branch (111:7): [True: 2, False: 83]
  ------------------
  112|      2|    bad = TRUE;
  ------------------
  |  |  210|      2|#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|     85|  if (bad)
  ------------------
  |  Branch (119:7): [True: 5, False: 80]
  ------------------
  120|      5|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      5|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      5|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      5|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  121|     85|             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|    165|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (126:16): [True: 80, False: 85]
  ------------------
  127|     80|    int cindex = cinfo->cur_comp_info[ci]->component_index;
  128|     80|    coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  129|     80|    prev_coef_bit_ptr = &cinfo->coef_bits[cindex + cinfo->num_components][0];
  130|     80|    if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (130:9): [True: 1, False: 79]
  |  Branch (130:24): [True: 1, False: 0]
  ------------------
  131|      1|      WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      1|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      1|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  132|    870|    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|     80|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 79, False: 1]
  |  |  ------------------
  ------------------
                  for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  513|    870|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 0, False: 870]
  |  |  ------------------
  ------------------
  |  Branch (132:37): [True: 790, False: 80]
  ------------------
  133|    790|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (133:11): [True: 0, False: 790]
  ------------------
  134|      0|        prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  135|    790|      else
  136|    790|        prev_coef_bit_ptr[coefi] = 0;
  137|    790|    }
  138|    159|    for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (138:29): [True: 79, False: 80]
  ------------------
  139|     79|      int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (139:22): [True: 79, False: 0]
  ------------------
  140|     79|      if (cinfo->Ah != expected)
  ------------------
  |  Branch (140:11): [True: 1, False: 78]
  ------------------
  141|      1|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      1|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      1|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  142|     79|      coef_bit_ptr[coefi] = cinfo->Al;
  143|     79|    }
  144|     80|  }
  145|       |
  146|       |  /* Select MCU decoding routine */
  147|     85|  if (cinfo->Ah == 0) {
  ------------------
  |  Branch (147:7): [True: 78, False: 7]
  ------------------
  148|     78|    if (is_DC_band)
  ------------------
  |  Branch (148:9): [True: 78, False: 0]
  ------------------
  149|     78|      entropy->pub.decode_mcu = decode_mcu_DC_first;
  150|      0|    else
  151|      0|      entropy->pub.decode_mcu = decode_mcu_AC_first;
  152|     78|  } else {
  153|      7|    if (is_DC_band)
  ------------------
  |  Branch (153:9): [True: 0, False: 7]
  ------------------
  154|      0|      entropy->pub.decode_mcu = decode_mcu_DC_refine;
  155|      7|    else
  156|      7|      entropy->pub.decode_mcu = decode_mcu_AC_refine;
  157|      7|  }
  158|       |
  159|    163|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (159:16): [True: 78, False: 85]
  ------------------
  160|     78|    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|     78|    if (is_DC_band) {
  ------------------
  |  Branch (164:9): [True: 78, False: 0]
  ------------------
  165|     78|      if (cinfo->Ah == 0) {     /* DC refinement needs no table */
  ------------------
  |  Branch (165:11): [True: 78, False: 0]
  ------------------
  166|     78|        tbl = compptr->dc_tbl_no;
  167|     78|        pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  168|     78|        jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, pdtbl);
  ------------------
  |  |  210|     78|#define TRUE    1
  ------------------
  169|     78|      }
  170|     78|    } else {
  171|      0|      tbl = compptr->ac_tbl_no;
  172|      0|      pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  173|      0|      jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, pdtbl);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  174|       |      /* remember the single active table */
  175|      0|      entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
  176|      0|    }
  177|       |    /* Initialize DC predictions to 0 */
  178|     78|    entropy->saved.last_dc_val[ci] = 0;
  179|     78|  }
  180|       |
  181|       |  /* Initialize bitread state variables */
  182|     85|  entropy->bitstate.bits_left = 0;
  183|     85|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  184|     85|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|     85|#define FALSE   0               /* values of boolean */
  ------------------
  185|       |
  186|       |  /* Initialize private state variables */
  187|     85|  entropy->saved.EOBRUN = 0;
  188|       |
  189|       |  /* Initialize restart counter */
  190|     85|  entropy->restarts_to_go = cinfo->restart_interval;
  191|     85|}
jdphuff.c:decode_mcu_DC_first:
  291|  25.1k|{
  292|  25.1k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  293|  25.1k|  int Al = cinfo->Al;
  294|  25.1k|  register int s, r;
  295|  25.1k|  int blkn, ci;
  296|  25.1k|  JBLOCKROW block;
  297|  25.1k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  25.1k|  register bit_buf_type get_buffer; \
  |  |  126|  25.1k|  register int bits_left; \
  |  |  127|  25.1k|  bitread_working_state br_state
  ------------------
  298|  25.1k|  savable_state state;
  299|  25.1k|  d_derived_tbl *tbl;
  300|  25.1k|  jpeg_component_info *compptr;
  301|       |
  302|       |  /* Process restart marker if needed; may have to suspend */
  303|  25.1k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (303:7): [True: 0, False: 25.1k]
  ------------------
  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|  25.1k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (312:7): [True: 25.1k, False: 0]
  ------------------
  313|       |
  314|       |    /* Load up working state */
  315|  25.1k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  25.1k|  br_state.cinfo = cinfop; \
  |  |  131|  25.1k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  25.1k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  25.1k|  get_buffer = permstate.get_buffer; \
  |  |  134|  25.1k|  bits_left = permstate.bits_left;
  ------------------
  316|  25.1k|    state = entropy->saved;
  317|       |
  318|       |    /* Outer loop handles each block in the MCU */
  319|       |
  320|  50.3k|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (320:20): [True: 25.1k, False: 25.1k]
  ------------------
  321|  25.1k|      block = MCU_data[blkn];
  322|  25.1k|      ci = cinfo->MCU_membership[blkn];
  323|  25.1k|      compptr = cinfo->cur_comp_info[ci];
  324|  25.1k|      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|  25.1k|      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
  ------------------
  |  |  200|  25.1k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  25.1k|  register int nb, look; \
  |  |  202|  25.1k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  25.1k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 2.58k, False: 22.5k]
  |  |  ------------------
  |  |  203|  2.58k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 2.58k]
  |  |  ------------------
  |  |  204|  2.58k|      { failaction; } \
  |  |  205|  2.58k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  2.58k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.58k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 76, False: 2.50k]
  |  |  ------------------
  |  |  207|     76|      nb = 1;  goto slowlabel; \
  |  |  208|     76|    } \
  |  |  209|  2.58k|  } \
  |  |  210|  25.1k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  25.0k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  25.0k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  25.0k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  25.0k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 24.9k, False: 115]
  |  |  ------------------
  |  |  212|  24.9k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  24.9k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  24.9k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  24.9k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  24.9k|  } else { \
  |  |  215|    186|slowlabel: \
  |  |  216|    186|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 186]
  |  |  ------------------
  |  |  217|    186|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|    186|      { failaction; } \
  |  |  219|    186|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|    186|  } \
  |  |  221|  25.0k|}
  ------------------
  330|  25.1k|      if (s) {
  ------------------
  |  Branch (330:11): [True: 21.4k, False: 3.73k]
  ------------------
  331|  21.4k|        CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  21.4k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  21.4k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 361, False: 21.0k]
  |  |  ------------------
  |  |  162|    361|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 361]
  |  |  ------------------
  |  |  163|    361|      { action; } \
  |  |  164|    361|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    361|  } \
  |  |  166|  21.4k|}
  ------------------
  332|  21.4k|        r = GET_BITS(s);
  ------------------
  |  |  169|  21.4k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  333|  21.4k|        s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|  21.4k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|  13.5k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 13.5k, False: 7.92k]
  |  |  ------------------
  ------------------
  334|  21.4k|      }
  335|       |
  336|       |      /* Convert DC difference to actual value, update last_dc_val */
  337|  25.1k|      if ((state.last_dc_val[ci] >= 0 &&
  ------------------
  |  Branch (337:12): [True: 6.96k, False: 18.1k]
  ------------------
  338|  6.96k|           s > INT_MAX - state.last_dc_val[ci]) ||
  ------------------
  |  Branch (338:12): [True: 0, False: 6.96k]
  ------------------
  339|  25.0k|          (state.last_dc_val[ci] < 0 && s < INT_MIN - state.last_dc_val[ci]))
  ------------------
  |  Branch (339:12): [True: 18.1k, False: 6.96k]
  |  Branch (339:41): [True: 0, False: 18.1k]
  ------------------
  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|  25.1k|      s += state.last_dc_val[ci];
  342|  25.1k|      state.last_dc_val[ci] = s;
  343|       |      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
  344|  25.1k|      (*block)[0] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|  25.1k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  345|  25.1k|    }
  346|       |
  347|       |    /* Completed MCU, so update state */
  348|  25.1k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  25.1k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  25.1k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  25.1k|  permstate.get_buffer = get_buffer; \
  |  |  140|  25.1k|  permstate.bits_left = bits_left
  ------------------
  349|  25.1k|    entropy->saved = state;
  350|  25.1k|  }
  351|       |
  352|       |  /* Account for restart interval (no-op if not using restarts) */
  353|  25.1k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (353:7): [True: 0, False: 25.1k]
  ------------------
  354|      0|    entropy->restarts_to_go--;
  355|       |
  356|  25.1k|  return TRUE;
  ------------------
  |  |  210|  25.1k|#define TRUE    1
  ------------------
  357|  25.1k|}

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

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

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

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

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

jinit_memory_mgr:
 1196|  2.66k|{
 1197|  2.66k|  my_mem_ptr mem;
 1198|  2.66k|  long max_to_use;
 1199|  2.66k|  int pool;
 1200|  2.66k|  size_t test_mac;
 1201|       |
 1202|  2.66k|  cinfo->mem = NULL;            /* for safety if init fails */
 1203|       |
 1204|       |  /* Check for configuration errors.
 1205|       |   * sizeof(ALIGN_TYPE) should be a power of 2; otherwise, it probably
 1206|       |   * doesn't reflect any real hardware alignment requirement.
 1207|       |   * The test is a little tricky: for X>0, X and X-1 have no one-bits
 1208|       |   * in common if and only if X is a power of 2, ie has only one one-bit.
 1209|       |   * Some compilers may give an "unreachable code" warning here; ignore it.
 1210|       |   */
 1211|  2.66k|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  2.66k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  2.66k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1211:7): [Folded, False: 2.66k]
  ------------------
 1212|      0|    ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1213|       |  /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be
 1214|       |   * a multiple of ALIGN_SIZE.
 1215|       |   * Again, an "unreachable code" warning may be ignored here.
 1216|       |   * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK.
 1217|       |   */
 1218|  2.66k|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  2.66k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1219|  2.66k|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|  5.32k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1219:7): [True: 0, False: 2.66k]
  ------------------
 1220|  2.66k|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|  2.66k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  2.66k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1220:7): [Folded, False: 0]
  ------------------
 1221|      0|    ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1222|       |
 1223|  2.66k|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1224|       |
 1225|       |  /* Attempt to allocate memory manager's control block */
 1226|  2.66k|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1227|       |
 1228|  2.66k|  if (mem == NULL) {
  ------------------
  |  Branch (1228:7): [True: 0, False: 2.66k]
  ------------------
 1229|      0|    jpeg_mem_term(cinfo);       /* system-dependent cleanup */
 1230|      0|    ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 0);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1231|      0|  }
 1232|       |
 1233|       |  /* OK, fill in the method pointers */
 1234|  2.66k|  mem->pub.alloc_small = alloc_small;
 1235|  2.66k|  mem->pub.alloc_large = alloc_large;
 1236|  2.66k|  mem->pub.alloc_sarray = alloc_sarray;
 1237|  2.66k|  mem->pub.alloc_barray = alloc_barray;
 1238|  2.66k|  mem->pub.request_virt_sarray = request_virt_sarray;
 1239|  2.66k|  mem->pub.request_virt_barray = request_virt_barray;
 1240|  2.66k|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1241|  2.66k|  mem->pub.access_virt_sarray = access_virt_sarray;
 1242|  2.66k|  mem->pub.access_virt_barray = access_virt_barray;
 1243|  2.66k|  mem->pub.free_pool = free_pool;
 1244|  2.66k|  mem->pub.self_destruct = self_destruct;
 1245|       |
 1246|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1247|  2.66k|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  2.66k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1248|       |
 1249|       |  /* Initialize working state */
 1250|  2.66k|  mem->pub.max_memory_to_use = max_to_use;
 1251|       |
 1252|  7.98k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  2.66k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  7.98k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1252:35): [True: 5.32k, False: 2.66k]
  ------------------
 1253|  5.32k|    mem->small_list[pool] = NULL;
 1254|  5.32k|    mem->large_list[pool] = NULL;
 1255|  5.32k|  }
 1256|  2.66k|  mem->virt_sarray_list = NULL;
 1257|  2.66k|  mem->virt_barray_list = NULL;
 1258|       |
 1259|  2.66k|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1260|       |
 1261|       |  /* Declare ourselves open for business */
 1262|  2.66k|  cinfo->mem = &mem->pub;
 1263|       |
 1264|       |  /* Check for an environment variable JPEGMEM; if found, override the
 1265|       |   * default max_memory setting from jpeg_mem_init.  Note that the
 1266|       |   * surrounding application may again override this value.
 1267|       |   * If your system doesn't support getenv(), define NO_GETENV to disable
 1268|       |   * this feature.
 1269|       |   */
 1270|  2.66k|#ifndef NO_GETENV
 1271|  2.66k|  {
 1272|  2.66k|    char memenv[30] = { 0 };
 1273|       |
 1274|  2.66k|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1274:9): [True: 2.66k, False: 0]
  |  Branch (1274:45): [True: 0, False: 2.66k]
  ------------------
 1275|      0|      char ch = 'x';
 1276|       |
 1277|       |#ifdef _MSC_VER
 1278|       |      if (sscanf_s(memenv, "%ld%c", &max_to_use, &ch, 1) > 0) {
 1279|       |#else
 1280|      0|      if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) {
  ------------------
  |  Branch (1280:11): [True: 0, False: 0]
  ------------------
 1281|      0|#endif
 1282|      0|        if (ch == 'm' || ch == 'M')
  ------------------
  |  Branch (1282:13): [True: 0, False: 0]
  |  Branch (1282:26): [True: 0, False: 0]
  ------------------
 1283|      0|          max_to_use *= 1000L;
 1284|      0|        mem->pub.max_memory_to_use = max_to_use * 1000L;
 1285|      0|      }
 1286|      0|    }
 1287|  2.66k|  }
 1288|  2.66k|#endif
 1289|       |
 1290|  2.66k|}
jmemmgr.c:alloc_small:
  269|  55.2k|{
  270|  55.2k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  271|  55.2k|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  272|  55.2k|  char *data_ptr;
  273|  55.2k|  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|  55.2k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  55.2k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (281:7): [True: 0, False: 55.2k]
  ------------------
  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|  55.2k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  55.2k|#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|  55.2k|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  55.2k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (289:7): [True: 0, False: 55.2k]
  ------------------
  290|  55.2k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  55.2k|#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|  55.2k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  55.2k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (294:7): [True: 0, False: 55.2k]
  |  Branch (294:22): [True: 0, False: 55.2k]
  ------------------
  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|  55.2k|  prev_hdr_ptr = NULL;
  297|  55.2k|  hdr_ptr = mem->small_list[pool_id];
  298|  56.3k|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (298:10): [True: 50.6k, False: 5.66k]
  ------------------
  299|  50.6k|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (299:9): [True: 49.6k, False: 1.02k]
  ------------------
  300|  49.6k|      break;                    /* found pool with enough space */
  301|  1.02k|    prev_hdr_ptr = hdr_ptr;
  302|  1.02k|    hdr_ptr = hdr_ptr->next;
  303|  1.02k|  }
  304|       |
  305|       |  /* Time to make a new pool? */
  306|  55.2k|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (306:7): [True: 5.66k, False: 49.6k]
  ------------------
  307|       |    /* min_request is what we need now, slop is what will be leftover */
  308|  5.66k|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  5.66k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  309|  5.66k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (309:9): [True: 4.88k, False: 783]
  ------------------
  310|  4.88k|      slop = first_pool_slop[pool_id];
  311|    783|    else
  312|    783|      slop = extra_pool_slop[pool_id];
  313|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  314|  5.66k|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|  5.66k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (314:9): [True: 0, False: 5.66k]
  ------------------
  315|      0|      slop = (size_t)(MAX_ALLOC_CHUNK - min_request);
  ------------------
  |  |   62|      0|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  316|       |    /* Try to get space, if fail reduce slop and try again */
  317|  5.66k|    for (;;) {
  318|  5.66k|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  319|  5.66k|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (319:11): [True: 5.66k, False: 0]
  ------------------
  320|  5.66k|        break;
  321|      0|      slop /= 2;
  322|      0|      if (slop < MIN_SLOP)      /* give up when it gets real small */
  ------------------
  |  |  263|      0|#define MIN_SLOP  50            /* greater than 0 to avoid futile looping */
  ------------------
  |  Branch (322:11): [True: 0, False: 0]
  ------------------
  323|      0|        out_of_memory(cinfo, 2); /* jpeg_get_small failed */
  324|      0|    }
  325|  5.66k|    mem->total_space_allocated += min_request + slop;
  326|       |    /* Success, initialize the new pool header and add to end of list */
  327|  5.66k|    hdr_ptr->next = NULL;
  328|  5.66k|    hdr_ptr->bytes_used = 0;
  329|  5.66k|    hdr_ptr->bytes_left = sizeofobject + slop;
  330|  5.66k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (330:9): [True: 4.88k, False: 783]
  ------------------
  331|  4.88k|      mem->small_list[pool_id] = hdr_ptr;
  332|    783|    else
  333|    783|      prev_hdr_ptr->next = hdr_ptr;
  334|  5.66k|  }
  335|       |
  336|       |  /* OK, allocate the object from the current pool */
  337|  55.2k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  338|  55.2k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  339|  55.2k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  55.2k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (339:7): [True: 55.2k, False: 0]
  ------------------
  340|  55.2k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  55.2k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  55.2k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  341|  55.2k|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  342|  55.2k|  hdr_ptr->bytes_used += sizeofobject;
  343|  55.2k|  hdr_ptr->bytes_left -= sizeofobject;
  344|       |
  345|  55.2k|  return (void *)data_ptr;
  346|  55.2k|}
jmemmgr.c:round_up_pow2:
   45|  67.7k|{
   46|  67.7k|  return ((a + b - 1) & (~(b - 1)));
   47|  67.7k|}
jmemmgr.c:alloc_large:
  366|  7.12k|{
  367|  7.12k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  368|  7.12k|  large_pool_ptr hdr_ptr;
  369|  7.12k|  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|  7.12k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  7.12k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (376:7): [True: 0, False: 7.12k]
  ------------------
  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|  7.12k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  7.12k|#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|  7.12k|  if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  7.12k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (384:7): [True: 0, False: 7.12k]
  ------------------
  385|  7.12k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  7.12k|#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|  7.12k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  7.12k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (389:7): [True: 0, False: 7.12k]
  |  Branch (389:22): [True: 0, False: 7.12k]
  ------------------
  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|  7.12k|  hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
  393|  7.12k|                                           sizeof(large_pool_hdr) +
  394|  7.12k|                                           ALIGN_SIZE - 1);
  ------------------
  |  |   89|  7.12k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  395|  7.12k|  if (hdr_ptr == NULL)
  ------------------
  |  Branch (395:7): [True: 0, False: 7.12k]
  ------------------
  396|      0|    out_of_memory(cinfo, 4);    /* jpeg_get_large failed */
  397|  7.12k|  mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
  398|  7.12k|                                ALIGN_SIZE - 1;
  ------------------
  |  |   89|  7.12k|#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|  7.12k|  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|  7.12k|  hdr_ptr->bytes_used = sizeofobject;
  406|  7.12k|  hdr_ptr->bytes_left = 0;
  407|  7.12k|  mem->large_list[pool_id] = hdr_ptr;
  408|       |
  409|  7.12k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  410|  7.12k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  411|  7.12k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  7.12k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (411:7): [True: 7.12k, False: 0]
  ------------------
  412|  7.12k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  7.12k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  7.12k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  413|       |
  414|  7.12k|  return (void *)data_ptr;
  415|  7.12k|}
jmemmgr.c:alloc_sarray:
  438|  5.33k|{
  439|  5.33k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  440|  5.33k|  JSAMPARRAY result;
  441|  5.33k|  JSAMPROW workspace;
  442|  5.33k|  JDIMENSION rowsperchunk, currow, i;
  443|  5.33k|  long ltemp;
  444|  5.33k|  J12SAMPARRAY result12;
  445|  5.33k|  J12SAMPROW workspace12;
  446|  5.33k|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  447|  5.33k|  J16SAMPARRAY result16;
  448|  5.33k|  J16SAMPROW workspace16;
  449|  5.33k|#endif
  450|  5.33k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (450:24): [True: 5.33k, False: 0]
  ------------------
  451|  5.33k|                        ((j_decompress_ptr)cinfo)->data_precision :
  452|  5.33k|                        ((j_compress_ptr)cinfo)->data_precision;
  453|  5.33k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (453:24): [True: 139, False: 5.19k]
  ------------------
  454|  5.19k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (454:45): [True: 301, False: 4.89k]
  ------------------
  455|    301|                                            sizeof(J12SAMPLE) :
  456|  5.19k|                                            sizeof(JSAMPLE));
  457|       |
  458|       |  /* Make sure each row is properly aligned */
  459|  5.33k|  if ((ALIGN_SIZE % sample_size) != 0)
  ------------------
  |  |   89|  5.33k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (459:7): [True: 0, False: 5.33k]
  ------------------
  460|      0|    out_of_memory(cinfo, 5);    /* safety check */
  461|       |
  462|  5.33k|  if (samplesperrow == 0 || samplesperrow > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  5.33k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (462:7): [True: 0, False: 5.33k]
  |  Branch (462:29): [True: 0, False: 5.33k]
  ------------------
  463|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  464|       |       is close to SIZE_MAX. */
  465|      0|    out_of_memory(cinfo, 9);
  466|      0|  }
  467|  5.33k|  samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) /
  ------------------
  |  |   89|  5.33k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  468|  5.33k|                                                           sample_size);
  469|       |
  470|       |  /* Calculate max # of rows allowed in one allocation chunk */
  471|  5.33k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  5.33k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  472|  5.33k|          ((long)samplesperrow * (long)sample_size);
  473|  5.33k|  if (ltemp <= 0)
  ------------------
  |  Branch (473:7): [True: 0, False: 5.33k]
  ------------------
  474|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  475|  5.33k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (475:7): [True: 0, False: 5.33k]
  ------------------
  476|      0|    rowsperchunk = (JDIMENSION)ltemp;
  477|  5.33k|  else
  478|  5.33k|    rowsperchunk = numrows;
  479|  5.33k|  mem->last_rowsperchunk = rowsperchunk;
  480|       |
  481|  5.33k|  if (data_precision <= 8) {
  ------------------
  |  Branch (481:7): [True: 4.89k, False: 440]
  ------------------
  482|       |    /* Get space for row pointers (small object) */
  483|  4.89k|    result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
  484|  4.89k|                                     (size_t)(numrows * sizeof(JSAMPROW)));
  485|       |
  486|       |    /* Get the rows themselves (large objects) */
  487|  4.89k|    currow = 0;
  488|  9.78k|    while (currow < numrows) {
  ------------------
  |  Branch (488:12): [True: 4.89k, False: 4.89k]
  ------------------
  489|  4.89k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|  4.89k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 4.89k]
  |  |  ------------------
  ------------------
  490|  4.89k|      workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
  491|  4.89k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  492|  41.8k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (492:30): [True: 36.9k, False: 4.89k]
  ------------------
  493|  36.9k|        result[currow++] = workspace;
  494|  36.9k|        workspace += samplesperrow;
  495|  36.9k|      }
  496|  4.89k|    }
  497|       |
  498|  4.89k|    return result;
  499|  4.89k|  } else if (data_precision <= 12) {
  ------------------
  |  Branch (499:14): [True: 301, False: 139]
  ------------------
  500|       |    /* Get space for row pointers (small object) */
  501|    301|    result12 = (J12SAMPARRAY)alloc_small(cinfo, pool_id,
  502|    301|                                         (size_t)(numrows *
  503|    301|                                                  sizeof(J12SAMPROW)));
  504|       |
  505|       |    /* Get the rows themselves (large objects) */
  506|    301|    currow = 0;
  507|    602|    while (currow < numrows) {
  ------------------
  |  Branch (507:12): [True: 301, False: 301]
  ------------------
  508|    301|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|    301|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 301]
  |  |  ------------------
  ------------------
  509|    301|      workspace12 = (J12SAMPROW)alloc_large(cinfo, pool_id,
  510|    301|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  511|  4.11k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (511:30): [True: 3.81k, False: 301]
  ------------------
  512|  3.81k|        result12[currow++] = workspace12;
  513|  3.81k|        workspace12 += samplesperrow;
  514|  3.81k|      }
  515|    301|    }
  516|       |
  517|    301|    return (JSAMPARRAY)result12;
  518|    301|  } else {
  519|    139|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  520|       |    /* Get space for row pointers (small object) */
  521|    139|    result16 = (J16SAMPARRAY)alloc_small(cinfo, pool_id,
  522|    139|                                         (size_t)(numrows *
  523|    139|                                                  sizeof(J16SAMPROW)));
  524|       |
  525|       |    /* Get the rows themselves (large objects) */
  526|    139|    currow = 0;
  527|    278|    while (currow < numrows) {
  ------------------
  |  Branch (527:12): [True: 139, False: 139]
  ------------------
  528|    139|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|    139|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 139]
  |  |  ------------------
  ------------------
  529|    139|      workspace16 = (J16SAMPROW)alloc_large(cinfo, pool_id,
  530|    139|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  531|  3.53k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (531:30): [True: 3.40k, False: 139]
  ------------------
  532|  3.40k|        result16[currow++] = workspace16;
  533|  3.40k|        workspace16 += samplesperrow;
  534|  3.40k|      }
  535|    139|    }
  536|       |
  537|    139|    return (JSAMPARRAY)result16;
  538|       |#else
  539|       |    ERREXIT1(cinfo, JERR_BAD_PRECISION, data_precision);
  540|       |    return NULL;
  541|       |#endif
  542|    139|  }
  543|  5.33k|}
jmemmgr.c:alloc_barray:
  555|  1.00k|{
  556|  1.00k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  557|  1.00k|  JBLOCKARRAY result;
  558|  1.00k|  JBLOCKROW workspace;
  559|  1.00k|  JDIMENSION rowsperchunk, currow, i;
  560|  1.00k|  long ltemp;
  561|       |
  562|       |  /* Make sure each row is properly aligned */
  563|  1.00k|  if (blocksperrow == 0 || (sizeof(JBLOCK) % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  1.00k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (563:7): [True: 0, False: 1.00k]
  |  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|  1.00k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  1.00k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  568|  1.00k|          ((long)blocksperrow * sizeof(JBLOCK));
  569|  1.00k|  if (ltemp <= 0)
  ------------------
  |  Branch (569:7): [True: 0, False: 1.00k]
  ------------------
  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|  1.00k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (571:7): [True: 0, False: 1.00k]
  ------------------
  572|      0|    rowsperchunk = (JDIMENSION)ltemp;
  573|  1.00k|  else
  574|  1.00k|    rowsperchunk = numrows;
  575|  1.00k|  mem->last_rowsperchunk = rowsperchunk;
  576|       |
  577|       |  /* Get space for row pointers (small object) */
  578|  1.00k|  result = (JBLOCKARRAY)alloc_small(cinfo, pool_id,
  579|  1.00k|                                    (size_t)(numrows * sizeof(JBLOCKROW)));
  580|       |
  581|       |  /* Get the rows themselves (large objects) */
  582|  1.00k|  currow = 0;
  583|  2.00k|  while (currow < numrows) {
  ------------------
  |  Branch (583:10): [True: 1.00k, False: 1.00k]
  ------------------
  584|  1.00k|    rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|  1.00k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 1.00k]
  |  |  ------------------
  ------------------
  585|  1.00k|    workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
  586|  1.00k|        (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
  587|  1.00k|                  sizeof(JBLOCK)));
  588|  74.4k|    for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (588:28): [True: 73.4k, False: 1.00k]
  ------------------
  589|  73.4k|      result[currow++] = workspace;
  590|  73.4k|      workspace += blocksperrow;
  591|  73.4k|    }
  592|  1.00k|  }
  593|       |
  594|  1.00k|  return result;
  595|  1.00k|}
jmemmgr.c:request_virt_sarray:
  640|     54|{
  641|     54|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  642|     54|  jvirt_sarray_ptr result;
  643|       |
  644|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  645|     54|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|     54|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (645:7): [True: 0, False: 54]
  ------------------
  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|     54|  result = (jvirt_sarray_ptr)alloc_small(cinfo, pool_id,
  650|     54|                                         sizeof(struct jvirt_sarray_control));
  651|       |
  652|     54|  result->mem_buffer = NULL;    /* marks array not yet realized */
  653|     54|  result->rows_in_array = numrows;
  654|     54|  result->samplesperrow = samplesperrow;
  655|     54|  result->maxaccess = maxaccess;
  656|     54|  result->pre_zero = pre_zero;
  657|     54|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|     54|#define FALSE   0               /* values of boolean */
  ------------------
  658|     54|  result->next = mem->virt_sarray_list; /* add to list of virtual arrays */
  659|     54|  mem->virt_sarray_list = result;
  660|       |
  661|     54|  return result;
  662|     54|}
jmemmgr.c:request_virt_barray:
  670|  1.00k|{
  671|  1.00k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  672|  1.00k|  jvirt_barray_ptr result;
  673|       |
  674|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  675|  1.00k|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|  1.00k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (675:7): [True: 0, False: 1.00k]
  ------------------
  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|  1.00k|  result = (jvirt_barray_ptr)alloc_small(cinfo, pool_id,
  680|  1.00k|                                         sizeof(struct jvirt_barray_control));
  681|       |
  682|  1.00k|  result->mem_buffer = NULL;    /* marks array not yet realized */
  683|  1.00k|  result->rows_in_array = numrows;
  684|  1.00k|  result->blocksperrow = blocksperrow;
  685|  1.00k|  result->maxaccess = maxaccess;
  686|  1.00k|  result->pre_zero = pre_zero;
  687|  1.00k|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|  1.00k|#define FALSE   0               /* values of boolean */
  ------------------
  688|  1.00k|  result->next = mem->virt_barray_list; /* add to list of virtual arrays */
  689|  1.00k|  mem->virt_barray_list = result;
  690|       |
  691|  1.00k|  return result;
  692|  1.00k|}
jmemmgr.c:realize_virt_arrays:
  698|  2.11k|{
  699|  2.11k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  700|  2.11k|  size_t space_per_minheight, maximum_space, avail_mem;
  701|  2.11k|  size_t minheights, max_minheights;
  702|  2.11k|  jvirt_sarray_ptr sptr;
  703|  2.11k|  jvirt_barray_ptr bptr;
  704|  2.11k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (704:24): [True: 2.11k, False: 0]
  ------------------
  705|  2.11k|                        ((j_decompress_ptr)cinfo)->data_precision :
  706|  2.11k|                        ((j_compress_ptr)cinfo)->data_precision;
  707|  2.11k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (707:24): [True: 14, False: 2.09k]
  ------------------
  708|  2.09k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (708:45): [True: 75, False: 2.02k]
  ------------------
  709|     75|                                            sizeof(J12SAMPLE) :
  710|  2.09k|                                            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|  2.11k|  space_per_minheight = 0;
  717|  2.11k|  maximum_space = 0;
  718|  2.16k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (718:38): [True: 54, False: 2.11k]
  ------------------
  719|     54|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (719:9): [True: 54, False: 0]
  ------------------
  720|     54|      size_t new_space = (size_t)sptr->rows_in_array *
  721|     54|                         (size_t)sptr->samplesperrow * sample_size;
  722|       |
  723|     54|      space_per_minheight += (size_t)sptr->maxaccess *
  724|     54|                             (size_t)sptr->samplesperrow * sample_size;
  725|     54|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (725:11): [True: 0, False: 54]
  ------------------
  726|      0|        out_of_memory(cinfo, 10);
  727|     54|      maximum_space += new_space;
  728|     54|    }
  729|     54|  }
  730|  3.11k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (730:38): [True: 1.00k, False: 2.11k]
  ------------------
  731|  1.00k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (731:9): [True: 1.00k, False: 0]
  ------------------
  732|  1.00k|      size_t new_space = (size_t)bptr->rows_in_array *
  733|  1.00k|                         (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  734|       |
  735|  1.00k|      space_per_minheight += (size_t)bptr->maxaccess *
  736|  1.00k|                             (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  737|  1.00k|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (737:11): [True: 0, False: 1.00k]
  ------------------
  738|      0|        out_of_memory(cinfo, 11);
  739|  1.00k|      maximum_space += new_space;
  740|  1.00k|    }
  741|  1.00k|  }
  742|       |
  743|  2.11k|  if (space_per_minheight <= 0)
  ------------------
  |  Branch (743:7): [True: 1.14k, False: 967]
  ------------------
  744|  1.14k|    return;                     /* no unrealized arrays, no work */
  745|       |
  746|       |  /* Determine amount of memory to actually use; this is system-dependent. */
  747|    967|  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
  748|    967|                                 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|    967|  if (avail_mem >= maximum_space)
  ------------------
  |  Branch (754:7): [True: 967, False: 0]
  ------------------
  755|    967|    max_minheights = 1000000000L;
  756|      0|  else {
  757|      0|    max_minheights = avail_mem / space_per_minheight;
  758|       |    /* If there doesn't seem to be enough space, try to get the minimum
  759|       |     * anyway.  This allows a "stub" implementation of jpeg_mem_available().
  760|       |     */
  761|      0|    if (max_minheights <= 0)
  ------------------
  |  Branch (761:9): [True: 0, False: 0]
  ------------------
  762|      0|      max_minheights = 1;
  763|      0|  }
  764|       |
  765|       |  /* Allocate the in-memory buffers and initialize backing store as needed. */
  766|       |
  767|  1.02k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (767:38): [True: 54, False: 967]
  ------------------
  768|     54|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (768:9): [True: 54, False: 0]
  ------------------
  769|     54|      minheights = ((long)sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
  770|     54|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (770:11): [True: 54, False: 0]
  ------------------
  771|       |        /* This buffer fits in memory */
  772|     54|        sptr->rows_in_mem = sptr->rows_in_array;
  773|     54|      } 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|     54|      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     54|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  783|     54|                                      sptr->samplesperrow, sptr->rows_in_mem);
  784|     54|      sptr->rowsperchunk = mem->last_rowsperchunk;
  785|     54|      sptr->cur_start_row = 0;
  786|     54|      sptr->first_undef_row = 0;
  787|     54|      sptr->dirty = FALSE;
  ------------------
  |  |  207|     54|#define FALSE   0               /* values of boolean */
  ------------------
  788|     54|    }
  789|     54|  }
  790|       |
  791|  1.96k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (791:38): [True: 1.00k, False: 967]
  ------------------
  792|  1.00k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (792:9): [True: 1.00k, False: 0]
  ------------------
  793|  1.00k|      minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
  794|  1.00k|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (794:11): [True: 1.00k, False: 0]
  ------------------
  795|       |        /* This buffer fits in memory */
  796|  1.00k|        bptr->rows_in_mem = bptr->rows_in_array;
  797|  1.00k|      } 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|  1.00k|      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.00k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  807|  1.00k|                                      bptr->blocksperrow, bptr->rows_in_mem);
  808|  1.00k|      bptr->rowsperchunk = mem->last_rowsperchunk;
  809|  1.00k|      bptr->cur_start_row = 0;
  810|  1.00k|      bptr->first_undef_row = 0;
  811|  1.00k|      bptr->dirty = FALSE;
  ------------------
  |  |  207|  1.00k|#define FALSE   0               /* values of boolean */
  ------------------
  812|  1.00k|    }
  813|  1.00k|  }
  814|    967|}
jmemmgr.c:access_virt_barray:
 1015|  61.6k|{
 1016|  61.6k|  JDIMENSION end_row = start_row + num_rows;
 1017|  61.6k|  JDIMENSION undef_row;
 1018|       |
 1019|       |  /* debugging check */
 1020|  61.6k|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (1020:7): [True: 0, False: 61.6k]
  |  Branch (1020:39): [True: 0, False: 61.6k]
  ------------------
 1021|  61.6k|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (1021:7): [True: 0, False: 61.6k]
  ------------------
 1022|      0|    ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1023|       |
 1024|       |  /* Make the desired part of the virtual array accessible */
 1025|  61.6k|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (1025:7): [True: 0, False: 61.6k]
  ------------------
 1026|  61.6k|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (1026:7): [True: 0, False: 61.6k]
  ------------------
 1027|      0|    if (!ptr->b_s_open)
  ------------------
  |  Branch (1027:9): [True: 0, False: 0]
  ------------------
 1028|      0|      ERREXIT(cinfo, JERR_VIRTUAL_BUG);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1029|       |    /* Flush old buffer contents if necessary */
 1030|      0|    if (ptr->dirty) {
  ------------------
  |  Branch (1030:9): [True: 0, False: 0]
  ------------------
 1031|      0|      do_barray_io(cinfo, ptr, TRUE);
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
 1032|      0|      ptr->dirty = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1033|      0|    }
 1034|       |    /* Decide what part of virtual array to access.
 1035|       |     * Algorithm: if target address > current window, assume forward scan,
 1036|       |     * load starting at target address.  If target address < current window,
 1037|       |     * assume backward scan, load so that target area is top of window.
 1038|       |     * Note that when switching from forward write to forward read, will have
 1039|       |     * start_row = 0, so the limiting case applies and we load from 0 anyway.
 1040|       |     */
 1041|      0|    if (start_row > ptr->cur_start_row) {
  ------------------
  |  Branch (1041:9): [True: 0, False: 0]
  ------------------
 1042|      0|      ptr->cur_start_row = start_row;
 1043|      0|    } else {
 1044|       |      /* use long arithmetic here to avoid overflow & unsigned problems */
 1045|      0|      long ltemp;
 1046|       |
 1047|      0|      ltemp = (long)end_row - (long)ptr->rows_in_mem;
 1048|      0|      if (ltemp < 0)
  ------------------
  |  Branch (1048:11): [True: 0, False: 0]
  ------------------
 1049|      0|        ltemp = 0;              /* don't fall off front end of file */
 1050|      0|      ptr->cur_start_row = (JDIMENSION)ltemp;
 1051|      0|    }
 1052|       |    /* Read in the selected part of the array.
 1053|       |     * During the initial write pass, we will do no actual read
 1054|       |     * because the selected part is all undefined.
 1055|       |     */
 1056|      0|    do_barray_io(cinfo, ptr, FALSE);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1057|      0|  }
 1058|       |  /* Ensure the accessed part of the array is defined; prezero if needed.
 1059|       |   * To improve locality of access, we only prezero the part of the array
 1060|       |   * that the caller is about to access, not the entire in-memory array.
 1061|       |   */
 1062|  61.6k|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (1062:7): [True: 22.1k, False: 39.5k]
  ------------------
 1063|  22.1k|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (1063:9): [True: 0, False: 22.1k]
  ------------------
 1064|      0|      if (writable)             /* writer skipped over a section of array */
  ------------------
  |  Branch (1064:11): [True: 0, False: 0]
  ------------------
 1065|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1066|      0|      undef_row = start_row;    /* but reader is allowed to read ahead */
 1067|  22.1k|    } else {
 1068|  22.1k|      undef_row = ptr->first_undef_row;
 1069|  22.1k|    }
 1070|  22.1k|    if (writable)
  ------------------
  |  Branch (1070:9): [True: 22.1k, False: 0]
  ------------------
 1071|  22.1k|      ptr->first_undef_row = end_row;
 1072|  22.1k|    if (ptr->pre_zero) {
  ------------------
  |  Branch (1072:9): [True: 22.1k, False: 0]
  ------------------
 1073|  22.1k|      size_t bytesperrow = (size_t)ptr->blocksperrow * sizeof(JBLOCK);
 1074|  22.1k|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
 1075|  22.1k|      end_row -= ptr->cur_start_row;
 1076|  66.7k|      while (undef_row < end_row) {
  ------------------
  |  Branch (1076:14): [True: 44.5k, False: 22.1k]
  ------------------
 1077|  44.5k|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
 1078|  44.5k|        undef_row++;
 1079|  44.5k|      }
 1080|  22.1k|    } 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|  22.1k|  }
 1085|       |  /* Flag the buffer dirty if caller will write in it */
 1086|  61.6k|  if (writable)
  ------------------
  |  Branch (1086:7): [True: 44.5k, False: 17.1k]
  ------------------
 1087|  44.5k|    ptr->dirty = TRUE;
  ------------------
  |  |  210|  44.5k|#define TRUE    1
  ------------------
 1088|       |  /* Return address of proper part of the buffer */
 1089|  61.6k|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1090|  61.6k|}
jmemmgr.c:free_pool:
 1099|  6.06k|{
 1100|  6.06k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
 1101|  6.06k|  small_pool_ptr shdr_ptr;
 1102|  6.06k|  large_pool_ptr lhdr_ptr;
 1103|  6.06k|  size_t space_freed;
 1104|       |
 1105|  6.06k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  6.06k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (1105:7): [True: 0, False: 6.06k]
  |  Branch (1105:22): [True: 0, False: 6.06k]
  ------------------
 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|  6.06k|  if (pool_id == JPOOL_IMAGE) {
  ------------------
  |  |  889|  6.06k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (1114:7): [True: 3.40k, False: 2.66k]
  ------------------
 1115|  3.40k|    jvirt_sarray_ptr sptr;
 1116|  3.40k|    jvirt_barray_ptr bptr;
 1117|       |
 1118|  3.45k|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1118:40): [True: 54, False: 3.40k]
  ------------------
 1119|     54|      if (sptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1119:11): [True: 0, False: 54]
  ------------------
 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|     54|    }
 1124|  3.40k|    mem->virt_sarray_list = NULL;
 1125|  4.40k|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1125:40): [True: 1.00k, False: 3.40k]
  ------------------
 1126|  1.00k|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1126:11): [True: 0, False: 1.00k]
  ------------------
 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|  1.00k|    }
 1131|  3.40k|    mem->virt_barray_list = NULL;
 1132|  3.40k|  }
 1133|       |
 1134|       |  /* Release large objects */
 1135|  6.06k|  lhdr_ptr = mem->large_list[pool_id];
 1136|  6.06k|  mem->large_list[pool_id] = NULL;
 1137|       |
 1138|  13.1k|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1138:10): [True: 7.12k, False: 6.06k]
  ------------------
 1139|  7.12k|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1140|  7.12k|    space_freed = lhdr_ptr->bytes_used +
 1141|  7.12k|                  lhdr_ptr->bytes_left +
 1142|  7.12k|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  7.12k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1143|  7.12k|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1144|  7.12k|    mem->total_space_allocated -= space_freed;
 1145|  7.12k|    lhdr_ptr = next_lhdr_ptr;
 1146|  7.12k|  }
 1147|       |
 1148|       |  /* Release small objects */
 1149|  6.06k|  shdr_ptr = mem->small_list[pool_id];
 1150|  6.06k|  mem->small_list[pool_id] = NULL;
 1151|       |
 1152|  11.7k|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1152:10): [True: 5.66k, False: 6.06k]
  ------------------
 1153|  5.66k|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1154|  5.66k|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1155|  5.66k|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  5.66k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1156|  5.66k|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1157|  5.66k|    mem->total_space_allocated -= space_freed;
 1158|  5.66k|    shdr_ptr = next_shdr_ptr;
 1159|  5.66k|  }
 1160|  6.06k|}
jmemmgr.c:self_destruct:
 1170|  2.66k|{
 1171|  2.66k|  int pool;
 1172|       |
 1173|       |  /* Close all backing store, release all memory.
 1174|       |   * Releasing pools in reverse order might help avoid fragmentation
 1175|       |   * with some (brain-damaged) malloc libraries.
 1176|       |   */
 1177|  7.98k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  2.66k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  7.98k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1177:35): [True: 5.32k, False: 2.66k]
  ------------------
 1178|  5.32k|    free_pool(cinfo, pool);
 1179|  5.32k|  }
 1180|       |
 1181|       |  /* Release the memory manager control block too. */
 1182|  2.66k|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1183|  2.66k|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1184|       |
 1185|  2.66k|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1186|  2.66k|}

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

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

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

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

_ZN11InputSourceC2Ev:
   35|   142k|    InputSource() = default;
_ZN11InputSourceD2Ev:
   37|   142k|    virtual ~InputSource() = default;
_ZN11InputSource6FinderC2Ev:
   43|   124k|        Finder() = default;
_ZN11InputSource6FinderD2Ev:
   45|  47.2k|        virtual ~Finder() = default;

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

_ZN4qpdf10BaseHandleD2Ev:
  131|  44.1M|        ~BaseHandle() = default;
_ZN4qpdf10BaseHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  120|  7.30M|            obj(obj) {};
_ZN4qpdf10BaseHandleC2ERKS0_:
  123|  12.4M|        BaseHandle(BaseHandle const&) = default;
_ZNK4qpdf10BaseHandleeqERKS0_:
   67|   102k|        {
   68|   102k|            return obj == other.obj;
   69|   102k|        }
_ZNK4qpdf10BaseHandle5emptyEv:
   82|  5.30k|        {
   83|  5.30k|            return size() == 0;
   84|  5.30k|        }
_ZN4qpdf10BaseHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
  122|  9.73M|            obj(std::move(obj)) {};
_ZN4qpdf10BaseHandleC2Ev:
  118|  1.64M|        BaseHandle() = default;
_ZN4qpdf10BaseHandleaSEOS0_:
  126|   860k|        BaseHandle& operator=(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleC2EOS0_:
  125|  10.0M|        BaseHandle(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleaSERKS0_:
  124|   700k|        BaseHandle& operator=(BaseHandle const&) = default;

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

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

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

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

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

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

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

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

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

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

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

_ZN10QPDFObjGenC2Eii:
   40|  1.67M|        obj(obj),
   41|  1.67M|        gen(gen)
   42|  1.67M|    {
   43|  1.67M|    }
_ZNK10QPDFObjGenltERKS_:
   46|  64.7M|    {
   47|  64.7M|        return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen);
  ------------------
  |  Branch (47:16): [True: 35.8M, False: 28.8M]
  |  Branch (47:36): [True: 8.48M, False: 20.4M]
  |  Branch (47:54): [True: 108k, False: 8.37M]
  ------------------
   48|  64.7M|    }
_ZNK10QPDFObjGeneqERKS_:
   51|   268k|    {
   52|   268k|        return obj == rhs.obj && gen == rhs.gen;
  ------------------
  |  Branch (52:16): [True: 262k, False: 5.87k]
  |  Branch (52:34): [True: 262k, False: 118]
  ------------------
   53|   268k|    }
_ZNK10QPDFObjGenneERKS_:
   56|   248k|    {
   57|   248k|        return !(*this == rhs);
   58|   248k|    }
_ZNK10QPDFObjGen6getObjEv:
   61|  1.58M|    {
   62|  1.58M|        return obj;
   63|  1.58M|    }
_ZNK10QPDFObjGen6getGenEv:
   66|  4.12k|    {
   67|  4.12k|        return gen;
   68|  4.12k|    }
_ZNK10QPDFObjGen10isIndirectEv:
   71|  6.67M|    {
   72|  6.67M|        return obj != 0;
   73|  6.67M|    }
_ZNK10QPDFObjGen7unparseEc:
   76|   594k|    {
   77|   594k|        return std::to_string(obj) + separator + std::to_string(gen);
   78|   594k|    }
_ZN10QPDFObjGen3set3addES_:
  111|   333k|        {
  112|   333k|            if (og.isIndirect()) {
  ------------------
  |  Branch (112:17): [True: 216k, False: 117k]
  ------------------
  113|   216k|                if (count(og)) {
  ------------------
  |  Branch (113:21): [True: 11.7k, False: 204k]
  ------------------
  114|  11.7k|                    return false;
  115|  11.7k|                }
  116|   204k|                emplace(og);
  117|   204k|            }
  118|   322k|            return true;
  119|   333k|        }
_ZN10QPDFObjGenC2Ev:
   38|  17.1M|    QPDFObjGen() = default;

_ZN16QPDFObjectHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
 1315|  6.06M|        qpdf::BaseHandle(obj)
 1316|  6.06M|    {
 1317|  6.06M|    }
_ZN16QPDFObjectHandleC2ERKS_:
  290|  12.0M|    QPDFObjectHandle(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilter16PipelineAccessor11setPipelineEPS0_P8Pipeline:
  176|  53.2k|            {
  177|  53.2k|                f->setPipeline(p);
  178|  53.2k|            }
_ZN16QPDFObjectHandle9RectangleC2Ev:
  236|  1.78k|            llx(0.0),
  237|  1.78k|            lly(0.0),
  238|  1.78k|            urx(0.0),
  239|  1.78k|            ury(0.0)
  240|  1.78k|        {
  241|  1.78k|        }
_ZN16QPDFObjectHandle9RectangleC2Edddd:
  243|  69.9k|            llx(llx),
  244|  69.9k|            lly(lly),
  245|  69.9k|            urx(urx),
  246|  69.9k|            ury(ury)
  247|  69.9k|        {
  248|  69.9k|        }
_ZN16QPDFObjectHandle6MatrixC2Edddddd:
  272|    356|            a(a),
  273|    356|            b(b),
  274|    356|            c(c),
  275|    356|            d(d),
  276|    356|            e(e),
  277|    356|            f(f)
  278|    356|        {
  279|    356|        }
_ZN16QPDFObjectHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
 1319|  9.01M|        qpdf::BaseHandle(std::move(obj))
 1320|  9.01M|    {
 1321|  9.01M|    }
_ZN16QPDFObjectHandle6getObjEv:
 1324|   247k|    {
 1325|   247k|        return obj;
 1326|   247k|    }
_ZNK16QPDFObjectHandle14QPDFArrayItems8iteratorneERKS1_:
 1518|   292k|        {
 1519|   292k|            return !operator==(other);
 1520|   292k|        }
_ZNK4qpdf10BaseHandlecvbEv:
 1559|  15.1M|    {
 1560|  15.1M|        return static_cast<bool>(obj);
 1561|  15.1M|    }
_ZNK4qpdf10BaseHandlecv16QPDFObjectHandleEv:
 1565|   368k|    {
 1566|   368k|        return {obj};
 1567|   368k|    }
_ZN16QPDFObjectHandleC2Ev:
  289|  1.61M|    QPDFObjectHandle() = default;
_ZN16QPDFObjectHandleaSEOS_:
  293|   792k|    QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleC2EOS_:
  292|  10.0M|    QPDFObjectHandle(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorD2Ev:
 1491|  8.54k|        virtual ~iterator() = default;
_ZN16QPDFObjectHandleaSERKS_:
  291|   662k|    QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilterC2Ev:
  163|  89.8k|        TokenFilter() = default;
_ZN16QPDFObjectHandle11TokenFilterD2Ev:
  164|  26.8k|        virtual ~TokenFilter() = default;

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

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

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

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

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

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

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

_ZN13QPDFTokenizer5TokenC2Ev:
   71|  7.53M|            type(tt_bad)
   72|  7.53M|        {
   73|  7.53M|        }
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES8_S8_:
   81|  7.53M|            type(type),
   82|  7.53M|            value(value),
   83|  7.53M|            raw_value(raw_value),
   84|  7.53M|            error_message(error_message)
   85|  7.53M|        {
   86|  7.53M|        }
_ZNK13QPDFTokenizer5Token7getTypeEv:
   89|  13.9M|        {
   90|  13.9M|            return this->type;
   91|  13.9M|        }
_ZNK13QPDFTokenizer5Token8getValueEv:
   94|  6.71M|        {
   95|  6.71M|            return this->value;
   96|  6.71M|        }
_ZNK13QPDFTokenizer5Token11getRawValueEv:
   99|  1.97M|        {
  100|  1.97M|            return this->raw_value;
  101|  1.97M|        }
_ZNK13QPDFTokenizer5Token9isIntegerEv:
  116|  3.27M|        {
  117|  3.27M|            return this->type == tt_integer;
  118|  3.27M|        }
_ZNK13QPDFTokenizer5Token6isWordERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  126|  8.62M|        {
  127|  8.62M|            return this->type == tt_word && this->value == value;
  ------------------
  |  Branch (127:20): [True: 3.24M, False: 5.38M]
  |  Branch (127:45): [True: 833k, False: 2.40M]
  ------------------
  128|  8.62M|        }

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

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

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

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

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

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

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

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

_ZN17BufferInputSourceC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEP6Bufferb:
   16|  27.1k|    own_memory(own_memory),
   17|  27.1k|    description(description),
   18|  27.1k|    buf(buf),
   19|  27.1k|    cur_offset(0),
   20|  27.1k|    max_offset(buf ? QIntC::to_offset(buf->getSize()) : 0)
  ------------------
  |  Branch (20:16): [True: 27.1k, False: 0]
  ------------------
   21|  27.1k|{
   22|  27.1k|}
_ZN17BufferInputSourceD2Ev:
   35|  27.1k|{
   36|  27.1k|    if (own_memory) {
  ------------------
  |  Branch (36:9): [True: 0, False: 27.1k]
  ------------------
   37|      0|        delete buf;
   38|      0|    }
   39|  27.1k|}
_ZN17BufferInputSource18findAndSkipNextEOLEv:
   43|  2.16M|{
   44|  2.16M|    util::internal_error_if(cur_offset < 0, "BufferInputSource offset < 0");
   45|  2.16M|    qpdf_offset_t end_pos = max_offset;
   46|  2.16M|    if (cur_offset >= end_pos) {
  ------------------
  |  Branch (46:9): [True: 7.80k, False: 2.15M]
  ------------------
   47|  7.80k|        last_offset = end_pos;
   48|  7.80k|        cur_offset = end_pos;
   49|  7.80k|        return end_pos;
   50|  7.80k|    }
   51|       |
   52|  2.15M|    qpdf_offset_t result = 0;
   53|  2.15M|    unsigned char const* buffer = buf->getBuffer();
   54|  2.15M|    unsigned char const* end = buffer + end_pos;
   55|  2.15M|    unsigned char const* p = buffer + cur_offset;
   56|       |
   57|   244M|    while ((p < end) && !((*p == '\r') || (*p == '\n'))) {
  ------------------
  |  Branch (57:12): [True: 244M, False: 17.6k]
  |  Branch (57:27): [True: 477k, False: 243M]
  |  Branch (57:43): [True: 1.66M, False: 242M]
  ------------------
   58|   242M|        ++p;
   59|   242M|    }
   60|  2.15M|    if (p < end) {
  ------------------
  |  Branch (60:9): [True: 2.13M, False: 17.6k]
  ------------------
   61|  2.13M|        result = p - buffer;
   62|  2.13M|        cur_offset = result + 1;
   63|  2.13M|        ++p;
   64|  2.40M|        while ((cur_offset < end_pos) && ((*p == '\r') || (*p == '\n'))) {
  ------------------
  |  Branch (64:16): [True: 2.40M, False: 2.89k]
  |  Branch (64:43): [True: 14.4k, False: 2.38M]
  |  Branch (64:59): [True: 252k, False: 2.13M]
  ------------------
   65|   267k|            ++p;
   66|   267k|            ++cur_offset;
   67|   267k|        }
   68|  2.13M|    } else {
   69|  17.6k|        cur_offset = end_pos;
   70|  17.6k|        result = end_pos;
   71|  17.6k|    }
   72|  2.15M|    return result;
   73|  2.16M|}
_ZNK17BufferInputSource7getNameEv:
   77|  1.18M|{
   78|  1.18M|    return description;
   79|  1.18M|}
_ZN17BufferInputSource4tellEv:
   83|  23.7M|{
   84|  23.7M|    return cur_offset;
   85|  23.7M|}
_ZN17BufferInputSource4seekExi:
   89|  16.0M|{
   90|  16.0M|    switch (whence) {
   91|  15.8M|    case SEEK_SET:
  ------------------
  |  Branch (91:5): [True: 15.8M, False: 203k]
  ------------------
   92|  15.8M|        cur_offset = offset;
   93|  15.8M|        break;
   94|       |
   95|  53.9k|    case SEEK_END:
  ------------------
  |  Branch (95:5): [True: 53.9k, False: 15.9M]
  ------------------
   96|  53.9k|        QIntC::range_check(max_offset, offset);
   97|  53.9k|        cur_offset = max_offset + offset;
   98|  53.9k|        break;
   99|       |
  100|   149k|    default:
  ------------------
  |  Branch (100:5): [True: 149k, False: 15.8M]
  ------------------
  101|   149k|        util::assertion(whence == SEEK_CUR, "invalid argument to BufferInputSource::seek");
  102|   149k|        QIntC::range_check(cur_offset, offset);
  103|   149k|        cur_offset += offset;
  104|  16.0M|    }
  105|       |
  106|  16.0M|    if (cur_offset < 0) {
  ------------------
  |  Branch (106:9): [True: 449, False: 16.0M]
  ------------------
  107|    449|        throw std::runtime_error(description + ": seek before beginning of buffer");
  108|    449|    }
  109|  16.0M|}
_ZN17BufferInputSource4readEPcm:
  119|  3.19M|{
  120|  3.19M|    util::internal_error_if(cur_offset < 0, "BufferInputSource offset < 0");
  121|  3.19M|    qpdf_offset_t end_pos = max_offset;
  122|  3.19M|    if (cur_offset >= end_pos) {
  ------------------
  |  Branch (122:9): [True: 81.2k, False: 3.11M]
  ------------------
  123|  81.2k|        last_offset = end_pos;
  124|  81.2k|        return 0;
  125|  81.2k|    }
  126|       |
  127|  3.11M|    last_offset = cur_offset;
  128|  3.11M|    size_t len = std::min(QIntC::to_size(end_pos - cur_offset), length);
  129|  3.11M|    memcpy(buffer, buf->getBuffer() + cur_offset, len);
  130|  3.11M|    cur_offset += QIntC::to_offset(len);
  131|  3.11M|    return len;
  132|  3.19M|}
_ZN17BufferInputSource8unreadChEc:
  136|  18.4k|{
  137|  18.4k|    if (cur_offset > 0) {
  ------------------
  |  Branch (137:9): [True: 18.4k, False: 0]
  ------------------
  138|  18.4k|        --cur_offset;
  139|  18.4k|    }
  140|  18.4k|}
_ZN4qpdf2is12OffsetBuffer4seekExi:
  258|  25.6M|{
  259|  25.6M|    switch (whence) {
  260|  25.6M|    case SEEK_SET:
  ------------------
  |  Branch (260:5): [True: 25.6M, False: 0]
  ------------------
  261|  25.6M|        pos = offset - global_offset;
  262|  25.6M|        break;
  263|       |
  264|      0|    case SEEK_END:
  ------------------
  |  Branch (264:5): [True: 0, False: 25.6M]
  ------------------
  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.6M]
  ------------------
  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.6M|    }
  274|       |
  275|  25.6M|    if (pos < 0) {
  ------------------
  |  Branch (275:9): [True: 0, False: 25.6M]
  ------------------
  276|      0|        throw std::runtime_error(description + ": seek before beginning of buffer");
  277|      0|    }
  278|  25.6M|}
_ZN4qpdf2is12OffsetBuffer4readEPcm:
  282|  5.21M|{
  283|  5.21M|    util::internal_error_if(pos < 0, "is::OffsetBuffer offset < 0");
  284|  5.21M|    auto end_pos = static_cast<qpdf_offset_t>(view_.size());
  285|  5.21M|    if (pos >= end_pos) {
  ------------------
  |  Branch (285:9): [True: 84.3k, False: 5.12M]
  ------------------
  286|  84.3k|        last_offset = end_pos + global_offset;
  287|  84.3k|        return 0;
  288|  84.3k|    }
  289|       |
  290|  5.12M|    last_offset = pos + global_offset;
  291|  5.12M|    size_t len = std::min(QIntC::to_size(end_pos - pos), length);
  292|  5.12M|    memcpy(buffer, view_.data() + pos, len);
  293|  5.12M|    pos += QIntC::to_offset(len);
  294|  5.12M|    return len;
  295|  5.21M|}

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

_ZN11InputSource13setLastOffsetEx:
   15|  28.7M|{
   16|  28.7M|    this->last_offset = offset;
   17|  28.7M|}
_ZNK11InputSource13getLastOffsetEv:
   21|  12.9M|{
   22|  12.9M|    return this->last_offset;
   23|  12.9M|}
_ZN11InputSource9read_lineERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   27|  13.9k|{
   28|       |    // Return at most max_line_length characters from the next line. Lines are terminated by one or
   29|       |    // more \r or \n characters. Consume the trailing newline characters but don't return them.
   30|       |    // After this is called, the file will be positioned after a line terminator or at the end of
   31|       |    // the file, and last_offset will point to position the file had when this method was called.
   32|       |
   33|  13.9k|    read(str, count, at);
   34|  13.9k|    auto eol = str.find_first_of("\n\r"sv);
   35|  13.9k|    if (eol != std::string::npos) {
  ------------------
  |  Branch (35:9): [True: 11.7k, False: 2.28k]
  ------------------
   36|  11.7k|        auto next_line = str.find_first_not_of("\n\r"sv, eol);
   37|  11.7k|        str.resize(eol);
   38|  11.7k|        if (eol != std::string::npos) {
  ------------------
  |  Branch (38:13): [True: 11.7k, False: 0]
  ------------------
   39|  11.7k|            seek(last_offset + static_cast<qpdf_offset_t>(next_line), SEEK_SET);
   40|  11.7k|            return eol;
   41|  11.7k|        }
   42|  11.7k|    }
   43|       |    // We did not necessarily find the end of the trailing newline sequence.
   44|  2.28k|    seek(last_offset, SEEK_SET);
   45|  2.28k|    findAndSkipNextEOL();
   46|  2.28k|    return eol;
   47|  13.9k|}
_ZN11InputSource8readLineEm:
   51|  13.9k|{
   52|  13.9k|    return read_line(max_line_length);
   53|  13.9k|}
_ZN11InputSource9findFirstEPKcxmRNS_6FinderE:
   65|   129k|{
   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|   129k|    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|   129k|    size_t size = sizeof(buf) - 1;
   79|   129k|    util::assertion(
   80|   129k|        !(strlen(start_chars) < 1 || strlen(start_chars) > size),
  ------------------
  |  Branch (80:11): [True: 0, False: 129k]
  |  Branch (80:38): [True: 0, False: 129k]
  ------------------
   81|   129k|        "InputSource::findSource called with too small or too large of a character sequence" //
   82|   129k|    );
   83|       |
   84|   129k|    char* p = nullptr;
   85|   129k|    qpdf_offset_t buf_offset = offset;
   86|   129k|    size_t bytes_read = 0;
   87|       |
   88|       |    // Guarantee that we return from this loop. Each time through, we either return, advance p, or
   89|       |    // restart the loop with a condition that will cause return on the next pass. Eventually we will
   90|       |    // either be out of range or hit EOF, either of which forces us to return.
   91|  5.22M|    while (true) {
  ------------------
  |  Branch (91:12): [True: 5.22M, Folded]
  ------------------
   92|       |        // Do we need to read more data? Pretend size = 5, buf starts at 0, and start_chars has 3
   93|       |        // characters. buf[5] is valid and null. If p == 2, start_chars could be buf[2] through
   94|       |        // buf[4], so p + strlen(start_chars) == buf + size is okay. If p points to buf[size], since
   95|       |        // strlen(start_chars) is always >= 1, this overflow test will be correct for that case
   96|       |        // regardless of start_chars.
   97|  5.22M|        if ((p == nullptr) || ((p + strlen(start_chars)) > (buf + bytes_read))) {
  ------------------
  |  Branch (97:13): [True: 129k, False: 5.09M]
  |  Branch (97:31): [True: 301k, False: 4.79M]
  ------------------
   98|   431k|            if (p) {
  ------------------
  |  Branch (98:17): [True: 301k, False: 129k]
  ------------------
   99|   301k|                QTC::TC(
  100|   301k|                    "libtests", "InputSource read next block", ((p == buf + bytes_read) ? 0 : 1));
  ------------------
  |  Branch (100:65): [True: 287k, False: 13.4k]
  ------------------
  101|   301k|                buf_offset += (p - buf);
  102|   301k|            }
  103|   431k|            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|   431k|            bytes_read = this->read(buf, size);
  108|   431k|            if (bytes_read < strlen(start_chars)) {
  ------------------
  |  Branch (108:17): [True: 50.5k, False: 380k]
  ------------------
  109|  50.5k|                QTC::TC("libtests", "InputSource find EOF", bytes_read == 0 ? 0 : 1);
  ------------------
  |  Branch (109:61): [True: 43.8k, False: 6.74k]
  ------------------
  110|  50.5k|                return false;
  111|  50.5k|            }
  112|   380k|            memset(buf + bytes_read, '\0', 1 + (size - bytes_read));
  113|   380k|            p = buf;
  114|   380k|        }
  115|       |
  116|       |        // Search for the first character.
  117|  5.17M|        if ((p = static_cast<char*>(
  ------------------
  |  Branch (117:13): [True: 4.88M, False: 287k]
  ------------------
  118|       |                 // line-break
  119|  5.17M|                 memchr(p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) != nullptr) {
  120|  4.88M|            if (p == buf) {
  ------------------
  |  Branch (120:17): [True: 14.2k, False: 4.87M]
  ------------------
  121|  14.2k|                QTC::TC("libtests", "InputSource found match at buf[0]");
  122|  14.2k|            }
  123|       |            // Found first letter.
  124|  4.88M|            if (len != 0) {
  ------------------
  |  Branch (124:17): [True: 32.0k, False: 4.85M]
  ------------------
  125|       |                // Make sure it's in range.
  126|  32.0k|                size_t p_relative_offset = QIntC::to_size((p - buf) + (buf_offset - offset));
  127|  32.0k|                if (p_relative_offset >= len) {
  ------------------
  |  Branch (127:21): [True: 2.93k, False: 29.0k]
  ------------------
  128|       |                    // out of range
  129|  2.93k|                    QTC::TC("libtests", "InputSource out of range");
  130|  2.93k|                    return false;
  131|  2.93k|                }
  132|  32.0k|            }
  133|  4.88M|            if ((p + strlen(start_chars)) > (buf + bytes_read)) {
  ------------------
  |  Branch (133:17): [True: 8.62k, False: 4.87M]
  ------------------
  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|  8.62k|                QTC::TC("libtests", "InputSource not enough bytes");
  137|  8.62k|                continue;
  138|  8.62k|            }
  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|  4.87M|            if (strncmp(p, start_chars, strlen(start_chars)) == 0) {
  ------------------
  |  Branch (142:17): [True: 1.67M, False: 3.19M]
  ------------------
  143|       |                // Call finder.check() with the input source positioned to the point of the match.
  144|  1.67M|                this->seek(buf_offset + (p - buf), SEEK_SET);
  145|  1.67M|                if (finder.check()) {
  ------------------
  |  Branch (145:21): [True: 76.4k, False: 1.60M]
  ------------------
  146|  76.4k|                    return true;
  147|  1.60M|                } else {
  148|  1.60M|                    QTC::TC("libtests", "InputSource start_chars matched but not check");
  149|  1.60M|                }
  150|  3.19M|            } else {
  151|  3.19M|                QTC::TC("libtests", "InputSource first char matched but not string");
  152|  3.19M|            }
  153|       |            // This occurrence of the first character wasn't a match. Skip over it and keep
  154|       |            // searching.
  155|  4.79M|            ++p;
  156|  4.79M|        } else {
  157|       |            // Trigger reading the next block
  158|   287k|            p = buf + bytes_read;
  159|   287k|        }
  160|  5.17M|    }
  161|   129k|}
_ZN11InputSource8findLastEPKcxmRNS_6FinderE:
  165|  27.1k|{
  166|  27.1k|    bool found = false;
  167|  27.1k|    qpdf_offset_t after_found_offset = 0;
  168|  27.1k|    qpdf_offset_t cur_offset = offset;
  169|  27.1k|    size_t cur_len = len;
  170|  32.8k|    while (this->findFirst(start_chars, cur_offset, cur_len, finder)) {
  ------------------
  |  Branch (170:12): [True: 5.73k, False: 27.1k]
  ------------------
  171|  5.73k|        if (found) {
  ------------------
  |  Branch (171:13): [True: 427, False: 5.30k]
  ------------------
  172|    427|            QTC::TC("libtests", "InputSource findLast found more than one");
  173|  5.30k|        } else {
  174|  5.30k|            found = true;
  175|  5.30k|        }
  176|  5.73k|        after_found_offset = this->tell();
  177|  5.73k|        cur_offset = after_found_offset;
  178|  5.73k|        cur_len = len - QIntC::to_size((cur_offset - offset));
  179|  5.73k|    }
  180|  27.1k|    if (found) {
  ------------------
  |  Branch (180:9): [True: 5.30k, False: 21.8k]
  ------------------
  181|       |        this->seek(after_found_offset, SEEK_SET);
  182|  5.30k|    }
  183|  27.1k|    return found;
  184|  27.1k|}
_ZN11InputSource9read_lineEmx:
   57|  13.9k|{
   58|  13.9k|    std::string result(count, '\0');
   59|  13.9k|    read_line(result, count, at);
   60|  13.9k|    return result;
   61|  13.9k|}

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

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

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

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

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

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

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

_ZN17Pl_ASCII85DecoderC2EPKcP8Pipeline:
   12|  4.76k|    Pipeline(identifier, next)
   13|  4.76k|{
   14|  4.76k|    util::assertion(next, "Attempt to create Pl_ASCII85Decoder with nullptr as next");
   15|  4.76k|}
_ZN17Pl_ASCII85Decoder5writeEPKhm:
   19|  4.97k|{
   20|  4.97k|    if (eod > 1) {
  ------------------
  |  Branch (20:9): [True: 199, False: 4.77k]
  ------------------
   21|    199|        return;
   22|    199|    }
   23|   860k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (23:24): [True: 856k, False: 3.91k]
  ------------------
   24|   856k|        switch (buf[i]) {
  ------------------
  |  Branch (24:17): [True: 19.6k, False: 836k]
  ------------------
   25|  8.04k|        case ' ':
  ------------------
  |  Branch (25:9): [True: 8.04k, False: 848k]
  ------------------
   26|  8.25k|        case '\f':
  ------------------
  |  Branch (26:9): [True: 207, False: 856k]
  ------------------
   27|  8.69k|        case '\v':
  ------------------
  |  Branch (27:9): [True: 441, False: 856k]
  ------------------
   28|  9.08k|        case '\t':
  ------------------
  |  Branch (28:9): [True: 394, False: 856k]
  ------------------
   29|  15.0k|        case '\r':
  ------------------
  |  Branch (29:9): [True: 5.96k, False: 850k]
  ------------------
   30|  19.6k|        case '\n':
  ------------------
  |  Branch (30:9): [True: 4.59k, False: 851k]
  ------------------
   31|  19.6k|            QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
   32|       |            // ignore whitespace
   33|  19.6k|            continue;
   34|   856k|        }
   35|   836k|        if (eod > 1) {
  ------------------
  |  Branch (35:13): [True: 531, False: 836k]
  ------------------
   36|    531|            break;
   37|   836k|        } else if (eod == 1) {
  ------------------
  |  Branch (37:20): [True: 1.56k, False: 834k]
  ------------------
   38|  1.56k|            util::no_ci_rt_error_if(buf[i] != '>', "broken end-of-data sequence in base 85 data");
   39|  1.56k|            flush();
   40|  1.56k|            eod = 2;
   41|   834k|        } else {
   42|   834k|            switch (buf[i]) {
   43|  1.55k|            case '~':
  ------------------
  |  Branch (43:13): [True: 1.55k, False: 833k]
  ------------------
   44|  1.55k|                eod = 1;
   45|  1.55k|                break;
   46|       |
   47|  3.07k|            case 'z':
  ------------------
  |  Branch (47:13): [True: 3.07k, False: 831k]
  ------------------
   48|  3.07k|                if (pos != 0) {
  ------------------
  |  Branch (48:21): [True: 29, False: 3.05k]
  ------------------
   49|     29|                    throw std::runtime_error("unexpected z during base 85 decode");
   50|     29|                }
   51|  3.05k|                unsigned char zeroes[4];
   52|  3.05k|                memset(zeroes, '\0', 4);
   53|  3.05k|                next()->write(zeroes, 4);
   54|  3.05k|                break;
   55|       |
   56|   830k|            default:
  ------------------
  |  Branch (56:13): [True: 830k, False: 4.63k]
  ------------------
   57|   830k|                if (buf[i] < 33 || buf[i] > 117) {
  ------------------
  |  Branch (57:21): [True: 51, False: 830k]
  |  Branch (57:36): [True: 184, False: 829k]
  ------------------
   58|    235|                    error = true;
   59|    235|                    throw std::runtime_error("character out of range during base 85 decode");
   60|   829k|                } else {
   61|   829k|                    this->inbuf[this->pos++] = buf[i];
   62|   829k|                    if (pos == 5) {
  ------------------
  |  Branch (62:25): [True: 164k, False: 665k]
  ------------------
   63|   164k|                        flush();
   64|   164k|                    }
   65|   829k|                }
   66|   829k|                break;
   67|   834k|            }
   68|   834k|        }
   69|   836k|    }
   70|  4.77k|}
_ZN17Pl_ASCII85Decoder5flushEv:
   74|   170k|{
   75|   170k|    if (this->pos == 0) {
  ------------------
  |  Branch (75:9): [True: 2.42k, False: 167k]
  ------------------
   76|  2.42k|        return;
   77|  2.42k|    }
   78|   167k|    unsigned long lval = 0;
   79|  1.00M|    for (int i = 0; i < 5; ++i) {
  ------------------
  |  Branch (79:21): [True: 838k, False: 167k]
  ------------------
   80|   838k|        lval *= 85;
   81|   838k|        lval += (this->inbuf[i] - 33U);
   82|   838k|    }
   83|       |
   84|   167k|    unsigned char outbuf[4];
   85|   167k|    memset(outbuf, 0, 4);
   86|   838k|    for (int i = 3; i >= 0; --i) {
  ------------------
  |  Branch (86:21): [True: 670k, False: 167k]
  ------------------
   87|   670k|        outbuf[i] = lval & 0xff;
   88|   670k|        lval >>= 8;
   89|   670k|    }
   90|       |
   91|   167k|    QTC::TC("libtests", "Pl_ASCII85Decoder partial flush", (this->pos == 5) ? 0 : 1);
  ------------------
  |  Branch (91:60): [True: 164k, False: 3.63k]
  ------------------
   92|       |    // Reset before calling getNext()->write in case that throws an exception.
   93|   167k|    auto t = this->pos - 1;
   94|   167k|    this->pos = 0;
   95|   167k|    memset(this->inbuf, 117, 5);
   96|       |
   97|   167k|    next()->write(outbuf, t);
   98|   167k|}
_ZN17Pl_ASCII85Decoder6finishEv:
  102|  4.73k|{
  103|  4.73k|    if (error) {
  ------------------
  |  Branch (103:9): [True: 197, False: 4.54k]
  ------------------
  104|    197|        return;
  105|    197|    }
  106|  4.54k|    flush();
  107|  4.54k|    next()->finish();
  108|  4.54k|}

_ZN18Pl_ASCIIHexDecoderC2EPKcP8Pipeline:
   13|    667|    Pipeline(identifier, next)
   14|    667|{
   15|    667|    util::assertion(next, "Attempt to create Pl_ASCIIHexDecoder with nullptr as next");
   16|    667|}
_ZN18Pl_ASCIIHexDecoder5writeEPKhm:
   20|  1.04k|{
   21|  1.04k|    if (eod) {
  ------------------
  |  Branch (21:9): [True: 205, False: 843]
  ------------------
   22|    205|        return;
   23|    205|    }
   24|  6.79k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (24:24): [True: 6.17k, False: 618]
  ------------------
   25|  6.17k|        char ch = static_cast<char>(toupper(buf[i]));
   26|  6.17k|        switch (ch) {
   27|    407|        case ' ':
  ------------------
  |  Branch (27:9): [True: 407, False: 5.77k]
  ------------------
   28|    616|        case '\f':
  ------------------
  |  Branch (28:9): [True: 209, False: 5.96k]
  ------------------
   29|    824|        case '\v':
  ------------------
  |  Branch (29:9): [True: 208, False: 5.97k]
  ------------------
   30|  1.03k|        case '\t':
  ------------------
  |  Branch (30:9): [True: 209, False: 5.96k]
  ------------------
   31|  1.25k|        case '\r':
  ------------------
  |  Branch (31:9): [True: 225, False: 5.95k]
  ------------------
   32|  1.54k|        case '\n':
  ------------------
  |  Branch (32:9): [True: 287, False: 5.89k]
  ------------------
   33|  1.54k|            QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space");
   34|       |            // ignore whitespace
   35|  1.54k|            break;
   36|       |
   37|     67|        case '>':
  ------------------
  |  Branch (37:9): [True: 67, False: 6.11k]
  ------------------
   38|     67|            eod = true;
   39|     67|            flush();
   40|     67|            break;
   41|       |
   42|  4.56k|        default:
  ------------------
  |  Branch (42:9): [True: 4.56k, False: 1.61k]
  ------------------
   43|  4.56k|            if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F')) {
  ------------------
  |  Branch (43:18): [True: 4.45k, False: 108]
  |  Branch (43:31): [True: 2.89k, False: 1.56k]
  |  Branch (43:46): [True: 1.55k, False: 118]
  |  Branch (43:59): [True: 1.52k, False: 38]
  ------------------
   44|  4.41k|                inbuf[pos++] = ch;
   45|  4.41k|                if (pos == 2) {
  ------------------
  |  Branch (45:21): [True: 2.13k, False: 2.27k]
  ------------------
   46|  2.13k|                    flush();
   47|  2.13k|                }
   48|  4.41k|            } else {
   49|    156|                char t[2];
   50|    156|                t[0] = ch;
   51|    156|                t[1] = 0;
   52|    156|                throw std::runtime_error("character out of range during base Hex decode: "s + t);
   53|    156|            }
   54|  4.41k|            break;
   55|  6.17k|        }
   56|  6.02k|        if (eod) {
  ------------------
  |  Branch (56:13): [True: 67, False: 5.95k]
  ------------------
   57|     67|            break;
   58|     67|        }
   59|  6.02k|    }
   60|    843|}
_ZN18Pl_ASCIIHexDecoder5flushEv:
   64|  2.82k|{
   65|  2.82k|    if (pos == 0) {
  ------------------
  |  Branch (65:9): [True: 558, False: 2.26k]
  ------------------
   66|    558|        QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush");
   67|    558|        return;
   68|    558|    }
   69|  2.26k|    int b[2];
   70|  6.78k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (70:21): [True: 4.52k, False: 2.26k]
  ------------------
   71|  4.52k|        if (inbuf[i] >= 'A') {
  ------------------
  |  Branch (71:13): [True: 1.51k, False: 3.01k]
  ------------------
   72|  1.51k|            b[i] = inbuf[i] - 'A' + 10;
   73|  3.01k|        } else {
   74|  3.01k|            b[i] = inbuf[i] - '0';
   75|  3.01k|        }
   76|  4.52k|    }
   77|  2.26k|    auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
   78|       |
   79|  2.26k|    QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", (pos == 2) ? 0 : 1);
  ------------------
  |  Branch (79:61): [True: 2.13k, False: 128]
  ------------------
   80|       |    // Reset before calling getNext()->write in case that throws an exception.
   81|  2.26k|    pos = 0;
   82|  2.26k|    inbuf[0] = '0';
   83|  2.26k|    inbuf[1] = '0';
   84|  2.26k|    inbuf[2] = '\0';
   85|       |
   86|  2.26k|    next()->write(&ch, 1);
   87|  2.26k|}
_ZN18Pl_ASCIIHexDecoder6finishEv:
   91|    619|{
   92|    619|    flush();
   93|    619|    next()->finish();
   94|    619|}

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

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

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

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

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

_ZN13Pl_LZWDecoderC2EPKcP8Pipelineb:
   12|  8.46k|    Pipeline(identifier, next),
   13|  8.46k|    code_change_delta(early_code_change)
   14|  8.46k|{
   15|  8.46k|    util::assertion(next, "Attempt to create Pl_LZWDecoder with nullptr as next");
   16|  8.46k|}
_ZN13Pl_LZWDecoder5writeEPKhm:
   20|  4.40M|{
   21|  11.6M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (21:24): [True: 7.29M, False: 4.40M]
  ------------------
   22|  7.29M|        buf[next_char_++] = bytes[i];
   23|  7.29M|        if (next_char_ == 3) {
  ------------------
  |  Branch (23:13): [True: 2.43M, False: 4.86M]
  ------------------
   24|  2.43M|            next_char_ = 0;
   25|  2.43M|        }
   26|  7.29M|        bits_available += 8;
   27|  7.29M|        if (bits_available >= code_size) {
  ------------------
  |  Branch (27:13): [True: 6.20M, False: 1.09M]
  ------------------
   28|  6.20M|            sendNextCode();
   29|  6.20M|        }
   30|  7.29M|    }
   31|  4.40M|}
_ZN13Pl_LZWDecoder6finishEv:
   35|  8.29k|{
   36|  8.29k|    next()->finish();
   37|  8.29k|}
_ZN13Pl_LZWDecoder12sendNextCodeEv:
   41|  6.20M|{
   42|  6.20M|    unsigned int high = byte_pos;
   43|  6.20M|    unsigned int med = (byte_pos + 1) % 3;
   44|  6.20M|    unsigned int low = (byte_pos + 2) % 3;
   45|       |
   46|  6.20M|    unsigned int bits_from_high = 8 - bit_pos;
   47|  6.20M|    unsigned int bits_from_med = code_size - bits_from_high;
   48|  6.20M|    unsigned int bits_from_low = 0;
   49|  6.20M|    if (bits_from_med > 8) {
  ------------------
  |  Branch (49:9): [True: 378k, False: 5.82M]
  ------------------
   50|   378k|        bits_from_low = bits_from_med - 8;
   51|   378k|        bits_from_med = 8;
   52|   378k|    }
   53|  6.20M|    unsigned int high_mask = (1U << bits_from_high) - 1U;
   54|  6.20M|    unsigned int med_mask = 0xff - ((1U << (8 - bits_from_med)) - 1U);
   55|  6.20M|    unsigned int low_mask = 0xff - ((1U << (8 - bits_from_low)) - 1U);
   56|  6.20M|    unsigned int code = 0;
   57|  6.20M|    code += (buf[high] & high_mask) << bits_from_med;
   58|  6.20M|    code += ((buf[med] & med_mask) >> (8 - bits_from_med));
   59|  6.20M|    if (bits_from_low) {
  ------------------
  |  Branch (59:9): [True: 378k, False: 5.82M]
  ------------------
   60|   378k|        code <<= bits_from_low;
   61|   378k|        code += ((buf[low] & low_mask) >> (8 - bits_from_low));
   62|   378k|        byte_pos = low;
   63|   378k|        bit_pos = bits_from_low;
   64|  5.82M|    } else {
   65|  5.82M|        byte_pos = med;
   66|  5.82M|        bit_pos = bits_from_med;
   67|  5.82M|    }
   68|  6.20M|    if (bit_pos == 8) {
  ------------------
  |  Branch (68:9): [True: 711k, False: 5.49M]
  ------------------
   69|   711k|        bit_pos = 0;
   70|   711k|        ++byte_pos;
   71|   711k|        byte_pos %= 3;
   72|   711k|    }
   73|  6.20M|    bits_available -= code_size;
   74|       |
   75|  6.20M|    handleCode(code);
   76|  6.20M|}
_ZN13Pl_LZWDecoder12getFirstCharEj:
   80|  65.4k|{
   81|  65.4k|    if (code < 256) {
  ------------------
  |  Branch (81:9): [True: 1.88k, False: 63.5k]
  ------------------
   82|  1.88k|        return static_cast<unsigned char>(code);
   83|  1.88k|    }
   84|  63.5k|    util::no_ci_rt_error_if(
   85|  63.5k|        code <= 257,
   86|  63.5k|        "Pl_LZWDecoder::getFirstChar called with invalid code (" + std::to_string(code) + ")");
   87|       |
   88|  63.5k|    unsigned int idx = code - 258;
   89|  63.5k|    util::no_ci_rt_error_if(idx >= table.size(), "Pl_LZWDecoder::getFirstChar: table overflow");
   90|  63.5k|    Buffer& b = table.at(idx);
   91|  63.5k|    return b.getBuffer()[0];
   92|  65.4k|}
_ZN13Pl_LZWDecoder10addToTableEh:
   96|  4.90M|{
   97|  4.90M|    unsigned int last_size = 0;
   98|  4.90M|    unsigned char const* last_data = nullptr;
   99|  4.90M|    unsigned char tmp[1];
  100|       |
  101|  4.90M|    if (last_code < 256) {
  ------------------
  |  Branch (101:9): [True: 4.84M, False: 65.0k]
  ------------------
  102|  4.84M|        tmp[0] = static_cast<unsigned char>(last_code);
  103|  4.84M|        last_data = tmp;
  104|  4.84M|        last_size = 1;
  105|  4.84M|    } else {
  106|  65.0k|        util::no_ci_rt_error_if(
  107|  65.0k|            last_code <= 257,
  108|  65.0k|            "Pl_LZWDecoder::addToTable called with invalid code (" + std::to_string(last_code) +
  109|  65.0k|                ")");
  110|  65.0k|        unsigned int idx = last_code - 258;
  111|  65.0k|        util::no_ci_rt_error_if(idx >= table.size(), "Pl_LZWDecoder::addToTable: table overflow");
  112|  65.0k|        Buffer& b = table.at(idx);
  113|  65.0k|        last_data = b.getBuffer();
  114|  65.0k|        last_size = QIntC::to_uint(b.getSize());
  115|  65.0k|    }
  116|       |
  117|  4.90M|    Buffer entry(1 + last_size);
  118|  4.90M|    unsigned char* new_data = entry.getBuffer();
  119|  4.90M|    memcpy(new_data, last_data, last_size);
  120|  4.90M|    new_data[last_size] = c;
  121|  4.90M|    table.push_back(std::move(entry));
  122|  4.90M|}
_ZN13Pl_LZWDecoder10handleCodeEj:
  126|  6.20M|{
  127|  6.20M|    if (eod) {
  ------------------
  |  Branch (127:9): [True: 731k, False: 5.47M]
  ------------------
  128|   731k|        return;
  129|   731k|    }
  130|       |
  131|  5.47M|    if (code == 256) {
  ------------------
  |  Branch (131:9): [True: 305k, False: 5.16M]
  ------------------
  132|   305k|        if (!table.empty()) {
  ------------------
  |  Branch (132:13): [True: 257k, False: 47.8k]
  ------------------
  133|   257k|            QTC::TC("libtests", "Pl_LZWDecoder intermediate reset");
  134|   257k|        }
  135|   305k|        table.clear();
  136|   305k|        code_size = 9;
  137|  5.16M|    } else if (code == 257) {
  ------------------
  |  Branch (137:16): [True: 59, False: 5.16M]
  ------------------
  138|     59|        eod = true;
  139|  5.16M|    } else {
  140|  5.16M|        if (last_code != 256) {
  ------------------
  |  Branch (140:13): [True: 4.90M, False: 261k]
  ------------------
  141|       |            // Add to the table from last time.  New table entry would be what we read last plus the
  142|       |            // first character of what we're reading now.
  143|  4.90M|            unsigned char next_c = '\0';
  144|  4.90M|            unsigned int table_size = QIntC::to_uint(table.size());
  145|  4.90M|            if (code < 256) {
  ------------------
  |  Branch (145:17): [True: 4.84M, False: 65.8k]
  ------------------
  146|       |                // just read < 256; last time's next_c was code
  147|  4.84M|                next_c = static_cast<unsigned char>(code);
  148|  4.84M|            } else if (code > 257) {
  ------------------
  |  Branch (148:24): [True: 65.8k, False: 0]
  ------------------
  149|  65.8k|                size_t idx = code - 258;
  150|  65.8k|                if (idx > table_size) {
  ------------------
  |  Branch (150:21): [True: 415, False: 65.4k]
  ------------------
  151|    415|                    throw std::runtime_error("LZWDecoder: bad code received");
  152|  65.4k|                } else if (idx == table_size) {
  ------------------
  |  Branch (152:28): [True: 1.89k, False: 63.5k]
  ------------------
  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|  1.89k|                    next_c = getFirstChar(last_code);
  156|  63.5k|                } else {
  157|  63.5k|                    next_c = getFirstChar(code);
  158|  63.5k|                }
  159|  65.8k|            }
  160|  4.90M|            unsigned int new_idx = 258 + table_size;
  161|  4.90M|            util::no_ci_rt_error_if(new_idx == 4096, "LZWDecoder: table full");
  162|  4.90M|            addToTable(next_c);
  163|  4.90M|            unsigned int change_idx = new_idx + code_change_delta;
  164|  4.90M|            if (change_idx == 511 || change_idx == 1023 || change_idx == 2047) {
  ------------------
  |  Branch (164:17): [True: 985, False: 4.90M]
  |  Branch (164:38): [True: 730, False: 4.90M]
  |  Branch (164:60): [True: 384, False: 4.90M]
  ------------------
  165|  2.08k|                ++code_size;
  166|  2.08k|            }
  167|  4.90M|        }
  168|       |
  169|  5.16M|        if (code < 256) {
  ------------------
  |  Branch (169:13): [True: 5.10M, False: 65.4k]
  ------------------
  170|  5.10M|            auto ch = static_cast<unsigned char>(code);
  171|  5.10M|            next()->write(&ch, 1);
  172|  5.10M|        } else {
  173|  65.4k|            unsigned int idx = code - 258;
  174|  65.4k|            if (idx >= table.size()) {
  ------------------
  |  Branch (174:17): [True: 45, False: 65.4k]
  ------------------
  175|     45|                throw std::runtime_error("Pl_LZWDecoder::handleCode: table overflow");
  176|     45|            }
  177|  65.4k|            Buffer& b = table.at(idx);
  178|  65.4k|            next()->write(b.getBuffer(), b.getSize());
  179|  65.4k|        }
  180|  5.16M|    }
  181|       |
  182|  5.47M|    last_code = code;
  183|  5.47M|}

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

_ZN12Pl_PNGFilterC2EPKcP8PipelineNS_8action_eEjjj:
   30|  3.74k|    Pipeline(identifier, next),
   31|  3.74k|    action(action)
   32|  3.74k|{
   33|  3.74k|    util::assertion(next, "Attempt to create Pl_PNGFilter with nullptr as next");
   34|  3.74k|    util::no_ci_rt_error_if(
   35|  3.74k|        samples_per_pixel < 1, "PNGFilter created with invalid samples_per_pixel");
   36|  3.74k|    util::no_ci_rt_error_if(
   37|  3.74k|        !(bits_per_sample == 1 || bits_per_sample == 2 || bits_per_sample == 4 ||
  ------------------
  |  Branch (37:11): [True: 71, False: 3.67k]
  |  Branch (37:35): [True: 67, False: 3.60k]
  |  Branch (37:59): [True: 67, False: 3.54k]
  ------------------
   38|  3.54k|          bits_per_sample == 8 || bits_per_sample == 16),
  ------------------
  |  Branch (38:11): [True: 3.46k, False: 79]
  |  Branch (38:35): [True: 62, False: 17]
  ------------------
   39|  3.74k|        "PNGFilter created with invalid bits_per_sample not 1, 2, 4, 8, or 16");
   40|  3.74k|    auto bits_per_pixel = 1ULL * bits_per_sample * samples_per_pixel;
   41|  3.74k|    util::no_ci_rt_error_if(
   42|  3.74k|        !util::fits<uint32_t>(bits_per_pixel + 7),
   43|  3.74k|        "PNGFilter created with bits_per_sample and samples_per_pixel values that cause overflow");
   44|  3.74k|    util::no_ci_rt_error_if(
   45|  3.74k|        !util::fits<uint32_t>(columns),
   46|  3.74k|        "PNGFilter created with columns value that causes overflow");
   47|  3.74k|    bytes_per_pixel = static_cast<uint32_t>((bits_per_pixel + 7) / 8);
   48|  3.74k|    auto bpr = ((columns * bits_per_pixel) + 7) / 8;
   49|  3.74k|    util::no_ci_rt_error_if(
   50|  3.74k|        bpr == 0 || !util::fits<uint32_t>(bpr), "PNGFilter created with invalid columns value");
  ------------------
  |  Branch (50:9): [True: 20, False: 3.72k]
  |  Branch (50:21): [True: 3, False: 3.72k]
  ------------------
   51|  3.74k|    util::no_ci_rt_error_if(
   52|  3.74k|        memory_limit > 0 && bpr > (memory_limit / 2U), "PNGFilter memory limit exceeded");
  ------------------
  |  Branch (52:9): [True: 3.72k, False: 23]
  |  Branch (52:29): [True: 8, False: 3.71k]
  ------------------
   53|  3.74k|    bytes_per_row = static_cast<uint32_t>(bpr);
   54|  3.74k|    buf1 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   55|  3.74k|    buf2 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   56|  3.74k|    memset(buf1.get(), 0, bytes_per_row + 1);
   57|  3.74k|    memset(buf2.get(), 0, bytes_per_row + 1);
   58|  3.74k|    cur_row = buf1.get();
   59|  3.74k|    prev_row = buf2.get();
   60|       |
   61|       |    // number of bytes per incoming row
   62|  3.74k|    incoming = (action == a_encode ? bytes_per_row : bytes_per_row + 1);
  ------------------
  |  Branch (62:17): [True: 0, False: 3.74k]
  ------------------
   63|  3.74k|}
_ZN12Pl_PNGFilter5writeEPKhm:
   73|  65.2k|{
   74|  65.2k|    size_t left = incoming - pos;
   75|  65.2k|    size_t offset = 0;
   76|   965k|    while (len >= left) {
  ------------------
  |  Branch (76:12): [True: 900k, False: 65.2k]
  ------------------
   77|       |        // finish off current row
   78|   900k|        memcpy(cur_row + pos, data + offset, left);
   79|   900k|        offset += left;
   80|   900k|        len -= left;
   81|       |
   82|   900k|        processRow();
   83|       |
   84|       |        // Swap rows
   85|   900k|        unsigned char* t = prev_row;
   86|   900k|        prev_row = cur_row;
   87|   900k|        cur_row = t ? t : buf2.get();
  ------------------
  |  Branch (87:19): [True: 900k, False: 2]
  ------------------
   88|   900k|        memset(cur_row, 0, bytes_per_row + 1);
   89|   900k|        left = incoming;
   90|   900k|        pos = 0;
   91|   900k|    }
   92|  65.2k|    if (len) {
  ------------------
  |  Branch (92:9): [True: 63.7k, False: 1.55k]
  ------------------
   93|  63.7k|        memcpy(cur_row + pos, data + offset, len);
   94|  63.7k|    }
   95|  65.2k|    pos += len;
   96|  65.2k|}
_ZN12Pl_PNGFilter10processRowEv:
  100|   901k|{
  101|   901k|    if (action == a_encode) {
  ------------------
  |  Branch (101:9): [True: 0, False: 901k]
  ------------------
  102|      0|        encodeRow();
  103|   901k|    } else {
  104|   901k|        decodeRow();
  105|   901k|    }
  106|   901k|}
_ZN12Pl_PNGFilter9decodeRowEv:
  110|   901k|{
  111|   901k|    int filter = cur_row[0];
  112|   901k|    if (prev_row) {
  ------------------
  |  Branch (112:9): [True: 901k, False: 0]
  ------------------
  113|   901k|        switch (filter) {
  114|   206k|        case 0:
  ------------------
  |  Branch (114:9): [True: 206k, False: 695k]
  ------------------
  115|   206k|            break;
  116|   114k|        case 1:
  ------------------
  |  Branch (116:9): [True: 114k, False: 787k]
  ------------------
  117|   114k|            decodeSub();
  118|   114k|            break;
  119|   413k|        case 2:
  ------------------
  |  Branch (119:9): [True: 413k, False: 488k]
  ------------------
  120|   413k|            decodeUp();
  121|   413k|            break;
  122|    457|        case 3:
  ------------------
  |  Branch (122:9): [True: 457, False: 901k]
  ------------------
  123|    457|            decodeAverage();
  124|    457|            break;
  125|  1.18k|        case 4:
  ------------------
  |  Branch (125:9): [True: 1.18k, False: 900k]
  ------------------
  126|  1.18k|            decodePaeth();
  127|  1.18k|            break;
  128|   166k|        default:
  ------------------
  |  Branch (128:9): [True: 166k, False: 735k]
  ------------------
  129|       |            // ignore
  130|   166k|            break;
  131|   901k|        }
  132|   901k|    }
  133|       |
  134|   901k|    next()->write(cur_row + 1, bytes_per_row);
  135|   901k|}
_ZN12Pl_PNGFilter9decodeSubEv:
  139|   114k|{
  140|   114k|    unsigned char* buffer = cur_row + 1;
  141|   114k|    unsigned int bpp = bytes_per_pixel;
  142|       |
  143|  1.16M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (143:30): [True: 1.05M, False: 114k]
  ------------------
  144|  1.05M|        unsigned char left = 0;
  145|       |
  146|  1.05M|        if (i >= bpp) {
  ------------------
  |  Branch (146:13): [True: 913k, False: 140k]
  ------------------
  147|   913k|            left = buffer[i - bpp];
  148|   913k|        }
  149|       |
  150|  1.05M|        buffer[i] = static_cast<unsigned char>(buffer[i] + left);
  151|  1.05M|    }
  152|   114k|}
_ZN12Pl_PNGFilter8decodeUpEv:
  156|   413k|{
  157|   413k|    unsigned char* buffer = cur_row + 1;
  158|   413k|    unsigned char* above_buffer = prev_row + 1;
  159|       |
  160|  2.59M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (160:30): [True: 2.17M, False: 413k]
  ------------------
  161|  2.17M|        unsigned char up = above_buffer[i];
  162|  2.17M|        buffer[i] = static_cast<unsigned char>(buffer[i] + up);
  163|  2.17M|    }
  164|   413k|}
_ZN12Pl_PNGFilter13decodeAverageEv:
  168|    457|{
  169|    457|    unsigned char* buffer = cur_row + 1;
  170|    457|    unsigned char* above_buffer = prev_row + 1;
  171|    457|    auto bpp = bytes_per_pixel;
  172|       |
  173|   547k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (173:30): [True: 547k, False: 457]
  ------------------
  174|   547k|        int left = 0;
  175|   547k|        int up = 0;
  176|       |
  177|   547k|        if (i >= bpp) {
  ------------------
  |  Branch (177:13): [True: 546k, False: 457]
  ------------------
  178|   546k|            left = buffer[i - bpp];
  179|   546k|        }
  180|       |
  181|   547k|        up = above_buffer[i];
  182|   547k|        buffer[i] = static_cast<unsigned char>(buffer[i] + (left + up) / 2);
  183|   547k|    }
  184|    457|}
_ZN12Pl_PNGFilter11decodePaethEv:
  188|  1.18k|{
  189|  1.18k|    unsigned char* buffer = cur_row + 1;
  190|  1.18k|    unsigned char* above_buffer = prev_row + 1;
  191|  1.18k|    auto bpp = bytes_per_pixel;
  192|       |
  193|   824k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (193:30): [True: 823k, False: 1.18k]
  ------------------
  194|   823k|        int left = 0;
  195|   823k|        int up = above_buffer[i];
  196|   823k|        int upper_left = 0;
  197|       |
  198|   823k|        if (i >= bpp) {
  ------------------
  |  Branch (198:13): [True: 822k, False: 1.20k]
  ------------------
  199|   822k|            left = buffer[i - bpp];
  200|   822k|            upper_left = above_buffer[i - bpp];
  201|   822k|        }
  202|       |
  203|   823k|        buffer[i] = static_cast<unsigned char>(buffer[i] + PaethPredictor(left, up, upper_left));
  204|   823k|    }
  205|  1.18k|}
_ZN12Pl_PNGFilter14PaethPredictorEiii:
  209|   823k|{
  210|   823k|    int p = a + b - c;
  211|   823k|    int pa = abs_diff(p, a);
  212|   823k|    int pb = abs_diff(p, b);
  213|   823k|    int pc = abs_diff(p, c);
  214|       |
  215|   823k|    if (pa <= pb && pa <= pc) {
  ------------------
  |  Branch (215:9): [True: 820k, False: 2.68k]
  |  Branch (215:21): [True: 820k, False: 302]
  ------------------
  216|   820k|        return a;
  217|   820k|    }
  218|  2.99k|    if (pb <= pc) {
  ------------------
  |  Branch (218:9): [True: 2.64k, False: 343]
  ------------------
  219|  2.64k|        return b;
  220|  2.64k|    }
  221|    343|    return c;
  222|  2.99k|}
_ZN12Pl_PNGFilter6finishEv:
  242|  3.69k|{
  243|  3.69k|    if (pos) {
  ------------------
  |  Branch (243:9): [True: 1.44k, False: 2.25k]
  ------------------
  244|       |        // write partial row
  245|  1.44k|        processRow();
  246|  1.44k|    }
  247|  3.69k|    prev_row = nullptr;
  248|  3.69k|    cur_row = buf1.get();
  249|  3.69k|    pos = 0;
  250|  3.69k|    memset(cur_row, 0, bytes_per_row + 1);
  251|       |
  252|  3.69k|    next()->finish();
  253|  3.69k|}
Pl_PNGFilter.cc:_ZL8abs_diffii:
   19|  2.47M|{
   20|  2.47M|    return a > b ? a - b : b - a;
  ------------------
  |  Branch (20:12): [True: 1.59M, False: 875k]
  ------------------
   21|  2.47M|}

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

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

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

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

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

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

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

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

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

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

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

_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_:
    9|   932k|    std::runtime_error(createWhat(filename, object, (offset ? offset : -1), message)),
  ------------------
  |  Branch (9:54): [True: 575k, False: 357k]
  ------------------
   10|   932k|    error_code(error_code),
   11|   932k|    filename(filename),
   12|   932k|    object(object),
   13|   932k|    offset(offset ? offset : -1),
  ------------------
  |  Branch (13:12): [True: 575k, False: 357k]
  ------------------
   14|   932k|    message(message)
   15|   932k|{
   16|   932k|}
_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_b:
   25|   372k|    std::runtime_error(
   26|   372k|        createWhat(filename, object, (offset || zero_offset_valid ? offset : -1), message)),
  ------------------
  |  Branch (26:39): [True: 372k, False: 41]
  |  Branch (26:49): [True: 41, False: 0]
  ------------------
   27|   372k|    error_code(error_code),
   28|   372k|    filename(filename),
   29|   372k|    object(object),
   30|   372k|    offset(offset || zero_offset_valid ? offset : -1),
  ------------------
  |  Branch (30:12): [True: 372k, False: 41]
  |  Branch (30:22): [True: 41, False: 0]
  ------------------
   31|   372k|    message(message)
   32|   372k|{
   33|   372k|}
_ZN7QPDFExc10createWhatERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_xS8_:
   41|  1.30M|{
   42|  1.30M|    std::string result;
   43|  1.30M|    if (!filename.empty()) {
  ------------------
  |  Branch (43:9): [True: 961k, False: 344k]
  ------------------
   44|   961k|        result += filename;
   45|   961k|    }
   46|  1.30M|    if (!(object.empty() && offset < 0)) {
  ------------------
  |  Branch (46:11): [True: 179k, False: 1.12M]
  |  Branch (46:29): [True: 136k, False: 43.8k]
  ------------------
   47|  1.16M|        if (!filename.empty()) {
  ------------------
  |  Branch (47:13): [True: 825k, False: 343k]
  ------------------
   48|   825k|            result += " (";
   49|   825k|        }
   50|  1.16M|        if (!object.empty()) {
  ------------------
  |  Branch (50:13): [True: 1.12M, False: 43.8k]
  ------------------
   51|  1.12M|            result += object;
   52|  1.12M|            if (offset >= 0) {
  ------------------
  |  Branch (52:17): [True: 769k, False: 356k]
  ------------------
   53|   769k|                result += ", ";
   54|   769k|            }
   55|  1.12M|        }
   56|  1.16M|        if (offset >= 0) {
  ------------------
  |  Branch (56:13): [True: 813k, False: 356k]
  ------------------
   57|   813k|            result += "offset " + std::to_string(offset);
   58|   813k|        }
   59|  1.16M|        if (!filename.empty()) {
  ------------------
  |  Branch (59:13): [True: 825k, False: 343k]
  ------------------
   60|   825k|            result += ")";
   61|   825k|        }
   62|  1.16M|    }
   63|  1.30M|    if (!result.empty()) {
  ------------------
  |  Branch (63:9): [True: 1.30M, False: 240]
  ------------------
   64|  1.30M|        result += ": ";
   65|  1.30M|    }
   66|  1.30M|    result += message;
   67|  1.30M|    return result;
   68|  1.30M|}

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

_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|  62.8k|{
   78|  62.8k|    static auto l = create();
   79|  62.8k|    return l;
   80|  62.8k|}
_ZN10QPDFLogger4warnEPKc:
  102|     22|{
  103|     22|    getWarn(false)->writeCStr(s);
  104|     22|}
_ZN10QPDFLogger7getWarnEb:
  114|  1.25M|{
  115|  1.25M|    if (m->p_warn) {
  ------------------
  |  Branch (115:9): [True: 0, False: 1.25M]
  ------------------
  116|      0|        return m->p_warn;
  117|      0|    }
  118|  1.25M|    return getError(null_okay);
  119|  1.25M|}
_ZN10QPDFLogger8getErrorEb:
  135|  1.28M|{
  136|  1.28M|    return throwIfNull(m->p_error, null_okay);
  137|  1.28M|}
_ZN10QPDFLogger11throwIfNullENSt3__110shared_ptrI8PipelineEEb:
  254|  1.28M|{
  255|  1.28M|    if (!(null_okay || p)) {
  ------------------
  |  Branch (255:11): [True: 0, False: 1.28M]
  |  Branch (255:24): [True: 1.28M, False: 0]
  ------------------
  256|      0|        throw std::logic_error("QPDFLogger: requested a null pipeline without null_okay == true");
  257|      0|    }
  258|  1.28M|    return p;
  259|  1.28M|}
QPDFLogger.cc:_ZN12_GLOBAL__N_18Pl_TrackC2EPKcP8Pipeline:
   15|      1|            Pipeline(identifier, next)
   16|      1|        {
   17|      1|            if (!next) {
  ------------------
  |  Branch (17:17): [True: 0, False: 1]
  ------------------
   18|      0|                throw std::logic_error("Attempt to create Pl_Track with nullptr as next");
   19|      0|            }
   20|      1|        }
QPDFLogger.cc:_ZN12_GLOBAL__N_18Pl_Track6finishEv:
   31|      1|        {
   32|      1|            next()->finish();
   33|      1|        }

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

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

_ZNK4qpdf10BaseHandlecv10QPDFObjGenEv:
   34|   424k|{
   35|   424k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (35:12): [True: 423k, False: 428]
  ------------------
   36|   424k|}
_ZN16QPDFObjectHandle18StreamDataProviderC2Eb:
   46|  31.8k|    supports_retry(supports_retry)
   47|  31.8k|{
   48|  31.8k|}
_ZN16QPDFObjectHandle18StreamDataProviderD2Ev:
   51|  31.8k|{
   52|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   53|  31.8k|}
_ZN16QPDFObjectHandle18StreamDataProvider13supportsRetryEv:
   85|  4.69k|{
   86|  4.69k|    return supports_retry;
   87|  4.69k|}
_ZN16QPDFObjectHandle11TokenFilter9handleEOFEv:
  119|  13.4k|{
  120|  13.4k|}
_ZN16QPDFObjectHandle11TokenFilter11setPipelineEP8Pipeline:
  124|  53.2k|{
  125|  53.2k|    pipeline = p;
  126|  53.2k|}
_ZN16QPDFObjectHandle11TokenFilter5writeEPKcm:
  130|   255k|{
  131|   255k|    if (!pipeline) {
  ------------------
  |  Branch (131:9): [True: 0, False: 255k]
  ------------------
  132|      0|        return;
  133|      0|    }
  134|   255k|    if (len) {
  ------------------
  |  Branch (134:9): [True: 243k, False: 12.7k]
  ------------------
  135|   243k|        pipeline->write(data, len);
  136|   243k|    }
  137|   255k|}
_ZN16QPDFObjectHandle11TokenFilter5writeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  141|   169k|{
  142|   169k|    write(str.c_str(), str.length());
  143|   169k|}
_ZN16QPDFObjectHandle11TokenFilter10writeTokenERKN13QPDFTokenizer5TokenE:
  147|  86.2k|{
  148|  86.2k|    std::string const& value = token.getRawValue();
  149|  86.2k|    write(value.c_str(), value.length());
  150|  86.2k|}
_ZN4qpdf4Name19analyzeJSONEncodingERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  180|   303k|{
  181|   303k|    int tail = 0;       // Number of continuation characters expected.
  182|   303k|    bool tail2 = false; // Potential overlong 3 octet utf-8.
  183|   303k|    bool tail3 = false; // potential overlong 4 octet
  184|   303k|    bool needs_escaping = false;
  185|  12.0M|    for (auto const& it: name) {
  ------------------
  |  Branch (185:24): [True: 12.0M, False: 280k]
  ------------------
  186|  12.0M|        auto c = static_cast<unsigned char>(it);
  187|  12.0M|        if (tail) {
  ------------------
  |  Branch (187:13): [True: 13.4k, False: 12.0M]
  ------------------
  188|  13.4k|            if ((c & 0xc0) != 0x80) {
  ------------------
  |  Branch (188:17): [True: 5.19k, False: 8.21k]
  ------------------
  189|  5.19k|                return {false, false};
  190|  5.19k|            }
  191|  8.21k|            if (tail2) {
  ------------------
  |  Branch (191:17): [True: 515, False: 7.69k]
  ------------------
  192|    515|                if ((c & 0xe0) == 0x80) {
  ------------------
  |  Branch (192:21): [True: 92, False: 423]
  ------------------
  193|     92|                    return {false, false};
  194|     92|                }
  195|    423|                tail2 = false;
  196|  7.69k|            } else if (tail3) {
  ------------------
  |  Branch (196:24): [True: 624, False: 7.07k]
  ------------------
  197|    624|                if ((c & 0xf0) == 0x80) {
  ------------------
  |  Branch (197:21): [True: 231, False: 393]
  ------------------
  198|    231|                    return {false, false};
  199|    231|                }
  200|    393|                tail3 = false;
  201|    393|            }
  202|  7.88k|            tail--;
  203|  12.0M|        } else if (c < 0x80) {
  ------------------
  |  Branch (203:20): [True: 12.0M, False: 25.6k]
  ------------------
  204|  12.0M|            if (!needs_escaping) {
  ------------------
  |  Branch (204:17): [True: 2.03M, False: 9.97M]
  ------------------
  205|  2.03M|                needs_escaping = !((c > 34 && c != '\\') || c == ' ' || c == 33);
  ------------------
  |  Branch (205:37): [True: 2.02M, False: 7.79k]
  |  Branch (205:47): [True: 2.02M, False: 5.65k]
  |  Branch (205:61): [True: 208, False: 13.2k]
  |  Branch (205:73): [True: 1.08k, False: 12.1k]
  ------------------
  206|  2.03M|            }
  207|  12.0M|        } else if ((c & 0xe0) == 0xc0) {
  ------------------
  |  Branch (207:20): [True: 3.24k, False: 22.3k]
  ------------------
  208|  3.24k|            if ((c & 0xfe) == 0xc0) {
  ------------------
  |  Branch (208:17): [True: 519, False: 2.72k]
  ------------------
  209|    519|                return {false, false};
  210|    519|            }
  211|  2.72k|            tail = 1;
  212|  22.3k|        } else if ((c & 0xf0) == 0xe0) {
  ------------------
  |  Branch (212:20): [True: 3.35k, False: 19.0k]
  ------------------
  213|  3.35k|            tail2 = (c == 0xe0);
  214|  3.35k|            tail = 2;
  215|  19.0k|        } else if ((c & 0xf8) == 0xf0) {
  ------------------
  |  Branch (215:20): [True: 2.90k, False: 16.1k]
  ------------------
  216|  2.90k|            tail3 = (c == 0xf0);
  217|  2.90k|            tail = 3;
  218|  16.1k|        } else {
  219|  16.1k|            return {false, false};
  220|  16.1k|        }
  221|  12.0M|    }
  222|   280k|    return {tail == 0, !needs_escaping};
  223|   303k|}
_ZN4qpdf4Name9normalizeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  227|  66.3k|{
  228|  66.3k|    if (name.empty()) {
  ------------------
  |  Branch (228:9): [True: 0, False: 66.3k]
  ------------------
  229|      0|        return name;
  230|      0|    }
  231|  66.3k|    std::string result;
  232|  66.3k|    result += name.at(0);
  233|  34.9M|    for (size_t i = 1; i < name.length(); ++i) {
  ------------------
  |  Branch (233:24): [True: 34.8M, False: 66.3k]
  ------------------
  234|  34.8M|        char ch = name.at(i);
  235|       |        // Don't use locale/ctype here; follow PDF spec guidelines.
  236|  34.8M|        if (ch == '\0') {
  ------------------
  |  Branch (236:13): [True: 7.69k, False: 34.8M]
  ------------------
  237|       |            // QPDFTokenizer embeds a null character to encode an invalid #.
  238|  7.69k|            result += "#";
  239|  34.8M|        } else if (
  240|  34.8M|            ch < 33 || ch == '#' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (240:13): [True: 32.5M, False: 2.28M]
  |  Branch (240:24): [True: 869, False: 2.28M]
  |  Branch (240:37): [True: 286, False: 2.28M]
  |  Branch (240:50): [True: 361, False: 2.28M]
  |  Branch (240:63): [True: 416, False: 2.28M]
  |  Branch (240:76): [True: 208, False: 2.28M]
  |  Branch (240:89): [True: 216, False: 2.28M]
  ------------------
  241|  34.2M|            ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch > 126) {
  ------------------
  |  Branch (241:13): [True: 541, False: 2.28M]
  |  Branch (241:26): [True: 205, False: 2.28M]
  |  Branch (241:39): [True: 201, False: 2.28M]
  |  Branch (241:52): [True: 76, False: 2.28M]
  |  Branch (241:65): [True: 530, False: 2.28M]
  |  Branch (241:78): [True: 1.69M, False: 588k]
  ------------------
  242|  34.2M|            result += util::hex_encode_char(ch);
  243|  34.2M|        } else {
  244|   588k|            result += ch;
  245|   588k|        }
  246|  34.8M|    }
  247|  66.3k|    return result;
  248|  66.3k|}
_ZNK4qpdf10BaseHandle4copyEb:
  252|  1.07M|{
  253|  1.07M|    switch (resolved_type_code()) {
  ------------------
  |  Branch (253:13): [True: 1.07M, False: 0]
  ------------------
  254|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (254:5): [True: 0, False: 1.07M]
  ------------------
  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: 1.07M]
  ------------------
  258|      0|        return QPDFObject::create<QPDF_Reserved>();
  259|  74.3k|    case ::ot_null:
  ------------------
  |  Branch (259:5): [True: 74.3k, False: 996k]
  ------------------
  260|  74.3k|        return QPDFObject::create<QPDF_Null>();
  261|    886|    case ::ot_boolean:
  ------------------
  |  Branch (261:5): [True: 886, False: 1.06M]
  ------------------
  262|    886|        return QPDFObject::create<QPDF_Bool>(std::get<QPDF_Bool>(obj->value).val);
  263|   666k|    case ::ot_integer:
  ------------------
  |  Branch (263:5): [True: 666k, False: 403k]
  ------------------
  264|   666k|        return QPDFObject::create<QPDF_Integer>(std::get<QPDF_Integer>(obj->value).val);
  265|  46.7k|    case ::ot_real:
  ------------------
  |  Branch (265:5): [True: 46.7k, False: 1.02M]
  ------------------
  266|  46.7k|        return QPDFObject::create<QPDF_Real>(std::get<QPDF_Real>(obj->value).val);
  267|  50.1k|    case ::ot_string:
  ------------------
  |  Branch (267:5): [True: 50.1k, False: 1.02M]
  ------------------
  268|  50.1k|        return QPDFObject::create<QPDF_String>(std::get<QPDF_String>(obj->value).val);
  269|   154k|    case ::ot_name:
  ------------------
  |  Branch (269:5): [True: 154k, False: 915k]
  ------------------
  270|   154k|        return QPDFObject::create<QPDF_Name>(std::get<QPDF_Name>(obj->value).name);
  271|  41.8k|    case ::ot_array:
  ------------------
  |  Branch (271:5): [True: 41.8k, False: 1.02M]
  ------------------
  272|  41.8k|        {
  273|  41.8k|            auto const& a = std::get<QPDF_Array>(obj->value);
  274|  41.8k|            if (shallow) {
  ------------------
  |  Branch (274:17): [True: 0, False: 41.8k]
  ------------------
  275|      0|                return QPDFObject::create<QPDF_Array>(a);
  276|  41.8k|            } else {
  277|  41.8k|                QTC::TC("qpdf", "QPDF_Array copy", a.sp ? 0 : 1);
  ------------------
  |  Branch (277:52): [True: 447, False: 41.3k]
  ------------------
  278|  41.8k|                if (a.sp) {
  ------------------
  |  Branch (278:21): [True: 447, False: 41.3k]
  ------------------
  279|    447|                    QPDF_Array result;
  280|    447|                    result.sp = std::make_unique<QPDF_Array::Sparse>();
  281|    447|                    result.sp->size = a.sp->size;
  282|  6.36k|                    for (auto const& [idx, oh]: a.sp->elements) {
  ------------------
  |  Branch (282:47): [True: 6.36k, False: 447]
  ------------------
  283|  6.36k|                        result.sp->elements[idx] = oh.indirect() ? oh : oh.copy();
  ------------------
  |  Branch (283:52): [True: 450, False: 5.91k]
  ------------------
  284|  6.36k|                    }
  285|    447|                    return QPDFObject::create<QPDF_Array>(std::move(result));
  286|  41.3k|                } else {
  287|  41.3k|                    std::vector<QPDFObjectHandle> result;
  288|  41.3k|                    result.reserve(a.elements.size());
  289|   926k|                    for (auto const& element: a.elements) {
  ------------------
  |  Branch (289:45): [True: 926k, False: 41.3k]
  ------------------
  290|   926k|                        result.emplace_back(
  291|   926k|                            element ? (element.indirect() ? element : element.copy()) : element);
  ------------------
  |  Branch (291:29): [True: 926k, False: 0]
  |  Branch (291:40): [True: 16.7k, False: 909k]
  ------------------
  292|   926k|                    }
  293|  41.3k|                    return QPDFObject::create<QPDF_Array>(std::move(result), false);
  294|  41.3k|                }
  295|  41.8k|            }
  296|  41.8k|        }
  297|  35.0k|    case ::ot_dictionary:
  ------------------
  |  Branch (297:5): [True: 35.0k, False: 1.03M]
  ------------------
  298|  35.0k|        {
  299|  35.0k|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  300|  35.0k|            if (shallow) {
  ------------------
  |  Branch (300:17): [True: 0, False: 35.0k]
  ------------------
  301|      0|                return QPDFObject::create<QPDF_Dictionary>(d.items);
  302|  35.0k|            } else {
  303|  35.0k|                std::map<std::string, QPDFObjectHandle> new_items;
  304|   238k|                for (auto const& [key, val]: d.items) {
  ------------------
  |  Branch (304:44): [True: 238k, False: 35.0k]
  ------------------
  305|   238k|                    new_items[key] = val.indirect() ? val : val.copy();
  ------------------
  |  Branch (305:38): [True: 122k, False: 116k]
  ------------------
  306|   238k|                }
  307|  35.0k|                return QPDFObject::create<QPDF_Dictionary>(new_items);
  308|  35.0k|            }
  309|  35.0k|        }
  310|     22|    case ::ot_stream:
  ------------------
  |  Branch (310:5): [True: 22, False: 1.07M]
  ------------------
  311|     22|        QTC::TC("qpdf", "QPDF_Stream ERR shallow copy stream");
  312|     22|        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: 1.07M]
  ------------------
  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: 1.07M]
  ------------------
  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: 1.07M]
  ------------------
  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: 1.07M]
  ------------------
  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: 1.07M]
  ------------------
  325|      0|        return referenced_object().obj_sp();
  326|  1.07M|    }
  327|      0|    return {}; // unreachable
  328|  1.07M|}
_ZNK4qpdf10BaseHandle7unparseEv:
  474|   353k|{
  475|   353k|    switch (resolved_type_code()) {
  ------------------
  |  Branch (475:13): [True: 353k, False: 0]
  ------------------
  476|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (476:5): [True: 0, False: 353k]
  ------------------
  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: 353k]
  ------------------
  480|      0|        throw std::logic_error("QPDFObjectHandle: attempting to unparse a reserved object");
  481|      0|        return ""; // does not return
  482|  58.2k|    case ::ot_null:
  ------------------
  |  Branch (482:5): [True: 58.2k, False: 295k]
  ------------------
  483|  58.2k|        return "null";
  484|    362|    case ::ot_boolean:
  ------------------
  |  Branch (484:5): [True: 362, False: 352k]
  ------------------
  485|    362|        return std::get<QPDF_Bool>(obj->value).val ? "true" : "false";
  ------------------
  |  Branch (485:16): [True: 30, False: 332]
  ------------------
  486|   107k|    case ::ot_integer:
  ------------------
  |  Branch (486:5): [True: 107k, False: 245k]
  ------------------
  487|   107k|        return std::to_string(std::get<QPDF_Integer>(obj->value).val);
  488|  3.20k|    case ::ot_real:
  ------------------
  |  Branch (488:5): [True: 3.20k, False: 350k]
  ------------------
  489|  3.20k|        return std::get<QPDF_Real>(obj->value).val;
  490|   140k|    case ::ot_string:
  ------------------
  |  Branch (490:5): [True: 140k, False: 213k]
  ------------------
  491|   140k|        return std::get<QPDF_String>(obj->value).unparse(false);
  492|  43.6k|    case ::ot_name:
  ------------------
  |  Branch (492:5): [True: 43.6k, False: 309k]
  ------------------
  493|  43.6k|        return Name::normalize(std::get<QPDF_Name>(obj->value).name);
  494|      0|    case ::ot_array:
  ------------------
  |  Branch (494:5): [True: 0, False: 353k]
  ------------------
  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: 353k]
  ------------------
  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: 353k]
  ------------------
  531|      0|        return obj->og.unparse(' ') + " R";
  532|      0|    case ::ot_operator:
  ------------------
  |  Branch (532:5): [True: 0, False: 353k]
  ------------------
  533|      0|        return std::get<QPDF_Operator>(obj->value).val;
  534|      0|    case ::ot_inlineimage:
  ------------------
  |  Branch (534:5): [True: 0, False: 353k]
  ------------------
  535|      0|        return std::get<QPDF_InlineImage>(obj->value).val;
  536|      0|    case ::ot_unresolved:
  ------------------
  |  Branch (536:5): [True: 0, False: 353k]
  ------------------
  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: 353k]
  ------------------
  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: 353k]
  ------------------
  543|      0|        return obj->og.unparse(' ') + " R";
  544|   353k|    }
  545|      0|    return {}; // unreachable
  546|   353k|}
_ZNK4qpdf10BaseHandle10write_jsonEiRN4JSON6WriterE:
  550|   513k|{
  551|   513k|    switch (resolved_type_code()) {
  552|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (552:5): [True: 0, False: 513k]
  ------------------
  553|      0|        throw std::logic_error(
  554|      0|            "QPDFObjectHandle: attempting to get JSON from a uninitialized object");
  555|      0|        break; // unreachable
  556|  22.0k|    case ::ot_null:
  ------------------
  |  Branch (556:5): [True: 22.0k, False: 491k]
  ------------------
  557|  22.0k|    case ::ot_operator:
  ------------------
  |  Branch (557:5): [True: 0, False: 513k]
  ------------------
  558|  22.0k|    case ::ot_inlineimage:
  ------------------
  |  Branch (558:5): [True: 0, False: 513k]
  ------------------
  559|  22.0k|        p << "null";
  560|  22.0k|        break;
  561|  4.18k|    case ::ot_boolean:
  ------------------
  |  Branch (561:5): [True: 4.18k, False: 509k]
  ------------------
  562|  4.18k|        p << std::get<QPDF_Bool>(obj->value).val;
  563|  4.18k|        break;
  564|   164k|    case ::ot_integer:
  ------------------
  |  Branch (564:5): [True: 164k, False: 348k]
  ------------------
  565|   164k|        p << std::to_string(std::get<QPDF_Integer>(obj->value).val);
  566|   164k|        break;
  567|  54.8k|    case ::ot_real:
  ------------------
  |  Branch (567:5): [True: 54.8k, False: 458k]
  ------------------
  568|  54.8k|        {
  569|  54.8k|            auto const& val = std::get<QPDF_Real>(obj->value).val;
  570|  54.8k|            if (val.empty()) {
  ------------------
  |  Branch (570:17): [True: 0, False: 54.8k]
  ------------------
  571|       |                // Can't really happen...
  572|      0|                p << "0";
  573|  54.8k|            } else if (val.at(0) == '.') {
  ------------------
  |  Branch (573:24): [True: 707, False: 54.0k]
  ------------------
  574|    707|                p << "0" << val;
  575|  54.0k|            } else if (val.length() >= 2 && val.at(0) == '-' && val.at(1) == '.') {
  ------------------
  |  Branch (575:24): [True: 35.0k, False: 19.0k]
  |  Branch (575:45): [True: 2.40k, False: 32.6k]
  |  Branch (575:65): [True: 1.94k, False: 457]
  ------------------
  576|  1.94k|                p << "-0." << val.substr(2);
  577|  52.1k|            } else if (val.at(0) == '0') {
  ------------------
  |  Branch (577:24): [True: 20.2k, False: 31.8k]
  ------------------
  578|  20.2k|                auto i = val.find_first_not_of('0');
  579|  20.2k|                if (i == std::string::npos) {
  ------------------
  |  Branch (579:21): [True: 19.0k, False: 1.26k]
  ------------------
  580|  19.0k|                    p << "0";
  581|  19.0k|                } else if (val.at(i) == '.') {
  ------------------
  |  Branch (581:28): [True: 1.16k, False: 102]
  ------------------
  582|  1.16k|                    p << "0" << val.substr(i);
  583|  1.16k|                } else {
  584|    102|                    p << val.substr(i);
  585|    102|                }
  586|  31.8k|            } else {
  587|  31.8k|                p << val;
  588|  31.8k|            }
  589|  54.8k|            if (val.back() == '.') {
  ------------------
  |  Branch (589:17): [True: 875, False: 53.9k]
  ------------------
  590|    875|                p << "0";
  591|    875|            }
  592|  54.8k|        }
  593|  54.8k|        break;
  594|  26.0k|    case ::ot_string:
  ------------------
  |  Branch (594:5): [True: 26.0k, False: 487k]
  ------------------
  595|  26.0k|        std::get<QPDF_String>(obj->value).writeJSON(json_version, p);
  596|  26.0k|        break;
  597|   117k|    case ::ot_name:
  ------------------
  |  Branch (597:5): [True: 117k, False: 396k]
  ------------------
  598|   117k|        {
  599|   117k|            auto const& n = std::get<QPDF_Name>(obj->value);
  600|       |            // For performance reasons this code is duplicated in QPDF_Dictionary::writeJSON. When
  601|       |            // updating this method make sure QPDF_Dictionary is also update.
  602|   117k|            if (json_version == 1) {
  ------------------
  |  Branch (602:17): [True: 0, False: 117k]
  ------------------
  603|      0|                p << "\"" << JSON::Writer::encode_string(Name::normalize(n.name)) << "\"";
  604|   117k|            } else {
  605|   117k|                if (auto res = Name::analyzeJSONEncoding(n.name); res.first) {
  ------------------
  |  Branch (605:67): [True: 107k, False: 9.67k]
  ------------------
  606|   107k|                    if (res.second) {
  ------------------
  |  Branch (606:25): [True: 104k, False: 3.36k]
  ------------------
  607|   104k|                        p << "\"" << n.name << "\"";
  608|   104k|                    } else {
  609|  3.36k|                        p << "\"" << JSON::Writer::encode_string(n.name) << "\"";
  610|  3.36k|                    }
  611|   107k|                } else {
  612|  9.67k|                    p << "\"n:" << JSON::Writer::encode_string(Name::normalize(n.name)) << "\"";
  613|  9.67k|                }
  614|   117k|            }
  615|   117k|        }
  616|   117k|        break;
  617|  65.8k|    case ::ot_array:
  ------------------
  |  Branch (617:5): [True: 65.8k, False: 447k]
  ------------------
  618|  65.8k|        {
  619|  65.8k|            auto const& a = std::get<QPDF_Array>(obj->value);
  620|  65.8k|            p.writeStart('[');
  621|  65.8k|            if (a.sp) {
  ------------------
  |  Branch (621:17): [True: 484, False: 65.3k]
  ------------------
  622|    484|                size_t next = 0;
  623|  8.17k|                for (auto& [key, value]: a.sp->elements) {
  ------------------
  |  Branch (623:40): [True: 8.17k, False: 484]
  ------------------
  624|  49.7k|                    for (size_t j = next; j < key; ++j) {
  ------------------
  |  Branch (624:43): [True: 41.5k, False: 8.17k]
  ------------------
  625|  41.5k|                        p.writeNext() << "null";
  626|  41.5k|                    }
  627|  8.17k|                    p.writeNext();
  628|  8.17k|                    auto item_og = value.id_gen();
  629|  8.17k|                    if (item_og.isIndirect()) {
  ------------------
  |  Branch (629:25): [True: 380, False: 7.79k]
  ------------------
  630|    380|                        p << "\"" << item_og.unparse(' ') << " R\"";
  631|  7.79k|                    } else {
  632|  7.79k|                        value.write_json(json_version, p);
  633|  7.79k|                    }
  634|  8.17k|                    next = key + 1;
  635|  8.17k|                }
  636|  15.9k|                for (size_t j = next; j < a.sp->size; ++j) {
  ------------------
  |  Branch (636:39): [True: 15.5k, False: 484]
  ------------------
  637|  15.5k|                    p.writeNext() << "null";
  638|  15.5k|                }
  639|  65.3k|            } else {
  640|   357k|                for (auto const& item: a.elements) {
  ------------------
  |  Branch (640:38): [True: 357k, False: 65.3k]
  ------------------
  641|   357k|                    p.writeNext();
  642|   357k|                    auto item_og = item.id_gen();
  643|   357k|                    if (item_og.isIndirect()) {
  ------------------
  |  Branch (643:25): [True: 9.52k, False: 348k]
  ------------------
  644|  9.52k|                        p << "\"" << item_og.unparse(' ') << " R\"";
  645|   348k|                    } else {
  646|   348k|                        item.write_json(json_version, p);
  647|   348k|                    }
  648|   357k|                }
  649|  65.3k|            }
  650|  65.8k|            p.writeEnd(']');
  651|  65.8k|        }
  652|  65.8k|        break;
  653|  58.4k|    case ::ot_dictionary:
  ------------------
  |  Branch (653:5): [True: 58.4k, False: 455k]
  ------------------
  654|  58.4k|        {
  655|  58.4k|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  656|  58.4k|            p.writeStart('{');
  657|   223k|            for (auto& iter: d.items) {
  ------------------
  |  Branch (657:28): [True: 223k, False: 58.4k]
  ------------------
  658|   223k|                if (!iter.second.null()) {
  ------------------
  |  Branch (658:21): [True: 185k, False: 38.0k]
  ------------------
  659|   185k|                    p.writeNext();
  660|   185k|                    if (json_version == 1) {
  ------------------
  |  Branch (660:25): [True: 0, False: 185k]
  ------------------
  661|      0|                        p << "\"" << JSON::Writer::encode_string(Name::normalize(iter.first))
  662|      0|                          << "\": ";
  663|   185k|                    } else if (auto res = Name::analyzeJSONEncoding(iter.first); res.first) {
  ------------------
  |  Branch (663:82): [True: 172k, False: 13.0k]
  ------------------
  664|   172k|                        if (res.second) {
  ------------------
  |  Branch (664:29): [True: 168k, False: 4.03k]
  ------------------
  665|   168k|                            p << "\"" << iter.first << "\": ";
  666|   168k|                        } else {
  667|  4.03k|                            p << "\"" << JSON::Writer::encode_string(iter.first) << "\": ";
  668|  4.03k|                        }
  669|   172k|                    } else {
  670|  13.0k|                        p << "\"n:" << JSON::Writer::encode_string(Name::normalize(iter.first))
  671|  13.0k|                          << "\": ";
  672|  13.0k|                    }
  673|   185k|                    iter.second.writeJSON(json_version, p);
  674|   185k|                }
  675|   223k|            }
  676|  58.4k|            p.writeEnd('}');
  677|  58.4k|        }
  678|  58.4k|        break;
  679|      0|    case ::ot_stream:
  ------------------
  |  Branch (679:5): [True: 0, False: 513k]
  ------------------
  680|      0|        std::get<QPDF_Stream>(obj->value).m->stream_dict.writeJSON(json_version, p);
  681|      0|        break;
  682|      0|    case ::ot_reference:
  ------------------
  |  Branch (682:5): [True: 0, False: 513k]
  ------------------
  683|      0|        p << "\"" << obj->og.unparse(' ') << " R\"";
  684|      0|        break;
  685|      0|    default:
  ------------------
  |  Branch (685:5): [True: 0, False: 513k]
  ------------------
  686|      0|        throw std::logic_error("attempted to write an unsuitable object as JSON");
  687|   513k|    }
  688|   513k|}
_ZN4qpdf10BaseHandle10disconnectEb:
  692|  4.50M|{
  693|       |    // QPDF::~QPDF() calls disconnect for indirect objects, so we don't do that here.
  694|  4.50M|    if (only_direct && indirect()) {
  ------------------
  |  Branch (694:9): [True: 4.02M, False: 485k]
  |  Branch (694:24): [True: 321k, False: 3.69M]
  ------------------
  695|   321k|        return;
  696|   321k|    }
  697|       |
  698|  4.18M|    switch (raw_type_code()) {
  699|   210k|    case ::ot_array:
  ------------------
  |  Branch (699:5): [True: 210k, False: 3.97M]
  ------------------
  700|   210k|        {
  701|   210k|            auto& a = std::get<QPDF_Array>(obj->value);
  702|   210k|            if (a.sp) {
  ------------------
  |  Branch (702:17): [True: 744, False: 210k]
  ------------------
  703|  30.9k|                for (auto& item: a.sp->elements) {
  ------------------
  |  Branch (703:32): [True: 30.9k, False: 744]
  ------------------
  704|  30.9k|                    item.second.disconnect();
  705|  30.9k|                }
  706|   210k|            } else {
  707|  2.69M|                for (auto& oh: a.elements) {
  ------------------
  |  Branch (707:30): [True: 2.69M, False: 210k]
  ------------------
  708|  2.69M|                    oh.disconnect();
  709|  2.69M|                }
  710|   210k|            }
  711|   210k|        }
  712|   210k|        break;
  713|   301k|    case ::ot_dictionary:
  ------------------
  |  Branch (713:5): [True: 301k, False: 3.88M]
  ------------------
  714|  1.24M|        for (auto& iter: std::get<QPDF_Dictionary>(obj->value).items) {
  ------------------
  |  Branch (714:24): [True: 1.24M, False: 301k]
  ------------------
  715|  1.24M|            iter.second.disconnect();
  716|  1.24M|        }
  717|   301k|        break;
  718|  46.3k|    case ::ot_stream:
  ------------------
  |  Branch (718:5): [True: 46.3k, False: 4.13M]
  ------------------
  719|  46.3k|        {
  720|  46.3k|            auto& s = std::get<QPDF_Stream>(obj->value);
  721|  46.3k|            s.m->stream_provider = nullptr;
  722|  46.3k|            s.m->stream_dict.disconnect();
  723|  46.3k|        }
  724|  46.3k|        break;
  725|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (725:5): [True: 0, False: 4.18M]
  ------------------
  726|      0|        return;
  727|  3.62M|    default:
  ------------------
  |  Branch (727:5): [True: 3.62M, False: 558k]
  ------------------
  728|  3.62M|        break;
  729|  4.18M|    }
  730|  4.18M|    obj->qpdf = nullptr;
  731|  4.18M|    obj->og = QPDFObjGen();
  732|  4.18M|}
_ZNK16QPDFObjectHandle14isSameObjectAsERKS_:
  736|    263|{
  737|    263|    return obj == rhs.obj;
  738|    263|}
_ZNK4qpdf10BaseHandle9type_nameEv:
  748|  15.5k|{
  749|  15.5k|    static constexpr std::array<char const*, 16> tn{
  750|  15.5k|        "uninitialized",
  751|  15.5k|        "reserved",
  752|  15.5k|        "null",
  753|  15.5k|        "boolean",
  754|  15.5k|        "integer",
  755|  15.5k|        "real",
  756|  15.5k|        "string",
  757|  15.5k|        "name",
  758|  15.5k|        "array",
  759|  15.5k|        "dictionary",
  760|  15.5k|        "stream",
  761|  15.5k|        "operator",
  762|  15.5k|        "inline-image",
  763|  15.5k|        "unresolved",
  764|  15.5k|        "destroyed",
  765|  15.5k|        "reference"};
  766|  15.5k|    return tn[type_code()];
  767|  15.5k|}
_ZNK16QPDFObjectHandle6isBoolEv:
  783|   310k|{
  784|   310k|    return type_code() == ::ot_boolean;
  785|   310k|}
_ZNK16QPDFObjectHandle6isNullEv:
  797|   157k|{
  798|   157k|    return type_code() == ::ot_null;
  799|   157k|}
_ZNK16QPDFObjectHandle9isIntegerEv:
  803|   968k|{
  804|   968k|    return type_code() == ::ot_integer;
  805|   968k|}
_ZNK16QPDFObjectHandle6isRealEv:
  809|   541k|{
  810|   541k|    return type_code() == ::ot_real;
  811|   541k|}
_ZNK16QPDFObjectHandle8isNumberEv:
  815|   398k|{
  816|   398k|    return (isInteger() || isReal());
  ------------------
  |  Branch (816:13): [True: 84.7k, False: 313k]
  |  Branch (816:28): [True: 310k, False: 3.15k]
  ------------------
  817|   398k|}
_ZNK16QPDFObjectHandle15getNumericValueEv:
  821|   169k|{
  822|   169k|    if (isInteger()) {
  ------------------
  |  Branch (822:9): [True: 17.5k, False: 151k]
  ------------------
  823|  17.5k|        return static_cast<double>(getIntValue());
  824|   151k|    } else if (isReal()) {
  ------------------
  |  Branch (824:16): [True: 151k, False: 0]
  ------------------
  825|   151k|        return atof(getRealValue().c_str());
  826|   151k|    } else {
  827|      0|        typeWarning("number", "returning 0");
  828|      0|        QTC::TC("qpdf", "QPDFObjectHandle numeric non-numeric");
  829|      0|        return 0;
  830|      0|    }
  831|   169k|}
_ZNK16QPDFObjectHandle16getValueAsNumberERd:
  835|   169k|{
  836|   169k|    if (!isNumber()) {
  ------------------
  |  Branch (836:9): [True: 413, False: 169k]
  ------------------
  837|    413|        return false;
  838|    413|    }
  839|   169k|    value = getNumericValue();
  840|   169k|    return true;
  841|   169k|}
_ZNK16QPDFObjectHandle6isNameEv:
  845|   214k|{
  846|   214k|    return type_code() == ::ot_name;
  847|   214k|}
_ZNK16QPDFObjectHandle8isStringEv:
  851|   159k|{
  852|   159k|    return type_code() == ::ot_string;
  853|   159k|}
_ZNK16QPDFObjectHandle10isOperatorEv:
  857|  3.81M|{
  858|  3.81M|    return type_code() == ::ot_operator;
  859|  3.81M|}
_ZNK16QPDFObjectHandle7isArrayEv:
  869|  76.5k|{
  870|  76.5k|    return type_code() == ::ot_array;
  871|  76.5k|}
_ZNK16QPDFObjectHandle12isDictionaryEv:
  875|  2.09M|{
  876|  2.09M|    return type_code() == ::ot_dictionary;
  877|  2.09M|}
_ZNK16QPDFObjectHandle8isStreamEv:
  881|   333k|{
  882|   333k|    return type_code() == ::ot_stream;
  883|   333k|}
_ZNK16QPDFObjectHandle8isScalarEv:
  893|   289k|{
  894|   289k|    return isBool() || isInteger() || isName() || isNull() || isReal() || isString();
  ------------------
  |  Branch (894:12): [True: 363, False: 289k]
  |  Branch (894:24): [True: 108k, False: 181k]
  |  Branch (894:39): [True: 43.8k, False: 137k]
  |  Branch (894:51): [True: 61.1k, False: 76.3k]
  |  Branch (894:63): [True: 3.20k, False: 73.1k]
  |  Branch (894:75): [True: 69.6k, False: 3.45k]
  ------------------
  895|   289k|}
_ZNK16QPDFObjectHandle15isNameAndEqualsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  899|  4.07k|{
  900|  4.07k|    return Name(*this) == name;
  901|  4.07k|}
_ZNK16QPDFObjectHandle18isDictionaryOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  905|  1.02M|{
  906|  1.02M|    return isDictionary() && (type.empty() || Name((*this)["/Type"]) == type) &&
  ------------------
  |  Branch (906:12): [True: 305k, False: 715k]
  |  Branch (906:31): [True: 126k, False: 178k]
  |  Branch (906:47): [True: 32.4k, False: 146k]
  ------------------
  907|   159k|        (subtype.empty() || Name((*this)["/Subtype"]) == subtype);
  ------------------
  |  Branch (907:10): [True: 56.9k, False: 102k]
  |  Branch (907:29): [True: 91.5k, False: 10.9k]
  ------------------
  908|  1.02M|}
_ZNK16QPDFObjectHandle14isStreamOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  912|   216k|{
  913|   216k|    if (auto stream = as_stream()) {
  ------------------
  |  Branch (913:14): [True: 37.1k, False: 179k]
  ------------------
  914|  37.1k|        return stream && (type.empty() || stream.Type() == type) &&
  ------------------
  |  Branch (914:16): [True: 37.1k, False: 0]
  |  Branch (914:27): [True: 11.2k, False: 25.8k]
  |  Branch (914:43): [True: 13.8k, False: 11.9k]
  ------------------
  915|  25.1k|            (subtype.empty() || stream.Subtype() == subtype);
  ------------------
  |  Branch (915:14): [True: 13.8k, False: 11.2k]
  |  Branch (915:33): [True: 517, False: 10.7k]
  ------------------
  916|  37.1k|    }
  917|   179k|    return false;
  918|   216k|}
_ZNK16QPDFObjectHandle12getBoolValueEv:
  924|  5.70k|{
  925|  5.70k|    if (auto boolean = as<QPDF_Bool>()) {
  ------------------
  |  Branch (925:14): [True: 5.70k, False: 0]
  ------------------
  926|  5.70k|        return boolean->val;
  927|  5.70k|    } else {
  928|      0|        typeWarning("boolean", "returning false");
  929|      0|        QTC::TC("qpdf", "QPDFObjectHandle boolean returning false");
  930|      0|        return false;
  931|      0|    }
  932|  5.70k|}
_ZN4qpdf7IntegerC2Ex:
  947|  38.0k|    BaseHandle(QPDFObject::create<QPDF_Integer>(value))
  948|  38.0k|{
  949|  38.0k|}
_ZN16QPDFObjectHandle10newIntegerEx:
  953|  4.35k|{
  954|  4.35k|    return {QPDFObject::create<QPDF_Integer>(value)};
  955|  4.35k|}
_ZNK4qpdf7Integer5valueEv:
  959|   174k|{
  960|   174k|    auto* i = as<QPDF_Integer>();
  961|   174k|    if (!i) {
  ------------------
  |  Branch (961:9): [True: 1.17k, False: 173k]
  ------------------
  962|  1.17k|        throw invalid_error("Integer");
  963|  1.17k|    }
  964|   173k|    return i->val;
  965|   174k|}
_ZNK16QPDFObjectHandle11getIntValueEv:
  969|  51.5k|{
  970|  51.5k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (970:20): [True: 51.5k, False: 0]
  ------------------
  971|  51.5k|        return integer;
  972|  51.5k|    } else {
  973|      0|        typeWarning("integer", "returning 0");
  974|      0|        return 0;
  975|      0|    }
  976|  51.5k|}
_ZNK16QPDFObjectHandle13getValueAsIntERx:
  980|  7.36k|{
  981|  7.36k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (981:20): [True: 7.28k, False: 87]
  ------------------
  982|  7.28k|        value = integer;
  983|  7.28k|        return true;
  984|  7.28k|    }
  985|     87|    return false;
  986|  7.36k|}
_ZNK16QPDFObjectHandle16getIntValueAsIntEv:
  990|  48.7k|{
  991|  48.7k|    try {
  992|  48.7k|        return Integer(*this).value<int>();
  993|  48.7k|    } catch (std::invalid_argument&) {
  994|     31|        typeWarning("integer", "returning 0");
  995|     31|        return 0;
  996|     31|    }
  997|  48.7k|}
_ZNK16QPDFObjectHandle13getValueAsIntERi:
 1001|  1.36k|{
 1002|  1.36k|    if (!isInteger()) {
  ------------------
  |  Branch (1002:9): [True: 46, False: 1.31k]
  ------------------
 1003|     46|        return false;
 1004|     46|    }
 1005|  1.31k|    value = getIntValueAsInt();
 1006|  1.31k|    return true;
 1007|  1.36k|}
_ZNK16QPDFObjectHandle12getUIntValueEv:
 1011|  25.0k|{
 1012|  25.0k|    try {
 1013|  25.0k|        return Integer(*this).value<unsigned long long>();
 1014|  25.0k|    } catch (std::invalid_argument&) {
 1015|    723|        typeWarning("integer", "returning 0");
 1016|    723|        return 0;
 1017|    723|    }
 1018|  25.0k|}
_ZNK16QPDFObjectHandle18getUIntValueAsUIntEv:
 1032|  7.48k|{
 1033|  7.48k|    try {
 1034|  7.48k|        return Integer(*this).value<unsigned int>();
 1035|  7.48k|    } catch (std::invalid_argument&) {
 1036|    419|        typeWarning("integer", "returning 0");
 1037|    419|        return 0;
 1038|    419|    }
 1039|  7.48k|}
_ZNK16QPDFObjectHandle14getValueAsUIntERj:
 1043|  1.54k|{
 1044|  1.54k|    if (!isInteger()) {
  ------------------
  |  Branch (1044:9): [True: 176, False: 1.36k]
  ------------------
 1045|    176|        return false;
 1046|    176|    }
 1047|  1.36k|    value = getUIntValueAsUInt();
 1048|  1.36k|    return true;
 1049|  1.54k|}
_ZNK16QPDFObjectHandle12getRealValueEv:
 1055|   151k|{
 1056|   151k|    if (auto* real = as<QPDF_Real>()) {
  ------------------
  |  Branch (1056:15): [True: 151k, False: 0]
  ------------------
 1057|   151k|        return real->val;
 1058|   151k|    }
 1059|      0|    typeWarning("real", "returning 0.0");
 1060|      0|    return "0.0";
 1061|   151k|}
_ZN16QPDFObjectHandle7newNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1077|  11.3k|{
 1078|  11.3k|    return {QPDFObject::create<QPDF_Name>(name)};
 1079|  11.3k|}
_ZN4qpdf4NameC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1087|  55.3k|    BaseHandle(QPDFObject::create<QPDF_Name>(std::move(name)))
 1088|  55.3k|{
 1089|  55.3k|}
_ZNK4qpdf4Name5valueEv:
 1093|   339k|{
 1094|   339k|    auto* n = as<QPDF_Name>();
 1095|   339k|    if (!n) {
  ------------------
  |  Branch (1095:9): [True: 0, False: 339k]
  ------------------
 1096|      0|        throw invalid_error("Name");
 1097|      0|    }
 1098|   339k|    return n->name;
 1099|   339k|}
_ZNK16QPDFObjectHandle7getNameEv:
 1103|  45.7k|{
 1104|  45.7k|    if (auto* name = as<QPDF_Name>()) {
  ------------------
  |  Branch (1104:15): [True: 42.1k, False: 3.64k]
  ------------------
 1105|  42.1k|        return name->name;
 1106|  42.1k|    }
 1107|  3.64k|    typeWarning("name", "returning dummy name");
 1108|  3.64k|    return "/QPDFFakeName";
 1109|  45.7k|}
_ZN16QPDFObjectHandle9newStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1125|  70.5k|{
 1126|  70.5k|    return {QPDFObject::create<QPDF_String>(str)};
 1127|  70.5k|}
_ZN16QPDFObjectHandle16newUnicodeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1131|  1.22k|{
 1132|  1.22k|    return {String::utf16(utf8_str).obj_sp()};
 1133|  1.22k|}
_ZN4qpdf6StringC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1136|    828|    BaseHandle(QPDFObject::create<QPDF_String>(str))
 1137|    828|{
 1138|    828|}
_ZN4qpdf6StringC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1141|    398|    BaseHandle(QPDFObject::create<QPDF_String>(std::move(str)))
 1142|    398|{
 1143|    398|}
_ZN4qpdf6String5utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1147|  1.22k|{
 1148|  1.22k|    std::string result;
 1149|  1.22k|    if (QUtil::utf8_to_pdf_doc(utf8_str, result, '?')) {
  ------------------
  |  Branch (1149:9): [True: 828, False: 398]
  ------------------
 1150|    828|        return String(result);
 1151|    828|    }
 1152|    398|    return String(QUtil::utf8_to_utf16(utf8_str));
 1153|  1.22k|}
_ZNK4qpdf6String5valueEv:
 1157|  3.67k|{
 1158|  3.67k|    auto* s = as<QPDF_String>();
 1159|  3.67k|    if (!s) {
  ------------------
  |  Branch (1159:9): [True: 0, False: 3.67k]
  ------------------
 1160|      0|        throw invalid_error("String");
 1161|      0|    }
 1162|  3.67k|    return s->val;
 1163|  3.67k|}
_ZNK4qpdf6String10utf8_valueEv:
 1167|   272k|{
 1168|   272k|    auto* s = as<QPDF_String>();
 1169|   272k|    if (!s) {
  ------------------
  |  Branch (1169:9): [True: 0, False: 272k]
  ------------------
 1170|      0|        throw invalid_error("String");
 1171|      0|    }
 1172|   272k|    if (util::is_utf16(s->val)) {
  ------------------
  |  Branch (1172:9): [True: 29.5k, False: 243k]
  ------------------
 1173|  29.5k|        return QUtil::utf16_to_utf8(s->val);
 1174|  29.5k|    }
 1175|   243k|    if (util::is_explicit_utf8(s->val)) {
  ------------------
  |  Branch (1175:9): [True: 3.25k, False: 239k]
  ------------------
 1176|       |        // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte representation
 1177|       |        // of U+FEFF.
 1178|  3.25k|        return s->val.substr(3);
 1179|  3.25k|    }
 1180|   239k|    return QUtil::pdf_doc_to_utf8(s->val);
 1181|   243k|}
_ZNK16QPDFObjectHandle14getStringValueEv:
 1185|  3.67k|{
 1186|  3.67k|    try {
 1187|  3.67k|        return String(obj).value();
 1188|  3.67k|    } catch (std::invalid_argument&) {
 1189|      0|        typeWarning("string", "returning empty string");
 1190|      0|        return {};
 1191|      0|    }
 1192|  3.67k|}
_ZNK16QPDFObjectHandle12getUTF8ValueEv:
 1207|   229k|{
 1208|   229k|    try {
 1209|   229k|        return String(obj).utf8_value();
 1210|   229k|    } catch (std::invalid_argument&) {
 1211|      0|        typeWarning("string", "returning empty string");
 1212|      0|        return {};
 1213|      0|    }
 1214|   229k|}
_ZNK16QPDFObjectHandle16getOperatorValueEv:
 1231|  1.49M|{
 1232|  1.49M|    if (auto* op = as<QPDF_Operator>()) {
  ------------------
  |  Branch (1232:15): [True: 1.49M, False: 0]
  ------------------
 1233|  1.49M|        return op->val;
 1234|  1.49M|    }
 1235|      0|    typeWarning("operator", "returning fake value");
 1236|      0|    return "QPDFFAKE";
 1237|  1.49M|}
_ZN16QPDFObjectHandle6aitemsEv:
 1273|  4.27k|{
 1274|  4.27k|    return *this;
 1275|  4.27k|}
_ZNK16QPDFObjectHandle11isOrHasNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1289|  2.15k|{
 1290|  2.15k|    if (isNameAndEquals(value)) {
  ------------------
  |  Branch (1290:9): [True: 122, False: 2.03k]
  ------------------
 1291|    122|        return true;
 1292|  2.03k|    } else if (isArray()) {
  ------------------
  |  Branch (1292:16): [True: 386, False: 1.64k]
  ------------------
 1293|  1.75k|        for (auto& item: getArrayAsVector()) {
  ------------------
  |  Branch (1293:24): [True: 1.75k, False: 372]
  ------------------
 1294|  1.75k|            if (item.isNameAndEquals(value)) {
  ------------------
  |  Branch (1294:17): [True: 14, False: 1.73k]
  ------------------
 1295|     14|                return true;
 1296|     14|            }
 1297|  1.75k|        }
 1298|    386|    }
 1299|  2.01k|    return false;
 1300|  2.15k|}
_ZN16QPDFObjectHandle14mergeResourcesES_PNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS1_IS7_S7_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S7_EEEEEES9_NS5_INSA_ISB_SE_EEEEEE:
 1317|  33.1k|{
 1318|  33.1k|    if (!(isDictionary() && other.isDictionary())) {
  ------------------
  |  Branch (1318:11): [True: 28.1k, False: 5.02k]
  |  Branch (1318:29): [True: 24.8k, False: 3.35k]
  ------------------
 1319|  8.37k|        QTC::TC("qpdf", "QPDFObjectHandle merge top type mismatch");
 1320|  8.37k|        return;
 1321|  8.37k|    }
 1322|       |
 1323|  24.8k|    auto make_og_to_name = [](QPDFObjectHandle& dict,
 1324|  24.8k|                              std::map<QPDFObjGen, std::string>& og_to_name) {
 1325|  24.8k|        for (auto const& [key, value]: dict.as_dictionary()) {
 1326|  24.8k|            if (!value.null() && value.isIndirect()) {
 1327|  24.8k|                og_to_name.insert_or_assign(value.getObjGen(), key);
 1328|  24.8k|            }
 1329|  24.8k|        }
 1330|  24.8k|    };
 1331|       |
 1332|       |    // This algorithm is described in comments in QPDFObjectHandle.hh
 1333|       |    // above the declaration of mergeResources.
 1334|  41.7k|    for (auto const& [rtype, value1]: other.as_dictionary()) {
  ------------------
  |  Branch (1334:37): [True: 41.7k, False: 24.8k]
  ------------------
 1335|  41.7k|        auto other_val = value1;
 1336|  41.7k|        if (hasKey(rtype)) {
  ------------------
  |  Branch (1336:13): [True: 25.1k, False: 16.6k]
  ------------------
 1337|  25.1k|            QPDFObjectHandle this_val = getKey(rtype);
 1338|  25.1k|            if (this_val.isDictionary() && other_val.isDictionary()) {
  ------------------
  |  Branch (1338:17): [True: 19.6k, False: 5.51k]
  |  Branch (1338:44): [True: 19.1k, False: 452]
  ------------------
 1339|  19.1k|                if (this_val.isIndirect()) {
  ------------------
  |  Branch (1339:21): [True: 3.84k, False: 15.3k]
  ------------------
 1340|       |                    // Do this even if there are no keys. Various places in the code call
 1341|       |                    // mergeResources with resource dictionaries that contain empty subdictionaries
 1342|       |                    // just to get this shallow copy functionality.
 1343|  3.84k|                    QTC::TC("qpdf", "QPDFObjectHandle replace with copy");
 1344|  3.84k|                    this_val = replaceKeyAndGetNew(rtype, this_val.shallowCopy());
 1345|  3.84k|                }
 1346|  19.1k|                std::map<QPDFObjGen, std::string> og_to_name;
 1347|  19.1k|                std::set<std::string> rnames;
 1348|  19.1k|                int min_suffix = 1;
 1349|  19.1k|                bool initialized_maps = false;
 1350|   143k|                for (auto const& [key, value2]: other_val.as_dictionary()) {
  ------------------
  |  Branch (1350:47): [True: 143k, False: 19.1k]
  ------------------
 1351|   143k|                    QPDFObjectHandle rval = value2;
 1352|   143k|                    if (!this_val.hasKey(key)) {
  ------------------
  |  Branch (1352:25): [True: 34.1k, False: 109k]
  ------------------
 1353|  34.1k|                        if (!rval.isIndirect()) {
  ------------------
  |  Branch (1353:29): [True: 11.1k, False: 23.0k]
  ------------------
 1354|  11.1k|                            QTC::TC("qpdf", "QPDFObjectHandle merge shallow copy");
 1355|  11.1k|                            rval = rval.shallowCopy();
 1356|  11.1k|                        }
 1357|  34.1k|                        this_val.replaceKey(key, rval);
 1358|   109k|                    } else if (conflicts) {
  ------------------
  |  Branch (1358:32): [True: 0, False: 109k]
  ------------------
 1359|      0|                        if (!initialized_maps) {
  ------------------
  |  Branch (1359:29): [True: 0, False: 0]
  ------------------
 1360|      0|                            make_og_to_name(this_val, og_to_name);
 1361|      0|                            rnames = this_val.getResourceNames();
 1362|      0|                            initialized_maps = true;
 1363|      0|                        }
 1364|      0|                        auto rval_og = rval.getObjGen();
 1365|      0|                        if (rval.isIndirect() && og_to_name.contains(rval_og)) {
  ------------------
  |  Branch (1365:29): [True: 0, False: 0]
  |  Branch (1365:50): [True: 0, False: 0]
  ------------------
 1366|      0|                            QTC::TC("qpdf", "QPDFObjectHandle merge reuse");
 1367|      0|                            auto new_key = og_to_name[rval_og];
 1368|      0|                            if (new_key != key) {
  ------------------
  |  Branch (1368:33): [True: 0, False: 0]
  ------------------
 1369|      0|                                (*conflicts)[rtype][key] = new_key;
 1370|      0|                            }
 1371|      0|                        } else {
 1372|      0|                            QTC::TC("qpdf", "QPDFObjectHandle merge generate");
 1373|      0|                            std::string new_key =
 1374|      0|                                getUniqueResourceName(key + "_", min_suffix, &rnames);
 1375|      0|                            (*conflicts)[rtype][key] = new_key;
 1376|      0|                            this_val.replaceKey(new_key, rval);
 1377|      0|                        }
 1378|      0|                    }
 1379|   143k|                }
 1380|  19.1k|            } else if (this_val.isArray() && other_val.isArray()) {
  ------------------
  |  Branch (1380:24): [True: 2.29k, False: 3.67k]
  |  Branch (1380:46): [True: 2.13k, False: 158]
  ------------------
 1381|  2.13k|                std::set<std::string> scalars;
 1382|  98.8k|                for (auto this_item: this_val.aitems()) {
  ------------------
  |  Branch (1382:36): [True: 98.8k, False: 2.13k]
  ------------------
 1383|  98.8k|                    if (this_item.isScalar()) {
  ------------------
  |  Branch (1383:25): [True: 97.8k, False: 920]
  ------------------
 1384|  97.8k|                        scalars.insert(this_item.unparse());
 1385|  97.8k|                    }
 1386|  98.8k|                }
 1387|   189k|                for (auto other_item: other_val.aitems()) {
  ------------------
  |  Branch (1387:37): [True: 189k, False: 2.13k]
  ------------------
 1388|   189k|                    if (other_item.isScalar()) {
  ------------------
  |  Branch (1388:25): [True: 187k, False: 1.83k]
  ------------------
 1389|   187k|                        if (!scalars.contains(other_item.unparse())) {
  ------------------
  |  Branch (1389:29): [True: 115k, False: 72.5k]
  ------------------
 1390|   115k|                            QTC::TC("qpdf", "QPDFObjectHandle merge array");
 1391|   115k|                            this_val.appendItem(other_item);
 1392|   115k|                        } else {
 1393|  72.5k|                            QTC::TC("qpdf", "QPDFObjectHandle merge array dup");
 1394|  72.5k|                        }
 1395|   187k|                    }
 1396|   189k|                }
 1397|  2.13k|            }
 1398|  25.1k|        } else {
 1399|  16.6k|            QTC::TC("qpdf", "QPDFObjectHandle merge copy from other");
 1400|  16.6k|            replaceKey(rtype, other_val.shallowCopy());
 1401|  16.6k|        }
 1402|  41.7k|    }
 1403|  24.8k|}
_ZNK16QPDFObjectHandle16getResourceNamesEv:
 1407|  16.4k|{
 1408|       |    // Return second-level dictionary keys
 1409|  16.4k|    std::set<std::string> result;
 1410|  45.1k|    for (auto const& item: as_dictionary(strict)) {
  ------------------
  |  Branch (1410:26): [True: 45.1k, False: 16.4k]
  ------------------
 1411|   405k|        for (auto const& [key2, val2]: item.second.as_dictionary(strict)) {
  ------------------
  |  Branch (1411:38): [True: 405k, False: 45.1k]
  ------------------
 1412|   405k|            if (!val2.null()) {
  ------------------
  |  Branch (1412:17): [True: 333k, False: 71.8k]
  ------------------
 1413|   333k|                result.insert(key2);
 1414|   333k|            }
 1415|   405k|        }
 1416|  45.1k|    }
 1417|  16.4k|    return result;
 1418|  16.4k|}
_ZNK16QPDFObjectHandle21getUniqueResourceNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERiPNS0_3setIS6_NS0_4lessIS6_EENS4_IS6_EEEE:
 1423|  16.4k|{
 1424|  16.4k|    std::set<std::string> names = (namesp ? *namesp : getResourceNames());
  ------------------
  |  Branch (1424:36): [True: 0, False: 16.4k]
  ------------------
 1425|  16.4k|    int max_suffix = min_suffix + QIntC::to_int(names.size());
 1426|  16.4k|    while (min_suffix <= max_suffix) {
  ------------------
  |  Branch (1426:12): [True: 16.4k, False: 0]
  ------------------
 1427|  16.4k|        std::string candidate = prefix + std::to_string(min_suffix);
 1428|  16.4k|        if (!names.contains(candidate)) {
  ------------------
  |  Branch (1428:13): [True: 16.4k, False: 10]
  ------------------
 1429|  16.4k|            return candidate;
 1430|  16.4k|        }
 1431|       |        // Increment after return; min_suffix should be the value
 1432|       |        // used, not the next value.
 1433|     10|        ++min_suffix;
 1434|     10|    }
 1435|       |    // This could only happen if there is a coding error.
 1436|       |    // The number of candidates we test is more than the
 1437|       |    // number of keys we're checking against.
 1438|      0|    throw std::logic_error(
 1439|      0|        "unable to find unconflicting name in QPDFObjectHandle::getUniqueResourceName");
 1440|  16.4k|}
_ZN16QPDFObjectHandle26arrayOrStreamToStreamArrayERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_:
 1455|  33.1k|{
 1456|  33.1k|    all_description = description;
 1457|  33.1k|    std::vector<QPDFObjectHandle> result;
 1458|  33.1k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (1458:14): [True: 9.22k, False: 23.9k]
  ------------------
 1459|  9.22k|        int n_items = static_cast<int>(array.size());
 1460|   186k|        for (int i = 0; i < n_items; ++i) {
  ------------------
  |  Branch (1460:25): [True: 177k, False: 9.22k]
  ------------------
 1461|   177k|            QPDFObjectHandle item = array[i];
 1462|   177k|            if (item.isStream()) {
  ------------------
  |  Branch (1462:17): [True: 37.3k, False: 139k]
  ------------------
 1463|  37.3k|                result.emplace_back(item);
 1464|   139k|            } else {
 1465|   139k|                item.warn(
 1466|   139k|                    {qpdf_e_damaged_pdf,
 1467|   139k|                     "",
 1468|   139k|                     description + ": item index " + std::to_string(i) + " (from 0)",
 1469|   139k|                     0,
 1470|   139k|                     "ignoring non-stream in an array of streams"});
 1471|   139k|            }
 1472|   177k|        }
 1473|  23.9k|    } else if (isStream()) {
  ------------------
  |  Branch (1473:16): [True: 8.93k, False: 15.0k]
  ------------------
 1474|  8.93k|        result.emplace_back(*this);
 1475|  15.0k|    } else if (!null()) {
  ------------------
  |  Branch (1475:16): [True: 627, False: 14.3k]
  ------------------
 1476|    627|        warn(
 1477|    627|            {qpdf_e_damaged_pdf,
 1478|    627|             "",
 1479|    627|             description,
 1480|    627|             0,
 1481|    627|             " object is supposed to be a stream or an array of streams but is neither"});
 1482|    627|    }
 1483|       |
 1484|  33.1k|    bool first = true;
 1485|  46.2k|    for (auto const& item: result) {
  ------------------
  |  Branch (1485:26): [True: 46.2k, False: 33.1k]
  ------------------
 1486|  46.2k|        if (first) {
  ------------------
  |  Branch (1486:13): [True: 17.2k, False: 29.0k]
  ------------------
 1487|  17.2k|            first = false;
 1488|  29.0k|        } else {
 1489|  29.0k|            all_description += ",";
 1490|  29.0k|        }
 1491|  46.2k|        all_description += " stream " + item.getObjGen().unparse(' ');
 1492|  46.2k|    }
 1493|       |
 1494|  33.1k|    return result;
 1495|  33.1k|}
_ZN16QPDFObjectHandle15getPageContentsEv:
 1499|  8.10k|{
 1500|  8.10k|    std::string description = "page object " + getObjGen().unparse(' ');
 1501|  8.10k|    std::string all_description;
 1502|  8.10k|    return getKey("/Contents").arrayOrStreamToStreamArray(description, all_description);
 1503|  8.10k|}
_ZN16QPDFObjectHandle15addPageContentsES_b:
 1507|  8.10k|{
 1508|  8.10k|    new_contents.assertStream();
 1509|       |
 1510|  8.10k|    std::vector<QPDFObjectHandle> content_streams;
 1511|  8.10k|    if (first) {
  ------------------
  |  Branch (1511:9): [True: 4.11k, False: 3.98k]
  ------------------
 1512|  4.11k|        QTC::TC("qpdf", "QPDFObjectHandle prepend page contents");
 1513|  4.11k|        content_streams.push_back(new_contents);
 1514|  4.11k|    }
 1515|  8.10k|    for (auto const& iter: getPageContents()) {
  ------------------
  |  Branch (1515:26): [True: 5.13k, False: 8.10k]
  ------------------
 1516|  5.13k|        QTC::TC("qpdf", "QPDFObjectHandle append page contents");
 1517|  5.13k|        content_streams.push_back(iter);
 1518|  5.13k|    }
 1519|  8.10k|    if (!first) {
  ------------------
  |  Branch (1519:9): [True: 3.98k, False: 4.11k]
  ------------------
 1520|  3.98k|        content_streams.push_back(new_contents);
 1521|  3.98k|    }
 1522|       |
 1523|  8.10k|    replaceKey("/Contents", newArray(content_streams));
 1524|  8.10k|}
_ZN16QPDFObjectHandle22coalesceContentStreamsEv:
 1561|  20.3k|{
 1562|  20.3k|    QPDFObjectHandle contents = getKey("/Contents");
 1563|  20.3k|    if (contents.isStream()) {
  ------------------
  |  Branch (1563:9): [True: 4.18k, False: 16.1k]
  ------------------
 1564|  4.18k|        QTC::TC("qpdf", "QPDFObjectHandle coalesce called on stream");
 1565|  4.18k|        return;
 1566|  16.1k|    } else if (!contents.isArray()) {
  ------------------
  |  Branch (1566:16): [True: 11.4k, False: 4.69k]
  ------------------
 1567|       |        // /Contents is optional for pages, and some very damaged files may have pages that are
 1568|       |        // invalid in other ways.
 1569|  11.4k|        return;
 1570|  11.4k|    }
 1571|       |    // Should not be possible for a page object to not have an owning PDF unless it was manually
 1572|       |    // constructed in some incorrect way. However, it can happen in a PDF file whose page structure
 1573|       |    // is direct, which is against spec but still possible to hand construct, as in fuzz issue
 1574|       |    // 27393.
 1575|  4.69k|    QPDF& qpdf = getQPDF("coalesceContentStreams called on object  with no associated PDF file");
 1576|       |
 1577|  4.69k|    QPDFObjectHandle new_contents = newStream(&qpdf);
 1578|  4.69k|    replaceKey("/Contents", new_contents);
 1579|       |
 1580|  4.69k|    auto provider = std::shared_ptr<StreamDataProvider>(new CoalesceProvider(*this, contents));
 1581|  4.69k|    new_contents.replaceStreamData(provider, newNull(), newNull());
 1582|  4.69k|}
_ZNK16QPDFObjectHandle7unparseEv:
 1586|   356k|{
 1587|   356k|    if (isIndirect()) {
  ------------------
  |  Branch (1587:9): [True: 2.96k, False: 353k]
  ------------------
 1588|  2.96k|        return getObjGen().unparse(' ') + " R";
 1589|   353k|    } else {
 1590|   353k|        return unparseResolved();
 1591|   353k|    }
 1592|   356k|}
_ZNK16QPDFObjectHandle15unparseResolvedEv:
 1596|   353k|{
 1597|   353k|    if (!obj) {
  ------------------
  |  Branch (1597:9): [True: 0, False: 353k]
  ------------------
 1598|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1599|      0|    }
 1600|   353k|    return BaseHandle::unparse();
 1601|   353k|}
_ZNK16QPDFObjectHandle7getJSONEib:
 1615|  17.6k|{
 1616|  17.6k|    if ((!dereference_indirect) && isIndirect()) {
  ------------------
  |  Branch (1616:9): [True: 0, False: 17.6k]
  |  Branch (1616:36): [True: 0, False: 0]
  ------------------
 1617|      0|        return JSON::makeString(unparse());
 1618|  17.6k|    } else if (!obj) {
  ------------------
  |  Branch (1618:16): [True: 0, False: 17.6k]
  ------------------
 1619|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1620|  17.6k|    } else {
 1621|  17.6k|        Pl_Buffer p{"json"};
 1622|  17.6k|        JSON::Writer jw{&p, 0};
 1623|  17.6k|        writeJSON(json_version, jw, dereference_indirect);
 1624|  17.6k|        p.finish();
 1625|  17.6k|        return JSON::parse(p.getString());
 1626|  17.6k|    }
 1627|  17.6k|}
_ZNK16QPDFObjectHandle9writeJSONEiRN4JSON6WriterEb:
 1631|   203k|{
 1632|   203k|    if (!dereference_indirect && isIndirect()) {
  ------------------
  |  Branch (1632:9): [True: 185k, False: 17.6k]
  |  Branch (1632:34): [True: 45.6k, False: 140k]
  ------------------
 1633|  45.6k|        p << "\"" << getObjGen().unparse(' ') << " R\"";
 1634|   157k|    } else if (!obj) {
  ------------------
  |  Branch (1634:16): [True: 0, False: 157k]
  ------------------
 1635|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1636|   157k|    } else {
 1637|   157k|        write_json(json_version, p);
 1638|   157k|    }
 1639|   203k|}
_ZN16QPDFObjectHandle18pipeContentStreamsEP8PipelineRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERS8_:
 1699|  25.0k|{
 1700|  25.0k|    bool need_newline = false;
 1701|  25.0k|    std::string buffer;
 1702|  25.0k|    pl::String buf(buffer);
 1703|  38.8k|    for (auto stream: arrayOrStreamToStreamArray(description, all_description)) {
  ------------------
  |  Branch (1703:21): [True: 38.8k, False: 23.9k]
  ------------------
 1704|  38.8k|        if (need_newline) {
  ------------------
  |  Branch (1704:13): [True: 14.2k, False: 24.5k]
  ------------------
 1705|  14.2k|            buf.writeCStr("\n");
 1706|  14.2k|        }
 1707|  38.8k|        if (!stream.pipeStreamData(&buf, 0, qpdf_dl_specialized)) {
  ------------------
  |  Branch (1707:13): [True: 1.12k, False: 37.6k]
  ------------------
 1708|  1.12k|            QTC::TC("qpdf", "QPDFObjectHandle errors in parsecontent");
 1709|  1.12k|            throw QPDFExc(
 1710|  1.12k|                qpdf_e_damaged_pdf,
 1711|  1.12k|                "content stream",
 1712|  1.12k|                "content stream object " + stream.getObjGen().unparse(' '),
 1713|  1.12k|                0,
 1714|  1.12k|                "errors while decoding content stream");
 1715|  1.12k|        }
 1716|  37.6k|        need_newline = buffer.empty() || buffer.back() != '\n';
  ------------------
  |  Branch (1716:24): [True: 3.51k, False: 34.1k]
  |  Branch (1716:42): [True: 13.9k, False: 20.2k]
  ------------------
 1717|  37.6k|        QTC::TC("qpdf", "QPDFObjectHandle need_newline", need_newline ? 0 : 1);
  ------------------
  |  Branch (1717:58): [True: 17.1k, False: 20.5k]
  ------------------
 1718|  37.6k|        p->writeString(buffer);
 1719|  37.6k|        buffer.clear();
 1720|  37.6k|    }
 1721|  23.9k|    p->finish();
 1722|  23.9k|}
_ZN16QPDFObjectHandle17parsePageContentsEPNS_15ParserCallbacksE:
 1726|  20.3k|{
 1727|  20.3k|    std::string description = "page object " + getObjGen().unparse(' ');
 1728|  20.3k|    getKey("/Contents").parseContentStream_internal(description, callbacks);
 1729|  20.3k|}
_ZN16QPDFObjectHandle27parseContentStream_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPNS_15ParserCallbacksE:
 1763|  20.3k|{
 1764|  20.3k|    std::string stream_data;
 1765|  20.3k|    pl::String buf(stream_data);
 1766|  20.3k|    std::string all_description;
 1767|  20.3k|    pipeContentStreams(&buf, description, all_description);
 1768|  20.3k|    if (callbacks) {
  ------------------
  |  Branch (1768:9): [True: 0, False: 20.3k]
  ------------------
 1769|      0|        callbacks->contentSize(stream_data.size());
 1770|      0|    }
 1771|  20.3k|    try {
 1772|  20.3k|        parseContentStream_data(stream_data, all_description, callbacks, getOwningQPDF());
 1773|  20.3k|    } catch (TerminateParsing&) {
 1774|      0|        return;
 1775|      0|    }
 1776|  19.0k|    if (callbacks) {
  ------------------
  |  Branch (1776:9): [True: 0, False: 19.0k]
  ------------------
 1777|      0|        callbacks->handleEOF();
 1778|      0|    }
 1779|  19.0k|}
_ZN16QPDFObjectHandle23parseContentStream_dataENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEERKNS0_12basic_stringIcS3_NS0_9allocatorIcEEEEPNS_15ParserCallbacksEP4QPDF:
 1787|  19.0k|{
 1788|  19.0k|    size_t stream_length = stream_data.size();
 1789|  19.0k|    auto input = is::OffsetBuffer(description, stream_data);
 1790|  19.0k|    Tokenizer tokenizer;
 1791|  19.0k|    tokenizer.allowEOF();
 1792|  19.0k|    auto max_bad_count = Limits::parser_max_errors();
 1793|  19.0k|    auto sp_description = Parser::make_description(description, "content");
 1794|  3.83M|    while (QIntC::to_size(input.tell()) < stream_length) {
  ------------------
  |  Branch (1794:12): [True: 3.81M, False: 12.6k]
  ------------------
 1795|       |        // Read a token and seek to the beginning. The offset we get from this process is the
 1796|       |        // beginning of the next non-ignorable (space, comment) token. This way, the offset and
 1797|       |        // don't including ignorable content.
 1798|  3.81M|        tokenizer.nextToken(input, "content", true);
 1799|  3.81M|        qpdf_offset_t offset = input.getLastOffset();
 1800|  3.81M|        input.seek(offset, SEEK_SET);
 1801|  3.81M|        auto [obj, empty] = Parser::parse_content(input, sp_description, tokenizer, context);
 1802|  3.81M|        if (empty) {
  ------------------
  |  Branch (1802:13): [True: 6.10k, False: 3.81M]
  ------------------
 1803|       |            // EOF
 1804|  6.10k|            return;
 1805|  6.10k|        }
 1806|  3.81M|        if (!obj) {
  ------------------
  |  Branch (1806:13): [True: 6.16k, False: 3.80M]
  ------------------
 1807|  6.16k|            if (max_bad_count && --max_bad_count == 0) {
  ------------------
  |  Branch (1807:17): [True: 6.16k, False: 0]
  |  Branch (1807:34): [True: 227, False: 5.93k]
  ------------------
 1808|    227|                Limits::error();
 1809|    227|                warn(
 1810|    227|                    context,
 1811|    227|                    {qpdf_e_damaged_pdf,
 1812|    227|                     description,
 1813|    227|                     "stream data",
 1814|    227|                     input.tell(),
 1815|    227|                     "limits error(parser-max-errors): too many errors during content stream "
 1816|    227|                     "parsing"});
 1817|    227|                return;
 1818|    227|            }
 1819|  5.93k|            obj = newNull();
 1820|  5.93k|        }
 1821|  3.81M|        size_t length = QIntC::to_size(input.tell() - offset);
 1822|  3.81M|        if (callbacks) {
  ------------------
  |  Branch (1822:13): [True: 0, False: 3.81M]
  ------------------
 1823|      0|            callbacks->handleObject(obj, QIntC::to_size(offset), length);
 1824|      0|        }
 1825|  3.81M|        if (obj.isOperator() && obj.getOperatorValue() == "ID") {
  ------------------
  |  Branch (1825:13): [True: 1.49M, False: 2.32M]
  |  Branch (1825:13): [True: 1.91k, False: 3.81M]
  |  Branch (1825:33): [True: 1.91k, False: 1.48M]
  ------------------
 1826|       |            // Discard next character; it is the space after ID that terminated the token.  Read
 1827|       |            // until end of inline image.
 1828|  1.91k|            char ch;
 1829|  1.91k|            input.read(&ch, 1);
 1830|  1.91k|            tokenizer.expectInlineImage(input);
 1831|  1.91k|            tokenizer.nextToken(input, description);
 1832|  1.91k|            offset = input.getLastOffset();
 1833|  1.91k|            length = QIntC::to_size(input.tell() - offset);
 1834|  1.91k|            if (tokenizer.getType() == QPDFTokenizer::tt_bad) {
  ------------------
  |  Branch (1834:17): [True: 119, False: 1.79k]
  ------------------
 1835|    119|                QTC::TC("qpdf", "QPDFObjectHandle EOF in inline image");
 1836|    119|                warn(
 1837|    119|                    context,
 1838|    119|                    {qpdf_e_damaged_pdf,
 1839|    119|                     description,
 1840|    119|                     "stream data",
 1841|    119|                     input.tell(),
 1842|    119|                     "EOF found while reading inline image"});
 1843|  1.79k|            } else {
 1844|  1.79k|                QTC::TC("qpdf", "QPDFObjectHandle inline image token");
 1845|  1.79k|                if (callbacks) {
  ------------------
  |  Branch (1845:21): [True: 0, False: 1.79k]
  ------------------
 1846|      0|                    callbacks->handleObject(
 1847|      0|                        QPDFObjectHandle::newInlineImage(tokenizer.getValue()),
 1848|      0|                        QIntC::to_size(offset),
 1849|      0|                        length);
 1850|      0|                }
 1851|  1.79k|            }
 1852|  1.91k|        }
 1853|  3.81M|    }
 1854|  19.0k|}
_ZN16QPDFObjectHandle7newNullEv:
 1895|   110k|{
 1896|   110k|    return {QPDFObject::create<QPDF_Null>()};
 1897|   110k|}
_ZN16QPDFObjectHandle7newRealEdib:
 1907|  66.7k|{
 1908|  66.7k|    return {QPDFObject::create<QPDF_Real>(value, decimal_places, trim_trailing_zeroes)};
 1909|  66.7k|}
_ZN16QPDFObjectHandle8newArrayERKNSt3__16vectorIS_NS0_9allocatorIS_EEEE:
 1931|  25.3k|{
 1932|  25.3k|    return {QPDFObject::create<QPDF_Array>(items)};
 1933|  25.3k|}
_ZN16QPDFObjectHandle8newArrayERKNS_9RectangleE:
 1937|  16.6k|{
 1938|  16.6k|    return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)});
 1939|  16.6k|}
_ZN16QPDFObjectHandle16newFromRectangleERKNS_9RectangleE:
 1967|  7.10k|{
 1968|  7.10k|    return newArray(rect);
 1969|  7.10k|}
_ZN16QPDFObjectHandle13newDictionaryEv:
 1985|  22.6k|{
 1986|  22.6k|    return newDictionary(std::map<std::string, QPDFObjectHandle>());
 1987|  22.6k|}
_ZN16QPDFObjectHandle13newDictionaryERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S_EEEEEE:
 1991|  22.6k|{
 1992|  22.6k|    return {QPDFObject::create<QPDF_Dictionary>(items)};
 1993|  22.6k|}
_ZN16QPDFObjectHandle9newStreamEP4QPDF:
 1997|  4.69k|{
 1998|  4.69k|    if (qpdf == nullptr) {
  ------------------
  |  Branch (1998:9): [True: 0, False: 4.69k]
  ------------------
 1999|      0|        throw std::runtime_error("attempt to create stream in null qpdf object");
 2000|      0|    }
 2001|  4.69k|    QTC::TC("qpdf", "QPDFObjectHandle newStream");
 2002|  4.69k|    return qpdf->newStream();
 2003|  4.69k|}
_ZNK4qpdf10BaseHandle11descriptionEv:
 2036|   203k|{
 2037|   203k|    return obj ? obj->getDescription() : ""s;
  ------------------
  |  Branch (2037:12): [True: 203k, False: 0]
  ------------------
 2038|   203k|}
_ZN16QPDFObjectHandle20setObjectDescriptionEP4QPDFRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2042|  28.1k|{
 2043|  28.1k|    if (obj) {
  ------------------
  |  Branch (2043:9): [True: 28.1k, False: 0]
  ------------------
 2044|  28.1k|        auto descr = std::make_shared<QPDFObject::Description>(object_description);
 2045|  28.1k|        obj->setDescription(owning_qpdf, descr);
 2046|  28.1k|    }
 2047|  28.1k|}
_ZNK16QPDFObjectHandle20hasObjectDescriptionEv:
 2051|  60.1k|{
 2052|  60.1k|    return obj && obj->hasDescription();
  ------------------
  |  Branch (2052:12): [True: 60.1k, False: 0]
  |  Branch (2052:19): [True: 32.0k, False: 28.1k]
  ------------------
 2053|  60.1k|}
_ZN16QPDFObjectHandle11shallowCopyEv:
 2057|  37.9k|{
 2058|  37.9k|    if (!obj) {
  ------------------
  |  Branch (2058:9): [True: 0, False: 37.9k]
  ------------------
 2059|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2060|      0|    }
 2061|  37.9k|    return {copy()};
 2062|  37.9k|}
_ZNK4qpdf10BaseHandle13invalid_errorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2137|  1.17k|{
 2138|  1.17k|    return std::invalid_argument(method + " operation attempted on invalid object");
 2139|  1.17k|}
_ZNK4qpdf10BaseHandle10type_errorEPKcRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 2149|  15.5k|{
 2150|  15.5k|    return {
 2151|  15.5k|        qpdf_e_object,
 2152|  15.5k|        "",
 2153|  15.5k|        description(),
 2154|  15.5k|        0,
 2155|  15.5k|        "operation for "s + expected_type + " attempted on object of type " + type_name() + ": " +
 2156|  15.5k|            message};
 2157|  15.5k|}
_ZNK16QPDFObjectHandle11typeWarningEPKcRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2161|  15.5k|{
 2162|  15.5k|    if (!obj) {
  ------------------
  |  Branch (2162:9): [True: 0, False: 15.5k]
  ------------------
 2163|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 2164|      0|    }
 2165|  15.5k|    warn(type_error(expected_type, message));
 2166|  15.5k|}
_ZNK16QPDFObjectHandle10assertTypeEPKcb:
 2182|  8.10k|{
 2183|  8.10k|    if (!istype) {
  ------------------
  |  Branch (2183:9): [True: 0, False: 8.10k]
  ------------------
 2184|      0|        throw type_error(type_name);
 2185|      0|    }
 2186|  8.10k|}
_ZNK16QPDFObjectHandle12assertStreamEv:
 2250|  8.10k|{
 2251|  8.10k|    assertType("stream", isStream());
 2252|  8.10k|}
_ZNK16QPDFObjectHandle13isFormXObjectEv:
 2305|  78.9k|{
 2306|  78.9k|    return isStreamOfType("", "/Form");
 2307|  78.9k|}
_ZNK16QPDFObjectHandle7isImageEb:
 2311|  14.1k|{
 2312|  14.1k|    return (
 2313|  14.1k|        isStreamOfType("", "/Image") &&
  ------------------
  |  Branch (2313:9): [True: 517, False: 13.6k]
  ------------------
 2314|    517|        ((!exclude_imagemask) ||
  ------------------
  |  Branch (2314:10): [True: 0, False: 517]
  ------------------
 2315|    517|         (!(getDict().getKey("/ImageMask").isBool() &&
  ------------------
  |  Branch (2315:13): [True: 351, False: 166]
  ------------------
 2316|    351|            getDict().getKey("/ImageMask").getBoolValue()))));
  ------------------
  |  Branch (2316:13): [True: 351, False: 0]
  ------------------
 2317|  14.1k|}
_ZN4qpdf10BaseHandle4warnEP4QPDFO7QPDFExc:
 2329|    346|{
 2330|    346|    if (!qpdf) {
  ------------------
  |  Branch (2330:9): [True: 0, False: 346]
  ------------------
 2331|      0|        throw std::move(e);
 2332|      0|    }
 2333|    346|    qpdf->warn(std::move(e));
 2334|    346|}
_ZNK4qpdf10BaseHandle4warnEO7QPDFExc:
 2338|   344k|{
 2339|   344k|    if (!qpdf()) {
  ------------------
  |  Branch (2339:9): [True: 591, False: 343k]
  ------------------
 2340|    591|        throw std::move(e);
 2341|    591|    }
 2342|   343k|    qpdf()->warn(std::move(e));
 2343|   343k|}
_ZNK4qpdf10BaseHandle4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2347|   223k|{
 2348|   223k|    if (qpdf()) {
  ------------------
  |  Branch (2348:9): [True: 188k, False: 35.7k]
  ------------------
 2349|   188k|        warn({qpdf_e_damaged_pdf, "", description(), 0, warning});
 2350|   188k|    } else {
 2351|  35.7k|        *QPDFLogger::defaultLogger()->getError() << warning << "\n";
 2352|  35.7k|    }
 2353|   223k|}
_ZN16QPDFObjectHandle14QPDFArrayItemsC2ERKS_:
 2441|  4.27k|    oh(oh)
 2442|  4.27k|{
 2443|  4.27k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorppEv:
 2447|   288k|{
 2448|   288k|    if (!m->is_end) {
  ------------------
  |  Branch (2448:9): [True: 288k, False: 0]
  ------------------
 2449|   288k|        ++m->item_number;
 2450|   288k|        updateIValue();
 2451|   288k|    }
 2452|   288k|    return *this;
 2453|   288k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratordeEv:
 2467|   288k|{
 2468|   288k|    updateIValue();
 2469|   288k|    return ivalue;
 2470|   288k|}
_ZNK16QPDFObjectHandle14QPDFArrayItems8iteratoreqERKS1_:
 2481|   292k|{
 2482|   292k|    return (m->item_number == other.m->item_number);
 2483|   292k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorC2ERS_b:
 2486|  8.54k|    m(new Members(oh, for_begin))
 2487|  8.54k|{
 2488|  8.54k|    updateIValue();
 2489|  8.54k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iterator12updateIValueEv:
 2493|   585k|{
 2494|   585k|    m->is_end = (m->item_number >= m->oh.getArrayNItems());
 2495|   585k|    if (m->is_end) {
  ------------------
  |  Branch (2495:9): [True: 8.54k, False: 576k]
  ------------------
 2496|  8.54k|        ivalue = QPDFObjectHandle();
 2497|   576k|    } else {
 2498|   576k|        ivalue = m->oh.getArrayItem(m->item_number);
 2499|   576k|    }
 2500|   585k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iterator7MembersC2ERS_b:
 2503|  8.54k|    oh(oh)
 2504|  8.54k|{
 2505|  8.54k|    item_number = for_begin ? 0 : oh.getArrayNItems();
  ------------------
  |  Branch (2505:19): [True: 4.27k, False: 4.27k]
  ------------------
 2506|  8.54k|}
_ZN16QPDFObjectHandle14QPDFArrayItems5beginEv:
 2510|  4.27k|{
 2511|  4.27k|    return {oh, true};
 2512|  4.27k|}
_ZN16QPDFObjectHandle14QPDFArrayItems3endEv:
 2516|  4.27k|{
 2517|  4.27k|    return {oh, false};
 2518|  4.27k|}
_ZNK16QPDFObjectHandle9getObjGenEv:
 2522|   921k|{
 2523|   921k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (2523:12): [True: 921k, False: 0]
  ------------------
 2524|   921k|}
_ZNK16QPDFObjectHandle11getObjectIDEv:
 2528|   675k|{
 2529|   675k|    return getObjGen().getObj();
 2530|   675k|}
_ZNK16QPDFObjectHandle10isIndirectEv:
 2540|   666k|{
 2541|   666k|    return getObjectID() != 0;
 2542|   666k|}
_ZNK16QPDFObjectHandle13getOwningQPDFEv:
 2547|   471k|{
 2548|   471k|    return obj ? obj->getQPDF() : nullptr;
  ------------------
  |  Branch (2548:12): [True: 471k, False: 0]
  ------------------
 2549|   471k|}
_ZNK16QPDFObjectHandle7getQPDFERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2553|  4.69k|{
 2554|  4.69k|    if (auto result = obj ? obj->getQPDF() : nullptr) {
  ------------------
  |  Branch (2554:14): [True: 4.69k, False: 0]
  ------------------
 2555|  4.69k|        return *result;
 2556|  4.69k|    }
 2557|      0|    throw std::runtime_error(error_msg.empty() ? "attempt to use a null qpdf object" : error_msg);
  ------------------
  |  Branch (2557:30): [True: 0, False: 0]
  ------------------
 2558|  4.69k|}
_ZN16QPDFObjectHandle15setParsedOffsetEx:
 2562|     19|{
 2563|     19|    if (obj) {
  ------------------
  |  Branch (2563:9): [True: 19, False: 0]
  ------------------
 2564|     19|        obj->setParsedOffset(offset);
 2565|     19|    }
 2566|     19|}
QPDFObjectHandle.cc:_ZN12_GLOBAL__N_116CoalesceProviderC2E16QPDFObjectHandleS1_:
   95|  4.69k|            containing_page(containing_page),
   96|  4.69k|            old_contents(old_contents)
   97|  4.69k|        {
   98|  4.69k|        }
QPDFObjectHandle.cc:_ZN12_GLOBAL__N_116CoalesceProviderD2Ev:
   99|  4.69k|        ~CoalesceProvider() override = default;
QPDFObjectHandle.cc:_ZN12_GLOBAL__N_116CoalesceProvider17provideStreamDataERK10QPDFObjGenP8Pipeline:
  110|  4.69k|{
  111|  4.69k|    QTC::TC("qpdf", "QPDFObjectHandle coalesce provide stream data");
  112|  4.69k|    std::string description = "page object " + containing_page.getObjGen().unparse(' ');
  113|  4.69k|    std::string all_description;
  114|  4.69k|    old_contents.pipeContentStreams(p, description, all_description);
  115|  4.69k|}

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

_ZN25QPDFOutlineDocumentHelper8Accessor9checkSeenERS_10QPDFObjGen:
   23|  5.55k|{
   24|  5.55k|    return !dh.m->seen.add(og);
   25|  5.55k|}
_ZN25QPDFOutlineDocumentHelperC2ER4QPDF:
   28|  11.6k|    QPDFDocumentHelper(qpdf),
   29|  11.6k|    m(std::make_shared<Members>())
   30|  11.6k|{
   31|  11.6k|    validate();
   32|  11.6k|}
_ZN25QPDFOutlineDocumentHelper8validateEb:
   42|  11.6k|{
   43|  11.6k|    m->outlines.clear();
   44|  11.6k|    m->names_dest = nullptr;
   45|       |
   46|  11.6k|    QPDFObjectHandle root = qpdf.getRoot();
   47|  11.6k|    if (!root.hasKey("/Outlines")) {
  ------------------
  |  Branch (47:9): [True: 10.8k, False: 780]
  ------------------
   48|  10.8k|        return;
   49|  10.8k|    }
   50|    780|    auto outlines = root.getKey("/Outlines");
   51|    780|    if (!(outlines.isDictionary() && outlines.hasKey("/First"))) {
  ------------------
  |  Branch (51:9): [True: 23, False: 757]
  |  Branch (51:11): [True: 768, False: 12]
  |  Branch (51:38): [True: 757, False: 11]
  ------------------
   52|     23|        return;
   53|     23|    }
   54|    757|    QPDFObjectHandle cur = outlines.getKey("/First");
   55|    757|    QPDFObjGen::set seen;
   56|  2.50k|    while (!cur.null()) {
  ------------------
  |  Branch (56:12): [True: 1.80k, False: 702]
  ------------------
   57|  1.80k|        if (!seen.add(cur)) {
  ------------------
  |  Branch (57:13): [True: 55, False: 1.74k]
  ------------------
   58|     55|            cur.warn("Loop detected loop in /Outlines tree");
   59|     55|            return;
   60|     55|        }
   61|  1.74k|        m->outlines.emplace_back(QPDFOutlineObjectHelper::Accessor::create(cur, *this, 1));
   62|  1.74k|        cur = cur.getKey("/Next");
   63|  1.74k|    }
   64|    757|}
_ZN25QPDFOutlineDocumentHelper16initializeByPageEv:
   80|  16.3k|{
   81|  16.3k|    std::list<QPDFOutlineObjectHelper> queue;
   82|  16.3k|    queue.insert(queue.end(), m->outlines.begin(), m->outlines.end());
   83|       |
   84|  22.1k|    while (!queue.empty()) {
  ------------------
  |  Branch (84:12): [True: 5.78k, False: 16.3k]
  ------------------
   85|  5.78k|        QPDFOutlineObjectHelper oh = queue.front();
   86|  5.78k|        queue.pop_front();
   87|  5.78k|        m->by_page[oh.getDestPage().getObjGen()].push_back(oh);
   88|  5.78k|        std::vector<QPDFOutlineObjectHelper> kids = oh.getKids();
   89|  5.78k|        queue.insert(queue.end(), kids.begin(), kids.end());
   90|  5.78k|    }
   91|  16.3k|}
_ZN25QPDFOutlineDocumentHelper18getOutlinesForPageE10QPDFObjGen:
   95|  17.5k|{
   96|  17.5k|    if (m->by_page.empty()) {
  ------------------
  |  Branch (96:9): [True: 16.3k, False: 1.16k]
  ------------------
   97|  16.3k|        initializeByPage();
   98|  16.3k|    }
   99|  17.5k|    if (m->by_page.contains(og)) {
  ------------------
  |  Branch (99:9): [True: 257, False: 17.3k]
  ------------------
  100|    257|        return m->by_page[og];
  101|    257|    }
  102|  17.3k|    return {};
  103|  17.5k|}
_ZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandle:
  107|  1.63k|{
  108|  1.63k|    QPDFObjectHandle result;
  109|  1.63k|    if (name.isName()) {
  ------------------
  |  Branch (109:9): [True: 113, False: 1.52k]
  ------------------
  110|    113|        if (!m->dest_dict) {
  ------------------
  |  Branch (110:13): [True: 31, False: 82]
  ------------------
  111|     31|            m->dest_dict = qpdf.getRoot().getKey("/Dests");
  112|     31|        }
  113|    113|        result = m->dest_dict.getKeyIfDict(name.getName());
  114|  1.52k|    } else if (name.isString()) {
  ------------------
  |  Branch (114:16): [True: 1.52k, False: 0]
  ------------------
  115|  1.52k|        if (!m->names_dest) {
  ------------------
  |  Branch (115:13): [True: 726, False: 794]
  ------------------
  116|    726|            auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
  117|    726|            if (dests.isDictionary()) {
  ------------------
  |  Branch (117:17): [True: 528, False: 198]
  ------------------
  118|    528|                m->names_dest = std::make_unique<QPDFNameTreeObjectHelper>(
  119|    528|                    dests,
  120|    528|                    qpdf,
  121|    528|                    [](QPDFObjectHandle const& o) -> bool {
  122|    528|                        return o.isArray() || o.contains("/D");
  123|    528|                    },
  124|    528|                    true);
  125|    528|                m->names_dest->validate();
  126|    528|            }
  127|    726|        }
  128|  1.52k|        if (m->names_dest) {
  ------------------
  |  Branch (128:13): [True: 1.22k, False: 294]
  ------------------
  129|  1.22k|            if (m->names_dest->findObject(name.getUTF8Value(), result)) {
  ------------------
  |  Branch (129:17): [True: 143, False: 1.08k]
  ------------------
  130|    143|                QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest");
  131|    143|            }
  132|  1.22k|        }
  133|  1.52k|    }
  134|  1.63k|    if (!result) {
  ------------------
  |  Branch (134:9): [True: 897, False: 736]
  ------------------
  135|    897|        return QPDFObjectHandle::newNull();
  136|    897|    }
  137|    736|    if (result.isDictionary()) {
  ------------------
  |  Branch (137:9): [True: 80, False: 656]
  ------------------
  138|     80|        return result.getKey("/D");
  139|     80|    }
  140|    656|    return result;
  141|    736|}
_ZN25QPDFOutlineDocumentHelper7MembersC2Ev:
   10|  11.6k|    Members() = default;
_ZN25QPDFOutlineDocumentHelper7MembersD2Ev:
   12|  11.6k|    ~Members() = default;
QPDFOutlineDocumentHelper.cc:_ZZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandleENK3$_0clERKS0_:
  121|  30.5k|                    [](QPDFObjectHandle const& o) -> bool {
  122|  30.5k|                        return o.isArray() || o.contains("/D");
  ------------------
  |  Branch (122:32): [True: 7.52k, False: 23.0k]
  |  Branch (122:47): [True: 22.3k, False: 670]
  ------------------
  123|  30.5k|                    },

_ZN23QPDFOutlineObjectHelper7MembersC2ER25QPDFOutlineDocumentHelper:
    8|  5.55k|    dh(dh)
    9|  5.55k|{
   10|  5.55k|}
_ZN23QPDFOutlineObjectHelperC2E16QPDFObjectHandleR25QPDFOutlineDocumentHelperi:
   14|  5.55k|    QPDFObjectHelper(a_oh),
   15|  5.55k|    m(new Members(dh))
   16|  5.55k|{
   17|  5.55k|    if (depth > 50) {
  ------------------
  |  Branch (17:9): [True: 0, False: 5.55k]
  ------------------
   18|       |        // Not exercised in test suite, but was tested manually by temporarily changing max depth
   19|       |        // to 1.
   20|      0|        return;
   21|      0|    }
   22|  5.55k|    if (QPDFOutlineDocumentHelper::Accessor::checkSeen(m->dh, a_oh.getObjGen())) {
  ------------------
  |  Branch (22:9): [True: 1.80k, False: 3.75k]
  ------------------
   23|  1.80k|        a_oh.warn("Loop detected loop in /Outlines tree");
   24|  1.80k|        return;
   25|  1.80k|    }
   26|       |
   27|  3.75k|    QPDFObjGen::set children;
   28|  3.75k|    QPDFObjectHandle cur = a_oh.getKey("/First");
   29|  7.56k|    while (!cur.null() && cur.isIndirect()) {
  ------------------
  |  Branch (29:12): [True: 4.06k, False: 3.49k]
  |  Branch (29:27): [True: 4.00k, False: 68]
  ------------------
   30|  4.00k|        if (!children.add(cur)) {
  ------------------
  |  Branch (30:13): [True: 191, False: 3.80k]
  ------------------
   31|    191|            cur.warn("Loop detected loop in /Outlines tree");
   32|    191|            break;
   33|    191|        }
   34|  3.80k|        QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth);
   35|  3.80k|        new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this);
   36|  3.80k|        m->kids.emplace_back(new_ooh);
   37|  3.80k|        cur = cur.getKey("/Next");
   38|  3.80k|    }
   39|  3.75k|}
_ZN23QPDFOutlineObjectHelper7getKidsEv:
   49|  5.30k|{
   50|  5.30k|    return m->kids;
   51|  5.30k|}
_ZN23QPDFOutlineObjectHelper7getDestEv:
   55|  5.78k|{
   56|  5.78k|    auto dest = get("/Dest");
   57|  5.78k|    if (dest.null()) {
  ------------------
  |  Branch (57:9): [True: 4.27k, False: 1.50k]
  ------------------
   58|  4.27k|        auto const& A = get("/A");
   59|  4.27k|        if (Name(A["/S"]) == "/GoTo") {
  ------------------
  |  Branch (59:13): [True: 1.90k, False: 2.37k]
  ------------------
   60|  1.90k|            dest = A["/D"];
   61|  1.90k|        }
   62|  4.27k|    }
   63|  5.78k|    if (dest.null()) {
  ------------------
  |  Branch (63:9): [True: 2.41k, False: 3.36k]
  ------------------
   64|  2.41k|        return QPDFObjectHandle::newNull();
   65|  2.41k|    }
   66|  3.36k|    if (dest.isName() || dest.isString()) {
  ------------------
  |  Branch (66:9): [True: 113, False: 3.25k]
  |  Branch (66:26): [True: 1.52k, False: 1.73k]
  ------------------
   67|  1.63k|        return m->dh.resolveNamedDest(dest);
   68|  1.63k|    }
   69|  1.73k|    return dest;
   70|  3.36k|}
_ZN23QPDFOutlineObjectHelper11getDestPageEv:
   74|  5.78k|{
   75|  5.78k|    QPDFObjectHandle dest = getDest();
   76|  5.78k|    if (!dest.empty() && dest.isArray()) {
  ------------------
  |  Branch (76:9): [True: 1.84k, False: 3.94k]
  |  Branch (76:26): [True: 1.75k, False: 84]
  ------------------
   77|  1.75k|        return dest.getArrayItem(0);
   78|  1.75k|    }
   79|  4.02k|    return QPDFObjectHandle::newNull();
   80|  5.78k|}

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

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

_ZN4qpdf4impl6Parser13parse_contentER11InputSourceNSt3__110shared_ptrINS4_7variantIJNS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEN10QPDFObject10JSON_DescrENSD_10ChildDescrENSD_14ObjStreamDescrEEEEEERNS_9TokenizerEP4QPDF:
   75|  3.81M|{
   76|  3.81M|    static const std::string content("content"); // GCC12 - make constexpr
   77|  3.81M|    auto p = Parser(
   78|  3.81M|        input,
   79|  3.81M|        std::move(sp_description),
   80|  3.81M|        content,
   81|  3.81M|        tokenizer,
   82|  3.81M|        nullptr,
   83|  3.81M|        context,
   84|  3.81M|        true,
   85|  3.81M|        0,
   86|  3.81M|        0,
   87|  3.81M|        context && context->doc().reconstructed_xref());
  ------------------
  |  Branch (87:9): [True: 3.81M, False: 0]
  |  Branch (87:20): [True: 3.81M, False: 6.90k]
  ------------------
   88|  3.81M|    if (auto result = p.parse(true)) {
  ------------------
  |  Branch (88:14): [True: 3.80M, False: 12.2k]
  ------------------
   89|  3.80M|        return {result, false};
   90|  3.80M|    }
   91|  12.2k|    return {{}, p.empty_};
   92|  3.81M|}
_ZN4qpdf4impl6Parser5parseER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERNS_9TokenizerEPN16QPDFObjectHandle15StringDecrypterER4QPDFb:
  129|   184k|{
  130|   184k|    return Parser(
  131|   184k|               input,
  132|   184k|               make_description(input.getName(), object_description),
  133|   184k|               object_description,
  134|   184k|               tokenizer,
  135|   184k|               decrypter,
  136|   184k|               &context,
  137|   184k|               true,
  138|   184k|               0,
  139|   184k|               0,
  140|   184k|               sanity_checks)
  141|   184k|        .parse();
  142|   184k|}
_ZN4qpdf4impl6Parser5parseERNS_2is12OffsetBufferEiiRNS_9TokenizerER4QPDF:
  147|  22.1k|{
  148|  22.1k|    return Parser(
  149|  22.1k|               input,
  150|  22.1k|               std::make_shared<QPDFObject::Description>(
  151|  22.1k|                   QPDFObject::ObjStreamDescr(stream_id, obj_id)),
  152|  22.1k|               "",
  153|  22.1k|               tokenizer,
  154|  22.1k|               nullptr,
  155|  22.1k|               &context,
  156|  22.1k|               true,
  157|  22.1k|               stream_id,
  158|  22.1k|               obj_id)
  159|  22.1k|        .parse();
  160|  22.1k|}
_ZN4qpdf4impl6Parser5parseEb:
  164|  4.02M|{
  165|  4.02M|    try {
  166|  4.02M|        return parse_first(content_stream);
  167|  4.02M|    } catch (Error&) {
  168|  10.9k|        return {};
  169|  10.9k|    } catch (QPDFExc& e) {
  170|  3.54k|        throw e;
  171|  3.54k|    } catch (std::logic_error& e) {
  172|      3|        throw e;
  173|  2.04k|    } catch (std::exception& e) {
  174|  2.04k|        warn("treating object as null because of error during parsing: "s + e.what());
  175|  2.04k|        return {};
  176|  2.04k|    }
  177|  4.02M|}
_ZN4qpdf4impl6Parser11parse_firstEb:
  181|  4.02M|{
  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|  4.02M|    QPDF::Doc::ParseGuard pg(context_);
  188|  4.02M|    start_ = input_.tell();
  189|  4.02M|    if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (189:9): [True: 5.44k, False: 4.01M]
  ------------------
  190|  5.44k|        warn(tokenizer_.getErrorMessage());
  191|  5.44k|    }
  192|       |
  193|  4.02M|    switch (tokenizer_.getType()) {
  194|  6.83k|    case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (194:5): [True: 6.83k, False: 4.01M]
  ------------------
  195|  6.83k|        if (content_stream) {
  ------------------
  |  Branch (195:13): [True: 6.10k, False: 728]
  ------------------
  196|       |            // In content stream mode, leave object uninitialized to indicate EOF
  197|  6.10k|            empty_ = true;
  198|  6.10k|            return {};
  199|  6.10k|        }
  200|    728|        warn("unexpected EOF");
  201|    728|        return {};
  202|       |
  203|  5.15k|    case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (203:5): [True: 5.15k, False: 4.02M]
  ------------------
  204|  5.15k|        return {};
  205|       |
  206|    280|    case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (206:5): [True: 280, False: 4.02M]
  ------------------
  207|    534|    case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (207:5): [True: 254, False: 4.02M]
  ------------------
  208|    534|        warn("treating unexpected brace token as null");
  209|    534|        return {};
  210|       |
  211|  1.30k|    case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (211:5): [True: 1.30k, False: 4.02M]
  ------------------
  212|  1.30k|        warn("treating unexpected array close token as null");
  213|  1.30k|        return {};
  214|       |
  215|    750|    case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (215:5): [True: 750, False: 4.02M]
  ------------------
  216|    750|        warn("unexpected dictionary close token");
  217|    750|        return {};
  218|       |
  219|  70.6k|    case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (219:5): [True: 70.6k, False: 3.95M]
  ------------------
  220|   243k|    case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (220:5): [True: 173k, False: 3.85M]
  ------------------
  221|   243k|        stack_.clear();
  222|   243k|        stack_.emplace_back(
  223|   243k|            input_,
  224|   243k|            (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array : st_dictionary_key);
  ------------------
  |  Branch (224:13): [True: 70.6k, False: 173k]
  ------------------
  225|   243k|        frame_ = &stack_.back();
  226|   243k|        return parse_remainder(content_stream);
  227|       |
  228|  1.18k|    case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (228:5): [True: 1.18k, False: 4.02M]
  ------------------
  229|  1.18k|        return with_description<QPDF_Bool>(tokenizer_.getValue() == "true");
  230|       |
  231|    316|    case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (231:5): [True: 316, False: 4.02M]
  ------------------
  232|    316|        return {QPDFObject::create<QPDF_Null>()};
  233|       |
  234|   623k|    case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (234:5): [True: 623k, False: 3.40M]
  ------------------
  235|   623k|        return with_description<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  236|       |
  237|   280k|    case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (237:5): [True: 280k, False: 3.74M]
  ------------------
  238|   280k|        return with_description<QPDF_Real>(tokenizer_.getValue());
  239|       |
  240|  1.30M|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (240:5): [True: 1.30M, False: 2.72M]
  ------------------
  241|  1.30M|        return with_description<QPDF_Name>(tokenizer_.getValue());
  242|       |
  243|  1.49M|    case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (243:5): [True: 1.49M, False: 2.52M]
  ------------------
  244|  1.49M|        {
  245|  1.49M|            auto const& value = tokenizer_.getValue();
  246|  1.49M|            if (content_stream) {
  ------------------
  |  Branch (246:17): [True: 1.49M, False: 7.58k]
  ------------------
  247|  1.49M|                return with_description<QPDF_Operator>(value);
  248|  1.49M|            } else if (value == "endobj") {
  ------------------
  |  Branch (248:24): [True: 279, False: 7.30k]
  ------------------
  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|    279|                empty_ = true;
  254|    279|                input_.seek(input_.getLastOffset(), SEEK_SET);
  255|    279|                if (!content_stream) {
  ------------------
  |  Branch (255:21): [True: 279, False: 0]
  ------------------
  256|    279|                    warn("empty object treated as null");
  257|    279|                }
  258|    279|                return {};
  259|  7.30k|            } else {
  260|  7.30k|                warn("unknown token while reading object; treating as string");
  261|  7.30k|                return with_description<QPDF_String>(value);
  262|  7.30k|            }
  263|  1.49M|        }
  264|       |
  265|  58.0k|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (265:5): [True: 58.0k, False: 3.96M]
  ------------------
  266|  58.0k|        if (decrypter_) {
  ------------------
  |  Branch (266:13): [True: 231, False: 57.8k]
  ------------------
  267|    231|            std::string s{tokenizer_.getValue()};
  268|    231|            decrypter_->decryptString(s);
  269|    231|            return with_description<QPDF_String>(s);
  270|  57.8k|        } else {
  271|  57.8k|            return with_description<QPDF_String>(tokenizer_.getValue());
  272|  57.8k|        }
  273|       |
  274|      0|    default:
  ------------------
  |  Branch (274:5): [True: 0, False: 4.02M]
  ------------------
  275|      0|        warn("treating unknown token type as null while reading object");
  276|      0|        return {};
  277|  4.02M|    }
  278|  4.02M|}
_ZN4qpdf4impl6Parser15parse_remainderEb:
  282|   243k|{
  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|   243k|    bad_count_ = 0;
  289|   243k|    bool b_contents = false;
  290|       |
  291|  10.7M|    while (true) {
  ------------------
  |  Branch (291:12): [True: 10.6M, Folded]
  ------------------
  292|  10.6M|        if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (292:13): [True: 60.6k, False: 10.6M]
  ------------------
  293|  60.6k|            warn(tokenizer_.getErrorMessage());
  294|  60.6k|        }
  295|  10.6M|        ++good_count_; // optimistically
  296|       |
  297|  10.6M|        if (int_count_ != 0) {
  ------------------
  |  Branch (297:13): [True: 4.62M, False: 6.06M]
  ------------------
  298|       |            // Special handling of indirect references. Treat integer tokens as part of an indirect
  299|       |            // reference until proven otherwise.
  300|  4.62M|            if (tokenizer_.getType() == QPDFTokenizer::tt_integer) {
  ------------------
  |  Branch (300:17): [True: 3.63M, False: 988k]
  ------------------
  301|  3.63M|                if (++int_count_ > 2) {
  ------------------
  |  Branch (301:21): [True: 2.89M, False: 740k]
  ------------------
  302|       |                    // Process the oldest buffered integer.
  303|  2.89M|                    add_int(int_count_);
  304|  2.89M|                }
  305|  3.63M|                last_offset_buffer_[int_count_ % 2] = input_.getLastOffset();
  306|  3.63M|                int_buffer_[int_count_ % 2] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  307|  3.63M|                continue;
  308|       |
  309|  3.63M|            } else if (
  310|   988k|                int_count_ >= 2 && tokenizer_.getType() == QPDFTokenizer::tt_word &&
  ------------------
  |  Branch (310:17): [True: 740k, False: 248k]
  |  Branch (310:36): [True: 668k, False: 72.0k]
  ------------------
  311|   668k|                tokenizer_.getValue() == "R") {
  ------------------
  |  Branch (311:17): [True: 633k, False: 34.8k]
  ------------------
  312|   633k|                if (!context_) {
  ------------------
  |  Branch (312:21): [True: 0, False: 633k]
  ------------------
  313|      0|                    throw std::logic_error(
  314|      0|                        "Parser::parse called without context on an object with indirect "
  315|      0|                        "references");
  316|      0|                }
  317|   633k|                auto id = QIntC::to_int(int_buffer_[(int_count_ - 1) % 2]);
  318|   633k|                auto gen = QIntC::to_int(int_buffer_[(int_count_) % 2]);
  319|   633k|                if (!(id < 1 || gen < 0 || gen >= 65535)) {
  ------------------
  |  Branch (319:23): [True: 4.68k, False: 628k]
  |  Branch (319:33): [True: 271, False: 628k]
  |  Branch (319:44): [True: 577, False: 627k]
  ------------------
  320|   627k|                    add(ParseGuard::getObject(context_, id, gen, parse_pdf_));
  321|   627k|                } else {
  322|  5.52k|                    add_bad_null(
  323|  5.52k|                        "treating bad indirect reference (" + std::to_string(id) + " " +
  324|  5.52k|                        std::to_string(gen) + " R) as null");
  325|  5.52k|                }
  326|   633k|                int_count_ = 0;
  327|   633k|                continue;
  328|       |
  329|   633k|            } else if (int_count_ > 0) {
  ------------------
  |  Branch (329:24): [True: 355k, False: 0]
  ------------------
  330|       |                // Process the buffered integers before processing the current token.
  331|   355k|                if (int_count_ > 1) {
  ------------------
  |  Branch (331:21): [True: 106k, False: 248k]
  ------------------
  332|   106k|                    add_int(int_count_ - 1);
  333|   106k|                }
  334|   355k|                add_int(int_count_);
  335|   355k|                int_count_ = 0;
  336|   355k|            }
  337|  4.62M|        }
  338|       |
  339|  6.41M|        switch (tokenizer_.getType()) {
  340|  7.89k|        case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (340:9): [True: 7.89k, False: 6.40M]
  ------------------
  341|  7.89k|            warn("parse error while reading object");
  342|  7.89k|            if (content_stream) {
  ------------------
  |  Branch (342:17): [True: 264, False: 7.63k]
  ------------------
  343|       |                // In content stream mode, leave object uninitialized to indicate EOF
  344|    264|                return {};
  345|    264|            }
  346|  7.63k|            warn("unexpected EOF");
  347|  7.63k|            return {};
  348|       |
  349|  51.8k|        case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (349:9): [True: 51.8k, False: 6.36M]
  ------------------
  350|  51.8k|            check_too_many_bad_tokens();
  351|  51.8k|            add_null();
  352|  51.8k|            continue;
  353|       |
  354|  3.12k|        case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (354:9): [True: 3.12k, False: 6.41M]
  ------------------
  355|  5.40k|        case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (355:9): [True: 2.28k, False: 6.41M]
  ------------------
  356|  5.40k|            add_bad_null("treating unexpected brace token as null");
  357|  5.40k|            continue;
  358|       |
  359|   360k|        case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (359:9): [True: 360k, False: 6.05M]
  ------------------
  360|   360k|            if (frame_->state == st_array) {
  ------------------
  |  Branch (360:17): [True: 358k, False: 2.79k]
  ------------------
  361|   358k|                auto object = frame_->null_count > 100
  ------------------
  |  Branch (361:31): [True: 452, False: 357k]
  ------------------
  362|   358k|                    ? QPDFObject::create<QPDF_Array>(std::move(frame_->olist), true)
  363|   358k|                    : QPDFObject::create<QPDF_Array>(std::move(frame_->olist));
  364|   358k|                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|   358k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (369:21): [True: 62.7k, False: 295k]
  ------------------
  370|  62.7k|                    return object;
  371|  62.7k|                }
  372|   295k|                stack_.pop_back();
  373|   295k|                frame_ = &stack_.back();
  374|   295k|                add(std::move(object));
  375|   295k|            } else {
  376|  2.79k|                if (sanity_checks_) {
  ------------------
  |  Branch (376:21): [True: 2.15k, False: 636]
  ------------------
  377|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  378|       |                    // unusable.
  379|  2.15k|                    warn("unexpected array close token; giving up on reading object");
  380|  2.15k|                    return {};
  381|  2.15k|                }
  382|    636|                add_bad_null("treating unexpected array close token as null");
  383|    636|            }
  384|   295k|            continue;
  385|       |
  386|   295k|        case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (386:9): [True: 265k, False: 6.15M]
  ------------------
  387|   265k|            if (frame_->state <= st_dictionary_value) {
  ------------------
  |  Branch (387:17): [True: 262k, False: 2.51k]
  ------------------
  388|       |                // Attempt to recover more or less gracefully from invalid dictionaries.
  389|   262k|                auto& dict = frame_->dict;
  390|       |
  391|   262k|                if (frame_->state == st_dictionary_value) {
  ------------------
  |  Branch (391:21): [True: 10.7k, False: 251k]
  ------------------
  392|  10.7k|                    warn(
  393|  10.7k|                        frame_->offset,
  394|  10.7k|                        "dictionary ended prematurely; using null as value for last key");
  395|  10.7k|                    dict[frame_->key] = QPDFObject::create<QPDF_Null>();
  396|  10.7k|                }
  397|   262k|                if (!frame_->olist.empty()) {
  ------------------
  |  Branch (397:21): [True: 82.0k, False: 180k]
  ------------------
  398|  82.0k|                    if (sanity_checks_) {
  ------------------
  |  Branch (398:25): [True: 79.8k, False: 2.17k]
  ------------------
  399|  79.8k|                        warn(
  400|  79.8k|                            frame_->offset,
  401|  79.8k|                            "expected dictionary keys but found non-name objects; ignoring");
  402|  79.8k|                    } else {
  403|  2.17k|                        fix_missing_keys();
  404|  2.17k|                    }
  405|  82.0k|                }
  406|       |
  407|   262k|                if (!frame_->contents_string.empty() && dict.contains("/Type") &&
  ------------------
  |  Branch (407:21): [True: 251, False: 262k]
  |  Branch (407:21): [True: 19, False: 262k]
  |  Branch (407:57): [True: 176, False: 75]
  ------------------
  408|    176|                    dict["/Type"].isNameAndEquals("/Sig") && dict.contains("/ByteRange") &&
  ------------------
  |  Branch (408:21): [True: 95, False: 81]
  |  Branch (408:62): [True: 29, False: 66]
  ------------------
  409|     29|                    dict.contains("/Contents") && dict["/Contents"].isString()) {
  ------------------
  |  Branch (409:21): [True: 19, False: 10]
  |  Branch (409:51): [True: 19, False: 0]
  ------------------
  410|     19|                    dict["/Contents"] = QPDFObjectHandle::newString(frame_->contents_string);
  411|     19|                    dict["/Contents"].setParsedOffset(frame_->contents_offset);
  412|     19|                }
  413|   262k|                auto object = QPDFObject::create<QPDF_Dictionary>(std::move(dict));
  414|   262k|                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|   262k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (419:21): [True: 150k, False: 112k]
  ------------------
  420|   150k|                    return object;
  421|   150k|                }
  422|   112k|                stack_.pop_back();
  423|   112k|                frame_ = &stack_.back();
  424|   112k|                add(std::move(object));
  425|   112k|            } else {
  426|  2.51k|                if (sanity_checks_) {
  ------------------
  |  Branch (426:21): [True: 2.05k, False: 464]
  ------------------
  427|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  428|       |                    // unusable.
  429|  2.05k|                    warn("unexpected dictionary close token; giving up on reading object");
  430|  2.05k|                    return {};
  431|  2.05k|                }
  432|    464|                add_bad_null("unexpected dictionary close token");
  433|    464|            }
  434|   112k|            continue;
  435|       |
  436|   367k|        case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (436:9): [True: 367k, False: 6.04M]
  ------------------
  437|   530k|        case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (437:9): [True: 163k, False: 6.25M]
  ------------------
  438|   530k|            if (stack_.size() > max_nesting) {
  ------------------
  |  Branch (438:17): [True: 102, False: 530k]
  ------------------
  439|    102|                limits_error(
  440|    102|                    "parser-max-nesting", "ignoring excessively deeply nested data structure");
  441|    102|            }
  442|   530k|            b_contents = false;
  443|   530k|            stack_.emplace_back(
  444|   530k|                input_,
  445|   530k|                (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array
  ------------------
  |  Branch (445:17): [True: 367k, False: 163k]
  ------------------
  446|   530k|                                                                       : st_dictionary_key);
  447|   530k|            frame_ = &stack_.back();
  448|   530k|            continue;
  449|       |
  450|  20.0k|        case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (450:9): [True: 20.0k, False: 6.39M]
  ------------------
  451|  20.0k|            add_scalar<QPDF_Bool>(tokenizer_.getValue() == "true");
  452|  20.0k|            continue;
  453|       |
  454|  94.4k|        case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (454:9): [True: 94.4k, False: 6.32M]
  ------------------
  455|  94.4k|            add_null();
  456|  94.4k|            continue;
  457|       |
  458|  1.48M|        case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (458:9): [True: 1.48M, False: 4.93M]
  ------------------
  459|  1.48M|            if (!content_stream) {
  ------------------
  |  Branch (459:17): [True: 988k, False: 494k]
  ------------------
  460|       |                // Buffer token in case it is part of an indirect reference.
  461|   988k|                last_offset_buffer_[1] = input_.getLastOffset();
  462|   988k|                int_buffer_[1] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  463|   988k|                int_count_ = 1;
  464|   988k|            } else {
  465|   494k|                add_scalar<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  466|   494k|            }
  467|  1.48M|            continue;
  468|       |
  469|   192k|        case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (469:9): [True: 192k, False: 6.22M]
  ------------------
  470|   192k|            add_scalar<QPDF_Real>(tokenizer_.getValue());
  471|   192k|            continue;
  472|       |
  473|  2.24M|        case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (473:9): [True: 2.24M, False: 4.17M]
  ------------------
  474|  2.24M|            if (frame_->state == st_dictionary_key) {
  ------------------
  |  Branch (474:17): [True: 1.08M, False: 1.15M]
  ------------------
  475|  1.08M|                frame_->key = tokenizer_.getValue();
  476|  1.08M|                frame_->state = st_dictionary_value;
  477|  1.08M|                b_contents = decrypter_ && frame_->key == "/Contents";
  ------------------
  |  Branch (477:30): [True: 43.4k, False: 1.04M]
  |  Branch (477:44): [True: 860, False: 42.5k]
  ------------------
  478|  1.08M|                continue;
  479|  1.15M|            } else {
  480|  1.15M|                add_scalar<QPDF_Name>(tokenizer_.getValue());
  481|  1.15M|            }
  482|  1.15M|            continue;
  483|       |
  484|  1.15M|        case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (484:9): [True: 612k, False: 5.80M]
  ------------------
  485|   612k|            if (content_stream) {
  ------------------
  |  Branch (485:17): [True: 285k, False: 326k]
  ------------------
  486|   285k|                add_scalar<QPDF_Operator>(tokenizer_.getValue());
  487|   285k|                continue;
  488|   285k|            }
  489|       |
  490|   326k|            if (sanity_checks_) {
  ------------------
  |  Branch (490:17): [True: 320k, False: 5.23k]
  ------------------
  491|   320k|                if (tokenizer_.getValue() == "endobj" || tokenizer_.getValue() == "endstream") {
  ------------------
  |  Branch (491:21): [True: 3.38k, False: 317k]
  |  Branch (491:58): [True: 738, False: 316k]
  ------------------
  492|       |                    // During sanity checks, assume an unexpected endobj or endstream indicates that
  493|       |                    // we are parsing past the end of the object.
  494|  4.12k|                    warn(
  495|  4.12k|                        "unexpected 'endobj' or 'endstream' while reading object; giving up on "
  496|  4.12k|                        "reading object");
  497|  4.12k|                    return {};
  498|  4.12k|                }
  499|       |
  500|   316k|                add_bad_null("unknown token while reading object; treating as null");
  501|   316k|                continue;
  502|   320k|            }
  503|       |
  504|  5.23k|            warn("unknown token while reading object; treating as string");
  505|  5.23k|            check_too_many_bad_tokens();
  506|  5.23k|            add_scalar<QPDF_String>(tokenizer_.getValue());
  507|       |
  508|  5.23k|            continue;
  509|       |
  510|   547k|        case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (510:9): [True: 547k, False: 5.86M]
  ------------------
  511|   547k|            {
  512|   547k|                auto const& val = tokenizer_.getValue();
  513|   547k|                if (decrypter_) {
  ------------------
  |  Branch (513:21): [True: 91.9k, False: 455k]
  ------------------
  514|  91.9k|                    if (b_contents) {
  ------------------
  |  Branch (514:25): [True: 453, False: 91.4k]
  ------------------
  515|    453|                        frame_->contents_string = val;
  516|    453|                        frame_->contents_offset = input_.getLastOffset();
  517|    453|                        b_contents = false;
  518|    453|                    }
  519|  91.9k|                    std::string s{val};
  520|  91.9k|                    decrypter_->decryptString(s);
  521|  91.9k|                    add_scalar<QPDF_String>(s);
  522|   455k|                } else {
  523|   455k|                    add_scalar<QPDF_String>(val);
  524|   455k|                }
  525|   547k|            }
  526|   547k|            continue;
  527|       |
  528|      0|        default:
  ------------------
  |  Branch (528:9): [True: 0, False: 6.41M]
  ------------------
  529|      0|            add_bad_null("treating unknown token type as null while reading object");
  530|  6.41M|        }
  531|  6.41M|    }
  532|   243k|}
_ZN4qpdf4impl6Parser3addEONSt3__110shared_ptrI10QPDFObjectEE:
  536|  7.09M|{
  537|  7.09M|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (537:9): [True: 6.07M, False: 1.01M]
  ------------------
  538|       |        // If state is st_dictionary_key then there is a missing key. Push onto olist for
  539|       |        // processing once the tt_dict_close token has been found.
  540|  6.07M|        frame_->olist.emplace_back(std::move(obj));
  541|  6.07M|    } else {
  542|  1.01M|        if (auto res = frame_->dict.insert_or_assign(frame_->key, std::move(obj)); !res.second) {
  ------------------
  |  Branch (542:84): [True: 11.2k, False: 1.00M]
  ------------------
  543|  11.2k|            warn_duplicate_key();
  544|  11.2k|        }
  545|  1.01M|        frame_->state = st_dictionary_key;
  546|  1.01M|    }
  547|  7.09M|}
_ZN4qpdf4impl6Parser8add_nullEv:
  551|   463k|{
  552|   463k|    const static ObjectPtr null_obj = QPDFObject::create<QPDF_Null>();
  553|       |
  554|   463k|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (554:9): [True: 413k, False: 49.3k]
  ------------------
  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|   413k|        frame_->olist.emplace_back(null_obj);
  558|   413k|    } else {
  559|  49.3k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, null_obj); !res.second) {
  ------------------
  |  Branch (559:78): [True: 1.25k, False: 48.0k]
  ------------------
  560|  1.25k|            warn_duplicate_key();
  561|  1.25k|        }
  562|  49.3k|        frame_->state = st_dictionary_key;
  563|  49.3k|    }
  564|   463k|    ++frame_->null_count;
  565|   463k|}
_ZN4qpdf4impl6Parser12add_bad_nullERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  569|   328k|{
  570|   328k|    warn(msg);
  571|   328k|    check_too_many_bad_tokens();
  572|   328k|    add_null();
  573|   328k|}
_ZN4qpdf4impl6Parser7add_intEi:
  577|  3.36M|{
  578|  3.36M|    auto obj = QPDFObject::create<QPDF_Integer>(int_buffer_[count % 2]);
  579|  3.36M|    obj->setDescription(context_, description_, last_offset_buffer_[count % 2]);
  580|  3.36M|    add(std::move(obj));
  581|  3.36M|}
_ZN4qpdf4impl6Parser15set_descriptionERNSt3__110shared_ptrI10QPDFObjectEEx:
  610|   620k|{
  611|   620k|    if (obj) {
  ------------------
  |  Branch (611:9): [True: 620k, False: 0]
  ------------------
  612|   620k|        obj->setDescription(context_, description_, parsed_offset);
  613|   620k|    }
  614|   620k|}
_ZN4qpdf4impl6Parser16fix_missing_keysEv:
  618|  2.17k|{
  619|  2.17k|    std::set<std::string> names;
  620|  7.75k|    for (auto& obj: frame_->olist) {
  ------------------
  |  Branch (620:19): [True: 7.75k, False: 2.17k]
  ------------------
  621|  7.75k|        if (obj.raw_type_code() == ::ot_name) {
  ------------------
  |  Branch (621:13): [True: 202, False: 7.55k]
  ------------------
  622|    202|            names.insert(obj.getName());
  623|    202|        }
  624|  7.75k|    }
  625|  2.17k|    int next_fake_key = 1;
  626|  7.14k|    for (auto const& item: frame_->olist) {
  ------------------
  |  Branch (626:26): [True: 7.14k, False: 2.17k]
  ------------------
  627|  7.16k|        while (true) {
  ------------------
  |  Branch (627:16): [True: 7.16k, Folded]
  ------------------
  628|  7.16k|            const std::string key = "/QPDFFake" + std::to_string(next_fake_key++);
  629|  7.16k|            const bool found_fake = !frame_->dict.contains(key) && !names.contains(key);
  ------------------
  |  Branch (629:37): [True: 7.14k, False: 19]
  |  Branch (629:68): [True: 7.14k, False: 0]
  ------------------
  630|  7.16k|            QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1));
  ------------------
  |  Branch (630:55): [True: 7.14k, False: 19]
  ------------------
  631|  7.16k|            if (found_fake) {
  ------------------
  |  Branch (631:17): [True: 7.14k, False: 19]
  ------------------
  632|  7.14k|                warn(
  633|  7.14k|                    frame_->offset,
  634|  7.14k|                    "expected dictionary key but found non-name object; inserting key " + key);
  635|  7.14k|                frame_->dict[key] = item;
  636|  7.14k|                break;
  637|  7.14k|            }
  638|  7.16k|        }
  639|  7.14k|    }
  640|  2.17k|}
_ZN4qpdf4impl6Parser25check_too_many_bad_tokensEv:
  644|   396k|{
  645|   396k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (645:52): [True: 300k, False: 95.2k]
  |  Branch (645:66): [True: 92.6k, False: 2.60k]
  ------------------
  646|   396k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (646:9): [True: 445, False: 395k]
  |  Branch (646:42): [True: 0, False: 395k]
  ------------------
  647|    445|        if (bad_count_) {
  ------------------
  |  Branch (647:13): [True: 366, False: 79]
  ------------------
  648|    366|            limits_error(
  649|    366|                "parser-max-container-size-damaged",
  650|    366|                "encountered errors while parsing an array or dictionary with more than " +
  651|    366|                    std::to_string(limit) + " elements; giving up on reading object");
  652|    366|        }
  653|    445|        limits_error(
  654|    445|            "parser-max-container-size",
  655|    445|            "encountered an array or dictionary with more than " + std::to_string(limit) +
  656|    445|                " elements during xref recovery; giving up on reading object");
  657|    445|    }
  658|   396k|    if (max_bad_count_ && --max_bad_count_ == 0) {
  ------------------
  |  Branch (658:9): [True: 395k, False: 445]
  |  Branch (658:27): [True: 1.72k, False: 394k]
  ------------------
  659|  1.72k|        limits_error(
  660|  1.72k|            "parser-max-errors", "too many errors during parsing; treating object as null");
  661|  1.72k|    }
  662|   396k|    if (good_count_ > 4) {
  ------------------
  |  Branch (662:9): [True: 157k, False: 238k]
  ------------------
  663|   157k|        good_count_ = 0;
  664|   157k|        bad_count_ = 1;
  665|   157k|        return;
  666|   157k|    }
  667|   238k|    if (++bad_count_ > 5 ||
  ------------------
  |  Branch (667:9): [True: 8.55k, False: 230k]
  ------------------
  668|   230k|        (frame_->state != st_array && std::cmp_less(max_bad_count_, frame_->olist.size()))) {
  ------------------
  |  Branch (668:10): [True: 136k, False: 93.5k]
  |  Branch (668:39): [True: 2.30k, False: 134k]
  ------------------
  669|       |        // Give up after 5 errors in close proximity or if the number of missing dictionary keys
  670|       |        // exceeds the remaining number of allowable total errors.
  671|  8.69k|        warn("too many errors; giving up on reading object");
  672|  8.69k|        throw Error();
  673|  8.69k|    }
  674|   230k|    good_count_ = 0;
  675|   230k|}
_ZN4qpdf4impl6Parser12limits_errorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  679|  2.27k|{
  680|  2.27k|    Limits::error();
  681|  2.27k|    warn("limits error("s + limit + "): " + msg);
  682|  2.27k|    throw Error();
  683|  2.27k|}
_ZNK4qpdf4impl6Parser4warnERK7QPDFExc:
  687|   557k|{
  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|   557k|    if (context_) {
  ------------------
  |  Branch (691:9): [True: 557k, False: 0]
  ------------------
  692|   557k|        context_->warn(e);
  693|   557k|    } else {
  694|      0|        throw e;
  695|      0|    }
  696|   557k|}
_ZN4qpdf4impl6Parser18warn_duplicate_keyEv:
  700|  12.5k|{
  701|  12.5k|    warn(
  702|  12.5k|        frame_->offset,
  703|  12.5k|        "dictionary has duplicated key " + frame_->key +
  704|  12.5k|            "; last occurrence overrides earlier ones");
  705|  12.5k|    check_too_many_bad_tokens();
  706|  12.5k|}
_ZNK4qpdf4impl6Parser4warnExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  710|   557k|{
  711|   557k|    if (stream_id_) {
  ------------------
  |  Branch (711:9): [True: 15.5k, False: 542k]
  ------------------
  712|  15.5k|        std::string descr = "object "s + std::to_string(obj_id_) + " 0";
  713|  15.5k|        std::string name = context_->getFilename() + " object stream " + std::to_string(stream_id_);
  714|  15.5k|        warn(QPDFExc(qpdf_e_damaged_pdf, name, descr, offset, msg));
  715|   542k|    } else {
  716|   542k|        warn(QPDFExc(qpdf_e_damaged_pdf, input_.getName(), object_description_, offset, msg));
  717|   542k|    }
  718|   557k|}
_ZNK4qpdf4impl6Parser4warnERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  722|   447k|{
  723|   447k|    warn(input_.getLastOffset(), msg);
  724|   447k|}
_ZN4QPDF3Doc10ParseGuardC2EPS_:
   26|  4.02M|        objects(qpdf ? &qpdf->m->objects : nullptr)
  ------------------
  |  Branch (26:17): [True: 4.02M, False: 0]
  ------------------
   27|  4.02M|    {
   28|  4.02M|        if (objects) {
  ------------------
  |  Branch (28:13): [True: 4.02M, False: 0]
  ------------------
   29|  4.02M|            objects->inParse(true);
   30|  4.02M|        }
   31|  4.02M|    }
_ZN4QPDF3Doc10ParseGuardD2Ev:
   40|  4.02M|    {
   41|  4.02M|        if (objects) {
  ------------------
  |  Branch (41:13): [True: 4.02M, False: 0]
  ------------------
   42|  4.02M|            objects->inParse(false);
   43|  4.02M|        }
   44|  4.02M|    }
_ZN4QPDF3Doc10ParseGuard9getObjectEPS_iib:
   35|   627k|    {
   36|   627k|        return qpdf->m->objects.getObjectForParser(id, gen, parse_pdf);
   37|   627k|    }
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_BoolJbEEE16QPDFObjectHandleDpOT0_:
  602|  1.18k|{
  603|  1.18k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.18k|    obj->setDescription(context_, description_, start_);
  605|  1.18k|    return {obj};
  606|  1.18k|}
_ZN4qpdf4impl6Parser16with_descriptionI12QPDF_IntegerJxEEE16QPDFObjectHandleDpOT0_:
  602|   622k|{
  603|   622k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|   622k|    obj->setDescription(context_, description_, start_);
  605|   622k|    return {obj};
  606|   622k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|   280k|{
  603|   280k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|   280k|    obj->setDescription(context_, description_, start_);
  605|   280k|    return {obj};
  606|   280k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.30M|{
  603|  1.30M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.30M|    obj->setDescription(context_, description_, start_);
  605|  1.30M|    return {obj};
  606|  1.30M|}
_ZN4qpdf4impl6Parser16with_descriptionI13QPDF_OperatorJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.49M|{
  603|  1.49M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.49M|    obj->setDescription(context_, description_, start_);
  605|  1.49M|    return {obj};
  606|  1.49M|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  64.7k|{
  603|  64.7k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  64.7k|    obj->setDescription(context_, description_, start_);
  605|  64.7k|    return {obj};
  606|  64.7k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|    231|{
  603|    231|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    231|    obj->setDescription(context_, description_, start_);
  605|    231|    return {obj};
  606|    231|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_BoolJbEEEvDpOT0_:
  586|  20.0k|{
  587|  20.0k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 13.5k, False: 6.52k]
  |  Branch (587:66): [True: 5.38k, False: 1.13k]
  ------------------
  588|  20.0k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 79, False: 19.9k]
  |  Branch (588:42): [True: 0, False: 19.9k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     79|        max_bad_count_ = 1;
  592|     79|        check_too_many_bad_tokens(); // always throws Error()
  593|     79|    }
  594|  20.0k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  20.0k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  20.0k|    add(std::move(obj));
  597|  20.0k|}
_ZN4qpdf4impl6Parser10add_scalarI12QPDF_IntegerJxEEEvDpOT0_:
  586|   494k|{
  587|   494k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 16.8k, False: 477k]
  |  Branch (587:66): [True: 477k, False: 571]
  ------------------
  588|   494k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 23, False: 494k]
  |  Branch (588:42): [True: 0, False: 494k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     23|        max_bad_count_ = 1;
  592|     23|        check_too_many_bad_tokens(); // always throws Error()
  593|     23|    }
  594|   494k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   494k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   494k|    add(std::move(obj));
  597|   494k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   192k|{
  587|   192k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 44.8k, False: 147k]
  |  Branch (587:66): [True: 134k, False: 12.9k]
  ------------------
  588|   192k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 80, False: 191k]
  |  Branch (588:42): [True: 0, False: 191k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     80|        max_bad_count_ = 1;
  592|     80|        check_too_many_bad_tokens(); // always throws Error()
  593|     80|    }
  594|   192k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   192k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   192k|    add(std::move(obj));
  597|   192k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  1.15M|{
  587|  1.15M|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 476k, False: 678k]
  |  Branch (587:66): [True: 337k, False: 340k]
  ------------------
  588|  1.15M|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 88, False: 1.15M]
  |  Branch (588:42): [True: 0, False: 1.15M]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     88|        max_bad_count_ = 1;
  592|     88|        check_too_many_bad_tokens(); // always throws Error()
  593|     88|    }
  594|  1.15M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  1.15M|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  1.15M|    add(std::move(obj));
  597|  1.15M|}
_ZN4qpdf4impl6Parser10add_scalarI13QPDF_OperatorJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   285k|{
  587|   285k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 68.9k, False: 216k]
  |  Branch (587:66): [True: 216k, False: 228]
  ------------------
  588|   285k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 43, False: 285k]
  |  Branch (588:42): [True: 0, False: 285k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     43|        max_bad_count_ = 1;
  592|     43|        check_too_many_bad_tokens(); // always throws Error()
  593|     43|    }
  594|   285k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   285k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   285k|    add(std::move(obj));
  597|   285k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   460k|{
  587|   460k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 108k, False: 351k]
  |  Branch (587:66): [True: 345k, False: 6.67k]
  ------------------
  588|   460k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 88, False: 460k]
  |  Branch (588:42): [True: 0, False: 460k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     88|        max_bad_count_ = 1;
  592|     88|        check_too_many_bad_tokens(); // always throws Error()
  593|     88|    }
  594|   460k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   460k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   460k|    add(std::move(obj));
  597|   460k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  91.9k|{
  587|  91.9k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 83.9k, False: 8.00k]
  |  Branch (587:66): [True: 7.92k, False: 83]
  ------------------
  588|  91.9k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 14, False: 91.9k]
  |  Branch (588:42): [True: 0, False: 91.9k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     14|        max_bad_count_ = 1;
  592|     14|        check_too_many_bad_tokens(); // always throws Error()
  593|     14|    }
  594|  91.9k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  91.9k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  91.9k|    add(std::move(obj));
  597|  91.9k|}

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

_ZN4qpdf9Tokenizer5resetEv:
   85|  37.0M|{
   86|  37.0M|    state = st_before_token;
   87|  37.0M|    type = tt::tt_bad;
   88|  37.0M|    val.clear();
   89|  37.0M|    raw_val.clear();
   90|  37.0M|    error_message = "";
   91|  37.0M|    before_token = true;
   92|  37.0M|    in_token = false;
   93|  37.0M|    char_to_unread = '\0';
   94|  37.0M|    inline_image_bytes = 0;
   95|  37.0M|    string_depth = 0;
   96|  37.0M|    bad = false;
   97|  37.0M|}
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  100|    247|    type(type),
  101|    247|    value(value),
  102|    247|    raw_value(value)
  103|    247|{
  104|    247|    if (type == tt_string) {
  ------------------
  |  Branch (104:9): [True: 0, False: 247]
  ------------------
  105|      0|        raw_value = QPDFObjectHandle::newString(value).unparse();
  106|    247|    } else if (type == tt_name) {
  ------------------
  |  Branch (106:16): [True: 0, False: 247]
  ------------------
  107|      0|        raw_value = QPDFObjectHandle::newName(value).unparse();
  108|      0|    }
  109|    247|}
_ZN13QPDFTokenizerC2Ev:
  112|  26.8k|    m(std::make_unique<qpdf::Tokenizer>())
  113|  26.8k|{
  114|  26.8k|}
_ZN13QPDFTokenizerD2Ev:
  116|  26.8k|QPDFTokenizer::~QPDFTokenizer() = default;
_ZN4qpdf9TokenizerC2Ev:
  119|  1.75M|{
  120|  1.75M|    reset();
  121|  1.75M|}
_ZN13QPDFTokenizer8allowEOFEv:
  125|  26.8k|{
  126|  26.8k|    m->allowEOF();
  127|  26.8k|}
_ZN4qpdf9Tokenizer8allowEOFEv:
  131|  73.0k|{
  132|  73.0k|    allow_eof = true;
  133|  73.0k|}
_ZN13QPDFTokenizer16includeIgnorableEv:
  137|  26.8k|{
  138|  26.8k|    m->includeIgnorable();
  139|  26.8k|}
_ZN4qpdf9Tokenizer16includeIgnorableEv:
  143|  26.8k|{
  144|  26.8k|    include_ignorable = true;
  145|  26.8k|}
_ZN4qpdf9Tokenizer7isSpaceEc:
  149|  48.9M|{
  150|  48.9M|    return (ch == '\0' || util::is_space(ch));
  ------------------
  |  Branch (150:13): [True: 3.80M, False: 45.1M]
  |  Branch (150:27): [True: 17.3M, False: 27.8M]
  ------------------
  151|  48.9M|}
_ZN4qpdf9Tokenizer11isDelimiterEc:
  155|   278M|{
  156|   278M|    return is_delimiter(ch);
  157|   278M|}
_ZN4qpdf9Tokenizer16presentCharacterEc:
  167|  29.4k|{
  168|  29.4k|    handleCharacter(ch);
  169|       |
  170|  29.4k|    if (in_token) {
  ------------------
  |  Branch (170:9): [True: 0, False: 29.4k]
  ------------------
  171|      0|        raw_val += ch;
  172|      0|    }
  173|  29.4k|}
_ZN4qpdf9Tokenizer15handleCharacterEc:
  177|   887M|{
  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|   887M|    switch (state) {
  182|      0|    case st_top:
  ------------------
  |  Branch (182:5): [True: 0, False: 887M]
  ------------------
  183|      0|        inTop(ch);
  184|      0|        return;
  185|       |
  186|  2.07M|    case st_in_space:
  ------------------
  |  Branch (186:5): [True: 2.07M, False: 885M]
  ------------------
  187|  2.07M|        inSpace(ch);
  188|  2.07M|        return;
  189|       |
  190|  1.85M|    case st_in_comment:
  ------------------
  |  Branch (190:5): [True: 1.85M, False: 886M]
  ------------------
  191|  1.85M|        inComment(ch);
  192|  1.85M|        return;
  193|       |
  194|   581k|    case st_lt:
  ------------------
  |  Branch (194:5): [True: 581k, False: 887M]
  ------------------
  195|   581k|        inLt(ch);
  196|   581k|        return;
  197|       |
  198|   407k|    case st_gt:
  ------------------
  |  Branch (198:5): [True: 407k, False: 887M]
  ------------------
  199|   407k|        inGt(ch);
  200|   407k|        return;
  201|       |
  202|   373M|    case st_in_string:
  ------------------
  |  Branch (202:5): [True: 373M, False: 514M]
  ------------------
  203|   373M|        inString(ch);
  204|   373M|        return;
  205|       |
  206|  91.1M|    case st_name:
  ------------------
  |  Branch (206:5): [True: 91.1M, False: 796M]
  ------------------
  207|  91.1M|        inName(ch);
  208|  91.1M|        return;
  209|       |
  210|  19.2M|    case st_number:
  ------------------
  |  Branch (210:5): [True: 19.2M, False: 868M]
  ------------------
  211|  19.2M|        inNumber(ch);
  212|  19.2M|        return;
  213|       |
  214|  3.36M|    case st_real:
  ------------------
  |  Branch (214:5): [True: 3.36M, False: 884M]
  ------------------
  215|  3.36M|        inReal(ch);
  216|  3.36M|        return;
  217|       |
  218|   147k|    case st_string_after_cr:
  ------------------
  |  Branch (218:5): [True: 147k, False: 887M]
  ------------------
  219|   147k|        inStringAfterCR(ch);
  220|   147k|        return;
  221|       |
  222|   484k|    case st_string_escape:
  ------------------
  |  Branch (222:5): [True: 484k, False: 887M]
  ------------------
  223|   484k|        inStringEscape(ch);
  224|   484k|        return;
  225|       |
  226|   110k|    case st_char_code:
  ------------------
  |  Branch (226:5): [True: 110k, False: 887M]
  ------------------
  227|   110k|        inCharCode(ch);
  228|   110k|        return;
  229|       |
  230|   177M|    case st_literal:
  ------------------
  |  Branch (230:5): [True: 177M, False: 709M]
  ------------------
  231|   177M|        inLiteral(ch);
  232|   177M|        return;
  233|       |
  234|   165M|    case st_inline_image:
  ------------------
  |  Branch (234:5): [True: 165M, False: 722M]
  ------------------
  235|   165M|        inInlineImage(ch);
  236|   165M|        return;
  237|       |
  238|  2.16M|    case st_in_hexstring:
  ------------------
  |  Branch (238:5): [True: 2.16M, False: 885M]
  ------------------
  239|  2.16M|        inHexstring(ch);
  240|  2.16M|        return;
  241|       |
  242|  2.17M|    case st_in_hexstring_2nd:
  ------------------
  |  Branch (242:5): [True: 2.17M, False: 885M]
  ------------------
  243|  2.17M|        inHexstring2nd(ch);
  244|  2.17M|        return;
  245|       |
  246|  43.4k|    case st_name_hex1:
  ------------------
  |  Branch (246:5): [True: 43.4k, False: 887M]
  ------------------
  247|  43.4k|        inNameHex1(ch);
  248|  43.4k|        return;
  249|       |
  250|  19.6k|    case st_name_hex2:
  ------------------
  |  Branch (250:5): [True: 19.6k, False: 887M]
  ------------------
  251|  19.6k|        inNameHex2(ch);
  252|  19.6k|        return;
  253|       |
  254|   460k|    case st_sign:
  ------------------
  |  Branch (254:5): [True: 460k, False: 887M]
  ------------------
  255|   460k|        inSign(ch);
  256|   460k|        return;
  257|       |
  258|   198k|    case st_decimal:
  ------------------
  |  Branch (258:5): [True: 198k, False: 887M]
  ------------------
  259|   198k|        inDecimal(ch);
  260|   198k|        return;
  261|       |
  262|  46.7M|    case (st_before_token):
  ------------------
  |  Branch (262:5): [True: 46.7M, False: 841M]
  ------------------
  263|  46.7M|        inBeforeToken(ch);
  264|  46.7M|        return;
  265|       |
  266|      0|    case (st_token_ready):
  ------------------
  |  Branch (266:5): [True: 0, False: 887M]
  ------------------
  267|      0|        inTokenReady(ch);
  268|      0|        return;
  269|       |
  270|      0|    default:
  ------------------
  |  Branch (270:5): [True: 0, False: 887M]
  ------------------
  271|      0|        throw std::logic_error("INTERNAL ERROR: invalid state while reading token");
  272|   887M|    }
  273|   887M|}
_ZN4qpdf9Tokenizer13inBeforeTokenEc:
  284|  46.7M|{
  285|       |    // Note: we specifically do not use ctype here.  It is locale-dependent.
  286|  46.7M|    if (isSpace(ch)) {
  ------------------
  |  Branch (286:9): [True: 20.5M, False: 26.2M]
  ------------------
  287|  20.5M|        before_token = !include_ignorable;
  288|  20.5M|        in_token = include_ignorable;
  289|  20.5M|        if (include_ignorable) {
  ------------------
  |  Branch (289:13): [True: 1.52M, False: 19.0M]
  ------------------
  290|  1.52M|            state = st_in_space;
  291|  1.52M|        }
  292|  26.2M|    } else if (ch == '%') {
  ------------------
  |  Branch (292:16): [True: 35.7k, False: 26.1M]
  ------------------
  293|  35.7k|        before_token = !include_ignorable;
  294|  35.7k|        in_token = include_ignorable;
  295|  35.7k|        state = st_in_comment;
  296|  26.1M|    } else {
  297|  26.1M|        before_token = false;
  298|  26.1M|        in_token = true;
  299|  26.1M|        inTop(ch);
  300|  26.1M|    }
  301|  46.7M|}
_ZN4qpdf9Tokenizer5inTopEc:
  305|  26.1M|{
  306|  26.1M|    switch (ch) {
  307|   678k|    case '(':
  ------------------
  |  Branch (307:5): [True: 678k, False: 25.5M]
  ------------------
  308|   678k|        string_depth = 1;
  309|   678k|        state = st_in_string;
  310|   678k|        return;
  311|       |
  312|   583k|    case '<':
  ------------------
  |  Branch (312:5): [True: 583k, False: 25.6M]
  ------------------
  313|   583k|        state = st_lt;
  314|   583k|        return;
  315|       |
  316|   408k|    case '>':
  ------------------
  |  Branch (316:5): [True: 408k, False: 25.7M]
  ------------------
  317|   408k|        state = st_gt;
  318|   408k|        return;
  319|       |
  320|  30.7k|    case (')'):
  ------------------
  |  Branch (320:5): [True: 30.7k, False: 26.1M]
  ------------------
  321|  30.7k|        type = tt::tt_bad;
  322|  30.7k|        QTC::TC("qpdf", "QPDFTokenizer bad )");
  323|  30.7k|        error_message = "unexpected )";
  324|  30.7k|        state = st_token_ready;
  325|  30.7k|        return;
  326|       |
  327|   516k|    case '[':
  ------------------
  |  Branch (327:5): [True: 516k, False: 25.6M]
  ------------------
  328|   516k|        type = tt::tt_array_open;
  329|   516k|        state = st_token_ready;
  330|   516k|        return;
  331|       |
  332|   424k|    case ']':
  ------------------
  |  Branch (332:5): [True: 424k, False: 25.7M]
  ------------------
  333|   424k|        type = tt::tt_array_close;
  334|   424k|        state = st_token_ready;
  335|   424k|        return;
  336|       |
  337|  7.43k|    case '{':
  ------------------
  |  Branch (337:5): [True: 7.43k, False: 26.1M]
  ------------------
  338|  7.43k|        type = tt::tt_brace_open;
  339|  7.43k|        state = st_token_ready;
  340|  7.43k|        return;
  341|       |
  342|  6.62k|    case '}':
  ------------------
  |  Branch (342:5): [True: 6.62k, False: 26.1M]
  ------------------
  343|  6.62k|        type = tt::tt_brace_close;
  344|  6.62k|        state = st_token_ready;
  345|  6.62k|        return;
  346|       |
  347|  5.34M|    case '/':
  ------------------
  |  Branch (347:5): [True: 5.34M, False: 20.8M]
  ------------------
  348|  5.34M|        state = st_name;
  349|  5.34M|        val += ch;
  350|  5.34M|        return;
  351|       |
  352|  2.41M|    case '0':
  ------------------
  |  Branch (352:5): [True: 2.41M, False: 23.7M]
  ------------------
  353|  3.80M|    case '1':
  ------------------
  |  Branch (353:5): [True: 1.38M, False: 24.7M]
  ------------------
  354|  5.19M|    case '2':
  ------------------
  |  Branch (354:5): [True: 1.39M, False: 24.7M]
  ------------------
  355|  5.73M|    case '3':
  ------------------
  |  Branch (355:5): [True: 543k, False: 25.6M]
  ------------------
  356|  6.27M|    case '4':
  ------------------
  |  Branch (356:5): [True: 536k, False: 25.6M]
  ------------------
  357|  6.79M|    case '5':
  ------------------
  |  Branch (357:5): [True: 525k, False: 25.6M]
  ------------------
  358|  7.92M|    case '6':
  ------------------
  |  Branch (358:5): [True: 1.13M, False: 25.0M]
  ------------------
  359|  8.82M|    case '7':
  ------------------
  |  Branch (359:5): [True: 895k, False: 25.2M]
  ------------------
  360|  9.27M|    case '8':
  ------------------
  |  Branch (360:5): [True: 453k, False: 25.7M]
  ------------------
  361|  9.55M|    case '9':
  ------------------
  |  Branch (361:5): [True: 275k, False: 25.9M]
  ------------------
  362|  9.55M|        state = st_number;
  363|  9.55M|        return;
  364|       |
  365|  9.42k|    case '+':
  ------------------
  |  Branch (365:5): [True: 9.42k, False: 26.1M]
  ------------------
  366|   555k|    case '-':
  ------------------
  |  Branch (366:5): [True: 545k, False: 25.6M]
  ------------------
  367|   555k|        state = st_sign;
  368|   555k|        return;
  369|       |
  370|   241k|    case '.':
  ------------------
  |  Branch (370:5): [True: 241k, False: 25.9M]
  ------------------
  371|   241k|        state = st_decimal;
  372|   241k|        return;
  373|       |
  374|  7.83M|    default:
  ------------------
  |  Branch (374:5): [True: 7.83M, False: 18.3M]
  ------------------
  375|  7.83M|        state = st_literal;
  376|  7.83M|        return;
  377|  26.1M|    }
  378|  26.1M|}
_ZN4qpdf9Tokenizer7inSpaceEc:
  382|  2.07M|{
  383|       |    // We only enter this state if include_ignorable is true.
  384|  2.07M|    if (!isSpace(ch)) {
  ------------------
  |  Branch (384:9): [True: 1.51M, False: 562k]
  ------------------
  385|  1.51M|        type = tt::tt_space;
  386|  1.51M|        in_token = false;
  387|  1.51M|        char_to_unread = ch;
  388|  1.51M|        state = st_token_ready;
  389|  1.51M|    }
  390|  2.07M|}
_ZN4qpdf9Tokenizer9inCommentEc:
  394|  1.85M|{
  395|  1.85M|    if ((ch == '\r') || (ch == '\n')) {
  ------------------
  |  Branch (395:9): [True: 5.90k, False: 1.84M]
  |  Branch (395:25): [True: 28.6k, False: 1.82M]
  ------------------
  396|  34.5k|        if (include_ignorable) {
  ------------------
  |  Branch (396:13): [True: 1.81k, False: 32.7k]
  ------------------
  397|  1.81k|            type = tt::tt_comment;
  398|  1.81k|            in_token = false;
  399|  1.81k|            char_to_unread = ch;
  400|  1.81k|            state = st_token_ready;
  401|  32.7k|        } else {
  402|  32.7k|            state = st_before_token;
  403|  32.7k|        }
  404|  34.5k|    }
  405|  1.85M|}
_ZN4qpdf9Tokenizer8inStringEc:
  409|   373M|{
  410|   373M|    switch (ch) {
  411|   484k|    case '\\':
  ------------------
  |  Branch (411:5): [True: 484k, False: 373M]
  ------------------
  412|   484k|        state = st_string_escape;
  413|   484k|        return;
  414|       |
  415|  1.70M|    case '(':
  ------------------
  |  Branch (415:5): [True: 1.70M, False: 371M]
  ------------------
  416|  1.70M|        val += ch;
  417|  1.70M|        ++string_depth;
  418|  1.70M|        return;
  419|       |
  420|  1.43M|    case ')':
  ------------------
  |  Branch (420:5): [True: 1.43M, False: 372M]
  ------------------
  421|  1.43M|        if (--string_depth == 0) {
  ------------------
  |  Branch (421:13): [True: 611k, False: 821k]
  ------------------
  422|   611k|            type = tt::tt_string;
  423|   611k|            state = st_token_ready;
  424|   611k|            return;
  425|   611k|        }
  426|       |
  427|   821k|        val += ch;
  428|   821k|        return;
  429|       |
  430|   147k|    case '\r':
  ------------------
  |  Branch (430:5): [True: 147k, False: 373M]
  ------------------
  431|       |        // CR by itself is converted to LF
  432|   147k|        val += '\n';
  433|   147k|        state = st_string_after_cr;
  434|   147k|        return;
  435|       |
  436|  13.8M|    case '\n':
  ------------------
  |  Branch (436:5): [True: 13.8M, False: 359M]
  ------------------
  437|  13.8M|        val += ch;
  438|  13.8M|        return;
  439|       |
  440|   355M|    default:
  ------------------
  |  Branch (440:5): [True: 355M, False: 17.6M]
  ------------------
  441|   355M|        val += ch;
  442|   355M|        return;
  443|   373M|    }
  444|   373M|}
_ZN4qpdf9Tokenizer6inNameEc:
  448|  91.1M|{
  449|  91.1M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (449:9): [True: 4.00M, False: 87.1M]
  ------------------
  450|       |        // A C-locale whitespace character or delimiter terminates token.  It is important to unread
  451|       |        // the whitespace character even though it is ignored since it may be the newline after a
  452|       |        // stream keyword.  Removing it here could make the stream-reading code break on some files,
  453|       |        // though not on any files in the test suite as of this
  454|       |        // writing.
  455|       |
  456|  4.00M|        type = bad ? tt::tt_bad : tt::tt_name;
  ------------------
  |  Branch (456:16): [True: 435, False: 4.00M]
  ------------------
  457|  4.00M|        in_token = false;
  458|  4.00M|        char_to_unread = ch;
  459|  4.00M|        state = st_token_ready;
  460|  87.1M|    } else if (ch == '#') {
  ------------------
  |  Branch (460:16): [True: 43.5k, False: 87.1M]
  ------------------
  461|  43.5k|        char_code = 0;
  462|  43.5k|        state = st_name_hex1;
  463|  87.1M|    } else {
  464|  87.1M|        val += ch;
  465|  87.1M|    }
  466|  91.1M|}
_ZN4qpdf9Tokenizer10inNameHex1Ec:
  470|  43.4k|{
  471|  43.4k|    hex_char = ch;
  472|       |
  473|  43.4k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (473:48): [True: 19.9k, False: 23.5k]
  ------------------
  474|  19.9k|        char_code = int(hval) << 4;
  475|  19.9k|        state = st_name_hex2;
  476|  23.5k|    } else {
  477|  23.5k|        QTC::TC("qpdf", "QPDFTokenizer bad name 1");
  478|  23.5k|        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|  23.5k|        val += '\0';
  481|  23.5k|        state = st_name;
  482|  23.5k|        inName(ch);
  483|  23.5k|    }
  484|  43.4k|}
_ZN4qpdf9Tokenizer10inNameHex2Ec:
  488|  19.6k|{
  489|  19.6k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (489:48): [True: 7.73k, False: 11.9k]
  ------------------
  490|  7.73k|        char_code |= int(hval);
  491|  11.9k|    } else {
  492|  11.9k|        QTC::TC("qpdf", "QPDFTokenizer bad name 2");
  493|  11.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|  11.9k|        val += '\0';
  496|  11.9k|        val += hex_char;
  497|  11.9k|        state = st_name;
  498|  11.9k|        inName(ch);
  499|  11.9k|        return;
  500|  11.9k|    }
  501|  7.73k|    if (char_code == 0) {
  ------------------
  |  Branch (501:9): [True: 1.23k, False: 6.49k]
  ------------------
  502|  1.23k|        QTC::TC("qpdf", "QPDFTokenizer null in name");
  503|  1.23k|        error_message = "null character not allowed in name token";
  504|  1.23k|        val += "#00";
  505|  1.23k|        state = st_name;
  506|  1.23k|        bad = true;
  507|  6.49k|    } else {
  508|  6.49k|        val += char(char_code);
  509|  6.49k|        state = st_name;
  510|  6.49k|    }
  511|  7.73k|}
_ZN4qpdf9Tokenizer6inSignEc:
  515|   460k|{
  516|   460k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (516:9): [True: 446k, False: 13.3k]
  ------------------
  517|   446k|        state = st_number;
  518|   446k|    } else if (ch == '.') {
  ------------------
  |  Branch (518:16): [True: 2.53k, False: 10.8k]
  ------------------
  519|  2.53k|        state = st_decimal;
  520|  10.8k|    } else {
  521|  10.8k|        state = st_literal;
  522|  10.8k|        inLiteral(ch);
  523|  10.8k|    }
  524|   460k|}
_ZN4qpdf9Tokenizer9inDecimalEc:
  528|   198k|{
  529|   198k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (529:9): [True: 18.7k, False: 180k]
  ------------------
  530|  18.7k|        state = st_real;
  531|   180k|    } else {
  532|   180k|        state = st_literal;
  533|   180k|        inLiteral(ch);
  534|   180k|    }
  535|   198k|}
_ZN4qpdf9Tokenizer8inNumberEc:
  539|  19.2M|{
  540|  19.2M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (540:9): [True: 10.1M, False: 9.09M]
  ------------------
  541|  10.1M|    } else if (ch == '.') {
  ------------------
  |  Branch (541:16): [True: 565k, False: 8.53M]
  ------------------
  542|   565k|        state = st_real;
  543|  8.53M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (543:16): [True: 8.31M, False: 220k]
  ------------------
  544|  8.31M|        type = tt::tt_integer;
  545|  8.31M|        state = st_token_ready;
  546|  8.31M|        in_token = false;
  547|  8.31M|        char_to_unread = ch;
  548|  8.31M|    } else {
  549|   220k|        state = st_literal;
  550|   220k|    }
  551|  19.2M|}
_ZN4qpdf9Tokenizer6inRealEc:
  555|  3.36M|{
  556|  3.36M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (556:9): [True: 2.78M, False: 582k]
  ------------------
  557|  2.78M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (557:16): [True: 570k, False: 12.1k]
  ------------------
  558|   570k|        type = tt::tt_real;
  559|   570k|        state = st_token_ready;
  560|   570k|        in_token = false;
  561|   570k|        char_to_unread = ch;
  562|   570k|    } else {
  563|  12.1k|        state = st_literal;
  564|  12.1k|    }
  565|  3.36M|}
_ZN4qpdf9Tokenizer14inStringEscapeEc:
  568|   484k|{
  569|   484k|    state = st_in_string;
  570|   484k|    switch (ch) {
  571|  8.65k|    case '0':
  ------------------
  |  Branch (571:5): [True: 8.65k, False: 476k]
  ------------------
  572|  9.08k|    case '1':
  ------------------
  |  Branch (572:5): [True: 429, False: 484k]
  ------------------
  573|  25.1k|    case '2':
  ------------------
  |  Branch (573:5): [True: 16.0k, False: 468k]
  ------------------
  574|  48.6k|    case '3':
  ------------------
  |  Branch (574:5): [True: 23.4k, False: 461k]
  ------------------
  575|  49.6k|    case '4':
  ------------------
  |  Branch (575:5): [True: 1.04k, False: 483k]
  ------------------
  576|  49.9k|    case '5':
  ------------------
  |  Branch (576:5): [True: 319, False: 484k]
  ------------------
  577|  59.9k|    case '6':
  ------------------
  |  Branch (577:5): [True: 10.0k, False: 474k]
  ------------------
  578|  62.9k|    case '7':
  ------------------
  |  Branch (578:5): [True: 3.00k, False: 481k]
  ------------------
  579|  62.9k|        state = st_char_code;
  580|  62.9k|        char_code = 0;
  581|  62.9k|        digit_count = 0;
  582|  62.9k|        inCharCode(ch);
  583|  62.9k|        return;
  584|       |
  585|  41.8k|    case 'n':
  ------------------
  |  Branch (585:5): [True: 41.8k, False: 442k]
  ------------------
  586|  41.8k|        val += '\n';
  587|  41.8k|        return;
  588|       |
  589|  7.50k|    case 'r':
  ------------------
  |  Branch (589:5): [True: 7.50k, False: 477k]
  ------------------
  590|  7.50k|        val += '\r';
  591|  7.50k|        return;
  592|       |
  593|   152k|    case 't':
  ------------------
  |  Branch (593:5): [True: 152k, False: 332k]
  ------------------
  594|   152k|        val += '\t';
  595|   152k|        return;
  596|       |
  597|  2.21k|    case 'b':
  ------------------
  |  Branch (597:5): [True: 2.21k, False: 482k]
  ------------------
  598|  2.21k|        val += '\b';
  599|  2.21k|        return;
  600|       |
  601|   134k|    case 'f':
  ------------------
  |  Branch (601:5): [True: 134k, False: 350k]
  ------------------
  602|   134k|        val += '\f';
  603|   134k|        return;
  604|       |
  605|  5.05k|    case '\n':
  ------------------
  |  Branch (605:5): [True: 5.05k, False: 479k]
  ------------------
  606|  5.05k|        return;
  607|       |
  608|    325|    case '\r':
  ------------------
  |  Branch (608:5): [True: 325, False: 484k]
  ------------------
  609|    325|        state = st_string_after_cr;
  610|    325|        return;
  611|       |
  612|  78.1k|    default:
  ------------------
  |  Branch (612:5): [True: 78.1k, False: 406k]
  ------------------
  613|       |        // PDF spec says backslash is ignored before anything else
  614|  78.1k|        val += ch;
  615|  78.1k|        return;
  616|   484k|    }
  617|   484k|}
_ZN4qpdf9Tokenizer15inStringAfterCREc:
  621|   147k|{
  622|   147k|    state = st_in_string;
  623|   147k|    if (ch != '\n') {
  ------------------
  |  Branch (623:9): [True: 104k, False: 42.8k]
  ------------------
  624|   104k|        inString(ch);
  625|   104k|    }
  626|   147k|}
_ZN4qpdf9Tokenizer4inLtEc:
  630|   581k|{
  631|   581k|    if (ch == '<') {
  ------------------
  |  Branch (631:9): [True: 502k, False: 79.2k]
  ------------------
  632|   502k|        type = tt::tt_dict_open;
  633|   502k|        state = st_token_ready;
  634|   502k|        return;
  635|   502k|    }
  636|       |
  637|  79.2k|    state = st_in_hexstring;
  638|  79.2k|    inHexstring(ch);
  639|  79.2k|}
_ZN4qpdf9Tokenizer4inGtEc:
  643|   407k|{
  644|   407k|    if (ch == '>') {
  ------------------
  |  Branch (644:9): [True: 365k, False: 42.4k]
  ------------------
  645|   365k|        type = tt::tt_dict_close;
  646|   365k|        state = st_token_ready;
  647|   365k|    } else {
  648|  42.4k|        type = tt::tt_bad;
  649|  42.4k|        QTC::TC("qpdf", "QPDFTokenizer bad >");
  650|  42.4k|        error_message = "unexpected >";
  651|  42.4k|        in_token = false;
  652|  42.4k|        char_to_unread = ch;
  653|  42.4k|        state = st_token_ready;
  654|  42.4k|    }
  655|   407k|}
_ZN4qpdf9Tokenizer9inLiteralEc:
  659|   178M|{
  660|   178M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (660:9): [True: 5.20M, False: 172M]
  ------------------
  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|  5.20M|        in_token = false;
  667|  5.20M|        char_to_unread = ch;
  668|  5.20M|        state = st_token_ready;
  669|  5.20M|        type = (raw_val == "true") || (raw_val == "false")
  ------------------
  |  Branch (669:16): [True: 18.1k, False: 5.18M]
  |  Branch (669:39): [True: 5.86k, False: 5.17M]
  ------------------
  670|  5.20M|            ? tt::tt_bool
  671|  5.20M|            : (raw_val == "null" ? tt::tt_null : tt::tt_word);
  ------------------
  |  Branch (671:16): [True: 96.3k, False: 5.07M]
  ------------------
  672|  5.20M|    }
  673|   178M|}
_ZN4qpdf9Tokenizer11inHexstringEc:
  677|  2.24M|{
  678|  2.24M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (678:48): [True: 2.17M, False: 73.2k]
  ------------------
  679|  2.17M|        char_code = int(hval) << 4;
  680|  2.17M|        state = st_in_hexstring_2nd;
  681|       |
  682|  2.17M|    } else if (ch == '>') {
  ------------------
  |  Branch (682:16): [True: 29.7k, False: 43.4k]
  ------------------
  683|  29.7k|        type = tt::tt_string;
  684|  29.7k|        state = st_token_ready;
  685|       |
  686|  43.4k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (686:16): [True: 18.6k, False: 24.8k]
  ------------------
  687|       |        // ignore
  688|       |
  689|  24.8k|    } else {
  690|  24.8k|        type = tt::tt_bad;
  691|  24.8k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
  692|  24.8k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  693|  24.8k|        state = st_token_ready;
  694|  24.8k|    }
  695|  2.24M|}
_ZN4qpdf9Tokenizer14inHexstring2ndEc:
  699|  2.17M|{
  700|  2.17M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (700:48): [True: 2.14M, False: 29.9k]
  ------------------
  701|  2.14M|        val += char(char_code) | hval;
  702|  2.14M|        state = st_in_hexstring;
  703|       |
  704|  2.14M|    } else if (ch == '>') {
  ------------------
  |  Branch (704:16): [True: 12.0k, False: 17.8k]
  ------------------
  705|       |        // PDF spec says odd hexstrings have implicit trailing 0.
  706|  12.0k|        val += char(char_code);
  707|  12.0k|        type = tt::tt_string;
  708|  12.0k|        state = st_token_ready;
  709|       |
  710|  17.8k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (710:16): [True: 9.02k, False: 8.83k]
  ------------------
  711|       |        // ignore
  712|       |
  713|  9.02k|    } else {
  714|  8.83k|        type = tt::tt_bad;
  715|  8.83k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
  716|  8.83k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  717|  8.83k|        state = st_token_ready;
  718|  8.83k|    }
  719|  2.17M|}
_ZN4qpdf9Tokenizer10inCharCodeEc:
  723|   173k|{
  724|   173k|    bool handled = false;
  725|   173k|    if (('0' <= ch) && (ch <= '7')) {
  ------------------
  |  Branch (725:9): [True: 163k, False: 10.1k]
  |  Branch (725:24): [True: 151k, False: 11.8k]
  ------------------
  726|   151k|        char_code = 8 * char_code + (int(ch) - int('0'));
  727|   151k|        if (++(digit_count) < 3) {
  ------------------
  |  Branch (727:13): [True: 110k, False: 40.8k]
  ------------------
  728|   110k|            return;
  729|   110k|        }
  730|  40.8k|        handled = true;
  731|  40.8k|    }
  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|  62.8k|    val += char(char_code % 256);
  735|  62.8k|    state = st_in_string;
  736|  62.8k|    if (!handled) {
  ------------------
  |  Branch (736:9): [True: 22.0k, False: 40.8k]
  ------------------
  737|  22.0k|        inString(ch);
  738|  22.0k|    }
  739|  62.8k|}
_ZN4qpdf9Tokenizer13inInlineImageEc:
  743|   165M|{
  744|   165M|    if ((raw_val.length() + 1) == inline_image_bytes) {
  ------------------
  |  Branch (744:9): [True: 2.02k, False: 165M]
  ------------------
  745|  2.02k|        QTC::TC("qpdf", "QPDFTokenizer found EI by byte count");
  746|  2.02k|        type = tt::tt_inline_image;
  747|  2.02k|        inline_image_bytes = 0;
  748|  2.02k|        state = st_token_ready;
  749|  2.02k|    }
  750|   165M|}
_ZN4qpdf9Tokenizer10presentEOFEv:
  760|   101k|{
  761|   101k|    switch (state) {
  762|  2.82k|    case st_name:
  ------------------
  |  Branch (762:5): [True: 2.82k, False: 98.8k]
  ------------------
  763|  2.98k|    case st_name_hex1:
  ------------------
  |  Branch (763:5): [True: 163, False: 101k]
  ------------------
  764|  3.05k|    case st_name_hex2:
  ------------------
  |  Branch (764:5): [True: 72, False: 101k]
  ------------------
  765|  9.53k|    case st_number:
  ------------------
  |  Branch (765:5): [True: 6.47k, False: 95.1k]
  ------------------
  766|  9.76k|    case st_real:
  ------------------
  |  Branch (766:5): [True: 239, False: 101k]
  ------------------
  767|  9.89k|    case st_sign:
  ------------------
  |  Branch (767:5): [True: 130, False: 101k]
  ------------------
  768|  10.0k|    case st_decimal:
  ------------------
  |  Branch (768:5): [True: 136, False: 101k]
  ------------------
  769|  29.4k|    case st_literal:
  ------------------
  |  Branch (769:5): [True: 19.4k, False: 82.2k]
  ------------------
  770|  29.4k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
  771|       |        // Push any delimiter to the state machine to finish off the final token.
  772|  29.4k|        presentCharacter('\f');
  773|  29.4k|        in_token = true;
  774|  29.4k|        break;
  775|       |
  776|      0|    case st_top:
  ------------------
  |  Branch (776:5): [True: 0, False: 101k]
  ------------------
  777|  55.6k|    case st_before_token:
  ------------------
  |  Branch (777:5): [True: 55.6k, False: 45.9k]
  ------------------
  778|  55.6k|        type = tt::tt_eof;
  779|  55.6k|        break;
  780|       |
  781|  10.5k|    case st_in_space:
  ------------------
  |  Branch (781:5): [True: 10.5k, False: 91.0k]
  ------------------
  782|  10.5k|        type = include_ignorable ? tt::tt_space : tt::tt_eof;
  ------------------
  |  Branch (782:16): [True: 10.5k, False: 0]
  ------------------
  783|  10.5k|        break;
  784|       |
  785|  1.17k|    case st_in_comment:
  ------------------
  |  Branch (785:5): [True: 1.17k, False: 100k]
  ------------------
  786|  1.17k|        type = include_ignorable ? tt::tt_comment : tt::tt_bad;
  ------------------
  |  Branch (786:16): [True: 211, False: 963]
  ------------------
  787|  1.17k|        break;
  788|       |
  789|      0|    case st_token_ready:
  ------------------
  |  Branch (789:5): [True: 0, False: 101k]
  ------------------
  790|      0|        break;
  791|       |
  792|  4.80k|    default:
  ------------------
  |  Branch (792:5): [True: 4.80k, False: 96.8k]
  ------------------
  793|  4.80k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
  794|  4.80k|        type = tt::tt_bad;
  795|  4.80k|        error_message = "EOF while reading token";
  796|   101k|    }
  797|   101k|    state = st_token_ready;
  798|   101k|}
_ZN13QPDFTokenizer17expectInlineImageER11InputSource:
  808|    247|{
  809|    247|    m->expectInlineImage(input);
  810|    247|}
_ZN4qpdf9Tokenizer17expectInlineImageER11InputSource:
  814|  2.15k|{
  815|  2.15k|    if (state == st_token_ready) {
  ------------------
  |  Branch (815:9): [True: 1.91k, False: 247]
  ------------------
  816|  1.91k|        reset();
  817|  1.91k|    } else if (state != st_before_token) {
  ------------------
  |  Branch (817:16): [True: 0, False: 247]
  ------------------
  818|      0|        throw std::logic_error(
  819|      0|            "QPDFTokenizer::expectInlineImage called when tokenizer is in improper state");
  820|      0|    }
  821|  2.15k|    findEI(input);
  822|  2.15k|    before_token = false;
  823|  2.15k|    in_token = true;
  824|  2.15k|    state = st_inline_image;
  825|  2.15k|}
_ZN4qpdf9Tokenizer6findEIER11InputSource:
  829|  2.15k|{
  830|  2.15k|    qpdf_offset_t last_offset = input.getLastOffset();
  831|  2.15k|    qpdf_offset_t pos = input.tell();
  832|       |
  833|       |    // Use QPDFWordTokenFinder to find EI surrounded by delimiters. Then read the next several
  834|       |    // tokens or up to EOF. If we find any suspicious-looking or tokens, this is probably still part
  835|       |    // of the image data, so keep looking for EI. Stop at the first EI that passes. If we get to the
  836|       |    // end without finding one, return the last EI we found. Store the number of bytes expected in
  837|       |    // the inline image including the EI and use that to break out of inline image, falling back to
  838|       |    // the old method if needed.
  839|       |
  840|  2.15k|    bool okay = false;
  841|  2.15k|    bool first_try = true;
  842|  48.5k|    while (!okay) {
  ------------------
  |  Branch (842:12): [True: 47.2k, False: 1.33k]
  ------------------
  843|  47.2k|        QPDFWordTokenFinder f(input, "EI");
  844|  47.2k|        if (!input.findFirst("EI", input.tell(), 0, f)) {
  ------------------
  |  Branch (844:13): [True: 823, False: 46.4k]
  ------------------
  845|    823|            break;
  846|    823|        }
  847|  46.4k|        inline_image_bytes = QIntC::to_size(input.tell() - pos - 2);
  848|       |
  849|  46.4k|        Tokenizer check;
  850|  46.4k|        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|  78.8k|        for (int i = 0; i < 10; ++i) {
  ------------------
  |  Branch (856:25): [True: 77.5k, False: 1.33k]
  ------------------
  857|  77.5k|            check.nextToken(input, "checker");
  858|  77.5k|            auto typ = check.getType();
  859|  77.5k|            if (typ == tt::tt_eof) {
  ------------------
  |  Branch (859:17): [True: 0, False: 77.5k]
  ------------------
  860|      0|                okay = true;
  861|  77.5k|            } else if (typ == tt::tt_bad) {
  ------------------
  |  Branch (861:24): [True: 5.60k, False: 71.9k]
  ------------------
  862|  5.60k|                found_bad = true;
  863|  71.9k|            } else if (typ == tt::tt_word) {
  ------------------
  |  Branch (863:24): [True: 52.8k, False: 19.1k]
  ------------------
  864|       |                // The qpdf tokenizer lumps alphabetic and otherwise uncategorized characters into
  865|       |                // "words". We recognize strings of alphabetic characters as potential valid
  866|       |                // operators for purposes of telling whether we're in valid content or not. It's not
  867|       |                // perfect, but it should work more reliably than what we used to do, which was
  868|       |                // already good enough for the vast majority of files.
  869|  52.8k|                bool found_alpha = false;
  870|  52.8k|                bool found_non_printable = false;
  871|  52.8k|                bool found_other = false;
  872|   140k|                for (char ch: check.getValue()) {
  ------------------
  |  Branch (872:29): [True: 140k, False: 21.8k]
  ------------------
  873|   140k|                    if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '*')) {
  ------------------
  |  Branch (873:26): [True: 8.29k, False: 131k]
  |  Branch (873:39): [True: 5.04k, False: 3.24k]
  |  Branch (873:54): [True: 71.7k, False: 63.4k]
  |  Branch (873:67): [True: 68.2k, False: 3.55k]
  |  Branch (873:81): [True: 384, False: 66.5k]
  ------------------
  874|       |                        // Treat '*' as alpha since there are valid PDF operators that contain *
  875|       |                        // along with alphabetic characters.
  876|  73.6k|                        found_alpha = true;
  877|  73.6k|                    } else if (static_cast<signed char>(ch) < 32 && !isSpace(ch)) {
  ------------------
  |  Branch (877:32): [True: 30.9k, False: 35.6k]
  |  Branch (877:69): [True: 30.9k, False: 0]
  ------------------
  878|       |                        // Compare ch as a signed char so characters outside of 7-bit will be < 0.
  879|  30.9k|                        found_non_printable = true;
  880|  30.9k|                        break;
  881|  35.6k|                    } else {
  882|  35.6k|                        found_other = true;
  883|  35.6k|                    }
  884|   140k|                }
  885|  52.8k|                if (found_non_printable || (found_alpha && found_other)) {
  ------------------
  |  Branch (885:21): [True: 30.9k, False: 21.8k]
  |  Branch (885:45): [True: 20.5k, False: 1.32k]
  |  Branch (885:60): [True: 8.51k, False: 12.0k]
  ------------------
  886|  39.4k|                    found_bad = true;
  887|  39.4k|                }
  888|  52.8k|            }
  889|  77.5k|            if (okay || found_bad) {
  ------------------
  |  Branch (889:17): [True: 0, False: 77.5k]
  |  Branch (889:25): [True: 45.0k, False: 32.4k]
  ------------------
  890|  45.0k|                break;
  891|  45.0k|            }
  892|  77.5k|        }
  893|  46.4k|        if (!found_bad) {
  ------------------
  |  Branch (893:13): [True: 1.33k, False: 45.0k]
  ------------------
  894|  1.33k|            okay = true;
  895|  1.33k|        }
  896|  46.4k|        if (!okay) {
  ------------------
  |  Branch (896:13): [True: 45.0k, False: 1.33k]
  ------------------
  897|  45.0k|            first_try = false;
  898|  45.0k|        }
  899|  46.4k|    }
  900|  2.15k|    if (okay && (!first_try)) {
  ------------------
  |  Branch (900:9): [True: 1.33k, False: 823]
  |  Branch (900:17): [True: 287, False: 1.04k]
  ------------------
  901|    287|        QTC::TC("qpdf", "QPDFTokenizer found EI after more than one try");
  902|    287|    }
  903|       |
  904|       |    input.seek(pos, SEEK_SET);
  905|  2.15k|    input.setLastOffset(last_offset);
  906|  2.15k|}
_ZN4qpdf9Tokenizer8getTokenERN13QPDFTokenizer5TokenERbRc:
  916|  7.53M|{
  917|  7.53M|    bool ready = (state == st_token_ready);
  918|  7.53M|    unread_char = !in_token && !before_token;
  ------------------
  |  Branch (918:19): [True: 6.82M, False: 708k]
  |  Branch (918:32): [True: 6.78M, False: 35.5k]
  ------------------
  919|  7.53M|    ch = char_to_unread;
  920|  7.53M|    if (ready) {
  ------------------
  |  Branch (920:9): [True: 7.53M, False: 0]
  ------------------
  921|  7.53M|        token = (!(type == tt::tt_name || type == tt::tt_string))
  ------------------
  |  Branch (921:20): [True: 453k, False: 7.07M]
  |  Branch (921:43): [True: 47.2k, False: 7.02M]
  ------------------
  922|  7.53M|            ? Token(type, raw_val, raw_val, error_message)
  923|  7.53M|            : Token(type, val, raw_val, error_message);
  924|       |
  925|  7.53M|        reset();
  926|  7.53M|    }
  927|  7.53M|    return ready;
  928|  7.53M|}
_ZN13QPDFTokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbm:
  945|  3.22M|{
  946|  3.22M|    return m->readToken(input, context, allow_bad, max_len);
  947|  3.22M|}
_ZN4qpdf9Tokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbm:
  958|  7.53M|{
  959|  7.53M|    nextToken(input, context, max_len);
  960|       |
  961|  7.53M|    Token token;
  962|  7.53M|    bool unread_char;
  963|  7.53M|    char char_to_unread;
  964|  7.53M|    getToken(token, unread_char, char_to_unread);
  965|       |
  966|  7.53M|    if (token.getType() == tt::tt_bad) {
  ------------------
  |  Branch (966:9): [True: 307k, False: 7.22M]
  ------------------
  967|   307k|        if (allow_bad) {
  ------------------
  |  Branch (967:13): [True: 307k, False: 0]
  ------------------
  968|   307k|            QTC::TC("qpdf", "QPDFTokenizer allowing bad token");
  969|   307k|        } 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|   307k|    }
  978|  7.53M|    return token;
  979|  7.53M|}
_ZN4qpdf9Tokenizer9nextTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
  983|  27.7M|{
  984|  27.7M|    if (state != st_inline_image) {
  ------------------
  |  Branch (984:9): [True: 27.7M, False: 2.15k]
  ------------------
  985|  27.7M|        reset();
  986|  27.7M|    }
  987|  27.7M|    qpdf_offset_t offset = input.fastTell();
  988|       |
  989|   915M|    while (state != st_token_ready) {
  ------------------
  |  Branch (989:12): [True: 887M, False: 27.7M]
  ------------------
  990|   887M|        char ch;
  991|   887M|        if (!input.fastRead(ch)) {
  ------------------
  |  Branch (991:13): [True: 101k, False: 887M]
  ------------------
  992|   101k|            presentEOF();
  993|       |
  994|   101k|            if ((type == tt::tt_eof) && (!allow_eof)) {
  ------------------
  |  Branch (994:17): [True: 55.6k, False: 45.9k]
  |  Branch (994:41): [True: 95, False: 55.5k]
  ------------------
  995|       |                // Nothing in the qpdf library calls readToken without allowEOF anymore, so this
  996|       |                // case is not exercised.
  997|     95|                type = tt::tt_bad;
  998|     95|                error_message = "unexpected EOF";
  999|     95|                offset = input.getLastOffset();
 1000|     95|            }
 1001|   887M|        } else {
 1002|   887M|            handleCharacter(ch);
 1003|   887M|            if (before_token) {
  ------------------
  |  Branch (1003:17): [True: 20.8M, False: 866M]
  ------------------
 1004|  20.8M|                ++offset;
 1005|  20.8M|            }
 1006|   887M|            if (in_token) {
  ------------------
  |  Branch (1006:17): [True: 847M, False: 40.4M]
  ------------------
 1007|   847M|                raw_val += ch;
 1008|   847M|            }
 1009|   887M|            if (max_len && (raw_val.length() >= max_len) && (state != st_token_ready)) {
  ------------------
  |  Branch (1009:17): [True: 34.4M, False: 853M]
  |  Branch (1009:28): [True: 5.57M, False: 28.9M]
  |  Branch (1009:61): [True: 5.50M, False: 64.3k]
  ------------------
 1010|       |                // terminate this token now
 1011|  5.50M|                QTC::TC("qpdf", "QPDFTokenizer block long token");
 1012|  5.50M|                type = tt::tt_bad;
 1013|  5.50M|                state = st_token_ready;
 1014|  5.50M|                error_message = "exceeded allowable length while reading token";
 1015|  5.50M|            }
 1016|   887M|        }
 1017|   887M|    }
 1018|       |
 1019|  27.7M|    input.fastUnread(!in_token && !before_token);
  ------------------
  |  Branch (1019:22): [True: 19.6M, False: 8.09M]
  |  Branch (1019:35): [True: 19.6M, False: 56.6k]
  ------------------
 1020|       |
 1021|  27.7M|    if (type != tt::tt_eof) {
  ------------------
  |  Branch (1021:9): [True: 27.7M, False: 55.5k]
  ------------------
 1022|  27.7M|        input.setLastOffset(offset);
 1023|  27.7M|    }
 1024|       |
 1025|  27.7M|    return error_message.empty();
 1026|  27.7M|}
QPDFTokenizer.cc:_ZL12is_delimiterc:
   25|   278M|{
   26|   278M|    return (
   27|   278M|        ch == ' ' || ch == '\n' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (27:9): [True: 10.1M, False: 268M]
  |  Branch (27:22): [True: 2.34M, False: 265M]
  |  Branch (27:36): [True: 2.51M, False: 263M]
  |  Branch (27:49): [True: 337k, False: 263M]
  |  Branch (27:62): [True: 28.6k, False: 263M]
  |  Branch (27:75): [True: 12.7k, False: 263M]
  |  Branch (27:88): [True: 12.4k, False: 263M]
  ------------------
   28|   263M|        ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch == '\t' || ch == '\r' ||
  ------------------
  |  Branch (28:9): [True: 202k, False: 262M]
  |  Branch (28:22): [True: 156k, False: 262M]
  |  Branch (28:35): [True: 221k, False: 262M]
  |  Branch (28:48): [True: 266k, False: 262M]
  |  Branch (28:61): [True: 25.9k, False: 262M]
  |  Branch (28:74): [True: 22.1k, False: 262M]
  |  Branch (28:88): [True: 746k, False: 261M]
  ------------------
   29|   261M|        ch == '\v' || ch == '\f' || ch == 0);
  ------------------
  |  Branch (29:9): [True: 22.9k, False: 261M]
  |  Branch (29:23): [True: 110k, False: 261M]
  |  Branch (29:37): [True: 929k, False: 260M]
  ------------------
   30|   278M|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderC2ER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   38|  47.2k|            is(is),
   39|  47.2k|            str(str)
   40|  47.2k|        {
   41|  47.2k|        }
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinder5checkEv:
   53|  1.63M|{
   54|       |    // Find a word token matching the given string, preceded by a delimiter, and followed by a
   55|       |    // delimiter or EOF.
   56|  1.63M|    Tokenizer tokenizer;
   57|  1.63M|    tokenizer.nextToken(is, "finder", str.size() + 2);
   58|  1.63M|    qpdf_offset_t pos = is.tell();
   59|  1.63M|    if (tokenizer.getType() != tt::tt_word || tokenizer.getValue() != str) {
  ------------------
  |  Branch (59:9): [True: 1.49M, False: 135k]
  |  Branch (59:47): [True: 89.2k, False: 46.4k]
  ------------------
   60|  1.58M|        QTC::TC("qpdf", "QPDFTokenizer finder found wrong word");
   61|  1.58M|        return false;
   62|  1.58M|    }
   63|  46.4k|    qpdf_offset_t token_start = is.getLastOffset();
   64|  46.4k|    char next;
   65|  46.4k|    bool next_okay = false;
   66|  46.4k|    if (is.read(&next, 1) == 0) {
  ------------------
  |  Branch (66:9): [True: 14, False: 46.3k]
  ------------------
   67|     14|        QTC::TC("qpdf", "QPDFTokenizer inline image at EOF");
   68|     14|        next_okay = true;
   69|  46.3k|    } else {
   70|  46.3k|        next_okay = is_delimiter(next);
   71|  46.3k|    }
   72|  46.4k|    is.seek(pos, SEEK_SET);
   73|  46.4k|    if (!next_okay) {
  ------------------
  |  Branch (73:9): [True: 0, False: 46.4k]
  ------------------
   74|      0|        return false;
   75|      0|    }
   76|  46.4k|    if (token_start == 0) {
  ------------------
  |  Branch (76:9): [True: 0, False: 46.4k]
  ------------------
   77|       |        // Can't actually happen...we never start the search at the beginning of the input.
   78|      0|        return false;
   79|      0|    }
   80|  46.4k|    return true;
   81|  46.4k|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderD2Ev:
   42|  47.2k|        ~QPDFWordTokenFinder() override = default;

_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEEb:
   39|  41.8k|{
   40|  41.8k|    if (sparse) {
  ------------------
  |  Branch (40:9): [True: 452, False: 41.3k]
  ------------------
   41|    452|        sp = std::make_unique<Sparse>();
   42|   101k|        for (auto& item: v) {
  ------------------
  |  Branch (42:24): [True: 101k, False: 452]
  ------------------
   43|   101k|            if (item.raw_type_code() != ::ot_null || item.indirect()) {
  ------------------
  |  Branch (43:17): [True: 26.3k, False: 75.4k]
  |  Branch (43:54): [True: 239, False: 75.2k]
  ------------------
   44|  26.6k|                sp->elements[sp->size] = std::move(item);
   45|  26.6k|            }
   46|   101k|            ++sp->size;
   47|   101k|        }
   48|  41.3k|    } else {
   49|  41.3k|        elements = std::move(v);
   50|  41.3k|    }
   51|  41.8k|}
_ZNK4qpdf5Array5arrayEv:
   55|   147k|{
   56|   147k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (56:14): [True: 147k, False: 0]
  ------------------
   57|   147k|        return a;
   58|   147k|    }
   59|       |
   60|      0|    throw std::runtime_error("Expected an array but found a non-array object");
   61|      0|    return nullptr; // unreachable
   62|   147k|}
_ZN4qpdf5ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   65|  5.62k|    BaseHandle(QPDFObject::create<QPDF_Array>(items))
   66|  5.62k|{
   67|  5.62k|}
_ZN4qpdf5ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   70|  9.28k|    BaseHandle(QPDFObject::create<QPDF_Array>(std::move(items)))
   71|  9.28k|{
   72|  9.28k|}
_ZN4qpdf5Array5emptyEv:
   76|    933|{
   77|    933|    return Array(std::vector<QPDFObjectHandle>());
   78|    933|}
_ZN4qpdf5Array5beginEv:
   82|   221k|{
   83|   221k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (83:14): [True: 138k, False: 82.4k]
  ------------------
   84|   138k|        if (!a->sp) {
  ------------------
  |  Branch (84:13): [True: 138k, False: 408]
  ------------------
   85|   138k|            return a->elements.begin();
   86|   138k|        }
   87|    408|        if (!sp_elements) {
  ------------------
  |  Branch (87:13): [True: 408, False: 0]
  ------------------
   88|    408|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
   89|    408|        }
   90|    408|        return sp_elements->begin();
   91|   138k|    }
   92|  82.4k|    return {};
   93|   221k|}
_ZN4qpdf5Array3endEv:
   97|   221k|{
   98|   221k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (98:14): [True: 138k, False: 82.4k]
  ------------------
   99|   138k|        if (!a->sp) {
  ------------------
  |  Branch (99:13): [True: 138k, False: 408]
  ------------------
  100|   138k|            return a->elements.end();
  101|   138k|        }
  102|    408|        if (!sp_elements) {
  ------------------
  |  Branch (102:13): [True: 0, False: 408]
  ------------------
  103|      0|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
  104|      0|        }
  105|    408|        return sp_elements->end();
  106|   138k|    }
  107|  82.4k|    return {};
  108|   221k|}
_ZNK4qpdf5Array4sizeEv:
  178|   314k|{
  179|   314k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (179:14): [True: 262k, False: 51.9k]
  ------------------
  180|   262k|        return a->sp ? a->sp->size : a->elements.size();
  ------------------
  |  Branch (180:16): [True: 69.4k, False: 193k]
  ------------------
  181|   262k|    }
  182|  51.9k|    return 0;
  183|   314k|}
_ZNK4qpdf5ArrayixEm:
  187|  1.16M|{
  188|  1.16M|    static const QPDFObjectHandle null_obj;
  189|  1.16M|    auto a = as<QPDF_Array>();
  190|  1.16M|    if (!a) {
  ------------------
  |  Branch (190:9): [True: 1.93k, False: 1.16M]
  ------------------
  191|  1.93k|        return null_obj;
  192|  1.93k|    }
  193|  1.16M|    if (a->sp) {
  ------------------
  |  Branch (193:9): [True: 79.1k, False: 1.08M]
  ------------------
  194|  79.1k|        auto const& iter = a->sp->elements.find(n);
  195|  79.1k|        return iter == a->sp->elements.end() ? null_obj : iter->second;
  ------------------
  |  Branch (195:16): [True: 68.3k, False: 10.8k]
  ------------------
  196|  79.1k|    }
  197|  1.08M|    return n >= a->elements.size() ? null_obj : a->elements[n];
  ------------------
  |  Branch (197:12): [True: 1.65k, False: 1.07M]
  ------------------
  198|  1.16M|}
_ZNK4qpdf5ArrayixEi:
  202|   991k|{
  203|   991k|    static const QPDFObjectHandle null_obj;
  204|   991k|    if (n < 0) {
  ------------------
  |  Branch (204:9): [True: 2.85k, False: 988k]
  ------------------
  205|  2.85k|        return null_obj;
  206|  2.85k|    }
  207|   988k|    return (*this)[static_cast<size_t>(n)];
  208|   991k|}
_ZNK4qpdf5Array3getEm:
  212|    240|{
  213|    240|    if (n >= size()) {
  ------------------
  |  Branch (213:9): [True: 0, False: 240]
  ------------------
  214|      0|        return {};
  215|      0|    }
  216|    240|    auto a = array();
  217|    240|    if (!a->sp) {
  ------------------
  |  Branch (217:9): [True: 240, False: 0]
  ------------------
  218|    240|        return a->elements[n];
  219|    240|    }
  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|    240|}
_ZNK4qpdf5Array3getEi:
  226|    240|{
  227|    240|    if (n < 0) {
  ------------------
  |  Branch (227:9): [True: 0, False: 240]
  ------------------
  228|      0|        return {};
  229|      0|    }
  230|    240|    return get(to_s(n));
  231|    240|}
_ZNK4qpdf5Array11getAsVectorEv:
  235|  9.02k|{
  236|  9.02k|    auto a = array();
  237|  9.02k|    if (a->sp) {
  ------------------
  |  Branch (237:9): [True: 411, False: 8.61k]
  ------------------
  238|    411|        std::vector<QPDFObjectHandle> v;
  239|    411|        v.reserve(size());
  240|  23.3k|        for (auto const& item: a->sp->elements) {
  ------------------
  |  Branch (240:30): [True: 23.3k, False: 411]
  ------------------
  241|  23.3k|            v.resize(item.first, null_oh);
  242|  23.3k|            v.emplace_back(item.second);
  243|  23.3k|        }
  244|    411|        v.resize(size(), null_oh);
  245|    411|        return v;
  246|  8.61k|    } else {
  247|  8.61k|        return a->elements;
  248|  8.61k|    }
  249|  9.02k|}
_ZN4qpdf5Array3setEmRK16QPDFObjectHandle:
  253|     78|{
  254|     78|    if (at >= size()) {
  ------------------
  |  Branch (254:9): [True: 0, False: 78]
  ------------------
  255|      0|        return false;
  256|      0|    }
  257|     78|    auto a = array();
  258|     78|    checkOwnership(oh);
  259|     78|    if (a->sp) {
  ------------------
  |  Branch (259:9): [True: 6, False: 72]
  ------------------
  260|      6|        a->sp->elements[at] = oh;
  261|     72|    } else {
  262|     72|        a->elements[at] = oh;
  263|     72|    }
  264|     78|    return true;
  265|     78|}
_ZN4qpdf5Array3setEiRK16QPDFObjectHandle:
  269|     78|{
  270|     78|    if (at < 0) {
  ------------------
  |  Branch (270:9): [True: 0, False: 78]
  ------------------
  271|      0|        return false;
  272|      0|    }
  273|     78|    return set(to_s(at), oh);
  274|     78|}
_ZN4qpdf5Array6insertEmRK16QPDFObjectHandle:
  290|  8.45k|{
  291|  8.45k|    auto a = array();
  292|  8.45k|    size_t sz = size();
  293|  8.45k|    if (at > sz) {
  ------------------
  |  Branch (293:9): [True: 0, False: 8.45k]
  ------------------
  294|      0|        return false;
  295|      0|    }
  296|  8.45k|    checkOwnership(item);
  297|  8.45k|    if (at == sz) {
  ------------------
  |  Branch (297:9): [True: 8.45k, False: 0]
  ------------------
  298|       |        // As special case, also allow insert beyond the end
  299|  8.45k|        push_back(item);
  300|  8.45k|        return true;
  301|  8.45k|    }
  302|      0|    if (!a->sp) {
  ------------------
  |  Branch (302:9): [True: 0, False: 0]
  ------------------
  303|      0|        a->elements.insert(a->elements.cbegin() + to_i(at), item);
  304|      0|        return true;
  305|      0|    }
  306|      0|    auto iter = a->sp->elements.crbegin();
  307|      0|    while (iter != a->sp->elements.crend()) {
  ------------------
  |  Branch (307:12): [True: 0, False: 0]
  ------------------
  308|      0|        auto key = (iter++)->first;
  309|      0|        if (key >= at) {
  ------------------
  |  Branch (309:13): [True: 0, False: 0]
  ------------------
  310|      0|            auto nh = a->sp->elements.extract(key);
  311|      0|            ++nh.key();
  312|      0|            a->sp->elements.insert(std::move(nh));
  313|      0|        } else {
  314|      0|            break;
  315|      0|        }
  316|      0|    }
  317|      0|    a->sp->elements[at] = item;
  318|      0|    ++a->sp->size;
  319|      0|    return true;
  320|      0|}
_ZN4qpdf5Array6insertEiRK16QPDFObjectHandle:
  324|  8.45k|{
  325|  8.45k|    if (at_i < 0) {
  ------------------
  |  Branch (325:9): [True: 0, False: 8.45k]
  ------------------
  326|      0|        return false;
  327|      0|    }
  328|  8.45k|    return insert(to_s(at_i), item);
  329|  8.45k|}
_ZN4qpdf5Array9push_backERK16QPDFObjectHandle:
  333|   126k|{
  334|   126k|    auto a = array();
  335|   126k|    checkOwnership(item);
  336|   126k|    if (a->sp) {
  ------------------
  |  Branch (336:9): [True: 198, False: 126k]
  ------------------
  337|    198|        a->sp->elements[(a->sp->size)++] = item;
  338|   126k|    } else {
  339|   126k|        a->elements.emplace_back(item);
  340|   126k|    }
  341|   126k|}
_ZN4qpdf5Array5eraseEm:
  345|  3.12k|{
  346|  3.12k|    auto a = array();
  347|  3.12k|    if (at >= size()) {
  ------------------
  |  Branch (347:9): [True: 0, False: 3.12k]
  ------------------
  348|      0|        return false;
  349|      0|    }
  350|  3.12k|    if (!a->sp) {
  ------------------
  |  Branch (350:9): [True: 3.12k, False: 0]
  ------------------
  351|  3.12k|        a->elements.erase(a->elements.cbegin() + to_i(at));
  352|  3.12k|        return true;
  353|  3.12k|    }
  354|      0|    auto end = a->sp->elements.end();
  355|      0|    if (auto iter = a->sp->elements.lower_bound(at); iter != end) {
  ------------------
  |  Branch (355:54): [True: 0, False: 0]
  ------------------
  356|      0|        if (iter->first == at) {
  ------------------
  |  Branch (356:13): [True: 0, False: 0]
  ------------------
  357|      0|            iter++;
  358|      0|            a->sp->elements.erase(at);
  359|      0|        }
  360|       |
  361|      0|        while (iter != end) {
  ------------------
  |  Branch (361:16): [True: 0, False: 0]
  ------------------
  362|      0|            auto nh = a->sp->elements.extract(iter++);
  363|      0|            --nh.key();
  364|      0|            a->sp->elements.insert(std::move(nh));
  365|      0|        }
  366|      0|    }
  367|      0|    --(a->sp->size);
  368|      0|    return true;
  369|  3.12k|}
_ZN4qpdf5Array5eraseEi:
  373|  3.12k|{
  374|  3.12k|    if (at_i < 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 3.12k]
  ------------------
  375|      0|        return false;
  376|      0|    }
  377|  3.12k|    return erase(to_s(at_i));
  378|  3.12k|}
_ZNK16QPDFObjectHandle14getArrayNItemsEv:
  382|   589k|{
  383|   589k|    auto s = size();
  384|   589k|    if (s > 1 || isArray()) {
  ------------------
  |  Branch (384:9): [True: 588k, False: 1.32k]
  |  Branch (384:18): [True: 1.32k, False: 0]
  ------------------
  385|   589k|        return to_i(s);
  386|   589k|    }
  387|      0|    typeWarning("array", "treating as empty");
  388|      0|    return 0;
  389|   589k|}
_ZNK16QPDFObjectHandle12getArrayItemEi:
  393|   602k|{
  394|   602k|    if (auto array = Array(*this)) {
  ------------------
  |  Branch (394:14): [True: 602k, False: 0]
  ------------------
  395|   602k|        if (auto result = array[n]) {
  ------------------
  |  Branch (395:18): [True: 533k, False: 68.1k]
  ------------------
  396|   533k|            return result;
  397|   533k|        }
  398|  68.1k|        if (n >= 0 && std::cmp_less(n, array.size())) {
  ------------------
  |  Branch (398:13): [True: 68.1k, False: 0]
  |  Branch (398:23): [True: 68.1k, False: 0]
  ------------------
  399|       |            // sparse array null
  400|  68.1k|            return newNull();
  401|  68.1k|        }
  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|   602k|}
_ZNK16QPDFObjectHandle11isRectangleEv:
  412|  81.4k|{
  413|  81.4k|    Array array(*this);
  414|   225k|    for (auto const& oh: array) {
  ------------------
  |  Branch (414:24): [True: 225k, False: 78.8k]
  ------------------
  415|   225k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (415:13): [True: 2.59k, False: 222k]
  ------------------
  416|  2.59k|            return false;
  417|  2.59k|        }
  418|   225k|    }
  419|  78.8k|    return array.size() == 4;
  420|  81.4k|}
_ZNK16QPDFObjectHandle8isMatrixEv:
  424|  11.4k|{
  425|  11.4k|    Array array(*this);
  426|  11.4k|    for (auto const& oh: array) {
  ------------------
  |  Branch (426:24): [True: 2.85k, False: 11.2k]
  ------------------
  427|  2.85k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (427:13): [True: 149, False: 2.71k]
  ------------------
  428|    149|            return false;
  429|    149|        }
  430|  2.85k|    }
  431|  11.2k|    return array.size() == 6;
  432|  11.4k|}
_ZNK16QPDFObjectHandle19getArrayAsRectangleEv:
  436|  43.4k|{
  437|  43.4k|    Array array(*this);
  438|  43.4k|    if (array.size() != 4) {
  ------------------
  |  Branch (438:9): [True: 1.36k, False: 42.0k]
  ------------------
  439|  1.36k|        return {};
  440|  1.36k|    }
  441|  42.0k|    std::array<double, 4> items;
  442|   209k|    for (size_t i = 0; i < 4; ++i) {
  ------------------
  |  Branch (442:24): [True: 167k, False: 41.6k]
  ------------------
  443|   167k|        if (!array[i].getValueAsNumber(items[i])) {
  ------------------
  |  Branch (443:13): [True: 413, False: 167k]
  ------------------
  444|    413|            return {};
  445|    413|        }
  446|   167k|    }
  447|  41.6k|    return {
  448|  41.6k|        std::min(items[0], items[2]),
  449|  41.6k|        std::min(items[1], items[3]),
  450|  41.6k|        std::max(items[0], items[2]),
  451|  41.6k|        std::max(items[1], items[3])};
  452|  42.0k|}
_ZNK16QPDFObjectHandle16getArrayAsMatrixEv:
  456|    356|{
  457|    356|    Array array(*this);
  458|    356|    if (array.size() != 6) {
  ------------------
  |  Branch (458:9): [True: 0, False: 356]
  ------------------
  459|      0|        return {};
  460|      0|    }
  461|    356|    std::array<double, 6> items;
  462|  2.49k|    for (size_t i = 0; i < 6; ++i) {
  ------------------
  |  Branch (462:24): [True: 2.13k, False: 356]
  ------------------
  463|  2.13k|        if (!array[i].getValueAsNumber(items[i])) {
  ------------------
  |  Branch (463:13): [True: 0, False: 2.13k]
  ------------------
  464|      0|            return {};
  465|      0|        }
  466|  2.13k|    }
  467|    356|    return {items[0], items[1], items[2], items[3], items[4], items[5]};
  468|    356|}
_ZNK16QPDFObjectHandle16getArrayAsVectorEv:
  472|  8.62k|{
  473|  8.62k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (473:14): [True: 8.62k, False: 0]
  ------------------
  474|  8.62k|        return array.getAsVector();
  475|  8.62k|    }
  476|      0|    typeWarning("array", "treating as empty");
  477|      0|    QTC::TC("qpdf", "QPDFObjectHandle array treating as empty vector");
  478|      0|    return {};
  479|  8.62k|}
_ZN16QPDFObjectHandle10appendItemERKS_:
  526|   115k|{
  527|   115k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (527:14): [True: 115k, False: 0]
  ------------------
  528|   115k|        array.push_back(item);
  529|   115k|    } else {
  530|      0|        typeWarning("array", "ignoring attempt to append item");
  531|      0|        QTC::TC("qpdf", "QPDFObjectHandle array ignoring append item");
  532|      0|    }
  533|   115k|}
_ZNK4qpdf10BaseHandle4sizeEv:
  566|   645k|{
  567|   645k|    switch (resolved_type_code()) {
  568|   608k|    case ::ot_array:
  ------------------
  |  Branch (568:5): [True: 608k, False: 36.6k]
  ------------------
  569|   608k|        return as<QPDF_Array>()->size();
  570|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (570:5): [True: 0, False: 645k]
  ------------------
  571|      0|    case ::ot_reserved:
  ------------------
  |  Branch (571:5): [True: 0, False: 645k]
  ------------------
  572|  10.0k|    case ::ot_null:
  ------------------
  |  Branch (572:5): [True: 10.0k, False: 635k]
  ------------------
  573|  10.0k|    case ::ot_destroyed:
  ------------------
  |  Branch (573:5): [True: 0, False: 645k]
  ------------------
  574|  10.0k|    case ::ot_unresolved:
  ------------------
  |  Branch (574:5): [True: 0, False: 645k]
  ------------------
  575|  10.0k|    case ::ot_reference:
  ------------------
  |  Branch (575:5): [True: 0, False: 645k]
  ------------------
  576|  10.0k|        return 0;
  577|    213|    case ::ot_boolean:
  ------------------
  |  Branch (577:5): [True: 213, False: 644k]
  ------------------
  578|  4.08k|    case ::ot_integer:
  ------------------
  |  Branch (578:5): [True: 3.87k, False: 641k]
  ------------------
  579|  4.66k|    case ::ot_real:
  ------------------
  |  Branch (579:5): [True: 581, False: 644k]
  ------------------
  580|  4.68k|    case ::ot_string:
  ------------------
  |  Branch (580:5): [True: 15, False: 645k]
  ------------------
  581|  26.2k|    case ::ot_name:
  ------------------
  |  Branch (581:5): [True: 21.5k, False: 623k]
  ------------------
  582|  26.4k|    case ::ot_dictionary:
  ------------------
  |  Branch (582:5): [True: 235, False: 644k]
  ------------------
  583|  26.6k|    case ::ot_stream:
  ------------------
  |  Branch (583:5): [True: 202, False: 644k]
  ------------------
  584|  26.6k|    case ::ot_inlineimage:
  ------------------
  |  Branch (584:5): [True: 0, False: 645k]
  ------------------
  585|  26.6k|    case ::ot_operator:
  ------------------
  |  Branch (585:5): [True: 0, False: 645k]
  ------------------
  586|  26.6k|        return 1;
  587|      0|    default:
  ------------------
  |  Branch (587:5): [True: 0, False: 645k]
  ------------------
  588|      0|        throw std::logic_error("Unexpected type code in size"); // unreachable
  589|      0|        return 0;                                               // unreachable
  590|   645k|    }
  591|   645k|}
_ZNK4qpdf10BaseHandleixEm:
  595|  2.34k|{
  596|  2.34k|    if (resolved_type_code() == ::ot_array) {
  ------------------
  |  Branch (596:9): [True: 2.34k, False: 0]
  ------------------
  597|  2.34k|        return Array(obj)[n];
  598|  2.34k|    }
  599|      0|    if (n < size()) {
  ------------------
  |  Branch (599:9): [True: 0, False: 0]
  ------------------
  600|      0|        return *this;
  601|      0|    }
  602|      0|    return {};
  603|      0|}
_ZNK4qpdf10BaseHandleixEi:
  607|  2.34k|{
  608|  2.34k|    if (n < 0) {
  ------------------
  |  Branch (608:9): [True: 0, False: 2.34k]
  ------------------
  609|      0|        return {};
  610|      0|    }
  611|  2.34k|    return (*this)[static_cast<size_t>(n)];
  612|  2.34k|}
QPDF_Array.cc:_ZL4to_si:
   15|  11.8k|{
   16|  11.8k|    return static_cast<size_t>(n);
   17|  11.8k|}
_ZNK4qpdf5Array14checkOwnershipERK16QPDFObjectHandle:
   27|   135k|{
   28|   135k|    if (!item) {
  ------------------
  |  Branch (28:9): [True: 0, False: 135k]
  ------------------
   29|      0|        throw std::logic_error("Attempting to add an uninitialized object to a QPDF_Array.");
   30|      0|    }
   31|   135k|    if (qpdf() && item.qpdf() && qpdf() != item.qpdf()) {
  ------------------
  |  Branch (31:9): [True: 855, False: 134k]
  |  Branch (31:19): [True: 763, False: 92]
  |  Branch (31:34): [True: 0, False: 763]
  ------------------
   32|      0|        throw std::logic_error(
   33|      0|            "Attempting to add an object from a different QPDF. Use "
   34|      0|            "QPDF::copyForeignObject to add objects from another file.");
   35|      0|    }
   36|   135k|}
QPDF_Array.cc:_ZL4to_im:
   21|   592k|{
   22|   592k|    return static_cast<int>(n);
   23|   592k|}

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

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

_ZN11QPDF_String9writeJSONEiRN4JSON6WriterE:
   18|  26.0k|{
   19|  26.0k|    if (json_version == 1) {
  ------------------
  |  Branch (19:9): [True: 0, False: 26.0k]
  ------------------
   20|      0|        if (util::is_utf16(val)) {
  ------------------
  |  Branch (20:13): [True: 0, False: 0]
  ------------------
   21|      0|            p << "\"" << JSON::Writer::encode_string(QUtil::utf16_to_utf8(val)) << "\"";
   22|      0|            return;
   23|      0|        }
   24|      0|        if (util::is_explicit_utf8(val)) {
  ------------------
  |  Branch (24:13): [True: 0, False: 0]
  ------------------
   25|       |            // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte
   26|       |            // representation of U+FEFF.
   27|      0|            p << "\"" << JSON::Writer::encode_string(val.substr(3)) << "\"";
   28|      0|            return;
   29|      0|        }
   30|      0|        p << "\"" << JSON::Writer::encode_string(QUtil::pdf_doc_to_utf8(val)) << "\"";
   31|      0|        return;
   32|      0|    }
   33|       |    // See if we can unambiguously represent as Unicode.
   34|  26.0k|    if (util::is_utf16(val)) {
  ------------------
  |  Branch (34:9): [True: 1.43k, False: 24.6k]
  ------------------
   35|  1.43k|        p << "\"u:" << JSON::Writer::encode_string(QUtil::utf16_to_utf8(val)) << "\"";
   36|  1.43k|        return;
   37|  1.43k|    }
   38|       |    // See if we can unambiguously represent as Unicode.
   39|  24.6k|    if (util::is_explicit_utf8(val)) {
  ------------------
  |  Branch (39:9): [True: 1.22k, False: 23.3k]
  ------------------
   40|  1.22k|        p << "\"u:" << JSON::Writer::encode_string(val.substr(3)) << "\"";
   41|  1.22k|        return;
   42|  1.22k|    }
   43|  23.3k|    if (!useHexString()) {
  ------------------
  |  Branch (43:9): [True: 10.7k, False: 12.6k]
  ------------------
   44|  10.7k|        auto candidate = QUtil::pdf_doc_to_utf8(val);
   45|  10.7k|        std::string test;
   46|  10.7k|        if (QUtil::utf8_to_pdf_doc(candidate, test, '?') && test == val) {
  ------------------
  |  Branch (46:13): [True: 10.7k, False: 0]
  |  Branch (46:61): [True: 10.3k, False: 314]
  ------------------
   47|       |            // This is a PDF-doc string that can be losslessly encoded as Unicode.
   48|  10.3k|            p << "\"u:" << JSON::Writer::encode_string(candidate) << "\"";
   49|  10.3k|            return;
   50|  10.3k|        }
   51|  10.7k|    }
   52|  13.0k|    p << "\"b:" << QUtil::hex_encode(val) << "\"";
   53|  13.0k|}
_ZNK11QPDF_String12useHexStringEv:
   57|   163k|{
   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|   163k|    unsigned int non_ascii = 0;
   62|  70.4M|    for (auto const ch: val) {
  ------------------
  |  Branch (62:23): [True: 70.4M, False: 111k]
  ------------------
   63|  70.4M|        if (ch > 126) {
  ------------------
  |  Branch (63:13): [True: 386k, False: 70.0M]
  ------------------
   64|   386k|            ++non_ascii;
   65|  70.0M|        } else if (ch >= 32) {
  ------------------
  |  Branch (65:20): [True: 10.2M, False: 59.8M]
  ------------------
   66|  10.2M|            continue;
   67|  59.8M|        } else if (ch < 0 || ch >= 24) {
  ------------------
  |  Branch (67:20): [True: 11.6M, False: 48.1M]
  |  Branch (67:30): [True: 111k, False: 48.0M]
  ------------------
   68|  11.7M|            ++non_ascii;
   69|  48.0M|        } else if (!(ch == '\n' || ch == '\r' || ch == '\t' || ch == '\b' || ch == '\f')) {
  ------------------
  |  Branch (69:22): [True: 444k, False: 47.6M]
  |  Branch (69:36): [True: 5.72k, False: 47.6M]
  |  Branch (69:50): [True: 47.3M, False: 244k]
  |  Branch (69:64): [True: 38.7k, False: 205k]
  |  Branch (69:78): [True: 153k, False: 51.9k]
  ------------------
   70|  51.9k|            return true;
   71|  51.9k|        }
   72|  70.4M|    }
   73|   111k|    return 5 * non_ascii > val.length();
   74|   163k|}
_ZN11QPDF_String7unparseEb:
   78|   140k|{
   79|   140k|    bool use_hexstring = force_binary || useHexString();
  ------------------
  |  Branch (79:26): [True: 0, False: 140k]
  |  Branch (79:42): [True: 59.3k, False: 80.8k]
  ------------------
   80|   140k|    std::string result;
   81|   140k|    if (use_hexstring) {
  ------------------
  |  Branch (81:9): [True: 59.3k, False: 80.8k]
  ------------------
   82|  59.3k|        static auto constexpr hexchars = "0123456789abcdef";
   83|  59.3k|        result.reserve(2 * val.length() + 2);
   84|  59.3k|        result += '<';
   85|  35.7M|        for (const char c: val) {
  ------------------
  |  Branch (85:26): [True: 35.7M, False: 59.3k]
  ------------------
   86|  35.7M|            result += hexchars[static_cast<unsigned char>(c) >> 4];
   87|  35.7M|            result += hexchars[c & 0x0f];
   88|  35.7M|        }
   89|  59.3k|        result += '>';
   90|  80.8k|    } else {
   91|  80.8k|        result += "(";
   92|  51.6M|        for (unsigned int i = 0; i < val.length(); ++i) {
  ------------------
  |  Branch (92:34): [True: 51.5M, False: 80.8k]
  ------------------
   93|  51.5M|            char ch = val.at(i);
   94|  51.5M|            switch (ch) {
   95|   248k|            case '\n':
  ------------------
  |  Branch (95:13): [True: 248k, False: 51.2M]
  ------------------
   96|   248k|                result += "\\n";
   97|   248k|                break;
   98|       |
   99|  3.74k|            case '\r':
  ------------------
  |  Branch (99:13): [True: 3.74k, False: 51.5M]
  ------------------
  100|  3.74k|                result += "\\r";
  101|  3.74k|                break;
  102|       |
  103|  38.9M|            case '\t':
  ------------------
  |  Branch (103:13): [True: 38.9M, False: 12.5M]
  ------------------
  104|  38.9M|                result += "\\t";
  105|  38.9M|                break;
  106|       |
  107|  22.5k|            case '\b':
  ------------------
  |  Branch (107:13): [True: 22.5k, False: 51.5M]
  ------------------
  108|  22.5k|                result += "\\b";
  109|  22.5k|                break;
  110|       |
  111|  95.4k|            case '\f':
  ------------------
  |  Branch (111:13): [True: 95.4k, False: 51.4M]
  ------------------
  112|  95.4k|                result += "\\f";
  113|  95.4k|                break;
  114|       |
  115|  10.5k|            case '(':
  ------------------
  |  Branch (115:13): [True: 10.5k, False: 51.5M]
  ------------------
  116|  10.5k|                result += "\\(";
  117|  10.5k|                break;
  118|       |
  119|  10.7k|            case ')':
  ------------------
  |  Branch (119:13): [True: 10.7k, False: 51.5M]
  ------------------
  120|  10.7k|                result += "\\)";
  121|  10.7k|                break;
  122|       |
  123|  10.6k|            case '\\':
  ------------------
  |  Branch (123:13): [True: 10.6k, False: 51.5M]
  ------------------
  124|  10.6k|                result += "\\\\";
  125|  10.6k|                break;
  126|       |
  127|  12.1M|            default:
  ------------------
  |  Branch (127:13): [True: 12.1M, False: 39.3M]
  ------------------
  128|  12.1M|                if (is_iso_latin1_printable(ch)) {
  ------------------
  |  Branch (128:21): [True: 6.57M, False: 5.57M]
  ------------------
  129|  6.57M|                    result += val.at(i);
  130|  6.57M|                } else {
  131|  5.57M|                    result += "\\" +
  132|  5.57M|                        QUtil::int_to_string_base(
  133|  5.57M|                                  static_cast<int>(static_cast<unsigned char>(ch)), 8, 3);
  134|  5.57M|                }
  135|  12.1M|                break;
  136|  51.5M|            }
  137|  51.5M|        }
  138|  80.8k|        result += ")";
  139|  80.8k|    }
  140|       |
  141|   140k|    return result;
  142|   140k|}
QPDF_String.cc:_ZL23is_iso_latin1_printablec:
   12|  12.1M|{
   13|  12.1M|    return (ch >= 32 && ch <= 126) || static_cast<unsigned char>(ch) >= 160;
  ------------------
  |  Branch (13:13): [True: 6.55M, False: 5.58M]
  |  Branch (13:25): [True: 6.45M, False: 101k]
  |  Branch (13:39): [True: 114k, False: 5.57M]
  ------------------
   14|  12.1M|}

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

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

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

_ZN5QUtil18int_to_string_baseExii:
  343|  5.57M|{
  344|  5.57M|    return int_to_string_base_internal(num, base, length);
  345|  5.57M|}
_ZN5QUtil16double_to_stringEdib:
  355|   222k|{
  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|   222k|    if (decimal_places <= 0) {
  ------------------
  |  Branch (359:9): [True: 154k, False: 68.1k]
  ------------------
  360|   154k|        decimal_places = 6;
  361|   154k|    }
  362|   222k|    std::ostringstream buf;
  363|   222k|    buf.imbue(std::locale::classic());
  364|   222k|    buf << std::setprecision(decimal_places) << std::fixed << num;
  365|   222k|    std::string result = buf.str();
  366|   222k|    if (trim_trailing_zeroes) {
  ------------------
  |  Branch (366:9): [True: 222k, False: 0]
  ------------------
  367|  1.30M|        while ((result.length() > 1) && (result.back() == '0')) {
  ------------------
  |  Branch (367:16): [True: 1.30M, False: 0]
  |  Branch (367:41): [True: 1.08M, False: 222k]
  ------------------
  368|  1.08M|            result.pop_back();
  369|  1.08M|        }
  370|   222k|        if ((result.length() > 1) && (result.back() == '.')) {
  ------------------
  |  Branch (370:13): [True: 222k, False: 0]
  |  Branch (370:38): [True: 120k, False: 101k]
  ------------------
  371|   120k|            result.pop_back();
  372|   120k|        }
  373|   222k|    }
  374|   222k|    return result;
  375|   222k|}
_ZN5QUtil12string_to_llEPKc:
  379|  7.08M|{
  380|  7.08M|    errno = 0;
  381|       |#ifdef _MSC_VER
  382|       |    long long result = _strtoi64(str, 0, 10);
  383|       |#else
  384|  7.08M|    long long result = strtoll(str, nullptr, 10);
  385|  7.08M|#endif
  386|  7.08M|    if (errno == ERANGE) {
  ------------------
  |  Branch (386:9): [True: 1.47k, False: 7.08M]
  ------------------
  387|  1.47k|        throw std::range_error(
  388|  1.47k|            std::string("overflow/underflow converting ") + str + " to 64-bit integer");
  389|  1.47k|    }
  390|  7.08M|    return result;
  391|  7.08M|}
_ZN5QUtil13string_to_intEPKc:
  395|  1.32M|{
  396|       |    // QIntC::to_int does range checking
  397|  1.32M|    return QIntC::to_int(string_to_ll(str));
  398|  1.32M|}
_ZN5QUtil21unsigned_char_pointerERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  447|  99.4k|{
  448|  99.4k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str.c_str()));
  449|  99.4k|}
_ZN5QUtil21unsigned_char_pointerEPKc:
  453|  7.48k|{
  454|  7.48k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str));
  455|  7.48k|}
_ZN5QUtil16make_unique_cstrERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  717|  7.48k|{
  718|  7.48k|    auto result = std::make_unique<char[]>(str.length() + 1);
  719|       |    // Use memcpy in case string contains nulls
  720|  7.48k|    result.get()[str.length()] = '\0';
  721|  7.48k|    memcpy(result.get(), str.c_str(), str.length());
  722|  7.48k|    return result;
  723|  7.48k|}
_ZN5QUtil10hex_encodeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  727|  13.0k|{
  728|  13.0k|    static auto constexpr hexchars = "0123456789abcdef";
  729|  13.0k|    std::string result;
  730|  13.0k|    result.reserve(2 * input.length());
  731|  13.0M|    for (const char c: input) {
  ------------------
  |  Branch (731:22): [True: 13.0M, False: 13.0k]
  ------------------
  732|  13.0M|        result += hexchars[static_cast<unsigned char>(c) >> 4];
  733|  13.0M|        result += hexchars[c & 0x0f];
  734|  13.0M|    }
  735|  13.0k|    return result;
  736|  13.0k|}
_ZN5QUtil7get_envERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPS6_:
  812|      1|{
  813|       |    // This was basically ripped out of wxWindows.
  814|       |#ifdef _WIN32
  815|       |# ifdef NO_GET_ENVIRONMENT
  816|       |    return false;
  817|       |# else
  818|       |    // first get the size of the buffer
  819|       |    DWORD len = ::GetEnvironmentVariable(var.c_str(), NULL, 0);
  820|       |    if (len == 0) {
  821|       |        // this means that there is no such variable
  822|       |        return false;
  823|       |    }
  824|       |
  825|       |    if (value) {
  826|       |        auto t = QUtil::make_shared_array<char>(len + 1);
  827|       |        ::GetEnvironmentVariable(var.c_str(), t.get(), len);
  828|       |        *value = t.get();
  829|       |    }
  830|       |
  831|       |    return true;
  832|       |# endif
  833|       |#else
  834|      1|    char* p = getenv(var.c_str());
  835|      1|    if (p == nullptr) {
  ------------------
  |  Branch (835:9): [True: 1, False: 0]
  ------------------
  836|      1|        return false;
  837|      1|    }
  838|      0|    if (value) {
  ------------------
  |  Branch (838:9): [True: 0, False: 0]
  ------------------
  839|      0|        *value = p;
  840|      0|    }
  841|       |
  842|      0|    return true;
  843|      1|#endif
  844|      1|}
_ZN5QUtil6toUTF8Em:
 1004|   401M|{
 1005|   401M|    std::string result;
 1006|       |
 1007|       |    // A UTF-8 encoding of a Unicode value is a single byte for Unicode values <= 127.  For larger
 1008|       |    // values, the first byte of the UTF-8 encoding has '1' as each of its n highest bits and '0'
 1009|       |    // for its (n+1)th highest bit where n is the total number of bytes required.  Subsequent bytes
 1010|       |    // start with '10' and have the remaining 6 bits free for encoding.  For example, an 11-bit
 1011|       |    // Unicode value can be stored in two bytes where the first is 110zzzzz, the second is 10zzzzzz,
 1012|       |    // and the z's represent the remaining bits.
 1013|       |
 1014|   401M|    if (uval > 0x7fffffff) {
  ------------------
  |  Branch (1014:9): [True: 0, False: 401M]
  ------------------
 1015|      0|        throw std::runtime_error("bounds error in QUtil::toUTF8");
 1016|   401M|    } else if (uval < 128) {
  ------------------
  |  Branch (1016:16): [True: 59.5M, False: 341M]
  ------------------
 1017|  59.5M|        result += static_cast<char>(uval);
 1018|   341M|    } else {
 1019|   341M|        unsigned char bytes[7];
 1020|   341M|        bytes[6] = '\0';
 1021|   341M|        unsigned char* cur_byte = &bytes[5];
 1022|       |
 1023|       |        // maximum value that will fit in the current number of bytes
 1024|   341M|        unsigned char maxval = 0x3f; // six bits
 1025|       |
 1026|  1.01G|        while (uval > QIntC::to_ulong(maxval)) {
  ------------------
  |  Branch (1026:16): [True: 672M, False: 341M]
  ------------------
 1027|       |            // Assign low six bits plus 10000000 to lowest unused byte position, then shift
 1028|   672M|            *cur_byte = static_cast<unsigned char>(0x80 + (uval & 0x3f));
 1029|   672M|            uval >>= 6;
 1030|       |            // Maximum that will fit in high byte now shrinks by one bit
 1031|   672M|            maxval = static_cast<unsigned char>(maxval >> 1);
 1032|       |            // Slide to the left one byte
 1033|   672M|            if (cur_byte <= bytes) {
  ------------------
  |  Branch (1033:17): [True: 0, False: 672M]
  ------------------
 1034|      0|                throw std::logic_error("QUtil::toUTF8: overflow error");
 1035|      0|            }
 1036|   672M|            --cur_byte;
 1037|   672M|        }
 1038|       |        // If maxval is k bits long, the high (7 - k) bits of the resulting byte must be high.
 1039|   341M|        *cur_byte = static_cast<unsigned char>(QIntC::to_ulong(0xff - (1 + (maxval << 1))) + uval);
 1040|       |
 1041|   341M|        result += reinterpret_cast<char*>(cur_byte);
 1042|   341M|    }
 1043|       |
 1044|   401M|    return result;
 1045|   401M|}
_ZN5QUtil7toUTF16Em:
 1049|  5.59M|{
 1050|  5.59M|    std::string result;
 1051|  5.59M|    if ((uval >= 0xd800) && (uval <= 0xdfff)) {
  ------------------
  |  Branch (1051:9): [True: 5.82k, False: 5.58M]
  |  Branch (1051:29): [True: 220, False: 5.60k]
  ------------------
 1052|    220|        result = "\xff\xfd";
 1053|  5.59M|    } else if (uval <= 0xffff) {
  ------------------
  |  Branch (1053:16): [True: 5.59M, False: 1.11k]
  ------------------
 1054|  5.59M|        char out[2];
 1055|  5.59M|        out[0] = static_cast<char>((uval & 0xff00) >> 8);
 1056|  5.59M|        out[1] = static_cast<char>(uval & 0xff);
 1057|  5.59M|        result = std::string(out, 2);
 1058|  5.59M|    } else if (uval <= 0x10ffff) {
  ------------------
  |  Branch (1058:16): [True: 564, False: 552]
  ------------------
 1059|    564|        char out[4];
 1060|    564|        uval -= 0x10000;
 1061|    564|        unsigned short high = static_cast<unsigned short>(((uval & 0xffc00) >> 10) + 0xd800);
 1062|    564|        unsigned short low = static_cast<unsigned short>((uval & 0x3ff) + 0xdc00);
 1063|    564|        out[0] = static_cast<char>((high & 0xff00) >> 8);
 1064|    564|        out[1] = static_cast<char>(high & 0xff);
 1065|    564|        out[2] = static_cast<char>((low & 0xff00) >> 8);
 1066|    564|        out[3] = static_cast<char>(low & 0xff);
 1067|    564|        result = std::string(out, 4);
 1068|    564|    } else {
 1069|    552|        result = "\xff\xfd";
 1070|    552|    }
 1071|       |
 1072|  5.59M|    return result;
 1073|  5.59M|}
_ZN5QUtil21getRandomDataProviderEv:
 1126|    184|{
 1127|    184|    return getRandomDataProviderProvider()->getProvider();
 1128|    184|}
_ZN5QUtil25initializeWithRandomBytesEPhm:
 1132|    184|{
 1133|    184|    getRandomDataProvider()->provideRandomData(data, len);
 1134|    184|}
_ZN5QUtil23get_next_utf8_codepointERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERmRb:
 1479|  47.5M|{
 1480|  47.5M|    auto o_pos = pos;
 1481|  47.5M|    size_t len = utf8_val.length();
 1482|  47.5M|    unsigned char ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1483|  47.5M|    error = false;
 1484|  47.5M|    if (ch < 128) {
  ------------------
  |  Branch (1484:9): [True: 22.3M, False: 25.1M]
  ------------------
 1485|  22.3M|        return static_cast<unsigned long>(ch);
 1486|  22.3M|    }
 1487|       |
 1488|  25.1M|    size_t bytes_needed = 0;
 1489|  25.1M|    unsigned bit_check = 0x40;
 1490|  25.1M|    unsigned char to_clear = 0x80;
 1491|  62.0M|    while (ch & bit_check) {
  ------------------
  |  Branch (1491:12): [True: 36.8M, False: 25.1M]
  ------------------
 1492|  36.8M|        ++bytes_needed;
 1493|  36.8M|        to_clear = static_cast<unsigned char>(to_clear | bit_check);
 1494|  36.8M|        bit_check >>= 1;
 1495|  36.8M|    }
 1496|  25.1M|    if (((bytes_needed > 5) || (bytes_needed < 1)) || ((pos + bytes_needed) > len)) {
  ------------------
  |  Branch (1496:10): [True: 290k, False: 24.8M]
  |  Branch (1496:32): [True: 6.80M, False: 18.0M]
  |  Branch (1496:55): [True: 457, False: 18.0M]
  ------------------
 1497|  7.09M|        error = true;
 1498|  7.09M|        return 0xfffd;
 1499|  7.09M|    }
 1500|       |
 1501|  18.0M|    auto codepoint = static_cast<unsigned long>(ch & ~to_clear);
 1502|  42.3M|    while (bytes_needed > 0) {
  ------------------
  |  Branch (1502:12): [True: 29.8M, False: 12.5M]
  ------------------
 1503|  29.8M|        --bytes_needed;
 1504|  29.8M|        ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1505|  29.8M|        if ((ch & 0xc0) != 0x80) {
  ------------------
  |  Branch (1505:13): [True: 5.52M, False: 24.2M]
  ------------------
 1506|  5.52M|            --pos;
 1507|  5.52M|            error = true;
 1508|  5.52M|            return 0xfffd;
 1509|  5.52M|        }
 1510|  24.2M|        codepoint <<= 6;
 1511|  24.2M|        codepoint += (ch & 0x3f);
 1512|  24.2M|    }
 1513|  12.5M|    unsigned long lower_bound = 0;
 1514|  12.5M|    switch (pos - o_pos) {
 1515|   816k|    case 2:
  ------------------
  |  Branch (1515:5): [True: 816k, False: 11.7M]
  ------------------
 1516|   816k|        lower_bound = 1 << 7;
 1517|   816k|        break;
 1518|  11.7M|    case 3:
  ------------------
  |  Branch (1518:5): [True: 11.7M, False: 819k]
  ------------------
 1519|  11.7M|        lower_bound = 1 << 11;
 1520|  11.7M|        break;
 1521|  1.80k|    case 4:
  ------------------
  |  Branch (1521:5): [True: 1.80k, False: 12.5M]
  ------------------
 1522|  1.80k|        lower_bound = 1 << 16;
 1523|  1.80k|        break;
 1524|    652|    case 5:
  ------------------
  |  Branch (1524:5): [True: 652, False: 12.5M]
  ------------------
 1525|    652|        lower_bound = 1 << 12;
 1526|    652|        break;
 1527|    363|    case 6:
  ------------------
  |  Branch (1527:5): [True: 363, False: 12.5M]
  ------------------
 1528|    363|        lower_bound = 1 << 26;
 1529|    363|        break;
 1530|      0|    default:
  ------------------
  |  Branch (1530:5): [True: 0, False: 12.5M]
  ------------------
 1531|      0|        lower_bound = 0;
 1532|  12.5M|    }
 1533|       |
 1534|  12.5M|    if (lower_bound > 0 && codepoint < lower_bound) {
  ------------------
  |  Branch (1534:9): [True: 12.5M, False: 0]
  |  Branch (1534:28): [True: 1.44k, False: 12.5M]
  ------------------
 1535|       |        // Too many bytes were used, but return whatever character was encoded.
 1536|  1.44k|        error = true;
 1537|  1.44k|    }
 1538|  12.5M|    return codepoint;
 1539|  12.5M|}
_ZN5QUtil13utf8_to_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1637|    398|{
 1638|    398|    return transcode_utf8(utf8, e_utf16, 0);
 1639|    398|}
_ZN5QUtil13utf8_to_asciiERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1643|  78.4k|{
 1644|  78.4k|    return transcode_utf8(utf8, e_ascii, unknown_char);
 1645|  78.4k|}
_ZN5QUtil16utf8_to_win_ansiERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1649|    766|{
 1650|    766|    return transcode_utf8(utf8, e_winansi, unknown_char);
 1651|    766|}
_ZN5QUtil17utf8_to_mac_romanERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1655|    284|{
 1656|    284|    return transcode_utf8(utf8, e_macroman, unknown_char);
 1657|    284|}
_ZN5QUtil15utf8_to_pdf_docERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_c:
 1685|  11.9k|{
 1686|  11.9k|    return transcode_utf8(utf8, pdfdoc, e_pdfdoc, unknown_char);
 1687|  11.9k|}
_ZN5QUtil8is_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1691|  30.9k|{
 1692|  30.9k|    return util::is_utf16(val);
 1693|  30.9k|}
_ZN5QUtil13utf16_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1703|  30.9k|{
 1704|  30.9k|    std::string result;
 1705|       |    // This code uses unsigned long and unsigned short to hold codepoint values. It requires
 1706|       |    // unsigned long to be at least 32 bits and unsigned short to be at least 16 bits, but it will
 1707|       |    // work fine if they are larger.
 1708|  30.9k|    unsigned long codepoint = 0L;
 1709|  30.9k|    size_t len = val.length();
 1710|  30.9k|    size_t start = 0;
 1711|  30.9k|    bool is_le = false;
 1712|  30.9k|    if (is_utf16(val)) {
  ------------------
  |  Branch (1712:9): [True: 30.9k, False: 0]
  ------------------
 1713|  30.9k|        if (static_cast<unsigned char>(val.at(0)) == 0xff) {
  ------------------
  |  Branch (1713:13): [True: 2.15k, False: 28.8k]
  ------------------
 1714|  2.15k|            is_le = true;
 1715|  2.15k|        }
 1716|  30.9k|        start += 2;
 1717|  30.9k|    }
 1718|       |    // If the string has an odd number of bytes, the last byte is ignored.
 1719|  56.4M|    for (size_t i = start; i + 1 < len; i += 2) {
  ------------------
  |  Branch (1719:28): [True: 56.4M, False: 30.9k]
  ------------------
 1720|       |        // Convert from UTF16-BE.  If we get a malformed codepoint, this code will generate
 1721|       |        // incorrect output without giving a warning.  Specifically, a high codepoint not followed
 1722|       |        // by a low codepoint will be discarded, and a low codepoint not preceded by a high
 1723|       |        // codepoint will just get its low 10 bits output.
 1724|  56.4M|        auto msb = is_le ? i + 1 : i;
  ------------------
  |  Branch (1724:20): [True: 340k, False: 56.0M]
  ------------------
 1725|  56.4M|        auto lsb = is_le ? i : i + 1;
  ------------------
  |  Branch (1725:20): [True: 340k, False: 56.0M]
  ------------------
 1726|  56.4M|        unsigned short bits = QIntC::to_ushort(
 1727|  56.4M|            (static_cast<unsigned char>(val.at(msb)) << 8) +
 1728|  56.4M|            static_cast<unsigned char>(val.at(lsb)));
 1729|  56.4M|        if ((bits & 0xFC00) == 0xD800) {
  ------------------
  |  Branch (1729:13): [True: 1.27k, False: 56.4M]
  ------------------
 1730|  1.27k|            codepoint = 0x10000U + ((bits & 0x3FFU) << 10U);
 1731|  1.27k|            continue;
 1732|  56.4M|        } else if ((bits & 0xFC00) == 0xDC00) {
  ------------------
  |  Branch (1732:20): [True: 4.37k, False: 56.4M]
  ------------------
 1733|  4.37k|            if (codepoint != 0) {
  ------------------
  |  Branch (1733:17): [True: 265, False: 4.10k]
  ------------------
 1734|    265|                QTC::TC("qpdf", "QUtil non-trivial UTF-16");
 1735|    265|            }
 1736|  4.37k|            codepoint += bits & 0x3FF;
 1737|  56.4M|        } else {
 1738|  56.4M|            codepoint = bits;
 1739|  56.4M|        }
 1740|       |
 1741|  56.4M|        result += QUtil::toUTF8(codepoint);
 1742|  56.4M|        codepoint = 0;
 1743|  56.4M|    }
 1744|  30.9k|    return result;
 1745|  30.9k|}
_ZN5QUtil15pdf_doc_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1781|   250k|{
 1782|   250k|    std::string result;
 1783|   250k|    size_t len = val.length();
 1784|   328M|    for (unsigned int i = 0; i < len; ++i) {
  ------------------
  |  Branch (1784:30): [True: 328M, False: 250k]
  ------------------
 1785|   328M|        unsigned char ch = static_cast<unsigned char>(val.at(i));
 1786|   328M|        unsigned short ch_short = ch;
 1787|   328M|        if ((ch >= 127) && (ch <= 160)) {
  ------------------
  |  Branch (1787:13): [True: 292M, False: 36.0M]
  |  Branch (1787:28): [True: 283M, False: 9.26M]
  ------------------
 1788|   283M|            ch_short = pdf_doc_to_unicode[ch - 127];
 1789|   283M|        } else if ((ch >= 24) && (ch <= 31)) {
  ------------------
  |  Branch (1789:20): [True: 35.3M, False: 9.98M]
  |  Branch (1789:34): [True: 1.13M, False: 34.1M]
  ------------------
 1790|  1.13M|            ch_short = pdf_doc_low_to_unicode[ch - 24];
 1791|  44.1M|        } else if (ch == 173) {
  ------------------
  |  Branch (1791:20): [True: 22.9k, False: 44.1M]
  ------------------
 1792|  22.9k|            ch_short = 0xfffd;
 1793|  22.9k|        }
 1794|   328M|        result += QUtil::toUTF8(ch_short);
 1795|   328M|    }
 1796|   250k|    return result;
 1797|   250k|}
QUtil.cc:_ZL29getRandomDataProviderProviderv:
 1112|    184|{
 1113|       |    // Thread-safe static initializer
 1114|    184|    static RandomDataProviderProvider rdpp;
 1115|    184|    return &rdpp;
 1116|    184|}
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|    184|{
 1101|    184|    return this->current_provider;
 1102|    184|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE10encoding_ec:
 1629|  79.8k|{
 1630|  79.8k|    std::string result;
 1631|  79.8k|    transcode_utf8(utf8_val, result, encoding, unknown);
 1632|  79.8k|    return result;
 1633|  79.8k|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERS5_10encoding_ec:
 1543|  91.7k|{
 1544|  91.7k|    bool okay = true;
 1545|  91.7k|    result.clear();
 1546|  91.7k|    size_t len = utf8_val.length();
 1547|  91.7k|    switch (encoding) {
 1548|    398|    case e_utf16:
  ------------------
  |  Branch (1548:5): [True: 398, False: 91.3k]
  ------------------
 1549|    398|        result += "\xfe\xff";
 1550|    398|        break;
 1551|  11.9k|    case e_pdfdoc:
  ------------------
  |  Branch (1551:5): [True: 11.9k, False: 79.8k]
  ------------------
 1552|       |        // We need to avoid having the result start with something that will be interpreted as
 1553|       |        // UTF-16 or UTF-8, meaning we can't end up with a string that starts with "fe ff",
 1554|       |        // (UTF-16-BE) "ff fe" (UTF-16-LE, not officially part of the PDF spec, but recognized by
 1555|       |        // most readers including qpdf), or "ef bb bf" (UTF-8). It's more efficient to check the
 1556|       |        // input string to see if it will map to one of those sequences than to check the output
 1557|       |        // string since all cases start with the same starting character.
 1558|  11.9k|        if ((len >= 4) && (utf8_val[0] == '\xc3')) {
  ------------------
  |  Branch (1558:13): [True: 10.1k, False: 1.72k]
  |  Branch (1558:27): [True: 843, False: 9.35k]
  ------------------
 1559|    843|            static std::string fe_ff("\xbe\xc3\xbf");
 1560|    843|            static std::string ff_fe("\xbf\xc3\xbe");
 1561|    843|            static std::string ef_bb_bf("\xaf\xc2\xbb\xc2\xbf");
 1562|       |            // C++-20 has starts_with, but when this was written, qpdf had a minimum supported
 1563|       |            // version of C++-17.
 1564|    843|            if ((utf8_val.compare(1, 3, fe_ff) == 0) || (utf8_val.compare(1, 3, ff_fe) == 0) ||
  ------------------
  |  Branch (1564:17): [True: 0, False: 843]
  |  Branch (1564:57): [True: 0, False: 843]
  ------------------
 1565|    843|                (utf8_val.compare(1, 5, ef_bb_bf) == 0)) {
  ------------------
  |  Branch (1565:17): [True: 0, False: 843]
  ------------------
 1566|      0|                result += unknown;
 1567|      0|                okay = false;
 1568|      0|            }
 1569|    843|        }
 1570|  11.9k|        break;
 1571|  79.4k|    default:
  ------------------
  |  Branch (1571:5): [True: 79.4k, False: 12.3k]
  ------------------
 1572|  79.4k|        break;
 1573|  91.7k|    }
 1574|  91.7k|    size_t pos = 0;
 1575|  47.6M|    while (pos < len) {
  ------------------
  |  Branch (1575:12): [True: 47.5M, False: 91.7k]
  ------------------
 1576|  47.5M|        bool error = false;
 1577|  47.5M|        unsigned long codepoint = QUtil::get_next_utf8_codepoint(utf8_val, pos, error);
 1578|  47.5M|        if (error) {
  ------------------
  |  Branch (1578:13): [True: 12.6M, False: 34.8M]
  ------------------
 1579|  12.6M|            okay = false;
 1580|  12.6M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1580:17): [True: 6.27M, False: 6.35M]
  ------------------
 1581|  6.27M|                result += "\xff\xfd";
 1582|  6.35M|            } else {
 1583|  6.35M|                result.append(1, unknown);
 1584|  6.35M|            }
 1585|  34.8M|        } else if (codepoint < 128) {
  ------------------
  |  Branch (1585:20): [True: 22.3M, False: 12.5M]
  ------------------
 1586|  22.3M|            char ch = static_cast<char>(codepoint);
 1587|  22.3M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1587:17): [True: 5.50M, False: 16.8M]
  ------------------
 1588|  5.50M|                result += QUtil::toUTF16(QIntC::to_ulong(ch));
 1589|  16.8M|            } else if ((encoding == e_pdfdoc) && (((ch >= 0x18) && (ch <= 0x1f)) || (ch == 127))) {
  ------------------
  |  Branch (1589:24): [True: 14.0M, False: 2.79M]
  |  Branch (1589:52): [True: 5.08M, False: 8.96M]
  |  Branch (1589:68): [True: 1.68M, False: 3.39M]
  |  Branch (1589:85): [True: 343k, False: 12.0M]
  ------------------
 1590|       |                // PDFDocEncoding maps some low characters to Unicode, so if we encounter those
 1591|       |                // invalid UTF-8 code points, map them to unknown so reversing the mapping doesn't
 1592|       |                // change them into other characters.
 1593|  2.02M|                okay = false;
 1594|  2.02M|                result.append(1, unknown);
 1595|  14.8M|            } else {
 1596|  14.8M|                result.append(1, ch);
 1597|  14.8M|            }
 1598|  22.3M|        } else if (encoding == e_utf16) {
  ------------------
  |  Branch (1598:20): [True: 90.5k, False: 12.4M]
  ------------------
 1599|  90.5k|            result += QUtil::toUTF16(codepoint);
 1600|  12.4M|        } else if ((codepoint == 0xad) && (encoding == e_pdfdoc)) {
  ------------------
  |  Branch (1600:20): [True: 222, False: 12.4M]
  |  Branch (1600:43): [True: 204, False: 18]
  ------------------
 1601|       |            // PDFDocEncoding omits 0x00ad (soft hyphen).
 1602|    204|            okay = false;
 1603|    204|            result.append(1, unknown);
 1604|  12.4M|        } else if (
 1605|  12.4M|            (codepoint > 160) && (codepoint < 256) &&
  ------------------
  |  Branch (1605:13): [True: 12.4M, False: 308]
  |  Branch (1605:34): [True: 608k, False: 11.8M]
  ------------------
 1606|   608k|            ((encoding == e_winansi) || (encoding == e_pdfdoc))) {
  ------------------
  |  Branch (1606:14): [True: 8.38k, False: 600k]
  |  Branch (1606:41): [True: 106k, False: 494k]
  ------------------
 1607|   114k|            result.append(1, static_cast<char>(codepoint & 0xff));
 1608|  12.3M|        } else {
 1609|  12.3M|            unsigned char ch = '\0';
 1610|  12.3M|            if (encoding == e_winansi) {
  ------------------
  |  Branch (1610:17): [True: 4.62M, False: 7.71M]
  ------------------
 1611|  4.62M|                ch = encode_winansi(codepoint);
 1612|  7.71M|            } else if (encoding == e_macroman) {
  ------------------
  |  Branch (1612:24): [True: 6.66k, False: 7.71M]
  ------------------
 1613|  6.66k|                ch = encode_macroman(codepoint);
 1614|  7.71M|            } else if (encoding == e_pdfdoc) {
  ------------------
  |  Branch (1614:24): [True: 1.44M, False: 6.26M]
  ------------------
 1615|  1.44M|                ch = encode_pdfdoc(codepoint);
 1616|  1.44M|            }
 1617|  12.3M|            if (ch == '\0') {
  ------------------
  |  Branch (1617:17): [True: 10.5M, False: 1.82M]
  ------------------
 1618|  10.5M|                okay = false;
 1619|  10.5M|                ch = static_cast<unsigned char>(unknown);
 1620|  10.5M|            }
 1621|  12.3M|            result.append(1, static_cast<char>(ch));
 1622|  12.3M|        }
 1623|  47.5M|    }
 1624|  91.7k|    return okay;
 1625|  91.7k|}
QUtil.cc:_ZL14encode_winansim:
 1449|  4.62M|{
 1450|  4.62M|    auto i = unicode_to_win_ansi.find(codepoint);
 1451|  4.62M|    if (i != unicode_to_win_ansi.end()) {
  ------------------
  |  Branch (1451:9): [True: 466k, False: 4.15M]
  ------------------
 1452|   466k|        return i->second;
 1453|   466k|    }
 1454|  4.15M|    return '\0';
 1455|  4.62M|}
QUtil.cc:_ZL15encode_macromanm:
 1459|  6.66k|{
 1460|  6.66k|    auto i = unicode_to_mac_roman.find(codepoint);
 1461|  6.66k|    if (i != unicode_to_mac_roman.end()) {
  ------------------
  |  Branch (1461:9): [True: 4.24k, False: 2.41k]
  ------------------
 1462|  4.24k|        return i->second;
 1463|  4.24k|    }
 1464|  2.41k|    return '\0';
 1465|  6.66k|}
QUtil.cc:_ZL13encode_pdfdocm:
 1469|  1.44M|{
 1470|  1.44M|    auto i = unicode_to_pdf_doc.find(codepoint);
 1471|  1.44M|    if (i != unicode_to_pdf_doc.end()) {
  ------------------
  |  Branch (1471:9): [True: 1.35M, False: 86.6k]
  ------------------
 1472|  1.35M|        return i->second;
 1473|  1.35M|    }
 1474|  86.6k|    return '\0';
 1475|  1.44M|}
QUtil.cc:_ZL27int_to_string_base_internalIxENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEET_ii:
  300|  5.57M|{
  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|  5.57M|    if (!((base == 8) || (base == 10) || (base == 16))) {
  ------------------
  |  Branch (304:11): [True: 5.57M, False: 0]
  |  Branch (304:26): [True: 0, False: 0]
  |  Branch (304:42): [True: 0, False: 0]
  ------------------
  305|      0|        throw std::logic_error("int_to_string_base called with unsupported base");
  306|      0|    }
  307|  5.57M|    std::string cvt;
  308|  5.57M|    if (base == 10) {
  ------------------
  |  Branch (308:9): [True: 0, False: 5.57M]
  ------------------
  309|       |        // Use the more efficient std::to_string when possible
  310|      0|        cvt = std::to_string(num);
  311|  5.57M|    } else {
  312|  5.57M|        std::ostringstream buf;
  313|  5.57M|        buf.imbue(std::locale::classic());
  314|  5.57M|        buf << std::setbase(base) << std::nouppercase << num;
  315|  5.57M|        cvt = buf.str();
  316|  5.57M|    }
  317|  5.57M|    std::string result;
  318|  5.57M|    int str_length = QIntC::to_int(cvt.length());
  319|  5.57M|    if ((length > 0) && (str_length < length)) {
  ------------------
  |  Branch (319:9): [True: 5.57M, False: 0]
  |  Branch (319:25): [True: 8.02k, False: 5.56M]
  ------------------
  320|  8.02k|        result.append(QIntC::to_size(length - str_length), '0');
  321|  8.02k|    }
  322|  5.57M|    result += cvt;
  323|  5.57M|    if ((length < 0) && (str_length < -length)) {
  ------------------
  |  Branch (323:9): [True: 0, False: 5.57M]
  |  Branch (323:25): [True: 0, False: 0]
  ------------------
  324|      0|        result.append(QIntC::to_size(-length - str_length), ' ');
  325|      0|    }
  326|  5.57M|    return result;
  327|  5.57M|}

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

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

_ZN17SF_FlateLzwDecode14setDecodeParmsE16QPDFObjectHandle:
   13|  29.9k|{
   14|  29.9k|    if (decode_parms.null()) {
  ------------------
  |  Branch (14:9): [True: 21.8k, False: 8.11k]
  ------------------
   15|  21.8k|        return true;
   16|  21.8k|    }
   17|       |
   18|  8.11k|    auto memory_limit = Pl_Flate::memory_limit();
   19|       |
   20|  8.11k|    std::set<std::string> keys = decode_parms.getKeys();
   21|  16.2k|    for (auto const& key: keys) {
  ------------------
  |  Branch (21:25): [True: 16.2k, False: 7.96k]
  ------------------
   22|  16.2k|        QPDFObjectHandle value = decode_parms.getKey(key);
   23|  16.2k|        if (key == "/Predictor") {
  ------------------
  |  Branch (23:13): [True: 5.18k, False: 11.1k]
  ------------------
   24|  5.18k|            if (value.isInteger()) {
  ------------------
  |  Branch (24:17): [True: 5.17k, False: 10]
  ------------------
   25|  5.17k|                predictor = value.getIntValueAsInt();
   26|  5.17k|                if (!(predictor == 1 || predictor == 2 || (predictor >= 10 && predictor <= 15))) {
  ------------------
  |  Branch (26:23): [True: 211, False: 4.96k]
  |  Branch (26:41): [True: 1.12k, False: 3.83k]
  |  Branch (26:60): [True: 3.79k, False: 41]
  |  Branch (26:79): [True: 3.76k, False: 28]
  ------------------
   27|     69|                    return false;
   28|     69|                }
   29|  5.17k|            } else {
   30|     10|                return false;
   31|     10|            }
   32|  11.1k|        } else if (key == "/Columns" || key == "/Colors" || key == "/BitsPerComponent") {
  ------------------
  |  Branch (32:20): [True: 4.20k, False: 6.89k]
  |  Branch (32:41): [True: 706, False: 6.19k]
  |  Branch (32:61): [True: 533, False: 5.65k]
  ------------------
   33|  5.44k|            if (value.isInteger()) {
  ------------------
  |  Branch (33:17): [True: 5.43k, False: 10]
  ------------------
   34|  5.43k|                int val = value.getIntValueAsInt();
   35|  5.43k|                if (memory_limit && static_cast<unsigned int>(val) > memory_limit) {
  ------------------
  |  Branch (35:21): [True: 5.43k, False: 1]
  |  Branch (35:37): [True: 22, False: 5.41k]
  ------------------
   36|     22|                    QPDFLogger::defaultLogger()->warn(
   37|     22|                        "SF_FlateLzwDecode parameter exceeds PL_Flate memory limit\n");
   38|     22|                    return false;
   39|     22|                }
   40|  5.41k|                if (key == "/Columns") {
  ------------------
  |  Branch (40:21): [True: 4.19k, False: 1.21k]
  ------------------
   41|  4.19k|                    columns = val;
   42|  4.19k|                } else if (key == "/Colors") {
  ------------------
  |  Branch (42:28): [True: 684, False: 534]
  ------------------
   43|    684|                    colors = val;
   44|    684|                } else if (key == "/BitsPerComponent") {
  ------------------
  |  Branch (44:28): [True: 533, False: 1]
  ------------------
   45|    533|                    bits_per_component = val;
   46|    533|                }
   47|  5.41k|            } else {
   48|     10|                return false;
   49|     10|            }
   50|  5.65k|        } else if (lzw && (key == "/EarlyChange")) {
  ------------------
  |  Branch (50:20): [True: 5.02k, False: 636]
  |  Branch (50:27): [True: 180, False: 4.84k]
  ------------------
   51|    180|            if (value.isInteger()) {
  ------------------
  |  Branch (51:17): [True: 174, False: 6]
  ------------------
   52|    174|                int earlychange = value.getIntValueAsInt();
   53|    174|                early_code_change = (earlychange == 1);
   54|    174|                if (!(earlychange == 0 || earlychange == 1)) {
  ------------------
  |  Branch (54:23): [True: 66, False: 108]
  |  Branch (54:43): [True: 66, False: 42]
  ------------------
   55|     42|                    return false;
   56|     42|                }
   57|    174|            } else {
   58|      6|                return false;
   59|      6|            }
   60|    180|        }
   61|  16.2k|    }
   62|       |
   63|  7.96k|    if (predictor > 1 && columns == 0) {
  ------------------
  |  Branch (63:9): [True: 4.89k, False: 3.06k]
  |  Branch (63:26): [True: 10, False: 4.88k]
  ------------------
   64|     10|        return false;
   65|     10|    }
   66|       |
   67|  7.95k|    return true;
   68|  7.96k|}
_ZN17SF_FlateLzwDecode17getDecodePipelineEP8Pipeline:
   72|  29.7k|{
   73|  29.7k|    std::unique_ptr<Pipeline> pipeline;
   74|  29.7k|    if (predictor >= 10 && predictor <= 15) {
  ------------------
  |  Branch (74:9): [True: 3.74k, False: 26.0k]
  |  Branch (74:28): [True: 3.74k, False: 0]
  ------------------
   75|  3.74k|        QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter");
   76|  3.74k|        pipeline = std::make_unique<Pl_PNGFilter>(
   77|  3.74k|            "png decode",
   78|  3.74k|            next,
   79|  3.74k|            Pl_PNGFilter::a_decode,
   80|  3.74k|            QIntC::to_uint(columns),
   81|  3.74k|            QIntC::to_uint(colors),
   82|  3.74k|            QIntC::to_uint(bits_per_component));
   83|  3.74k|        next = pipeline.get();
   84|  3.74k|        pipelines.push_back(std::move(pipeline));
   85|  26.0k|    } else if (predictor == 2) {
  ------------------
  |  Branch (85:16): [True: 1.11k, False: 24.9k]
  ------------------
   86|  1.11k|        QTC::TC("qpdf", "SF_FlateLzwDecode TIFF predictor");
   87|  1.11k|        pipeline = std::make_unique<Pl_TIFFPredictor>(
   88|  1.11k|            "tiff decode",
   89|  1.11k|            next,
   90|  1.11k|            Pl_TIFFPredictor::a_decode,
   91|  1.11k|            QIntC::to_uint(columns),
   92|  1.11k|            QIntC::to_uint(colors),
   93|  1.11k|            QIntC::to_uint(bits_per_component));
   94|  1.11k|        next = pipeline.get();
   95|  1.11k|        pipelines.push_back(std::move(pipeline));
   96|  1.11k|    }
   97|       |
   98|  29.7k|    if (lzw) {
  ------------------
  |  Branch (98:9): [True: 8.46k, False: 21.3k]
  ------------------
   99|  8.46k|        pipeline = std::make_unique<Pl_LZWDecoder>("lzw decode", next, early_code_change);
  100|  21.3k|    } else {
  101|  21.3k|        pipeline = std::make_unique<Pl_Flate>("stream inflate", next, Pl_Flate::a_inflate);
  102|  21.3k|    }
  103|  29.7k|    next = pipeline.get();
  104|  29.7k|    pipelines.push_back(std::move(pipeline));
  105|  29.7k|    return next;
  106|  29.7k|}

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

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

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

_ZN4qpdf4impl8AcroFormC2ERN4QPDF3DocE:
   38|  21.3k|            Common(doc)
   39|  21.3k|        {
   40|       |            // We have to analyze up front. Otherwise, when we are adding annotations and fields, we
   41|       |            // are in a temporarily unstable configuration where some widget annotations are not
   42|       |            // reachable.
   43|  21.3k|            validate();
   44|  21.3k|        }
_ZN4qpdf4impl8FormNodeC2ERK16QPDFObjectHandle:
  352|   193k|            BaseDictionary(oh)
  353|   193k|        {
  354|   193k|        }
_ZNK4qpdf4impl8FormNode2APEv:
  372|  16.5k|        {
  373|  16.5k|            return {get("/AP")};
  374|  16.5k|        }
_ZN4qpdf4impl8FormNode6ParentEv:
  386|   100k|        {
  387|   100k|            return {get("/Parent")};
  388|   100k|        }
_ZNK4qpdf4impl8FormNode4KidsEv:
  400|  41.2k|        {
  401|  41.2k|            return {get("/Kids")};
  402|  41.2k|        }
_ZNK4qpdf4impl8FormNode2FTEb:
  470|  61.7k|        {
  471|  61.7k|            return inheritable_value<Name>("/FT");
  472|  61.7k|        }
_ZNK4qpdf4impl8FormNode1TEv:
  480|  64.5k|        {
  481|  64.5k|            return {get("/T")};
  482|  64.5k|        }
_ZNK4qpdf4impl8FormNode5fieldEv:
  660|  17.0k|        {
  661|  17.0k|            return T() || Kids() || FT();
  ------------------
  |  Branch (661:20): [True: 9.35k, False: 7.72k]
  |  Branch (661:27): [True: 1.88k, False: 5.84k]
  |  Branch (661:37): [True: 1.32k, False: 4.52k]
  ------------------
  662|  17.0k|        }
_ZNK4qpdf4impl8FormNode6widgetEv:
  680|  17.0k|        {
  681|  17.0k|            return !Kids() && (contains("/Subtype") || contains("/Rect") || contains("/AP"));
  ------------------
  |  Branch (681:20): [True: 13.1k, False: 3.90k]
  |  Branch (681:32): [True: 7.66k, False: 5.51k]
  |  Branch (681:56): [True: 336, False: 5.18k]
  |  Branch (681:77): [True: 300, False: 4.88k]
  ------------------
  682|  17.0k|        }
_ZNK4qpdf4impl8FormNode13from_AcroFormERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  767|  26.4k|        {
  768|  26.4k|            return {qpdf() ? qpdf()->getRoot()["/AcroForm"][name] : null_oh};
  ------------------
  |  Branch (768:21): [True: 25.0k, False: 1.39k]
  ------------------
  769|  26.4k|        }
_ZN26QPDFAcroFormDocumentHelper7MembersC2ER4QPDF:
  790|  21.3k|        AcroForm(qpdf.doc())
  791|  21.3k|    {
  792|  21.3k|    }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_4NameEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  61.7k|        {
  449|  61.7k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 53.4k, False: 8.36k]
  ------------------
  450|  53.4k|                return {v};
  451|  53.4k|            }
  452|  8.36k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 8.36k, False: 0]
  ------------------
  453|  61.7k|        }
_ZN4qpdf4impl8AcroFormD2Ev:
   35|  21.3k|        ~AcroForm() = default;
_ZN4qpdf4impl8FormNodeC2ERKS1_:
  345|  38.3k|        FormNode(FormNode const&) = default;
_ZN4qpdf4impl8FormNodeaSEOS1_:
  348|  55.4k|        FormNode& operator=(FormNode&&) = default;
_ZNK4qpdf4impl8FormNode17inheritable_valueI16QPDFObjectHandleEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  7.71k|        {
  449|  7.71k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 1.48k, False: 6.23k]
  ------------------
  450|  1.48k|                return {v};
  451|  1.48k|            }
  452|  6.23k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 6.23k, False: 0]
  ------------------
  453|  7.71k|        }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_6StringEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  26.8k|        {
  449|  26.8k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 11.5k, False: 15.2k]
  ------------------
  450|  11.5k|                return {v};
  451|  11.5k|            }
  452|  15.2k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 15.2k, False: 0]
  ------------------
  453|  26.8k|        }
_ZNK4qpdf4impl8FormNode1VI16QPDFObjectHandleEET_b:
  564|  1.36k|        {
  565|  1.36k|            return inheritable_value<T>("/V", inherit);
  566|  1.36k|        }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_5ArrayEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  1.66k|        {
  449|  1.66k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 1.30k, False: 362]
  ------------------
  450|  1.30k|                return {v};
  451|  1.30k|            }
  452|    362|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 362, False: 0]
  ------------------
  453|  1.66k|        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

_ZNK4qpdf10BaseHandle13raw_type_codeEv:
  933|  48.6M|    {
  934|  48.6M|        return obj ? static_cast<qpdf_object_type_e>(obj->value.index()) : ::ot_uninitialized;
  ------------------
  |  Branch (934:16): [True: 48.6M, False: 0]
  ------------------
  935|  48.6M|    }
_ZNK4qpdf10BaseHandle4qpdfEv:
  927|  1.16M|    {
  928|  1.16M|        return obj ? obj->qpdf : nullptr;
  ------------------
  |  Branch (928:16): [True: 1.16M, False: 1.40k]
  ------------------
  929|  1.16M|    }
_ZNK4qpdf10BaseHandle6offsetEv:
  921|  96.5k|    {
  922|  96.5k|        return obj ? obj->parsed_offset : -1;
  ------------------
  |  Branch (922:16): [True: 96.5k, False: 0]
  ------------------
  923|  96.5k|    }
_ZNK4qpdf10BaseHandle9type_codeEv:
  951|  12.1M|    {
  952|  12.1M|        if (!obj) {
  ------------------
  |  Branch (952:13): [True: 246k, False: 11.9M]
  ------------------
  953|   246k|            return ::ot_uninitialized;
  954|   246k|        }
  955|  11.9M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (955:13): [True: 352k, False: 11.5M]
  ------------------
  956|   352k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  957|   352k|        }
  958|  11.5M|        if (raw_type_code() == ::ot_reference) {
  ------------------
  |  Branch (958:13): [True: 0, False: 11.5M]
  ------------------
  959|      0|            return std::get<QPDF_Reference>(obj->value).obj->getTypeCode();
  960|      0|        }
  961|  11.5M|        return raw_type_code();
  962|  11.5M|    }
_ZNK4qpdf10BaseHandle8indirectEv:
  860|  5.45M|    {
  861|  5.45M|        return obj ? obj->og.isIndirect() : false;
  ------------------
  |  Branch (861:16): [True: 5.45M, False: 6.15k]
  ------------------
  862|  5.45M|    }
_ZNK4qpdf10BaseHandle4nullEv:
  907|  1.63M|    {
  908|  1.63M|        return !obj || type_code() == ::ot_null;
  ------------------
  |  Branch (908:16): [True: 186k, False: 1.44M]
  |  Branch (908:24): [True: 313k, False: 1.13M]
  ------------------
  909|  1.63M|    }
_ZN4qpdf5ArrayC2ERK16QPDFObjectHandle:
   57|   942k|            BaseHandle(oh.resolved_type_code() == ::ot_array ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (57:24): [True: 855k, False: 87.1k]
  ------------------
   58|   942k|        {
   59|   942k|        }
_ZNK4qpdf10BaseHandle18resolved_type_codeEv:
  939|  4.56M|    {
  940|  4.56M|        if (!obj) {
  ------------------
  |  Branch (940:13): [True: 147k, False: 4.41M]
  ------------------
  941|   147k|            return ::ot_uninitialized;
  942|   147k|        }
  943|  4.41M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (943:13): [True: 663, False: 4.41M]
  ------------------
  944|    663|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  945|    663|        }
  946|  4.41M|        return raw_type_code();
  947|  4.41M|    }
_ZN4qpdf10BaseHandleC2ERK16QPDFObjectHandle:
  788|  2.71M|        obj(oh.obj)
  789|  2.71M|    {
  790|  2.71M|    }
_ZN4qpdf10DictionaryC2ERK16QPDFObjectHandle:
  268|   670k|            BaseDictionary(oh)
  269|   670k|        {
  270|   670k|        }
_ZN4qpdf14BaseDictionaryC2ERK16QPDFObjectHandle:
  238|   864k|            BaseHandle(oh.resolved_type_code() == ::ot_dictionary ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (238:24): [True: 748k, False: 115k]
  ------------------
  239|   864k|        {
  240|   864k|        }
_ZN4qpdf14BaseDictionary5beginEv:
  141|   125k|        {
  142|   125k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (142:22): [True: 92.1k, False: 33.7k]
  ------------------
  143|  92.1k|                return d->items.begin();
  144|  92.1k|            }
  145|  33.7k|            return {};
  146|   125k|        }
_ZNK4qpdf10BaseHandle2asI15QPDF_DictionaryEEPT_v:
  770|  3.21M|    {
  771|  3.21M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 77.4k, False: 3.13M]
  ------------------
  772|  77.4k|            return nullptr;
  773|  77.4k|        }
  774|  3.13M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 3.08M, False: 46.9k]
  ------------------
  775|  3.08M|            return &std::get<T>(obj->value);
  776|  3.08M|        }
  777|  46.9k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 1.07k, False: 45.8k]
  ------------------
  778|  1.07k|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|  1.07k|        }
  780|  45.8k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 45.8k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  45.8k|        return nullptr;
  785|  45.8k|    }
_ZN4qpdf14BaseDictionary3endEv:
  150|   125k|        {
  151|   125k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (151:22): [True: 92.1k, False: 33.7k]
  ------------------
  152|  92.1k|                return d->items.end();
  153|  92.1k|            }
  154|  33.7k|            return {};
  155|   125k|        }
_ZNK4qpdf10BaseHandle6id_genEv:
  854|   411k|    {
  855|   411k|        return obj ? obj->og : QPDFObjGen();
  ------------------
  |  Branch (855:16): [True: 411k, False: 0]
  ------------------
  856|   411k|    }
_ZNK4qpdf6Stream7getDictEv:
  554|   157k|        {
  555|   157k|            return {stream()->stream_dict};
  556|   157k|        }
_ZNK4qpdf6Stream6streamEv:
  697|   463k|        {
  698|   463k|            if (auto s = as<QPDF_Stream>()) {
  ------------------
  |  Branch (698:22): [True: 463k, False: 0]
  ------------------
  699|   463k|                if (auto ptr = s->m.get()) {
  ------------------
  |  Branch (699:26): [True: 463k, False: 1]
  ------------------
  700|   463k|                    return ptr;
  701|   463k|                }
  702|      1|                throw std::logic_error("QPDF_Stream: unexpected nullptr");
  703|   463k|            }
  704|      0|            throw std::runtime_error("operation for stream attempted on non-stream object");
  705|      0|            return nullptr; // unreachable
  706|   463k|        }
_ZNK4qpdf10BaseHandle2asI11QPDF_StreamEEPT_v:
  770|   463k|    {
  771|   463k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 463k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   463k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 463k, False: 0]
  ------------------
  775|   463k|            return &std::get<T>(obj->value);
  776|   463k|        }
  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|   296k|            BaseHandle(oh.type_code() == ::ot_integer ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (319:24): [True: 173k, False: 122k]
  ------------------
  320|   296k|        {
  321|   296k|        }
_ZNK4qpdf7IntegercvbEv:
  330|   157k|        {
  331|   157k|            return obj != nullptr;
  332|   157k|        }
_ZN4qpdfeqERKNS_4NameENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  473|   390k|        {
  474|   390k|            return lhs && lhs.value() == rhs;
  ------------------
  |  Branch (474:20): [True: 296k, False: 93.5k]
  |  Branch (474:27): [True: 179k, False: 117k]
  ------------------
  475|   390k|        }
_ZN4qpdf4NameC2ERK16QPDFObjectHandle:
  449|   515k|            BaseHandle(oh.type_code() == ::ot_name ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (449:24): [True: 335k, False: 180k]
  ------------------
  450|   515k|        {
  451|   515k|        }
_ZNK4qpdf10BaseHandle2ohEv:
  805|   249k|    {
  806|   249k|        return {obj};
  807|   249k|    }
_ZN10QPDFObject6createI9QPDF_NullJEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|   834k|{
  989|   834k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   834k|}
_ZNK4qpdf7Integer5valueITkNSt3__18integralEiEET_v:
  361|  48.7k|        {
  362|  48.7k|            try {
  363|  48.7k|                return static_cast<T>(*this);
  364|  48.7k|            } catch (std::underflow_error&) {
  365|    120|                if constexpr (std::is_same_v<T, int>) {
  366|    120|                    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|    120|                return std::numeric_limits<T>::min();
  377|    373|            } catch (std::overflow_error&) {
  378|    373|                if constexpr (std::is_same_v<T, int>) {
  379|    373|                    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|    373|                return std::numeric_limits<T>::max();
  388|    373|            }
  389|  48.7k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEiEEv:
  339|  62.8k|        {
  340|  62.8k|            auto v = value();
  341|       |
  342|  62.8k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 374, False: 62.5k]
  ------------------
  343|    374|                throw std::overflow_error("Integer conversion overflow");
  344|    374|            }
  345|  62.5k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 120, False: 62.3k]
  ------------------
  346|    120|                throw std::underflow_error("Integer conversion underflow");
  347|    120|            }
  348|  62.3k|            return static_cast<T>(v);
  349|  62.5k|        }
_ZN4qpdf5ArrayaSERKS0_:
   36|  4.23k|        {
   37|  4.23k|            if (obj != other.obj) {
  ------------------
  |  Branch (37:17): [True: 4.23k, False: 0]
  ------------------
   38|  4.23k|                obj = other.obj;
   39|  4.23k|            }
   40|  4.23k|            return *this;
   41|  4.23k|        }
_ZN4qpdf5ArrayC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
   47|   218k|            BaseHandle(obj)
   48|   218k|        {
   49|   218k|        }
_ZN4qpdf5ArrayC2EONSt3__110shared_ptrI10QPDFObjectEE:
   52|  51.0k|            BaseHandle(std::move(obj))
   53|  51.0k|        {
   54|  51.0k|        }
_ZN4qpdf5ArrayaSERK16QPDFObjectHandle:
   63|  17.7k|        {
   64|  17.7k|            assign(::ot_array, oh);
   65|  17.7k|            return *this;
   66|  17.7k|        }
_ZN4qpdf5ArrayC2EO16QPDFObjectHandle:
   69|     34|            BaseHandle(oh.resolved_type_code() == ::ot_array ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (69:24): [True: 1, False: 33]
  ------------------
   70|     34|        {
   71|     34|        }
_ZN4qpdf14BaseDictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  220|  79.3k|            BaseHandle(QPDFObject::create<QPDF_Dictionary>(std::move(dict)))
  221|  79.3k|        {
  222|  79.3k|        }
_ZN4qpdf14BaseDictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  225|   378k|            BaseHandle(obj)
  226|   378k|        {
  227|   378k|        }
_ZN4qpdf14BaseDictionaryC2EO16QPDFObjectHandle:
  243|  19.3k|            BaseHandle(
  244|  19.3k|                oh.resolved_type_code() == ::ot_dictionary ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (244:17): [True: 18.1k, False: 1.16k]
  ------------------
  245|  19.3k|        {
  246|  19.3k|        }
_ZN4qpdf10DictionaryaSERK16QPDFObjectHandle:
  274|  27.5k|        {
  275|  27.5k|            assign(::ot_dictionary, oh);
  276|  27.5k|            return *this;
  277|  27.5k|        }
_ZN4qpdf10DictionaryC2EO16QPDFObjectHandle:
  280|  19.3k|            BaseDictionary(std::move(oh))
  281|  19.3k|        {
  282|  19.3k|        }
_ZN4qpdf10DictionaryaSEO16QPDFObjectHandle:
  286|    261|        {
  287|    261|            assign(::ot_dictionary, std::move(oh));
  288|    261|            return *this;
  289|    261|        }
_ZNKR4qpdf4NamecvNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEv:
  461|  39.4k|        {
  462|  39.4k|            return value();
  463|  39.4k|        }
_ZN4qpdf4NullC2Ev:
  483|      2|            BaseHandle(QPDFObject::create<QPDF_Null>())
  484|      2|        {
  485|      2|        }
_ZN4qpdf4Null4tempEv:
  496|  83.2k|        {
  497|  83.2k|            return temp_.oh();
  498|  83.2k|        }
_ZN4qpdf4Null7if_nullE16QPDFObjectHandle:
  503|  16.5k|        {
  504|  16.5k|            return oh ? std::move(oh) : Null::temp();
  ------------------
  |  Branch (504:20): [True: 11.5k, False: 4.99k]
  ------------------
  505|  16.5k|        }
_ZN4qpdf6StreamC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  515|   156k|            BaseHandle(obj)
  516|   156k|        {
  517|   156k|        }
_ZN4qpdf6StreamC2EONSt3__110shared_ptrI10QPDFObjectEE:
  520|   176k|            BaseHandle(std::move(obj))
  521|   176k|        {
  522|   176k|        }
_ZN4qpdf6StreamC2EO16QPDFObjectHandle:
  537|  51.5k|            BaseHandle(oh.type_code() == ::ot_stream ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (537:24): [True: 18.7k, False: 32.7k]
  ------------------
  538|  51.5k|        {
  539|  51.5k|        }
_ZNK4qpdf6Stream6LengthEv:
  563|  4.40k|        {
  564|  4.40k|            return {getDict()["/Length"]};
  565|  4.40k|        }
_ZNK4qpdf6Stream7SubtypeEv:
  592|  11.2k|        {
  593|  11.2k|            return {getDict()["/Subtype"]};
  594|  11.2k|        }
_ZNK4qpdf6Stream4TypeEv:
  601|  25.8k|        {
  602|  25.8k|            return {getDict()["/Type"]};
  603|  25.8k|        }
_ZNK4qpdf6Stream9getLengthEv:
  624|  1.10k|        {
  625|  1.10k|            return stream()->length;
  626|  1.10k|        }
_ZN4qpdf6Stream11replaceDictERK16QPDFObjectHandle:
  681|  7.10k|        {
  682|  7.10k|            auto s = stream();
  683|  7.10k|            s->stream_dict = new_dict;
  684|  7.10k|            setDictDescription();
  685|  7.10k|        }
_ZN4qpdf6StringC2ERK16QPDFObjectHandle:
  732|  94.1k|            BaseHandle(oh.type_code() == ::ot_string ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (732:24): [True: 61.6k, False: 32.4k]
  ------------------
  733|  94.1k|        {
  734|  94.1k|        }
_ZN4qpdf6StringC2EO16QPDFObjectHandle:
  737|   233k|            BaseHandle(oh.type_code() == ::ot_string ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (737:24): [True: 233k, False: 0]
  ------------------
  738|   233k|        {
  739|   233k|        }
_ZNK4qpdf10BaseHandle6obj_spEv:
  799|   195k|    {
  800|   195k|        return obj;
  801|   195k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eRKS0_:
  838|  45.2k|    {
  839|  45.2k|        if (obj != other.obj) {
  ------------------
  |  Branch (839:13): [True: 21.1k, False: 24.0k]
  ------------------
  840|  21.1k|            obj = other.resolved_type_code() == required ? other.obj : nullptr;
  ------------------
  |  Branch (840:19): [True: 17.9k, False: 3.27k]
  ------------------
  841|  21.1k|        }
  842|  45.2k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eOS0_:
  846|    261|    {
  847|    261|        if (obj != other.obj) {
  ------------------
  |  Branch (847:13): [True: 183, False: 78]
  ------------------
  848|    183|            obj = other.resolved_type_code() == required ? std::move(other.obj) : nullptr;
  ------------------
  |  Branch (848:19): [True: 183, False: 0]
  ------------------
  849|    183|        }
  850|    261|    }
_ZNK4qpdf10BaseHandle21no_ci_stop_damaged_ifEbRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  877|  7.11k|    {
  878|  7.11k|        if (condition) {
  ------------------
  |  Branch (878:13): [True: 0, False: 7.11k]
  ------------------
  879|      0|            throw std::runtime_error(message);
  880|      0|        }
  881|  7.11k|    }
_ZNK4qpdf10BaseHandle13no_ci_warn_ifEbRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  885|  15.8k|    {
  886|  15.8k|        if (condition) {
  ------------------
  |  Branch (886:13): [True: 0, False: 15.8k]
  ------------------
  887|      0|            warn(warning);
  888|      0|        }
  889|  15.8k|    }
_ZNK4qpdf10BaseHandle3getERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  901|  1.35M|    {
  902|  1.35M|        return (*this)[key];
  903|  1.35M|    }
_ZN9QPDF_Null6createENSt3__110shared_ptrI10QPDFObjectEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
  974|   311k|{
  975|   311k|    auto n = QPDFObject::create<QPDF_Null>();
  976|   311k|    n->setChildDescription(parent->getQPDF(), parent, static_descr, var_descr);
  977|   311k|    return n;
  978|   311k|}
_ZNK16QPDFObjectHandle8as_arrayEN4qpdf5typedE:
 1006|   267k|{
 1007|   267k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1007:9): [True: 0, False: 267k]
  ------------------
 1008|      0|        assertType("array", false);
 1009|      0|    }
 1010|   267k|    if (options & qpdf::any_flag || type_code() == ::ot_array ||
  ------------------
  |  Branch (1010:9): [True: 82.8k, False: 184k]
  |  Branch (1010:37): [True: 133k, False: 51.0k]
  ------------------
 1011|   216k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1011:10): [True: 0, False: 51.0k]
  |  Branch (1011:38): [True: 0, False: 0]
  ------------------
 1012|   216k|        return qpdf::Array(obj);
 1013|   216k|    }
 1014|  51.0k|    return qpdf::Array(std::shared_ptr<QPDFObject>());
 1015|   267k|}
_ZNK16QPDFObjectHandle13as_dictionaryEN4qpdf5typedE:
 1019|   378k|{
 1020|   378k|    if (options & qpdf::any_flag || type_code() == ::ot_dictionary ||
  ------------------
  |  Branch (1020:9): [True: 63.7k, False: 314k]
  |  Branch (1020:37): [True: 286k, False: 28.0k]
  ------------------
 1021|   350k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1021:10): [True: 0, False: 28.0k]
  |  Branch (1021:38): [True: 0, False: 0]
  ------------------
 1022|   350k|        return qpdf::Dictionary(obj);
 1023|   350k|    }
 1024|  28.0k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1024:9): [True: 0, False: 28.0k]
  ------------------
 1025|      0|        assertType("dictionary", false);
 1026|      0|    }
 1027|  28.0k|    return qpdf::Dictionary(std::shared_ptr<QPDFObject>());
 1028|   378k|}
_ZNK16QPDFObjectHandle9as_streamEN4qpdf5typedE:
 1032|   335k|{
 1033|   335k|    if (options & qpdf::any_flag || type_code() == ::ot_stream ||
  ------------------
  |  Branch (1033:9): [True: 0, False: 335k]
  |  Branch (1033:37): [True: 158k, False: 176k]
  ------------------
 1034|   176k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1034:10): [True: 0, False: 176k]
  |  Branch (1034:38): [True: 0, False: 0]
  ------------------
 1035|   156k|        return qpdf::Stream(obj);
 1036|   156k|    }
 1037|   179k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1037:9): [True: 0, False: 179k]
  ------------------
 1038|      0|        assertType("stream", false);
 1039|      0|    }
 1040|   179k|    return qpdf::Stream(std::shared_ptr<QPDFObject>());
 1041|   335k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  22.6k|{
  989|  22.6k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  22.6k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   341k|{
  989|   341k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   341k|}
_ZN4qpdf10BaseHandleC2EO16QPDFObjectHandle:
  793|   300k|        obj(std::move(oh.obj))
  794|   300k|    {
  795|   300k|    }
_ZN4qpdf10DictionaryC2Ev:
  256|  23.9k|        Dictionary() = default;
_ZN4qpdf14BaseDictionaryC2Ev:
  212|  23.9k|        BaseDictionary() = default;
_ZN4qpdf10DictionaryC2ERKS0_:
  262|  52.4k|        Dictionary(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryC2ERKS0_:
  232|  90.8k|        BaseDictionary(BaseDictionary const&) = default;
_ZN4qpdf10DictionaryaSEOS0_:
  265|  4.80k|        Dictionary& operator=(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryaSEOS0_:
  235|  60.2k|        BaseDictionary& operator=(BaseDictionary&&) = default;
_ZN4qpdf6StreamaSEOS0_:
  528|  8.23k|        Stream& operator=(Stream&&) = default;
_ZN10QPDFObject6createI9QPDF_BoolJRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|    886|{
  989|    886|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    886|}
_ZN10QPDFObject6createI12QPDF_IntegerJRxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  4.06M|{
  989|  4.06M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  4.06M|}
_ZN10QPDFObject6createI9QPDF_RealJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  46.7k|{
  989|  46.7k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  46.7k|}
_ZN10QPDFObject6createI11QPDF_StringJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   142k|{
  989|   142k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   142k|}
_ZN10QPDFObject6createI9QPDF_NameJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   154k|{
  989|   154k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   154k|}
_ZN10QPDFObject6createI10QPDF_ArrayJS1_EEENSt3__110shared_ptrIS_EEDpOT0_:
  988|    447|{
  989|    447|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    447|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEbEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  41.8k|{
  989|  41.8k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  41.8k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  35.0k|{
  989|  35.0k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  35.0k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_BoolEEPT_v:
  770|  5.70k|    {
  771|  5.70k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 5.70k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  5.70k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 5.70k, False: 0]
  ------------------
  775|  5.70k|            return &std::get<T>(obj->value);
  776|  5.70k|        }
  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|   174k|    {
  771|   174k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 1.17k, False: 173k]
  ------------------
  772|  1.17k|            return nullptr;
  773|  1.17k|        }
  774|   173k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 173k, False: 0]
  ------------------
  775|   173k|            return &std::get<T>(obj->value);
  776|   173k|        }
  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|  58.8k|        {
  340|  58.8k|            auto v = value();
  341|       |
  342|  58.8k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 58.8k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  58.8k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 0, False: 58.8k]
  ------------------
  346|      0|                throw std::underflow_error("Integer conversion underflow");
  347|      0|            }
  348|  58.8k|            return static_cast<T>(v);
  349|  58.8k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEyEET_v:
  361|  25.0k|        {
  362|  25.0k|            try {
  363|  25.0k|                return static_cast<T>(*this);
  364|  25.0k|            } catch (std::underflow_error&) {
  365|       |                if constexpr (std::is_same_v<T, int>) {
  366|       |                    warn("requested value of integer is too small; returning INT_MIN");
  367|       |                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|       |                    warn("unsigned integer value request for negative number; returning 0");
  369|    111|                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|    111|                    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|    111|                return std::numeric_limits<T>::min();
  377|    111|            } 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|  25.0k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEyEEv:
  339|  25.0k|        {
  340|  25.0k|            auto v = value();
  341|       |
  342|  25.0k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 25.0k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  25.0k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 111, False: 24.9k]
  ------------------
  346|    111|                throw std::underflow_error("Integer conversion underflow");
  347|    111|            }
  348|  24.9k|            return static_cast<T>(v);
  349|  25.0k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEjEET_v:
  361|  7.48k|        {
  362|  7.48k|            try {
  363|  7.48k|                return static_cast<T>(*this);
  364|  7.48k|            } catch (std::underflow_error&) {
  365|       |                if constexpr (std::is_same_v<T, int>) {
  366|       |                    warn("requested value of integer is too small; returning INT_MIN");
  367|    123|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|    123|                    warn("unsigned integer value request for negative number; returning 0");
  369|       |                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|       |                    warn("unsigned value request for negative number; returning 0");
  371|       |                } else {
  372|       |                    warn(
  373|       |                        "underflow while converting integer object; returning smallest possible "
  374|       |                        "value");
  375|       |                }
  376|    123|                return std::numeric_limits<T>::min();
  377|    123|            } catch (std::overflow_error&) {
  378|       |                if constexpr (std::is_same_v<T, int>) {
  379|       |                    warn("requested value of integer is too big; returning INT_MAX");
  380|     75|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|     75|                    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|     75|                return std::numeric_limits<T>::max();
  388|     75|            }
  389|  7.48k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEjEEv:
  339|  7.48k|        {
  340|  7.48k|            auto v = value();
  341|       |
  342|  7.48k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 75, False: 7.40k]
  ------------------
  343|     75|                throw std::overflow_error("Integer conversion overflow");
  344|     75|            }
  345|  7.40k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 123, False: 7.28k]
  ------------------
  346|    123|                throw std::underflow_error("Integer conversion underflow");
  347|    123|            }
  348|  7.28k|            return static_cast<T>(v);
  349|  7.40k|        }
_ZNK4qpdf10BaseHandle2asI9QPDF_RealEEPT_v:
  770|   151k|    {
  771|   151k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 151k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   151k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 151k, False: 0]
  ------------------
  775|   151k|            return &std::get<T>(obj->value);
  776|   151k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZN10QPDFObject6createI9QPDF_NameJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  2.47M|{
  989|  2.47M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  2.47M|}
_ZN10QPDFObject6createI9QPDF_NameJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  55.3k|{
  989|  55.3k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  55.3k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_NameEEPT_v:
  770|   385k|    {
  771|   385k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 385k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   385k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 381k, False: 3.64k]
  ------------------
  775|   381k|            return &std::get<T>(obj->value);
  776|   381k|        }
  777|  3.64k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 1, False: 3.64k]
  ------------------
  778|      1|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      1|        }
  780|  3.64k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 3.64k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  3.64k|        return nullptr;
  785|  3.64k|    }
_ZN10QPDFObject6createI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   596k|{
  989|   596k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   596k|}
_ZN10QPDFObject6createI11QPDF_StringJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    398|{
  989|    398|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    398|}
_ZNK4qpdf10BaseHandle2asI11QPDF_StringEEPT_v:
  770|   276k|    {
  771|   276k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 276k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   276k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 276k, False: 0]
  ------------------
  775|   276k|            return &std::get<T>(obj->value);
  776|   276k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZNK4qpdf10BaseHandle2asI13QPDF_OperatorEEPT_v:
  770|  1.49M|    {
  771|  1.49M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 1.49M]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  1.49M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 1.49M, False: 0]
  ------------------
  775|  1.49M|            return &std::get<T>(obj->value);
  776|  1.49M|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZN10QPDFObject6createI9QPDF_RealJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   472k|{
  989|   472k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   472k|}
_ZN10QPDFObject6createI9QPDF_RealJRdRiRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  66.7k|{
  989|  66.7k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  66.7k|}
_ZN9QPDF_RealC2Edib:
  981|  66.7k|    val(QUtil::double_to_string(value, decimal_places, trim_trailing_zeroes))
  982|  66.7k|{
  983|  66.7k|}
_ZN10QPDFObject6createI13QPDF_OperatorJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  1.77M|{
  989|  1.77M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.77M|}
_ZN10QPDFObject6createI10QPDF_ArrayJRKNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  31.0k|{
  989|  31.0k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  31.0k|}
_ZN15QPDF_DictionaryC2EONSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
  967|   341k|    items(std::move(items))
  968|   341k|{
  969|   341k|}
_ZN10QPDFObject6createI9QPDF_BoolJbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  21.1k|{
  989|  21.1k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  21.1k|}
_ZN10QPDFObject6createI12QPDF_IntegerJxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  1.11M|{
  989|  1.11M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.11M|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   366k|{
  989|   366k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   366k|}
_ZNK4qpdf10BaseHandle2asI10QPDF_ArrayEEPT_v:
  770|  2.67M|    {
  771|  2.67M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 151k, False: 2.52M]
  ------------------
  772|   151k|            return nullptr;
  773|   151k|        }
  774|  2.52M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 2.45M, False: 67.8k]
  ------------------
  775|  2.45M|            return &std::get<T>(obj->value);
  776|  2.45M|        }
  777|  67.8k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 67.8k]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|  67.8k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 67.8k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  67.8k|        return nullptr;
  785|  67.8k|    }
_ZN4qpdf6Stream6LengthITkNSt3__18integralExEEvT_:
  582|  4.40k|        {
  583|  4.40k|            qpdf_expect(val >= 0);
  ------------------
  |  |   13|  4.40k|#define qpdf_expect assert
  ------------------
  |  Branch (583:13): [True: 4.40k, False: 0]
  ------------------
  584|  4.40k|            getDict().replace("/Length", Integer(val));
  585|  4.40k|        }
_ZN4qpdf6Stream6LengthITkNSt3__18integralEmEEvT_:
  582|  29.0k|        {
  583|  29.0k|            qpdf_expect(val >= 0);
  ------------------
  |  |   13|  29.0k|#define qpdf_expect assert
  ------------------
  |  Branch (583:13): [True: 29.0k, False: 0]
  ------------------
  584|  29.0k|            getDict().replace("/Length", Integer(val));
  585|  29.0k|        }
_ZN4qpdf7IntegerC2ITkNSt3__18integralEmEET_:
  307|  33.6k|            Integer(static_cast<long long>(value))
  308|  33.6k|        {
  309|       |            if constexpr (std::cmp_greater(
  310|       |                              std::numeric_limits<decltype(value)>::max(),
  311|  33.6k|                              std::numeric_limits<long long>::max())) {
  312|  33.6k|                if (std::cmp_greater(value, std::numeric_limits<long long>::max())) {
  ------------------
  |  Branch (312:21): [True: 0, False: 33.6k]
  ------------------
  313|      0|                    throw std::overflow_error("overflow constructing Integer");
  314|      0|                }
  315|  33.6k|            }
  316|  33.6k|        }
_ZN4qpdf10DictionaryC2EOS0_:
  264|  2.94k|        Dictionary(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryC2EOS0_:
  234|  2.94k|        BaseDictionary(BaseDictionary&&) = default;
_ZN4qpdf10DictionaryaSERKS0_:
  263|  5.62k|        Dictionary& operator=(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryaSERKS0_:
  233|  5.62k|        BaseDictionary& operator=(BaseDictionary const&) = default;
_ZN4qpdf5ArrayC2Ev:
   21|  4.23k|        Array() = default;

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

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

_ZNK4qpdf9Tokenizer7getTypeEv:
   64|  18.2M|        {
   65|  18.2M|            return this->type;
   66|  18.2M|        }
_ZNK4qpdf9Tokenizer8getValueEv:
   69|  13.6M|        {
   70|  13.6M|            return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string)
  ------------------
  |  Branch (70:21): [True: 3.54M, False: 10.1M]
  |  Branch (70:61): [True: 605k, False: 9.52M]
  ------------------
   71|  13.6M|                ? this->val
   72|  13.6M|                : this->raw_val;
   73|  13.6M|        }
_ZNK4qpdf9Tokenizer15getErrorMessageEv:
   81|  66.1k|        {
   82|  66.1k|            return this->error_message;
   83|  66.1k|        }

_ZN4QPDF3DocC2ERS_PNS_7MembersE:
  351|  27.1k|        qpdf(qpdf),
  352|  27.1k|        m(m)
  353|  27.1k|    {
  354|  27.1k|    }
_ZN4qpdf3Doc6ConfigC2Ev:
   43|  27.1k|                log_(QPDFLogger::defaultLogger())
   44|  27.1k|            {
   45|  27.1k|            }
_ZN4QPDF3Doc6CommonC2ERS_PNS_7MembersE:
 1296|   129k|    qpdf(qpdf),
 1297|   129k|    m(m),
 1298|   129k|    cf(m->cf),
 1299|   129k|    pages(m->pages),
 1300|   129k|    objects(m->objects)
 1301|   129k|{
 1302|   129k|}
_ZN4QPDF3Doc13LinearizationC2ERS0_:
  601|  27.1k|        Common(doc)
  602|  27.1k|    {
  603|  27.1k|    }
_ZN4QPDF3Doc6CommonC2ERS0_:
 1305|   102k|    Common(doc.qpdf, doc.m)
 1306|   102k|{
 1307|   102k|}
_ZN4QPDF3Doc7ObjectsC2ERS0_:
 1006|  27.1k|        Common(doc),
 1007|  27.1k|        foreign_(*this),
 1008|  27.1k|        streams_(*this)
 1009|  27.1k|    {
 1010|  27.1k|    }
_ZN4QPDF3Doc7Objects7ForeignC2ERNS0_6CommonE:
  921|  27.1k|            Common(common)
  922|  27.1k|        {
  923|  27.1k|        }
_ZN4QPDF3Doc7Objects7ForeignD2Ev:
  930|  27.1k|        ~Foreign() = default;
_ZN4QPDF3Doc5PagesC2ERS0_:
 1149|  27.1k|        Common(doc)
 1150|  27.1k|    {
 1151|  27.1k|    }
_ZN4QPDF3Doc5PagesD2Ev:
 1146|  27.1k|    ~Pages() = default;
_ZN4QPDF3Doc7ObjectsD2Ev:
 1003|  27.1k|    ~Objects() = default;
_ZN4QPDF3Doc7Objects7StreamsD2Ev:
  959|  27.1k|        ~Streams() = default;
_ZN4QPDF3Doc13LinearizationD2Ev:
  598|  27.1k|    ~Linearization() = default;
_ZN4QPDF3DocD2Ev:
  348|  27.1k|    ~Doc() = default;
_ZN4qpdf3Doc6Config12max_warningsEm:
  107|  11.7k|            {
  108|  11.7k|                max_warnings_ = val;
  109|  11.7k|                return *this;
  110|  11.7k|            }
_ZNK4qpdf3Doc6Config3logEv:
   75|  1.25M|            {
   76|  1.25M|                return log_;
   77|  1.25M|            }
_ZNK4qpdf3Doc6Config12max_warningsEv:
  101|  2.23M|            {
  102|  2.23M|                return max_warnings_;
  103|  2.23M|            }
_ZNK4qpdf3Doc6Config17suppress_warningsEv:
   88|  1.25M|            {
   89|  1.25M|                return suppress_warnings_;
   90|  1.25M|            }
_ZN4QPDF3docEv:
 1335|  3.87M|{
 1336|  3.87M|    return *m;
 1337|  3.87M|}
_ZN4QPDF3Doc8Resolver8resolvedEPS_10QPDFObjGen:
 1290|   354k|    {
 1291|   354k|        return qpdf->m->objects.resolve(og);
 1292|   354k|    }
_ZNK4QPDF3Doc7Objects12root_checkedEv:
 1038|   165k|    {
 1039|   165k|        return root_checked_;
 1040|   165k|    }
_ZN4QPDF3Doc7Objects12root_checkedEb:
 1044|  13.6k|    {
 1045|  13.6k|        root_checked_ = val;
 1046|  13.6k|    }
_ZN4QPDF20EncryptionParametersC2Ev:
  191|  27.1k|    EncryptionParameters() = default;
_ZN4QPDF7MembersD2Ev:
 1249|  27.1k|    ~Members() = default;
_ZN4QPDF15StringDecrypter13decryptStringERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  240|  92.1k|    {
  241|  92.1k|        qpdf->decryptString(val, og);
  242|  92.1k|    }
_ZNK4qpdf3Doc6Config19password_is_hex_keyEv:
   49|    976|            {
   50|    976|                return password_is_hex_key_;
   51|    976|            }
_ZNK4qpdf3Doc6Config19ignore_xref_streamsEv:
   62|  10.0k|            {
   63|  10.0k|                return ignore_xref_streams_;
   64|  10.0k|            }
_ZNK4qpdf3Doc6Config17surpress_recoveryEv:
  114|   207k|            {
  115|   207k|                return surpress_recovery_;
  116|   207k|            }
_ZNK4qpdf3Doc6Config19immediate_copy_fromEv:
  127|  1.12k|            {
  128|  1.12k|                return immediate_copy_from_;
  129|  1.12k|            }
_ZN4QPDF8ObjCacheC2ENSt3__110shared_ptrI10QPDFObjectEExx:
  175|   486k|        object(std::move(object)),
  176|   486k|        end_before_space(end_before_space),
  177|   486k|        end_after_space(end_after_space)
  178|   486k|    {
  179|   486k|    }
_ZN4QPDF20EncryptionParameters1REv:
  204|  4.12k|    {
  205|  4.12k|        return R_;
  206|  4.12k|    }
_ZN4QPDF3Doc6configEv:
  358|  1.12k|    {
  359|  1.12k|        return cf;
  360|  1.12k|    }
_ZN4QPDF3Doc8acroformEv:
  400|  9.65k|    {
  401|  9.65k|        if (!acroform_) {
  ------------------
  |  Branch (401:13): [True: 9.65k, False: 0]
  ------------------
  402|  9.65k|            no_inspection();
  403|  9.65k|            init_acroform();
  404|  9.65k|        }
  405|  9.65k|        return *acroform_;
  406|  9.65k|    }
_ZN4QPDF3Doc13no_inspectionEv:
  451|  9.65k|    {
  452|  9.65k|        if (global::Options::inspection_mode()) {
  ------------------
  |  Branch (452:13): [True: 0, False: 9.65k]
  ------------------
  453|      0|            throw std::logic_error("Attempted unsupported operation in inspection mode");
  454|      0|        }
  455|  9.65k|    }
_ZN4QPDF3Doc10EncryptionC2EiiiiRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_SA_SA_SA_SA_b:
  490|    976|        V(V),
  491|    976|        R(R),
  492|    976|        Length_bytes(Length_bytes),
  493|    976|        P(static_cast<unsigned long long>(P)),
  494|    976|        O(O),
  495|    976|        U(U),
  496|    976|        OE(OE),
  497|    976|        UE(UE),
  498|    976|        Perms(Perms),
  499|    976|        id1(id1),
  500|    976|        encrypt_metadata(encrypt_metadata)
  501|    976|    {
  502|    976|    }
_ZN4QPDF3Doc7Objects7Streams14pipeStreamDataEPS_10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
  973|  38.9k|        {
  974|  38.9k|            return qpdf->pipeStreamData(
  975|  38.9k|                og,
  976|  38.9k|                offset,
  977|  38.9k|                length,
  978|  38.9k|                dict,
  979|  38.9k|                is_root_metadata,
  980|  38.9k|                pipeline,
  981|  38.9k|                suppress_warnings,
  982|  38.9k|                will_retry);
  983|  38.9k|        }
_ZN4QPDF3Doc7Objects7Streams6copierEv:
  987|  2.21k|        {
  988|  2.21k|            return copier_;
  989|  2.21k|        }
_ZN4QPDF3Doc7Objects7streamsEv:
 1020|  1.12k|    {
 1021|  1.12k|        return streams_;
 1022|  1.12k|    }
_ZN4QPDF3Doc5Pages3allEv:
 1155|  89.2k|    {
 1156|  89.2k|        return !all_pages.empty() ? all_pages : cache();
  ------------------
  |  Branch (1156:16): [True: 70.4k, False: 18.7k]
  ------------------
 1157|  89.2k|    }
_ZN4QPDF3Doc5Pages5emptyEv:
 1161|  30.4k|    {
 1162|  30.4k|        return all().empty();
 1163|  30.4k|    }
_ZN4QPDF3Doc5Pages5beginEv:
 1173|  24.5k|    {
 1174|  24.5k|        return all().cbegin();
 1175|  24.5k|    }
_ZN4QPDF3Doc5Pages3endEv:
 1179|  24.5k|    {
 1180|  24.5k|        return all().cend();
 1181|  24.5k|    }
_ZN4QPDF3Doc7objectsEv:
 1317|  1.12k|{
 1318|  1.12k|    return m->objects;
 1319|  1.12k|};
_ZN4QPDF3Doc5pagesEv:
 1323|  24.4k|{
 1324|  24.4k|    return m->pages;
 1325|  24.4k|}
_ZNK4QPDF3Doc18reconstructed_xrefEv:
 1329|  3.82M|{
 1330|  3.82M|    return m->reconstructed_xref;
 1331|  3.82M|}
_ZN4QPDF3Doc6Common3toOImEExRKT_:
  313|  2.19M|        {
  314|  2.19M|            return QIntC::to_offset(i);
  315|  2.19M|        }
_ZN4QPDF3Doc6Common3toIIlEEiRKT_:
  325|  8.39k|        {
  326|  8.39k|            return QIntC::to_int(i);
  327|  8.39k|        }
_ZN4QPDF3Doc6Common3toIIxEEiRKT_:
  325|  2.53M|        {
  326|  2.53M|            return QIntC::to_int(i);
  327|  2.53M|        }
_ZN4QPDF3Doc6Common3toSIiEEmRKT_:
  319|  9.88k|        {
  320|  9.88k|            return QIntC::to_size(i);
  321|  9.88k|        }
_ZN4QPDF3Doc6Common3toSIyEEmRKT_:
  319|  14.7k|        {
  320|  14.7k|            return QIntC::to_size(i);
  321|  14.7k|        }
_ZN4QPDF3Doc6Common3toSIxEEmRKT_:
  319|  22.0k|        {
  320|  22.0k|            return QIntC::to_size(i);
  321|  22.0k|        }
_ZN4QPDF8ObjCacheC2Ev:
  170|   113k|    ObjCache() = default;
_ZN4QPDF3Doc6Common3toIImEEiRKT_:
  325|  59.6k|        {
  326|  59.6k|            return QIntC::to_int(i);
  327|  59.6k|        }

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

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

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

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

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

_ZN4qpdf4util17internal_error_ifIRA29_KcEEvbOT_:
   36|  5.35M|    {
   37|  5.35M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 5.35M]
  ------------------
   38|      0|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   39|      0|                                       .append(
   40|      0|                                           "\nThis is a qpdf bug. Please report at "
   41|      0|                                           "https://github.com/qpdf/qpdf/issues"));
   42|      0|        }
   43|  5.35M|    }
_ZN4qpdf4util9assertionIRA44_KcEEvbOT_:
   27|   149k|    {
   28|   149k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 149k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   149k|    }
_ZN4qpdf4util17internal_error_ifIRA28_KcEEvbOT_:
   36|  5.21M|    {
   37|  5.21M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 5.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|  5.21M|    }
_ZN4qpdf4util15hex_decode_charEc:
   99|  69.6M|    {
  100|  69.6M|        return digit <= '9' && digit >= '0'
  ------------------
  |  Branch (100:16): [True: 52.5M, False: 17.1M]
  |  Branch (100:32): [True: 52.4M, False: 72.3k]
  ------------------
  101|  69.6M|            ? char(digit - '0')
  102|  69.6M|            : (digit >= 'a' ? char(digit - 'a' + 10)
  ------------------
  |  Branch (102:16): [True: 17.0M, False: 175k]
  ------------------
  103|  17.1M|                            : (digit >= 'A' ? char(digit - 'A' + 10) : '\20'));
  ------------------
  |  Branch (103:32): [True: 56.4k, False: 119k]
  ------------------
  104|  69.6M|    }
_ZN4qpdf4util8is_spaceEc:
  114|  45.3M|    {
  115|  45.3M|        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v';
  ------------------
  |  Branch (115:16): [True: 12.5M, False: 32.8M]
  |  Branch (115:29): [True: 1.99M, False: 30.8M]
  |  Branch (115:43): [True: 574k, False: 30.2M]
  |  Branch (115:57): [True: 2.18M, False: 28.1M]
  |  Branch (115:71): [True: 181k, False: 27.9M]
  |  Branch (115:85): [True: 43.9k, False: 27.8M]
  ------------------
  116|  45.3M|    }
_ZN4qpdf4util8is_digitEc:
  120|  23.5M|    {
  121|  23.5M|        return (ch >= '0' && ch <= '9');
  ------------------
  |  Branch (121:17): [True: 13.9M, False: 9.64M]
  |  Branch (121:30): [True: 13.6M, False: 302k]
  ------------------
  122|  23.5M|    }
_ZN4qpdf4util15hex_encode_charEc:
  127|  34.2M|    {
  128|  34.2M|        static auto constexpr hexchars = "0123456789abcdef";
  129|  34.2M|        return {'#', hexchars[static_cast<unsigned char>(c) >> 4], hexchars[c & 0x0f]};
  130|  34.2M|    }
_ZN4qpdf4util8is_utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  149|   329k|    {
  150|   329k|        return str.starts_with("\xfe\xff") || str.starts_with("\xff\xfe");
  ------------------
  |  Branch (150:16): [True: 57.6k, False: 272k]
  |  Branch (150:47): [True: 4.30k, False: 267k]
  ------------------
  151|   329k|    }
_ZN4qpdf4util16is_explicit_utf8ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  155|   267k|    {
  156|       |        // QPDF_String.cc knows that this is a 3-byte sequence.
  157|   267k|        return str.starts_with("\xef\xbb\xbf");
  158|   267k|    }
_ZN4qpdf4util9assertionINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   27|   289k|    {
   28|   289k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 289k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   289k|    }
_ZN4qpdf4util9assertionIRA54_KcEEvbOT_:
   27|   129k|    {
   28|   129k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 129k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   129k|    }
_ZN4qpdf4util9assertionIRA57_KcEEvbOT_:
   27|  4.76k|    {
   28|  4.76k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 4.76k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  4.76k|    }
_ZN4qpdf4util9assertionIRA51_KcEEvbOT_:
   27|  1.35k|    {
   28|  1.35k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 1.35k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  1.35k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralElQsr3stdE8integralIT_EEEbT0_:
   63|  27.1k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  27.1k|                          std::numeric_limits<T>::min())) {
   67|  27.1k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 27.1k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  27.1k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|  27.1k|                          std::numeric_limits<T>::max())) {
   74|  27.1k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 27.1k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|  27.1k|        }
   78|  27.1k|        return true;
   79|  27.1k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEiQsr3stdE8integralIT_EEEbT0_:
   63|  27.1k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  27.1k|                          std::numeric_limits<T>::min())) {
   67|  27.1k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 27.1k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  27.1k|        }
   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|  27.1k|        return true;
   79|  27.1k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEyQsr3stdE8integralIT_EEEbT0_:
   63|   118k|    {
   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|   118k|                          std::numeric_limits<T>::max())) {
   74|   118k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 6, False: 118k]
  ------------------
   75|      6|                return false;
   76|      6|            }
   77|   118k|        }
   78|   118k|        return true;
   79|   118k|    }
_ZN4qpdf4util9assertionIRA45_KcEEvbOT_:
   27|   895k|    {
   28|   895k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 895k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   895k|    }
_ZN4qpdf4util9assertionIRA53_KcEEvbOT_:
   27|  8.46k|    {
   28|  8.46k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 8.46k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  8.46k|    }
_ZN4qpdf4util9assertionIRA35_KcEEvbOT_:
   27|  6.08k|    {
   28|  6.08k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 6.08k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  6.08k|    }
_ZN4qpdf4util17internal_error_ifIRA34_KcEEvbOT_:
   36|  8.05M|    {
   37|  8.05M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 3, False: 8.05M]
  ------------------
   38|      3|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   39|      3|                                       .append(
   40|      3|                                           "\nThis is a qpdf bug. Please report at "
   41|      3|                                           "https://github.com/qpdf/qpdf/issues"));
   42|      3|        }
   43|  8.05M|    }
_ZN4qpdf4util9assertionIRA68_KcEEvbOT_:
   27|  5.62k|    {
   28|  5.62k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 5.62k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  5.62k|    }
_ZN4qpdf4util9assertionIRA83_KcEEvbOT_:
   27|   129k|    {
   28|   129k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 129k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   129k|    }
_ZN4qpdf4util9assertionIRA65_KcEEvbOT_:
   27|  2.80k|    {
   28|  2.80k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.80k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.80k|    }
_ZN4qpdf4util9assertionIRA49_KcEEvbOT_:
   27|  4.23k|    {
   28|  4.23k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 4.23k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  4.23k|    }
_ZN4qpdf4util9assertionIRA43_KcEEvbOT_:
   27|  84.3k|    {
   28|  84.3k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 84.3k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  84.3k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA51_KcEEvbOT_:
   48|  2.94M|    {
   49|  2.94M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 23, False: 2.94M]
  ------------------
   50|     23|            throw std::runtime_error(std::forward<T>(msg));
   51|     23|        }
   52|  2.94M|    }
_ZN4qpdf4util9assertionIRA50_KcEEvbOT_:
   27|   271k|    {
   28|   271k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 271k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   271k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA23_KcEEvbOT_:
   48|  5.08M|    {
   49|  5.08M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 19, False: 5.08M]
  ------------------
   50|     19|            throw std::runtime_error(std::forward<T>(msg));
   51|     19|        }
   52|  5.08M|    }
_ZN4qpdf4util9assertionIRA52_KcEEvbOT_:
   27|  25.3M|    {
   28|  25.3M|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 25.3M]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  25.3M|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA44_KcEEvbOT_:
   48|  65.0k|    {
   49|  65.0k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 47, False: 65.0k]
  ------------------
   50|     47|            throw std::runtime_error(std::forward<T>(msg));
   51|     47|        }
   52|  65.0k|    }
_ZN4qpdf4util9assertionIRA58_KcEEvbOT_:
   27|    667|    {
   28|    667|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 667]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    667|    }
_ZN4qpdf4util9assertionIRA48_KcEEvbOT_:
   27|  25.9k|    {
   28|  25.9k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 25.9k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  25.9k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA73_KcEEvbOT_:
   48|  7.54k|    {
   49|  7.54k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 7.54k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  7.54k|    }
_ZN4qpdf4util9assertionIRA46_KcEEvbOT_:
   27|  2.99k|    {
   28|  2.99k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.99k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.99k|    }
_ZN4qpdf4util17no_ci_rt_error_ifINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   48|   128k|    {
   49|   128k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 128k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|   128k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA69_KcEEvbOT_:
   48|  25.0k|    {
   49|  25.0k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 17, False: 24.9k]
  ------------------
   50|     17|            throw std::runtime_error(std::forward<T>(msg));
   51|     17|        }
   52|  25.0k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA59_KcEEvbOT_:
   48|   214k|    {
   49|   214k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 214k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|   214k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA42_KcEEvbOT_:
   48|  65.0k|    {
   49|  65.0k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 65.0k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  65.0k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA49_KcEEvbOT_:
   48|  4.84k|    {
   49|  4.84k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 6, False: 4.84k]
  ------------------
   50|      6|            throw std::runtime_error(std::forward<T>(msg));
   51|      6|        }
   52|  4.84k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA88_KcEEvbOT_:
   48|  3.72k|    {
   49|  3.72k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 3.72k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  3.72k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEjQsr3stdE8integralIT_EEEbT0_:
   63|  3.72k|    {
   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|  3.72k|        return true;
   79|  3.72k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA58_KcEEvbOT_:
   48|  3.72k|    {
   49|  3.72k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 3.72k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  3.72k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA45_KcEEvbOT_:
   48|  3.72k|    {
   49|  3.72k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 3.72k]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|  3.72k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA32_KcEEvbOT_:
   48|  3.72k|    {
   49|  3.72k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 8, False: 3.71k]
  ------------------
   50|      8|            throw std::runtime_error(std::forward<T>(msg));
   51|      8|        }
   52|  3.72k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA35_KcEEvbOT_:
   48|   108k|    {
   49|   108k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 36, False: 108k]
  ------------------
   50|     36|            throw std::runtime_error(std::forward<T>(msg));
   51|     36|        }
   52|   108k|    }
_ZN4qpdf4util9assertionIRA47_KcEEvbOT_:
   27|  93.3k|    {
   28|  93.3k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 93.3k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  93.3k|    }
_ZN4qpdf4util9assertionIRA56_KcEEvbOT_:
   27|  1.11k|    {
   28|  1.11k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 1.11k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  1.11k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA53_KcEEvbOT_:
   48|  1.11k|    {
   49|  1.11k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 1.10k]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|  1.11k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA92_KcEEvbOT_:
   48|  1.10k|    {
   49|  1.10k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.10k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.10k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA36_KcEEvbOT_:
   48|  1.09k|    {
   49|  1.09k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 8, False: 1.09k]
  ------------------
   50|      8|            throw std::runtime_error(std::forward<T>(msg));
   51|      8|        }
   52|  1.09k|    }

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

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

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

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

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

sph_sha224:
  173|  32.5k|{
  174|  32.5k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  32.5k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  32.5k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|  32.5k|        unsigned current;
  176|  32.5k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|  32.5k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   95|  32.5k|#define SPH_BLEN     64U
  ------------------
  |  Branch (181:13): [True: 1.96k, False: 30.5k]
  ------------------
  182|  1.96k|                SPH_XCAT(HASH, _short)(cc, data, len);
  ------------------
  |  |   85|  1.96k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  1.96k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  183|  1.96k|                return;
  184|  1.96k|        }
  185|  30.5k|        sc = cc;
  186|  30.5k|#if SPH_64
  187|  30.5k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  30.5k|#define SPH_BLEN     64U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|  30.5k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 30.5k]
  ------------------
  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|  30.5k|        orig_len = len;
  206|  2.10M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   95|  2.10M|#define SPH_BLEN     64U
  ------------------
  |  Branch (206:16): [True: 2.07M, False: 30.5k]
  ------------------
  207|  2.07M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  647|  2.07M|#define RFUN   sha2_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  2.07M|#define SPH_VAL   sc->val
  ------------------
  208|  2.07M|                len -= SPH_BLEN;
  ------------------
  |  |   95|  2.07M|#define SPH_BLEN     64U
  ------------------
  209|  2.07M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   95|  2.07M|#define SPH_BLEN     64U
  ------------------
  210|  2.07M|        }
  211|  30.5k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 30.5k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|  30.5k|#if SPH_64
  214|  30.5k|        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|  30.5k|}
sha2.c:sha224_short:
  131|  1.96k|{
  132|  1.96k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  1.96k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  1.96k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  133|  1.96k|        unsigned current;
  134|       |
  135|  1.96k|        sc = cc;
  136|  1.96k|#if SPH_64
  137|  1.96k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  1.96k|#define SPH_BLEN     64U
  ------------------
  138|       |#else
  139|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  140|       |#endif
  141|  3.93k|        while (len > 0) {
  ------------------
  |  Branch (141:16): [True: 1.96k, False: 1.96k]
  ------------------
  142|  1.96k|                unsigned clen;
  143|       |#if !SPH_64
  144|       |                sph_u32 clow, clow2;
  145|       |#endif
  146|       |
  147|  1.96k|                clen = SPH_BLEN - current;
  ------------------
  |  |   95|  1.96k|#define SPH_BLEN     64U
  ------------------
  148|  1.96k|                if (clen > len)
  ------------------
  |  Branch (148:21): [True: 1.96k, False: 0]
  ------------------
  149|  1.96k|                        clen = (unsigned)len;
  150|  1.96k|                memcpy(sc->buf + current, data, clen);
  151|  1.96k|                data = (const unsigned char *)data + clen;
  152|  1.96k|                current += clen;
  153|  1.96k|                len -= clen;
  154|  1.96k|                if (current == SPH_BLEN) {
  ------------------
  |  |   95|  1.96k|#define SPH_BLEN     64U
  ------------------
  |  Branch (154:21): [True: 0, False: 1.96k]
  ------------------
  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|  1.96k|#if SPH_64
  159|  1.96k|                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|  1.96k|        }
  168|  1.96k|}
sha2.c:sha224_close:
  345|  31.9k|{
  346|  31.9k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|  31.9k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  31.9k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|  31.9k|}
sha2.c:sha224_addbits_and_close:
  242|  31.9k|{
  243|  31.9k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  31.9k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  31.9k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|  31.9k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|  31.9k|        sc = cc;
  250|  31.9k|#if SPH_64
  251|  31.9k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  31.9k|#define SPH_BLEN     64U
  ------------------
  252|       |#else
  253|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  254|       |#endif
  255|       |#ifdef PW01
  256|       |        sc->buf[current ++] = (0x100 | (ub & 0xFF)) >> (8 - n);
  257|       |#else
  258|  31.9k|        {
  259|  31.9k|                unsigned z;
  260|       |
  261|  31.9k|                z = 0x80U >> n;
  262|  31.9k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|  31.9k|        }
  264|  31.9k|#endif
  265|  31.9k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|  31.9k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  31.9k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  31.9k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 599, False: 31.3k]
  ------------------
  266|    599|                memset(sc->buf + current, 0, SPH_BLEN - current);
  ------------------
  |  |   95|    599|#define SPH_BLEN     64U
  ------------------
  267|    599|                RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|    599|#define RFUN   sha2_round
  ------------------
                              RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|    599|#define SPH_VAL   sc->val
  ------------------
  268|    599|                memset(sc->buf, 0, SPH_MAXPAD);
  ------------------
  |  |  110|    599|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|    599|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|    599|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  269|  31.3k|        } else {
  270|  31.3k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|  31.3k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  31.3k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  31.3k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  271|  31.3k|        }
  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|  31.9k|#if SPH_64
  303|  31.9k|#ifdef BE32
  304|  31.9k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  ------------------
  |  |  110|  31.9k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  31.9k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  31.9k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  305|  31.9k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|  31.9k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|  31.9k|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  ------------------
  ------------------
  306|       |#else
  307|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  308|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  309|       |#endif
  310|       |#else
  311|       |        low = sc->count_low;
  312|       |        high = SPH_T32((sc->count_high << 3) | (low >> 29));
  313|       |        low = SPH_T32(low << 3) + (sph_u32)n;
  314|       |#ifdef BE32
  315|       |        sph_enc32be(sc->buf + SPH_MAXPAD, high);
  316|       |        sph_enc32be(sc->buf + SPH_MAXPAD + SPH_WLEN, low);
  317|       |#else
  318|       |        sph_enc32le(sc->buf + SPH_MAXPAD, low);
  319|       |        sph_enc32le(sc->buf + SPH_MAXPAD + SPH_WLEN, high);
  320|       |#endif
  321|       |#endif
  322|  31.9k|#endif
  323|  31.9k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|  31.9k|#define RFUN   sha2_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  31.9k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   287k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 255k, False: 31.9k]
  ------------------
  330|       |#if defined BE64
  331|       |                sph_enc64be((unsigned char *)dst + 8 * u, sc->val[u]);
  332|       |#elif defined LE64
  333|       |                sph_enc64le((unsigned char *)dst + 8 * u, sc->val[u]);
  334|       |#elif defined BE32
  335|       |                sph_enc32be((unsigned char *)dst + 4 * u, sc->val[u]);
  336|       |#else
  337|       |                sph_enc32le((unsigned char *)dst + 4 * u, sc->val[u]);
  338|       |#endif
  339|   255k|        }
  340|  31.9k|#endif
  341|  31.9k|}
sph_sha384:
  173|  61.3k|{
  174|  61.3k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  61.3k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  61.3k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|  61.3k|        unsigned current;
  176|  61.3k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|  61.3k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   92|  61.3k|#define SPH_BLEN    128U
  ------------------
  |  Branch (181:13): [True: 0, False: 61.3k]
  ------------------
  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|  61.3k|        sc = cc;
  186|  61.3k|#if SPH_64
  187|  61.3k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|  61.3k|#define SPH_BLEN    128U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|  61.3k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 61.3k]
  ------------------
  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|  61.3k|        orig_len = len;
  206|  2.14M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   92|  2.14M|#define SPH_BLEN    128U
  ------------------
  |  Branch (206:16): [True: 2.08M, False: 61.3k]
  ------------------
  207|  2.08M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  202|  2.08M|#define RFUN   sha3_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  2.08M|#define SPH_VAL   sc->val
  ------------------
  208|  2.08M|                len -= SPH_BLEN;
  ------------------
  |  |   92|  2.08M|#define SPH_BLEN    128U
  ------------------
  209|  2.08M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   92|  2.08M|#define SPH_BLEN    128U
  ------------------
  210|  2.08M|        }
  211|  61.3k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 61.3k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|  61.3k|#if SPH_64
  214|  61.3k|        sc->count += (sph_u64)orig_len;
  215|       |#else
  216|       |        clow = sc->count_low;
  217|       |        clow2 = SPH_T32(clow + orig_len);
  218|       |        sc->count_low = clow2;
  219|       |        if (clow2 < clow)
  220|       |                sc->count_high ++;
  221|       |        /*
  222|       |         * This code handles the improbable situation where "size_t" is
  223|       |         * greater than 32 bits, and yet we do not have a 64-bit type.
  224|       |         */
  225|       |        orig_len >>= 12;
  226|       |        orig_len >>= 10;
  227|       |        orig_len >>= 10;
  228|       |        sc->count_high += orig_len;
  229|       |#endif
  230|  61.3k|}
sha2big.c:sha384_close:
  345|  61.3k|{
  346|  61.3k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|  61.3k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  61.3k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|  61.3k|}
sha2big.c:sha384_addbits_and_close:
  242|  61.3k|{
  243|  61.3k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  61.3k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  61.3k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|  61.3k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|  61.3k|        sc = cc;
  250|  61.3k|#if SPH_64
  251|  61.3k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|  61.3k|#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|  61.3k|        {
  259|  61.3k|                unsigned z;
  260|       |
  261|  61.3k|                z = 0x80U >> n;
  262|  61.3k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|  61.3k|        }
  264|  61.3k|#endif
  265|  61.3k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|  61.3k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  61.3k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  61.3k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 0, False: 61.3k]
  ------------------
  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|  61.3k|        } else {
  270|  61.3k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|  61.3k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  61.3k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  61.3k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  271|  61.3k|        }
  272|  61.3k|#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|  61.3k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD, sc->count >> 61);
  ------------------
  |  |  110|  61.3k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  61.3k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  61.3k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  284|  61.3k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |  110|  61.3k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  61.3k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  61.3k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
                      sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |   93|  61.3k|#define SPH_WLEN      8U
  ------------------
  285|  61.3k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|  61.3k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|  61.3k|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  ------------------
  ------------------
  286|  61.3k|#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|  61.3k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  202|  61.3k|#define RFUN   sha3_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  61.3k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   485k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 424k, False: 61.3k]
  ------------------
  330|   424k|#if defined BE64
  331|   424k|                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|   424k|        }
  340|  61.3k|#endif
  341|  61.3k|}

sha2.c:sph_dec32be_aligned:
 1471|  33.6M|{
 1472|  33.6M|#if SPH_LITTLE_ENDIAN
 1473|  33.6M|        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|  33.6M|}
sha2.c:sph_bswap32:
 1220|  33.8M|{
 1221|  33.8M|        __asm__ __volatile__ ("bswapl %0" : "=r" (x) : "0" (x));
 1222|  33.8M|        return x;
 1223|  33.8M|}
sha2.c:sph_enc64be_aligned:
 1706|  31.9k|{
 1707|  31.9k|#if SPH_LITTLE_ENDIAN
 1708|  31.9k|        *(sph_u64 *)dst = sph_bswap64(val);
 1709|       |#elif SPH_BIG_ENDIAN
 1710|       |        *(sph_u64 *)dst = val;
 1711|       |#else
 1712|       |        ((unsigned char *)dst)[0] = (unsigned char)(val >> 56);
 1713|       |        ((unsigned char *)dst)[1] = (unsigned char)(val >> 48);
 1714|       |        ((unsigned char *)dst)[2] = (unsigned char)(val >> 40);
 1715|       |        ((unsigned char *)dst)[3] = (unsigned char)(val >> 32);
 1716|       |        ((unsigned char *)dst)[4] = (unsigned char)(val >> 24);
 1717|       |        ((unsigned char *)dst)[5] = (unsigned char)(val >> 16);
 1718|       |        ((unsigned char *)dst)[6] = (unsigned char)(val >> 8);
 1719|       |        ((unsigned char *)dst)[7] = (unsigned char)(val);
 1720|       |#endif
 1721|  31.9k|}
sha2.c:sph_bswap64:
 1229|  31.9k|{
 1230|  31.9k|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  31.9k|        return x;
 1232|  31.9k|}
sha2.c:sph_enc32be:
 1374|   255k|{
 1375|   255k|#if defined SPH_UPTR
 1376|   255k|#if SPH_UNALIGNED
 1377|   255k|#if SPH_LITTLE_ENDIAN
 1378|   255k|        val = sph_bswap32(val);
 1379|   255k|#endif
 1380|   255k|        *(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|   255k|}
sha2big.c:sph_dec64be_aligned:
 1778|  34.3M|{
 1779|  34.3M|#if SPH_LITTLE_ENDIAN
 1780|  34.3M|        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|  34.3M|}
sha2big.c:sph_bswap64:
 1229|  34.9M|{
 1230|  34.9M|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  34.9M|        return x;
 1232|  34.9M|}
sha2big.c:sph_enc64be_aligned:
 1706|   122k|{
 1707|   122k|#if SPH_LITTLE_ENDIAN
 1708|   122k|        *(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|   122k|}
sha2big.c:sph_enc64be:
 1661|   424k|{
 1662|   424k|#if defined SPH_UPTR
 1663|   424k|#if SPH_UNALIGNED
 1664|   424k|#if SPH_LITTLE_ENDIAN
 1665|   424k|        val = sph_bswap64(val);
 1666|   424k|#endif
 1667|   424k|        *(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|   424k|}

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

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

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

inflate_table:
   48|  37.2k|                                unsigned FAR *bits, unsigned short FAR *work) {
   49|  37.2k|    unsigned len;               /* a code's length in bits */
   50|  37.2k|    unsigned sym;               /* index of code symbols */
   51|  37.2k|    unsigned min, max;          /* minimum and maximum code lengths */
   52|  37.2k|    unsigned root;              /* number of index bits for root table */
   53|  37.2k|    unsigned curr;              /* number of index bits for current table */
   54|  37.2k|    unsigned drop;              /* code bits to drop for sub-table */
   55|  37.2k|    int left;                   /* number of prefix codes available */
   56|  37.2k|    unsigned used;              /* code entries in table used */
   57|  37.2k|    unsigned huff;              /* Huffman code */
   58|  37.2k|    unsigned incr;              /* for incrementing code, index */
   59|  37.2k|    unsigned fill;              /* index for replicating entries */
   60|  37.2k|    unsigned low;               /* low bits for current root entry */
   61|  37.2k|    unsigned mask;              /* mask for low root bits */
   62|  37.2k|    code here;                  /* table entry for duplication */
   63|  37.2k|    code FAR *next;             /* next available space in table */
   64|  37.2k|    const unsigned short FAR *base = NULL;  /* base value table to use */
   65|  37.2k|    const unsigned short FAR *extra = NULL; /* extra bits table to use */
   66|  37.2k|    unsigned match = 0;         /* use base and extra for symbol >= match */
   67|  37.2k|    unsigned short count[MAXBITS+1];    /* number of codes of each length */
   68|  37.2k|    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
   69|  37.2k|    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
   70|  37.2k|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   71|  37.2k|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   72|  37.2k|    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
   73|  37.2k|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   74|  37.2k|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 68, 193};
   75|  37.2k|    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
   76|  37.2k|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   77|  37.2k|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   78|  37.2k|        8193, 12289, 16385, 24577, 0, 0};
   79|  37.2k|    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
   80|  37.2k|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   81|  37.2k|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   82|  37.2k|        28, 28, 29, 29, 64, 64};
   83|       |
   84|       |    /*
   85|       |       Process a set of code lengths to create a canonical Huffman code.  The
   86|       |       code lengths are lens[0..codes-1].  Each length corresponds to the
   87|       |       symbols 0..codes-1.  The Huffman code is generated by first sorting the
   88|       |       symbols by length from short to long, and retaining the symbol order
   89|       |       for codes with equal lengths.  Then the code starts with all zero bits
   90|       |       for the first code of the shortest length, and the codes are integer
   91|       |       increments for the same length, and zeros are appended as the length
   92|       |       increases.  For the deflate format, these bits are stored backwards
   93|       |       from their more natural integer increment ordering, and so when the
   94|       |       decoding tables are built in the large loop below, the integer codes
   95|       |       are incremented backwards.
   96|       |
   97|       |       This routine assumes, but does not check, that all of the entries in
   98|       |       lens[] are in the range 0..MAXBITS.  The caller must assure this.
   99|       |       1..MAXBITS is interpreted as that code length.  zero means that that
  100|       |       symbol does not occur in this code.
  101|       |
  102|       |       The codes are sorted by computing a count of codes for each length,
  103|       |       creating from that a table of starting indices for each length in the
  104|       |       sorted table, and then entering the symbols in order in the sorted
  105|       |       table.  The sorted table is work[], with that space being provided by
  106|       |       the caller.
  107|       |
  108|       |       The length counts are used for other purposes as well, i.e. finding
  109|       |       the minimum and maximum length codes, determining if there are any
  110|       |       codes at all, checking for a valid set of lengths, and looking ahead
  111|       |       at length counts to determine sub-table sizes when building the
  112|       |       decoding tables.
  113|       |     */
  114|       |
  115|       |    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
  116|   632k|    for (len = 0; len <= MAXBITS; len++)
  ------------------
  |  |   23|   632k|#define MAXBITS 15
  ------------------
  |  Branch (116:19): [True: 595k, False: 37.2k]
  ------------------
  117|   595k|        count[len] = 0;
  118|  3.90M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (118:19): [True: 3.86M, False: 37.2k]
  ------------------
  119|  3.86M|        count[lens[sym]]++;
  120|       |
  121|       |    /* bound code lengths, force root to be within code lengths */
  122|  37.2k|    root = *bits;
  123|   346k|    for (max = MAXBITS; max >= 1; max--)
  ------------------
  |  |   23|  37.2k|#define MAXBITS 15
  ------------------
  |  Branch (123:25): [True: 345k, False: 111]
  ------------------
  124|   345k|        if (count[max] != 0) break;
  ------------------
  |  Branch (124:13): [True: 37.1k, False: 308k]
  ------------------
  125|  37.2k|    if (root > max) root = max;
  ------------------
  |  Branch (125:9): [True: 22.1k, False: 15.0k]
  ------------------
  126|  37.2k|    if (max == 0) {                     /* no symbols to code at all */
  ------------------
  |  Branch (126:9): [True: 111, False: 37.1k]
  ------------------
  127|    111|        here.op = (unsigned char)64;    /* invalid code marker */
  128|    111|        here.bits = (unsigned char)1;
  129|    111|        here.val = (unsigned short)0;
  130|    111|        *(*table)++ = here;             /* make a table to force an error */
  131|    111|        *(*table)++ = here;
  132|    111|        *bits = 1;
  133|    111|        return 0;     /* no symbols, but wait for decoding to report error */
  134|    111|    }
  135|  75.2k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (135:19): [True: 75.0k, False: 192]
  ------------------
  136|  75.0k|        if (count[min] != 0) break;
  ------------------
  |  Branch (136:13): [True: 36.9k, False: 38.1k]
  ------------------
  137|  37.1k|    if (root < min) root = min;
  ------------------
  |  Branch (137:9): [True: 11, False: 37.0k]
  ------------------
  138|       |
  139|       |    /* check for an over-subscribed or incomplete set of lengths */
  140|  37.1k|    left = 1;
  141|   592k|    for (len = 1; len <= MAXBITS; len++) {
  ------------------
  |  |   23|   592k|#define MAXBITS 15
  ------------------
  |  Branch (141:19): [True: 555k, False: 36.9k]
  ------------------
  142|   555k|        left <<= 1;
  143|   555k|        left -= count[len];
  144|   555k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (144:13): [True: 135, False: 555k]
  ------------------
  145|   555k|    }
  146|  36.9k|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (146:9): [True: 110, False: 36.8k]
  |  Branch (146:22): [True: 48, False: 62]
  |  Branch (146:39): [True: 49, False: 13]
  ------------------
  147|     97|        return -1;                      /* incomplete set */
  148|       |
  149|       |    /* generate offsets into symbol table for each length for sorting */
  150|  36.8k|    offs[1] = 0;
  151|   553k|    for (len = 1; len < MAXBITS; len++)
  ------------------
  |  |   23|   553k|#define MAXBITS 15
  ------------------
  |  Branch (151:19): [True: 516k, False: 36.8k]
  ------------------
  152|   516k|        offs[len + 1] = offs[len] + count[len];
  153|       |
  154|       |    /* sort symbols by length, by symbol order within each length */
  155|  3.87M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (155:19): [True: 3.83M, False: 36.8k]
  ------------------
  156|  3.83M|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
  ------------------
  |  Branch (156:13): [True: 961k, False: 2.87M]
  ------------------
  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|  36.8k|    switch (type) {
  ------------------
  |  Branch (190:13): [True: 36.8k, False: 0]
  ------------------
  191|  13.5k|    case CODES:
  ------------------
  |  Branch (191:5): [True: 13.5k, False: 23.3k]
  ------------------
  192|  13.5k|        match = 20;
  193|  13.5k|        break;
  194|  11.7k|    case LENS:
  ------------------
  |  Branch (194:5): [True: 11.7k, False: 25.1k]
  ------------------
  195|  11.7k|        base = lbase;
  196|  11.7k|        extra = lext;
  197|  11.7k|        match = 257;
  198|  11.7k|        break;
  199|  11.6k|    case DISTS:
  ------------------
  |  Branch (199:5): [True: 11.6k, False: 25.2k]
  ------------------
  200|  11.6k|        base = dbase;
  201|  11.6k|        extra = dext;
  202|  36.8k|    }
  203|       |
  204|       |    /* initialize state for loop */
  205|  36.8k|    huff = 0;                   /* starting code */
  206|  36.8k|    sym = 0;                    /* starting code symbol */
  207|  36.8k|    len = min;                  /* starting code length */
  208|  36.8k|    next = *table;              /* current table to fill in */
  209|  36.8k|    curr = root;                /* current table index bits */
  210|  36.8k|    drop = 0;                   /* current bits to drop from code for index */
  211|  36.8k|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  212|  36.8k|    used = 1U << root;          /* use root table entries */
  213|  36.8k|    mask = used - 1;            /* mask for comparing low */
  214|       |
  215|       |    /* check available table space */
  216|  36.8k|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   50|  11.7k|#  define ENOUGH_LENS 852
  ------------------
  |  Branch (216:10): [True: 11.7k, False: 25.1k]
  |  Branch (216:26): [True: 0, False: 11.7k]
  ------------------
  217|  36.8k|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   51|  11.6k|#  define ENOUGH_DISTS 592
  ------------------
  |  Branch (217:10): [True: 11.6k, False: 25.2k]
  |  Branch (217:27): [True: 0, False: 11.6k]
  ------------------
  218|      0|        return 1;
  219|       |
  220|       |    /* process all codes and make table entries */
  221|   961k|    for (;;) {
  222|       |        /* create table entry */
  223|   961k|        here.bits = (unsigned char)(len - drop);
  224|   961k|        if (work[sym] + 1U < match) {
  ------------------
  |  Branch (224:13): [True: 603k, False: 358k]
  ------------------
  225|   603k|            here.op = (unsigned char)0;
  226|   603k|            here.val = work[sym];
  227|   603k|        }
  228|   358k|        else if (work[sym] >= match) {
  ------------------
  |  Branch (228:18): [True: 346k, False: 11.7k]
  ------------------
  229|   346k|            here.op = (unsigned char)(extra[work[sym] - match]);
  230|   346k|            here.val = base[work[sym] - match];
  231|   346k|        }
  232|  11.7k|        else {
  233|  11.7k|            here.op = (unsigned char)(32 + 64);         /* end of block */
  234|  11.7k|            here.val = 0;
  235|  11.7k|        }
  236|       |
  237|       |        /* replicate for those indices with low len bits equal to huff */
  238|   961k|        incr = 1U << (len - drop);
  239|   961k|        fill = 1U << curr;
  240|   961k|        min = fill;                 /* save offset to next table */
  241|  5.05M|        do {
  242|  5.05M|            fill -= incr;
  243|  5.05M|            next[(huff >> drop) + fill] = here;
  244|  5.05M|        } while (fill != 0);
  ------------------
  |  Branch (244:18): [True: 4.09M, False: 961k]
  ------------------
  245|       |
  246|       |        /* backwards increment the len-bit code huff */
  247|   961k|        incr = 1U << (len - 1);
  248|  1.88M|        while (huff & incr)
  ------------------
  |  Branch (248:16): [True: 925k, False: 961k]
  ------------------
  249|   925k|            incr >>= 1;
  250|   961k|        if (incr != 0) {
  ------------------
  |  Branch (250:13): [True: 925k, False: 36.8k]
  ------------------
  251|   925k|            huff &= incr - 1;
  252|   925k|            huff += incr;
  253|   925k|        }
  254|  36.8k|        else
  255|  36.8k|            huff = 0;
  256|       |
  257|       |        /* go to next symbol, update count, len */
  258|   961k|        sym++;
  259|   961k|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (259:13): [True: 192k, False: 769k]
  ------------------
  260|   192k|            if (len == max) break;
  ------------------
  |  Branch (260:17): [True: 36.8k, False: 155k]
  ------------------
  261|   155k|            len = lens[work[sym]];
  262|   155k|        }
  263|       |
  264|       |        /* create new sub-table if needed */
  265|   925k|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (265:13): [True: 212k, False: 712k]
  |  Branch (265:27): [True: 64.6k, False: 148k]
  ------------------
  266|       |            /* if first time, transition to sub-tables */
  267|  64.6k|            if (drop == 0)
  ------------------
  |  Branch (267:17): [True: 11.4k, False: 53.2k]
  ------------------
  268|  11.4k|                drop = root;
  269|       |
  270|       |            /* increment past last table */
  271|  64.6k|            next += min;            /* here min is 1 << curr */
  272|       |
  273|       |            /* determine length of next table */
  274|  64.6k|            curr = len - drop;
  275|  64.6k|            left = (int)(1 << curr);
  276|  84.9k|            while (curr + drop < max) {
  ------------------
  |  Branch (276:20): [True: 63.5k, False: 21.3k]
  ------------------
  277|  63.5k|                left -= count[curr + drop];
  278|  63.5k|                if (left <= 0) break;
  ------------------
  |  Branch (278:21): [True: 43.3k, False: 20.2k]
  ------------------
  279|  20.2k|                curr++;
  280|  20.2k|                left <<= 1;
  281|  20.2k|            }
  282|       |
  283|       |            /* check for enough space */
  284|  64.6k|            used += 1U << curr;
  285|  64.6k|            if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   50|  46.6k|#  define ENOUGH_LENS 852
  ------------------
  |  Branch (285:18): [True: 46.6k, False: 18.0k]
  |  Branch (285:34): [True: 0, False: 46.6k]
  ------------------
  286|  64.6k|                (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   51|  18.0k|#  define ENOUGH_DISTS 592
  ------------------
  |  Branch (286:18): [True: 18.0k, False: 46.6k]
  |  Branch (286:35): [True: 0, False: 18.0k]
  ------------------
  287|      0|                return 1;
  288|       |
  289|       |            /* point entry in root table to sub-table */
  290|  64.6k|            low = huff & mask;
  291|  64.6k|            (*table)[low].op = (unsigned char)curr;
  292|  64.6k|            (*table)[low].bits = (unsigned char)root;
  293|  64.6k|            (*table)[low].val = (unsigned short)(next - *table);
  294|  64.6k|        }
  295|   925k|    }
  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|  36.8k|    if (huff != 0) {
  ------------------
  |  Branch (300:9): [True: 13, False: 36.8k]
  ------------------
  301|     13|        here.op = (unsigned char)64;            /* invalid code marker */
  302|     13|        here.bits = (unsigned char)(len - drop);
  303|     13|        here.val = (unsigned short)0;
  304|     13|        next[huff] = here;
  305|     13|    }
  306|       |
  307|       |    /* set return parameters */
  308|  36.8k|    *table += used;
  309|  36.8k|    *bits = root;
  310|  36.8k|    return 0;
  311|  36.8k|}
inflate_fixed:
  364|  11.5k|void inflate_fixed(struct inflate_state FAR *state) {
  365|       |#ifdef BUILDFIXED
  366|       |    z_once(&built, buildtables);
  367|       |#endif /* BUILDFIXED */
  368|  11.5k|    state->lencode = lenfix;
  369|  11.5k|    state->lenbits = 9;
  370|  11.5k|    state->distcode = distfix;
  371|  11.5k|    state->distbits = 5;
  372|  11.5k|}

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

