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

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

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

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

jinit_arith_decoder:
  751|  1.10k|{
  752|  1.10k|  arith_entropy_ptr entropy;
  753|  1.10k|  int i;
  754|       |
  755|  1.10k|  entropy = (arith_entropy_ptr)
  756|  1.10k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.10k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  757|  1.10k|                                sizeof(arith_entropy_decoder));
  758|  1.10k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  759|  1.10k|  entropy->pub.start_pass = start_pass;
  760|       |
  761|       |  /* Mark tables unallocated */
  762|  18.7k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|  18.7k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (762:15): [True: 17.6k, False: 1.10k]
  ------------------
  763|  17.6k|    entropy->dc_stats[i] = NULL;
  764|  17.6k|    entropy->ac_stats[i] = NULL;
  765|  17.6k|  }
  766|       |
  767|       |  /* Initialize index for fixed probability estimation */
  768|  1.10k|  entropy->fixed_bin[0] = 113;
  769|       |
  770|  1.10k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (770:7): [True: 870, False: 232]
  ------------------
  771|       |    /* Create progression status table */
  772|    870|    int *coef_bit_ptr, ci;
  773|    870|    cinfo->coef_bits = (int (*)[DCTSIZE2])
  774|    870|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    870|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  775|    870|                                  cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|    870|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  776|    870|                                  sizeof(int));
  777|    870|    coef_bit_ptr = &cinfo->coef_bits[0][0];
  778|  1.74k|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (778:18): [True: 870, False: 870]
  ------------------
  779|  56.5k|      for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|  56.5k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (779:19): [True: 55.6k, False: 870]
  ------------------
  780|  55.6k|        *coef_bit_ptr++ = -1;
  781|    870|  }
  782|  1.10k|}
jdarith.c:start_pass:
  633|  2.10k|{
  634|  2.10k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  635|  2.10k|  int ci, tbl;
  636|  2.10k|  jpeg_component_info *compptr;
  637|       |
  638|  2.10k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (638:7): [True: 1.87k, False: 230]
  ------------------
  639|       |    /* Validate progressive scan parameters */
  640|  1.87k|    if (cinfo->Ss == 0) {
  ------------------
  |  Branch (640:9): [True: 1.31k, False: 561]
  ------------------
  641|  1.31k|      if (cinfo->Se != 0)
  ------------------
  |  Branch (641:11): [True: 1, False: 1.31k]
  ------------------
  642|      1|        goto bad;
  643|  1.31k|    } else {
  644|       |      /* need not check Ss/Se < 0 since they came from unsigned bytes */
  645|    561|      if (cinfo->Se < cinfo->Ss || cinfo->Se > DCTSIZE2 - 1)
  ------------------
  |  |   67|    558|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (645:11): [True: 3, False: 558]
  |  Branch (645:36): [True: 2, False: 556]
  ------------------
  646|      5|        goto bad;
  647|       |      /* AC scans may have only one component */
  648|    556|      if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (648:11): [True: 0, False: 556]
  ------------------
  649|      0|        goto bad;
  650|    556|    }
  651|  1.86k|    if (cinfo->Ah != 0) {
  ------------------
  |  Branch (651:9): [True: 4, False: 1.86k]
  ------------------
  652|       |      /* Successive approximation refinement scan: must have Al = Ah-1. */
  653|      4|      if (cinfo->Ah - 1 != cinfo->Al)
  ------------------
  |  Branch (653:11): [True: 1, False: 3]
  ------------------
  654|      1|        goto bad;
  655|      4|    }
  656|  1.86k|    if (cinfo->Al > 13) {       /* need not check for < 0 */
  ------------------
  |  Branch (656:9): [True: 1, False: 1.86k]
  ------------------
  657|      8|bad:
  658|      8|      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      8|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      8|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      8|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      8|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      8|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      8|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  659|      8|               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  660|      8|    }
  661|       |    /* Update progression status, and verify that scan order is legal.
  662|       |     * Note that inter-scan inconsistencies are treated as warnings
  663|       |     * not fatal errors ... not clear if this is right way to behave.
  664|       |     */
  665|  3.73k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (665:18): [True: 1.86k, False: 1.87k]
  ------------------
  666|  1.86k|      int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
  667|  1.86k|      int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  668|  1.86k|      int *prev_coef_bit_ptr =
  669|  1.86k|        &cinfo->coef_bits[cindex + cinfo->num_components][0];
  670|  1.86k|      if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (670:11): [True: 556, False: 1.30k]
  |  Branch (670:24): [True: 1, False: 555]
  ------------------
  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|  42.9k|      for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|  1.86k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 1.30k, False: 556]
  |  |  ------------------
  ------------------
                    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  513|  42.9k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 28.5k, False: 14.4k]
  |  |  ------------------
  ------------------
  |  Branch (672:39): [True: 41.1k, False: 1.86k]
  ------------------
  673|  41.1k|        if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (673:13): [True: 32.5k, False: 8.61k]
  ------------------
  674|  32.5k|          prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  675|  8.61k|        else
  676|  8.61k|          prev_coef_bit_ptr[coefi] = 0;
  677|  41.1k|      }
  678|  27.2k|      for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (678:31): [True: 25.4k, False: 1.86k]
  ------------------
  679|  25.4k|        int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (679:24): [True: 15.2k, False: 10.1k]
  ------------------
  680|  25.4k|        if (cinfo->Ah != expected)
  ------------------
  |  Branch (680:13): [True: 7, False: 25.4k]
  ------------------
  681|      7|          WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      7|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      7|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      7|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  682|  25.4k|        coef_bit_ptr[coefi] = cinfo->Al;
  683|  25.4k|      }
  684|  1.86k|    }
  685|       |    /* Select MCU decoding routine */
  686|  1.87k|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (686:9): [True: 1.85k, False: 16]
  ------------------
  687|  1.85k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (687:11): [True: 1.30k, False: 549]
  ------------------
  688|  1.30k|        entropy->pub.decode_mcu = decode_mcu_DC_first;
  689|    549|      else
  690|    549|        entropy->pub.decode_mcu = decode_mcu_AC_first;
  691|  1.85k|    } else {
  692|     16|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (692:11): [True: 0, False: 16]
  ------------------
  693|      0|        entropy->pub.decode_mcu = decode_mcu_DC_refine;
  694|     16|      else
  695|     16|        entropy->pub.decode_mcu = decode_mcu_AC_refine;
  696|     16|    }
  697|  1.87k|  } 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|    230|    if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|    229|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (701:9): [True: 1, False: 229]
  |  Branch (701:27): [True: 1, False: 228]
  ------------------
  702|    228|        cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (702:9): [True: 1, False: 227]
  |  Branch (702:27): [True: 1, False: 226]
  ------------------
  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|    230|    entropy->pub.decode_mcu = decode_mcu;
  706|    230|  }
  707|       |
  708|       |  /* Allocate & initialize requested statistics areas */
  709|  4.18k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (709:16): [True: 2.08k, False: 2.10k]
  ------------------
  710|  2.08k|    compptr = cinfo->cur_comp_info[ci];
  711|  2.08k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (711:9): [True: 228, False: 1.85k]
  |  Branch (711:38): [True: 1.30k, False: 549]
  |  Branch (711:56): [True: 1.30k, False: 0]
  ------------------
  712|  1.53k|      tbl = compptr->dc_tbl_no;
  713|  1.53k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  1.53k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (713:11): [True: 0, False: 1.53k]
  |  Branch (713:22): [True: 0, False: 1.53k]
  ------------------
  714|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  715|  1.53k|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (715:11): [True: 1.09k, False: 436]
  ------------------
  716|  1.09k|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  717|  1.09k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  889|  1.09k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|  1.09k|#define DC_STAT_BINS  64
  ------------------
  718|  1.53k|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  1.53k|#define DC_STAT_BINS  64
  ------------------
  719|       |      /* Initialize DC predictions to 0 */
  720|  1.53k|      entropy->last_dc_val[ci] = 0;
  721|  1.53k|      entropy->dc_context[ci] = 0;
  722|  1.53k|    }
  723|  2.08k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (723:9): [True: 228, False: 1.85k]
  |  Branch (723:37): [True: 549, False: 1.30k]
  ------------------
  724|    777|      tbl = compptr->ac_tbl_no;
  725|    777|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|    777|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (725:11): [True: 0, False: 777]
  |  Branch (725:22): [True: 0, False: 777]
  ------------------
  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|    777|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (727:11): [True: 566, False: 211]
  ------------------
  728|    566|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  729|    566|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  889|    566|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|    566|#define AC_STAT_BINS  256
  ------------------
  730|    777|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|    777|#define AC_STAT_BINS  256
  ------------------
  731|    777|    }
  732|  2.08k|  }
  733|       |
  734|       |  /* Initialize arithmetic decoding variables */
  735|  2.10k|  entropy->c = 0;
  736|  2.10k|  entropy->a = 0;
  737|  2.10k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  738|  2.10k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  2.10k|#define FALSE   0               /* values of boolean */
  ------------------
  739|       |
  740|       |  /* Initialize restart counter */
  741|  2.10k|  entropy->restarts_to_go = cinfo->restart_interval;
  742|  2.10k|}
jdarith.c:decode_mcu_DC_first:
  251|  6.61M|{
  252|  6.61M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  253|  6.61M|  JBLOCKROW block;
  254|  6.61M|  unsigned char *st;
  255|  6.61M|  int blkn, ci, tbl, sign;
  256|  6.61M|  int v, m;
  257|       |
  258|       |  /* Process restart marker if needed */
  259|  6.61M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (259:7): [True: 0, False: 6.61M]
  ------------------
  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|  6.61M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (265:7): [True: 0, False: 6.61M]
  ------------------
  266|       |
  267|       |  /* Outer loop handles each block in the MCU */
  268|       |
  269|  13.2M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (269:18): [True: 6.61M, False: 6.61M]
  ------------------
  270|  6.61M|    block = MCU_data[blkn];
  271|  6.61M|    ci = cinfo->MCU_membership[blkn];
  272|  6.61M|    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|  6.61M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  278|       |
  279|       |    /* Figure F.19: Decode_DC_DIFF */
  280|  6.61M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (280:9): [True: 2.38M, False: 4.23M]
  ------------------
  281|  2.38M|      entropy->dc_context[ci] = 0;
  282|  4.23M|    else {
  283|       |      /* Figure F.21: Decoding nonzero value v */
  284|       |      /* Figure F.22: Decoding the sign of v */
  285|  4.23M|      sign = arith_decode(cinfo, st + 1);
  286|  4.23M|      st += 2;  st += sign;
  287|       |      /* Figure F.23: Decoding the magnitude category of v */
  288|  4.23M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (288:11): [True: 2.75M, False: 1.47M]
  ------------------
  289|  2.75M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  290|  6.38M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (290:16): [True: 3.62M, False: 2.75M]
  ------------------
  291|  3.62M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (291:15): [True: 13, False: 3.62M]
  ------------------
  292|     13|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|     13|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     13|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  293|     13|            entropy->ct = -1;                   /* magnitude overflow */
  294|     13|            return TRUE;
  ------------------
  |  |  210|     13|#define TRUE    1
  ------------------
  295|     13|          }
  296|  3.62M|          st += 1;
  297|  3.62M|        }
  298|  2.75M|      }
  299|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  300|  4.23M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (300:11): [True: 0, False: 4.23M]
  ------------------
  301|      0|        entropy->dc_context[ci] = 0;               /* zero diff category */
  302|  4.23M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (302:16): [True: 2.12M, False: 2.10M]
  ------------------
  303|  2.12M|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  304|  2.10M|      else
  305|  2.10M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  306|  4.23M|      v = m;
  307|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  308|  4.23M|      st += 14;
  309|  7.86M|      while (m >>= 1)
  ------------------
  |  Branch (309:14): [True: 3.62M, False: 4.23M]
  ------------------
  310|  3.62M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (310:13): [True: 2.20M, False: 1.42M]
  ------------------
  311|  4.23M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (311:20): [True: 3.18M, False: 1.05M]
  ------------------
  312|  4.23M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  313|  4.23M|    }
  314|       |
  315|       |    /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
  316|  6.61M|    (*block)[0] = (JCOEF)LEFT_SHIFT(entropy->last_dc_val[ci], cinfo->Al);
  ------------------
  |  |   85|  6.61M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  317|  6.61M|  }
  318|       |
  319|  6.61M|  return TRUE;
  ------------------
  |  |  210|  6.61M|#define TRUE    1
  ------------------
  320|  6.61M|}
jdarith.c:arith_decode:
  116|  81.1M|{
  117|  81.1M|  register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  118|  81.1M|  register unsigned char nl, nm;
  119|  81.1M|  register JLONG qe, temp;
  120|  81.1M|  register int sv, data;
  121|       |
  122|       |  /* Renormalization & data input per section D.2.6 */
  123|   106M|  while (e->a < 0x8000L) {
  ------------------
  |  Branch (123:10): [True: 25.5M, False: 81.1M]
  ------------------
  124|  25.5M|    if (--e->ct < 0) {
  ------------------
  |  Branch (124:9): [True: 3.19M, False: 22.3M]
  ------------------
  125|       |      /* Need to fetch next data byte */
  126|  3.19M|      if (cinfo->unread_marker)
  ------------------
  |  Branch (126:11): [True: 2.74M, False: 455k]
  ------------------
  127|  2.74M|        data = 0;               /* stuff zero data */
  128|   455k|      else {
  129|   455k|        data = get_byte(cinfo); /* read next input byte */
  130|   455k|        if (data == 0xFF) {     /* zero stuff or marker code */
  ------------------
  |  Branch (130:13): [True: 4.60k, False: 450k]
  ------------------
  131|  8.30k|          do data = get_byte(cinfo);
  132|  8.30k|          while (data == 0xFF); /* swallow extra 0xFF bytes */
  ------------------
  |  Branch (132:18): [True: 3.70k, False: 4.60k]
  ------------------
  133|  4.60k|          if (data == 0)
  ------------------
  |  Branch (133:15): [True: 2.61k, False: 1.98k]
  ------------------
  134|  2.61k|            data = 0xFF;        /* discard stuffed zero byte */
  135|  1.98k|          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|  1.98k|            cinfo->unread_marker = data;
  143|  1.98k|            data = 0;
  144|  1.98k|          }
  145|  4.60k|        }
  146|   455k|      }
  147|  3.19M|      e->c = (e->c << 8) | data; /* insert data into C register */
  148|  3.19M|      if ((e->ct += 8) < 0)      /* update bit shift counter */
  ------------------
  |  Branch (148:11): [True: 4.15k, False: 3.19M]
  ------------------
  149|       |        /* Need more initial bytes */
  150|  4.15k|        if (++e->ct == 0)
  ------------------
  |  Branch (150:13): [True: 2.07k, False: 2.07k]
  ------------------
  151|       |          /* Got 2 initial bytes -> re-init A and exit loop */
  152|  2.07k|          e->a = 0x8000L; /* => e->a = 0x10000L after loop exit */
  153|  3.19M|    }
  154|  25.5M|    e->a <<= 1;
  155|  25.5M|  }
  156|       |
  157|       |  /* Fetch values from our compact representation of Table D.2:
  158|       |   * Qe values and probability estimation state machine
  159|       |   */
  160|  81.1M|  sv = *st;
  161|  81.1M|  qe = jpeg_aritab[sv & 0x7F];  /* => Qe_Value */
  162|  81.1M|  nl = qe & 0xFF;  qe >>= 8;    /* Next_Index_LPS + Switch_MPS */
  163|  81.1M|  nm = qe & 0xFF;  qe >>= 8;    /* Next_Index_MPS */
  164|       |
  165|       |  /* Decode & estimation procedures per sections D.2.4 & D.2.5 */
  166|  81.1M|  temp = e->a - qe;
  167|  81.1M|  e->a = temp;
  168|  81.1M|  temp <<= e->ct;
  169|  81.1M|  if (e->c >= temp) {
  ------------------
  |  Branch (169:7): [True: 7.72M, False: 73.3M]
  ------------------
  170|  7.72M|    e->c -= temp;
  171|       |    /* Conditional LPS (less probable symbol) exchange */
  172|  7.72M|    if (e->a < qe) {
  ------------------
  |  Branch (172:9): [True: 2.26M, False: 5.46M]
  ------------------
  173|  2.26M|      e->a = qe;
  174|  2.26M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  175|  5.46M|    } else {
  176|  5.46M|      e->a = qe;
  177|  5.46M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  178|  5.46M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  179|  5.46M|    }
  180|  73.3M|  } else if (e->a < 0x8000L) {
  ------------------
  |  Branch (180:14): [True: 10.8M, False: 62.5M]
  ------------------
  181|       |    /* Conditional MPS (more probable symbol) exchange */
  182|  10.8M|    if (e->a < qe) {
  ------------------
  |  Branch (182:9): [True: 3.72M, False: 7.12M]
  ------------------
  183|  3.72M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  184|  3.72M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  185|  7.12M|    } else {
  186|  7.12M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  187|  7.12M|    }
  188|  10.8M|  }
  189|       |
  190|  81.1M|  return sv >> 7;
  191|  81.1M|}
jdarith.c:get_byte:
   76|   463k|{
   77|   463k|  struct jpeg_source_mgr *src = cinfo->src;
   78|       |
   79|   463k|  if (src->bytes_in_buffer == 0)
  ------------------
  |  Branch (79:7): [True: 67, False: 463k]
  ------------------
   80|     67|    if (!(*src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (80:9): [True: 0, False: 67]
  ------------------
   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|   463k|  src->bytes_in_buffer--;
   83|   463k|  return *src->next_input_byte++;
   84|   463k|}
jdarith.c:decode_mcu_AC_first:
  330|  2.98M|{
  331|  2.98M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  332|  2.98M|  JBLOCKROW block;
  333|  2.98M|  unsigned char *st;
  334|  2.98M|  int tbl, sign, k;
  335|  2.98M|  int v, m;
  336|       |
  337|       |  /* Process restart marker if needed */
  338|  2.98M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (338:7): [True: 0, False: 2.98M]
  ------------------
  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.98M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (344:7): [True: 0, False: 2.98M]
  ------------------
  345|       |
  346|       |  /* There is always only one block per MCU */
  347|  2.98M|  block = MCU_data[0];
  348|  2.98M|  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|  9.29M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (353:23): [True: 9.29M, False: 1.79k]
  ------------------
  354|  9.29M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  355|  9.29M|    if (arith_decode(cinfo, st)) break;         /* EOB flag */
  ------------------
  |  Branch (355:9): [True: 2.98M, False: 6.31M]
  ------------------
  356|  13.6M|    while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (356:12): [True: 7.30M, False: 6.31M]
  ------------------
  357|  7.30M|      st += 3;  k++;
  358|  7.30M|      if (k > cinfo->Se) {
  ------------------
  |  Branch (358:11): [True: 6, False: 7.30M]
  ------------------
  359|      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))
  ------------------
  360|      6|        entropy->ct = -1;                       /* spectral overflow */
  361|      6|        return TRUE;
  ------------------
  |  |  210|      6|#define TRUE    1
  ------------------
  362|      6|      }
  363|  7.30M|    }
  364|       |    /* Figure F.21: Decoding nonzero value v */
  365|       |    /* Figure F.22: Decoding the sign of v */
  366|  6.31M|    sign = arith_decode(cinfo, entropy->fixed_bin);
  367|  6.31M|    st += 2;
  368|       |    /* Figure F.23: Decoding the magnitude category of v */
  369|  6.31M|    if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (369:9): [True: 3.41M, False: 2.90M]
  ------------------
  370|  3.41M|      if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (370:11): [True: 2.96M, False: 451k]
  ------------------
  371|  2.96M|        m <<= 1;
  372|  2.96M|        st = entropy->ac_stats[tbl] +
  373|  2.96M|             (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (373:15): [True: 733k, False: 2.22M]
  ------------------
  374|  4.95M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (374:16): [True: 1.99M, False: 2.96M]
  ------------------
  375|  1.99M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (375:15): [True: 2, False: 1.99M]
  ------------------
  376|      2|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      2|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  377|      2|            entropy->ct = -1;                   /* magnitude overflow */
  378|      2|            return TRUE;
  ------------------
  |  |  210|      2|#define TRUE    1
  ------------------
  379|      2|          }
  380|  1.99M|          st += 1;
  381|  1.99M|        }
  382|  2.96M|      }
  383|  3.41M|    }
  384|  6.31M|    v = m;
  385|       |    /* Figure F.24: Decoding the magnitude bit pattern of v */
  386|  6.31M|    st += 14;
  387|  11.2M|    while (m >>= 1)
  ------------------
  |  Branch (387:12): [True: 4.95M, False: 6.31M]
  ------------------
  388|  4.95M|      if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (388:11): [True: 3.04M, False: 1.91M]
  ------------------
  389|  6.31M|    v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (389:18): [True: 3.03M, False: 3.28M]
  ------------------
  390|       |    /* Scale and output coefficient in natural (dezigzagged) order */
  391|  6.31M|    (*block)[jpeg_natural_order[k]] = (JCOEF)((unsigned)v << cinfo->Al);
  392|  6.31M|  }
  393|       |
  394|  2.98M|  return TRUE;
  ------------------
  |  |  210|  2.98M|#define TRUE    1
  ------------------
  395|  2.98M|}
jdarith.c:decode_mcu:
  506|   433k|{
  507|   433k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  508|   433k|  jpeg_component_info *compptr;
  509|   433k|  JBLOCKROW block;
  510|   433k|  unsigned char *st;
  511|   433k|  int blkn, ci, tbl, sign, k;
  512|   433k|  int v, m;
  513|       |
  514|       |  /* Process restart marker if needed */
  515|   433k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (515:7): [True: 0, False: 433k]
  ------------------
  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|   433k|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (521:7): [True: 0, False: 433k]
  ------------------
  522|       |
  523|       |  /* Outer loop handles each block in the MCU */
  524|       |
  525|   866k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (525:18): [True: 433k, False: 433k]
  ------------------
  526|   433k|    block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (526:13): [True: 433k, False: 0]
  ------------------
  527|   433k|    ci = cinfo->MCU_membership[blkn];
  528|   433k|    compptr = cinfo->cur_comp_info[ci];
  529|       |
  530|       |    /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */
  531|       |
  532|   433k|    tbl = compptr->dc_tbl_no;
  533|       |
  534|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  535|   433k|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  536|       |
  537|       |    /* Figure F.19: Decode_DC_DIFF */
  538|   433k|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (538:9): [True: 206k, False: 226k]
  ------------------
  539|   206k|      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: 120k, False: 106k]
  ------------------
  547|   120k|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  548|   357k|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (548:16): [True: 237k, False: 120k]
  ------------------
  549|   237k|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (549:15): [True: 5, False: 237k]
  ------------------
  550|      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))
  ------------------
  551|      5|            entropy->ct = -1;                   /* magnitude overflow */
  552|      5|            return TRUE;
  ------------------
  |  |  210|      5|#define TRUE    1
  ------------------
  553|      5|          }
  554|   237k|          st += 1;
  555|   237k|        }
  556|   120k|      }
  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: 78.8k, False: 147k]
  ------------------
  561|  78.8k|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  562|   147k|      else
  563|   147k|        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: 107k, False: 129k]
  ------------------
  569|   226k|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (569:20): [True: 124k, False: 101k]
  ------------------
  570|   226k|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  571|   226k|    }
  572|       |
  573|   433k|    if (block)
  ------------------
  |  Branch (573:9): [True: 433k, False: 3]
  ------------------
  574|   433k|      (*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|   433k|    tbl = compptr->ac_tbl_no;
  579|       |
  580|       |    /* Figure F.20: Decode_AC_coefficients */
  581|  1.05M|    for (k = 1; k <= DCTSIZE2 - 1; k++) {
  ------------------
  |  |   67|  1.05M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (581:17): [True: 1.05M, False: 319]
  ------------------
  582|  1.05M|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  583|  1.05M|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (583:11): [True: 432k, False: 626k]
  ------------------
  584|  1.42M|      while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (584:14): [True: 800k, False: 626k]
  ------------------
  585|   800k|        st += 3;  k++;
  586|   800k|        if (k > DCTSIZE2 - 1) {
  ------------------
  |  |   67|   800k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (586:13): [True: 2, False: 800k]
  ------------------
  587|      2|          WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      2|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  588|      2|          entropy->ct = -1;                     /* spectral overflow */
  589|      2|          return TRUE;
  ------------------
  |  |  210|      2|#define TRUE    1
  ------------------
  590|      2|        }
  591|   800k|      }
  592|       |      /* Figure F.21: Decoding nonzero value v */
  593|       |      /* Figure F.22: Decoding the sign of v */
  594|   626k|      sign = arith_decode(cinfo, entropy->fixed_bin);
  595|   626k|      st += 2;
  596|       |      /* Figure F.23: Decoding the magnitude category of v */
  597|   626k|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (597:11): [True: 340k, False: 285k]
  ------------------
  598|   340k|        if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (598:13): [True: 260k, False: 80.3k]
  ------------------
  599|   260k|          m <<= 1;
  600|   260k|          st = entropy->ac_stats[tbl] +
  601|   260k|               (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (601:17): [True: 167k, False: 92.5k]
  ------------------
  602|   784k|          while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (602:18): [True: 523k, False: 260k]
  ------------------
  603|   523k|            if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (603:17): [True: 7, False: 523k]
  ------------------
  604|      7|              WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      7|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  605|      7|              entropy->ct = -1;                 /* magnitude overflow */
  606|      7|              return TRUE;
  ------------------
  |  |  210|      7|#define TRUE    1
  ------------------
  607|      7|            }
  608|   523k|            st += 1;
  609|   523k|          }
  610|   260k|        }
  611|   340k|      }
  612|   626k|      v = m;
  613|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  614|   626k|      st += 14;
  615|  1.41M|      while (m >>= 1)
  ------------------
  |  Branch (615:14): [True: 784k, False: 626k]
  ------------------
  616|   784k|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (616:13): [True: 404k, False: 379k]
  ------------------
  617|   626k|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (617:20): [True: 270k, False: 356k]
  ------------------
  618|   626k|      if (block)
  ------------------
  |  Branch (618:11): [True: 626k, False: 12]
  ------------------
  619|   626k|        (*block)[jpeg_natural_order[k]] = (JCOEF)v;
  620|   626k|    }
  621|   433k|  }
  622|       |
  623|   433k|  return TRUE;
  ------------------
  |  |  210|   433k|#define TRUE    1
  ------------------
  624|   433k|}

jinit_d_coef_controller:
  869|  1.62k|{
  870|  1.62k|  my_coef_ptr coef;
  871|       |
  872|  1.62k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.62k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (872:7): [True: 0, False: 1.62k]
  ------------------
  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.62k|  coef = (my_coef_ptr)
  876|  1.62k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.62k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|  1.62k|                                sizeof(my_coef_controller));
  878|  1.62k|  memset(coef, 0, sizeof(my_coef_controller));
  879|  1.62k|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|  1.62k|  coef->pub.start_input_pass = start_input_pass;
  881|  1.62k|  coef->pub.start_output_pass = start_output_pass;
  882|  1.62k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|  1.62k|  coef->coef_bits_latch = NULL;
  884|  1.62k|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|  1.62k|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 829, False: 799]
  ------------------
  888|    829|#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|    829|    int ci, access_rows;
  893|    829|    jpeg_component_info *compptr;
  894|       |
  895|  1.66k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 833, False: 829]
  ------------------
  896|    833|         ci++, compptr++) {
  897|    833|      access_rows = compptr->v_samp_factor;
  898|    833|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|    833|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 833, False: 0]
  ------------------
  901|    833|        access_rows *= 5;
  902|    833|#endif
  903|    833|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|    833|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|    833|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|    833|#define TRUE    1
  ------------------
  905|    833|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|    833|                               (long)compptr->h_samp_factor),
  907|    833|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|    833|                               (long)compptr->v_samp_factor),
  909|    833|         (JDIMENSION)access_rows);
  910|    833|    }
  911|    829|    coef->pub.consume_data = consume_data;
  912|    829|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|    829|#define _decompress_data  decompress_data
  ------------------
  913|    829|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|    829|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|    799|    JBLOCKROW buffer;
  920|    799|    int i;
  921|       |
  922|    799|    buffer = (JBLOCKROW)
  923|    799|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    799|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|    799|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|    799|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|  8.78k|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|  8.78k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 7.99k, False: 799]
  ------------------
  926|  7.99k|      coef->MCU_buffer[i] = buffer + i;
  927|  7.99k|    }
  928|    799|    coef->pub.consume_data = dummy_consume_data;
  929|    799|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  258|    799|#define _decompress_data  decompress_data
  ------------------
  930|    799|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|    799|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|  1.62k|  coef->workspace = (JCOEF *)
  935|  1.62k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.62k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|  1.62k|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|  1.62k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|  1.62k|}
jdcoefct-8.c:start_input_pass:
   50|  2.32k|{
   51|  2.32k|  cinfo->input_iMCU_row = 0;
   52|  2.32k|  start_iMCU_row(cinfo);
   53|  2.32k|}
jdcoefct-8.c:start_output_pass:
   62|  1.45k|{
   63|  1.45k|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|  1.45k|  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.45k|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 694, False: 760]
  ------------------
   68|    694|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 694, False: 0]
  |  Branch (68:38): [True: 501, False: 193]
  ------------------
   69|    501|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  258|    501|#define _decompress_data  decompress_data
  ------------------
   70|    193|    else
   71|    193|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|    193|#define _decompress_data  decompress_data
  ------------------
   72|    694|  }
   73|  1.45k|#endif
   74|  1.45k|  cinfo->output_iMCU_row = 0;
   75|  1.45k|}
jdcoefct-8.c:smoothing_ok:
  405|    694|{
  406|    694|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|    694|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|    694|#define FALSE   0               /* values of boolean */
  ------------------
  408|    694|  int ci, coefi;
  409|    694|  jpeg_component_info *compptr;
  410|    694|  JQUANT_TBL *qtable;
  411|    694|  int *coef_bits, *prev_coef_bits;
  412|    694|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|    694|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 0, False: 694]
  |  Branch (414:35): [True: 0, False: 694]
  ------------------
  415|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|    694|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 694, False: 0]
  ------------------
  419|    694|    coef->coef_bits_latch = (int *)
  420|    694|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    694|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|    694|                                  cinfo->num_components * 2 *
  422|    694|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|    694|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|    694|  coef_bits_latch = coef->coef_bits_latch;
  424|    694|  prev_coef_bits_latch =
  425|    694|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|    694|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|  1.20k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 694, False: 507]
  ------------------
  428|    694|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|    694|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 0, False: 694]
  ------------------
  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|    694|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 11, False: 683]
  ------------------
  434|    683|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|    683|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 15, False: 668]
  ------------------
  435|    668|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|    668|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 13, False: 655]
  ------------------
  436|    655|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|    655|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 21, False: 634]
  ------------------
  437|    634|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|    634|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 26, False: 608]
  ------------------
  438|    608|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|    608|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 59, False: 549]
  ------------------
  439|    549|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|    549|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 7, False: 542]
  ------------------
  440|    542|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|    542|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 7, False: 535]
  ------------------
  441|    535|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|    535|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 16, False: 519]
  ------------------
  442|    519|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|    519|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 12, False: 507]
  ------------------
  443|    187|      return FALSE;
  ------------------
  |  |  207|    187|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|    507|    coef_bits = cinfo->coef_bits[ci];
  446|    507|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|    507|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 0, False: 507]
  ------------------
  448|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  449|    507|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|  5.07k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|  5.07k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 4.56k, False: 507]
  ------------------
  452|  4.56k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 2.32k, False: 2.24k]
  ------------------
  453|  2.32k|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|  2.24k|      else
  455|  2.24k|        prev_coef_bits_latch[coefi] = -1;
  456|  4.56k|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|  4.56k|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 4.32k, False: 240]
  ------------------
  458|  4.32k|        smoothing_useful = TRUE;
  ------------------
  |  |  210|  4.32k|#define TRUE    1
  ------------------
  459|  4.56k|    }
  460|    507|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    507|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|    507|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    507|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|    507|  }
  463|       |
  464|    507|  return smoothing_useful;
  465|    694|}
jdcoefct-8.c:decompress_smooth_data:
  474|  38.9k|{
  475|  38.9k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  476|  38.9k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  477|  38.9k|  JDIMENSION block_num, last_block_column;
  478|  38.9k|  int ci, block_row, block_rows, access_rows, image_block_row,
  479|  38.9k|    image_block_rows;
  480|  38.9k|  JBLOCKARRAY buffer;
  481|  38.9k|  JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
  482|  38.9k|  JBLOCKROW next_block_row, next_next_block_row;
  483|  38.9k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  38.9k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  484|  38.9k|  JDIMENSION output_col;
  485|  38.9k|  jpeg_component_info *compptr;
  486|  38.9k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  38.9k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  487|  38.9k|  boolean change_dc;
  488|  38.9k|  JCOEF *workspace;
  489|  38.9k|  int *coef_bits;
  490|  38.9k|  JQUANT_TBL *quanttbl;
  491|  38.9k|  JLONG Q00, Q01, Q02, Q03 = 0, Q10, Q11, Q12 = 0, Q20, Q21 = 0, Q30 = 0, num;
  492|  38.9k|  int DC01, DC02, DC03, DC04, DC05, DC06, DC07, DC08, DC09, DC10, DC11, DC12,
  493|  38.9k|      DC13, DC14, DC15, DC16, DC17, DC18, DC19, DC20, DC21, DC22, DC23, DC24,
  494|  38.9k|      DC25;
  495|  38.9k|  int Al, pred;
  496|       |
  497|       |  /* Keep a local variable to avoid looking it up more than once */
  498|  38.9k|  workspace = coef->workspace;
  499|       |
  500|       |  /* Force some input to be done if we are getting ahead of the input. */
  501|  38.9k|  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
  ------------------
  |  Branch (501:10): [True: 38.9k, False: 0]
  ------------------
  502|  38.9k|         !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (502:10): [True: 0, False: 38.9k]
  ------------------
  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|  77.9k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (518:44): [True: 38.9k, False: 38.9k]
  ------------------
  519|  38.9k|       ci++, compptr++) {
  520|       |    /* Don't bother to IDCT an uninteresting component. */
  521|  38.9k|    if (!compptr->component_needed)
  ------------------
  |  Branch (521:9): [True: 0, False: 38.9k]
  ------------------
  522|      0|      continue;
  523|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  524|  38.9k|    if (cinfo->output_iMCU_row + 1 < last_iMCU_row) {
  ------------------
  |  Branch (524:9): [True: 37.9k, False: 985]
  ------------------
  525|  37.9k|      block_rows = compptr->v_samp_factor;
  526|  37.9k|      access_rows = block_rows * 3; /* this and next two iMCU rows */
  527|  37.9k|    } else if (cinfo->output_iMCU_row < last_iMCU_row) {
  ------------------
  |  Branch (527:16): [True: 484, False: 501]
  ------------------
  528|    484|      block_rows = compptr->v_samp_factor;
  529|    484|      access_rows = block_rows * 2; /* this and next iMCU row */
  530|    501|    } else {
  531|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  532|    501|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  533|    501|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (533:11): [True: 46, False: 455]
  ------------------
  534|    501|      access_rows = block_rows; /* this iMCU row only */
  535|    501|    }
  536|       |    /* Align the virtual buffer for this component. */
  537|  38.9k|    if (cinfo->output_iMCU_row > 1) {
  ------------------
  |  Branch (537:9): [True: 37.9k, False: 985]
  ------------------
  538|  37.9k|      access_rows += 2 * compptr->v_samp_factor; /* prior two iMCU rows too */
  539|  37.9k|      buffer = (*cinfo->mem->access_virt_barray)
  540|  37.9k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  541|  37.9k|         (cinfo->output_iMCU_row - 2) * compptr->v_samp_factor,
  542|  37.9k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  37.9k|#define FALSE   0               /* values of boolean */
  ------------------
  543|  37.9k|      buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
  544|  37.9k|    } else if (cinfo->output_iMCU_row > 0) {
  ------------------
  |  Branch (544:16): [True: 484, False: 501]
  ------------------
  545|    484|      access_rows += compptr->v_samp_factor; /* prior iMCU row too */
  546|    484|      buffer = (*cinfo->mem->access_virt_barray)
  547|    484|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  548|    484|         (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
  549|    484|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    484|#define FALSE   0               /* values of boolean */
  ------------------
  550|    484|      buffer += compptr->v_samp_factor; /* point to current iMCU row */
  551|    501|    } else {
  552|    501|      buffer = (*cinfo->mem->access_virt_barray)
  553|    501|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  554|    501|         (JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    501|#define FALSE   0               /* values of boolean */
  ------------------
  555|    501|    }
  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|  38.9k|    if (cinfo->output_iMCU_row > cinfo->master->last_good_iMCU_row)
  ------------------
  |  Branch (560:9): [True: 0, False: 38.9k]
  ------------------
  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|  38.9k|    else
  564|  38.9k|      coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
  ------------------
  |  |   58|  38.9k|#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|  38.9k|    change_dc =
  568|  38.9k|      coef_bits[1] == -1 && coef_bits[2] == -1 && coef_bits[3] == -1 &&
  ------------------
  |  Branch (568:7): [True: 31.2k, False: 7.74k]
  |  Branch (568:29): [True: 29.1k, False: 2.08k]
  |  Branch (568:51): [True: 26.3k, False: 2.78k]
  ------------------
  569|  26.3k|      coef_bits[4] == -1 && coef_bits[5] == -1 && coef_bits[6] == -1 &&
  ------------------
  |  Branch (569:7): [True: 26.0k, False: 276]
  |  Branch (569:29): [True: 25.2k, False: 819]
  |  Branch (569:51): [True: 25.1k, False: 82]
  ------------------
  570|  25.1k|      coef_bits[7] == -1 && coef_bits[8] == -1 && coef_bits[9] == -1;
  ------------------
  |  Branch (570:7): [True: 25.0k, False: 75]
  |  Branch (570:29): [True: 24.8k, False: 245]
  |  Branch (570:51): [True: 24.8k, False: 0]
  ------------------
  571|       |
  572|  38.9k|    quanttbl = compptr->quant_table;
  573|  38.9k|    Q00 = quanttbl->quantval[0];
  574|  38.9k|    Q01 = quanttbl->quantval[Q01_POS];
  ------------------
  |  |  385|  38.9k|#define Q01_POS  1
  ------------------
  575|  38.9k|    Q10 = quanttbl->quantval[Q10_POS];
  ------------------
  |  |  386|  38.9k|#define Q10_POS  8
  ------------------
  576|  38.9k|    Q20 = quanttbl->quantval[Q20_POS];
  ------------------
  |  |  387|  38.9k|#define Q20_POS  16
  ------------------
  577|  38.9k|    Q11 = quanttbl->quantval[Q11_POS];
  ------------------
  |  |  388|  38.9k|#define Q11_POS  9
  ------------------
  578|  38.9k|    Q02 = quanttbl->quantval[Q02_POS];
  ------------------
  |  |  389|  38.9k|#define Q02_POS  2
  ------------------
  579|  38.9k|    if (change_dc) {
  ------------------
  |  Branch (579:9): [True: 24.8k, False: 14.1k]
  ------------------
  580|  24.8k|      Q03 = quanttbl->quantval[Q03_POS];
  ------------------
  |  |  390|  24.8k|#define Q03_POS  3
  ------------------
  581|  24.8k|      Q12 = quanttbl->quantval[Q12_POS];
  ------------------
  |  |  391|  24.8k|#define Q12_POS  10
  ------------------
  582|  24.8k|      Q21 = quanttbl->quantval[Q21_POS];
  ------------------
  |  |  392|  24.8k|#define Q21_POS  17
  ------------------
  583|  24.8k|      Q30 = quanttbl->quantval[Q30_POS];
  ------------------
  |  |  393|  24.8k|#define Q30_POS  24
  ------------------
  584|  24.8k|    }
  585|  38.9k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|  38.9k|#define _inverse_DCT  inverse_DCT
  ------------------
  586|  38.9k|    output_ptr = output_buf[ci];
  587|       |    /* Loop over all DCT blocks to be processed. */
  588|  38.9k|    image_block_rows = block_rows * cinfo->total_iMCU_rows;
  589|   128k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (589:25): [True: 89.3k, False: 38.9k]
  ------------------
  590|  89.3k|      image_block_row = cinfo->output_iMCU_row * block_rows + block_row;
  591|  89.3k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  592|       |
  593|  89.3k|      if (image_block_row > 0)
  ------------------
  |  Branch (593:11): [True: 88.8k, False: 501]
  ------------------
  594|  88.8k|        prev_block_row =
  595|  88.8k|          buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
  596|    501|      else
  597|    501|        prev_block_row = buffer_ptr;
  598|       |
  599|  89.3k|      if (image_block_row > 1)
  ------------------
  |  Branch (599:11): [True: 88.3k, False: 1.00k]
  ------------------
  600|  88.3k|        prev_prev_block_row =
  601|  88.3k|          buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
  602|  1.00k|      else
  603|  1.00k|        prev_prev_block_row = prev_block_row;
  604|       |
  605|  89.3k|      if (image_block_row < image_block_rows - 1)
  ------------------
  |  Branch (605:11): [True: 88.8k, False: 501]
  ------------------
  606|  88.8k|        next_block_row =
  607|  88.8k|          buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
  608|    501|      else
  609|    501|        next_block_row = buffer_ptr;
  610|       |
  611|  89.3k|      if (image_block_row < image_block_rows - 2)
  ------------------
  |  Branch (611:11): [True: 88.7k, False: 575]
  ------------------
  612|  88.7k|        next_next_block_row =
  613|  88.7k|          buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
  614|    575|      else
  615|    575|        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|  89.3k|      DC01 = DC02 = DC03 = DC04 = DC05 = (int)prev_prev_block_row[0][0];
  621|  89.3k|      DC06 = DC07 = DC08 = DC09 = DC10 = (int)prev_block_row[0][0];
  622|  89.3k|      DC11 = DC12 = DC13 = DC14 = DC15 = (int)buffer_ptr[0][0];
  623|  89.3k|      DC16 = DC17 = DC18 = DC19 = DC20 = (int)next_block_row[0][0];
  624|  89.3k|      DC21 = DC22 = DC23 = DC24 = DC25 = (int)next_next_block_row[0][0];
  625|  89.3k|      output_col = 0;
  626|  89.3k|      last_block_column = compptr->width_in_blocks - 1;
  627|  89.3k|      for (block_num = cinfo->master->first_MCU_col[ci];
  628|  2.78M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (628:12): [True: 2.69M, False: 89.3k]
  ------------------
  629|       |        /* Fetch current DCT block into workspace so we can modify it. */
  630|  2.69M|        jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
  631|       |        /* Update DC values */
  632|  2.69M|        if (block_num == cinfo->master->first_MCU_col[ci] &&
  ------------------
  |  Branch (632:13): [True: 89.3k, False: 2.60M]
  ------------------
  633|  89.3k|            block_num < last_block_column) {
  ------------------
  |  Branch (633:13): [True: 63.6k, False: 25.7k]
  ------------------
  634|  63.6k|          DC04 = DC05 = (int)prev_prev_block_row[1][0];
  635|  63.6k|          DC09 = DC10 = (int)prev_block_row[1][0];
  636|  63.6k|          DC14 = DC15 = (int)buffer_ptr[1][0];
  637|  63.6k|          DC19 = DC20 = (int)next_block_row[1][0];
  638|  63.6k|          DC24 = DC25 = (int)next_next_block_row[1][0];
  639|  63.6k|        }
  640|  2.69M|        if (block_num + 1 < last_block_column) {
  ------------------
  |  Branch (640:13): [True: 2.54M, False: 153k]
  ------------------
  641|  2.54M|          DC05 = (int)prev_prev_block_row[2][0];
  642|  2.54M|          DC10 = (int)prev_block_row[2][0];
  643|  2.54M|          DC15 = (int)buffer_ptr[2][0];
  644|  2.54M|          DC20 = (int)next_block_row[2][0];
  645|  2.54M|          DC25 = (int)next_next_block_row[2][0];
  646|  2.54M|        }
  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|  2.69M|        if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
  ------------------
  |  Branch (658:13): [True: 2.67M, False: 21.8k]
  |  Branch (658:41): [True: 2.29M, False: 378k]
  ------------------
  659|  2.29M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (659:24): [True: 1.71M, False: 576k]
  ------------------
  660|  1.71M|                (-DC01 - DC02 + DC04 + DC05 - 3 * DC06 + 13 * DC07 -
  661|  1.71M|                 13 * DC09 + 3 * DC10 - 3 * DC11 + 38 * DC12 - 38 * DC14 +
  662|  1.71M|                 3 * DC15 - 3 * DC16 + 13 * DC17 - 13 * DC19 + 3 * DC20 -
  663|  1.71M|                 DC21 - DC22 + DC24 + DC25) :
  664|  2.29M|                (-7 * DC11 + 50 * DC12 - 50 * DC14 + 7 * DC15));
  665|  2.29M|          if (num >= 0) {
  ------------------
  |  Branch (665:15): [True: 1.69M, False: 600k]
  ------------------
  666|  1.69M|            pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
  667|  1.69M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (667:17): [True: 244k, False: 1.45M]
  |  Branch (667:27): [True: 3.46k, False: 241k]
  ------------------
  668|  3.46k|              pred = (1 << Al) - 1;
  669|  1.69M|          } else {
  670|   600k|            pred = (int)(((Q01 << 7) - num) / (Q01 << 8));
  671|   600k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (671:17): [True: 95.4k, False: 504k]
  |  Branch (671:27): [True: 2.35k, False: 93.1k]
  ------------------
  672|  2.35k|              pred = (1 << Al) - 1;
  673|   600k|            pred = -pred;
  674|   600k|          }
  675|  2.29M|          workspace[1] = (JCOEF)pred;
  676|  2.29M|        }
  677|       |        /* AC10 */
  678|  2.69M|        if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
  ------------------
  |  Branch (678:13): [True: 2.61M, False: 77.5k]
  |  Branch (678:41): [True: 2.53M, False: 87.6k]
  ------------------
  679|  2.53M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (679:24): [True: 1.71M, False: 811k]
  ------------------
  680|  1.71M|                (-DC01 - 3 * DC02 - 3 * DC03 - 3 * DC04 - DC05 - DC06 +
  681|  1.71M|                 13 * DC07 + 38 * DC08 + 13 * DC09 - DC10 + DC16 -
  682|  1.71M|                 13 * DC17 - 38 * DC18 - 13 * DC19 + DC20 + DC21 +
  683|  1.71M|                 3 * DC22 + 3 * DC23 + 3 * DC24 + DC25) :
  684|  2.53M|                (-7 * DC03 + 50 * DC08 - 50 * DC18 + 7 * DC23));
  685|  2.53M|          if (num >= 0) {
  ------------------
  |  Branch (685:15): [True: 2.04M, False: 486k]
  ------------------
  686|  2.04M|            pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
  687|  2.04M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (687:17): [True: 521k, False: 1.52M]
  |  Branch (687:27): [True: 46.6k, False: 474k]
  ------------------
  688|  46.6k|              pred = (1 << Al) - 1;
  689|  2.04M|          } else {
  690|   486k|            pred = (int)(((Q10 << 7) - num) / (Q10 << 8));
  691|   486k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (691:17): [True: 109k, False: 376k]
  |  Branch (691:27): [True: 21.2k, False: 88.3k]
  ------------------
  692|  21.2k|              pred = (1 << Al) - 1;
  693|   486k|            pred = -pred;
  694|   486k|          }
  695|  2.53M|          workspace[8] = (JCOEF)pred;
  696|  2.53M|        }
  697|       |        /* AC20 */
  698|  2.69M|        if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
  ------------------
  |  Branch (698:13): [True: 2.59M, False: 97.7k]
  |  Branch (698:41): [True: 2.40M, False: 191k]
  ------------------
  699|  2.40M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (699:24): [True: 1.71M, False: 687k]
  ------------------
  700|  1.71M|                (DC03 + 2 * DC07 + 7 * DC08 + 2 * DC09 - 5 * DC12 - 14 * DC13 -
  701|  1.71M|                 5 * DC14 + 2 * DC17 + 7 * DC18 + 2 * DC19 + DC23) :
  702|  2.40M|                (-DC03 + 13 * DC08 - 24 * DC13 + 13 * DC18 - DC23));
  703|  2.40M|          if (num >= 0) {
  ------------------
  |  Branch (703:15): [True: 1.25M, False: 1.15M]
  ------------------
  704|  1.25M|            pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
  705|  1.25M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (705:17): [True: 285k, False: 970k]
  |  Branch (705:27): [True: 12.8k, False: 272k]
  ------------------
  706|  12.8k|              pred = (1 << Al) - 1;
  707|  1.25M|          } else {
  708|  1.15M|            pred = (int)(((Q20 << 7) - num) / (Q20 << 8));
  709|  1.15M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (709:17): [True: 251k, False: 899k]
  |  Branch (709:27): [True: 13.4k, False: 237k]
  ------------------
  710|  13.4k|              pred = (1 << Al) - 1;
  711|  1.15M|            pred = -pred;
  712|  1.15M|          }
  713|  2.40M|          workspace[16] = (JCOEF)pred;
  714|  2.40M|        }
  715|       |        /* AC11 */
  716|  2.69M|        if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
  ------------------
  |  Branch (716:13): [True: 2.59M, False: 97.7k]
  |  Branch (716:41): [True: 2.46M, False: 137k]
  ------------------
  717|  2.46M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (717:24): [True: 1.71M, False: 742k]
  ------------------
  718|  1.71M|                (-DC01 + DC05 + 9 * DC07 - 9 * DC09 - 9 * DC17 +
  719|  1.71M|                 9 * DC19 + DC21 - DC25) :
  720|  2.46M|                (DC10 + DC16 - 10 * DC17 + 10 * DC19 - DC02 - DC20 + DC22 -
  721|   742k|                 DC24 + DC04 - DC06 + 10 * DC07 - 10 * DC09));
  722|  2.46M|          if (num >= 0) {
  ------------------
  |  Branch (722:15): [True: 1.47M, False: 985k]
  ------------------
  723|  1.47M|            pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
  724|  1.47M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (724:17): [True: 356k, False: 1.11M]
  |  Branch (724:27): [True: 3.29k, False: 353k]
  ------------------
  725|  3.29k|              pred = (1 << Al) - 1;
  726|  1.47M|          } else {
  727|   985k|            pred = (int)(((Q11 << 7) - num) / (Q11 << 8));
  728|   985k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (728:17): [True: 261k, False: 723k]
  |  Branch (728:27): [True: 3.29k, False: 258k]
  ------------------
  729|  3.29k|              pred = (1 << Al) - 1;
  730|   985k|            pred = -pred;
  731|   985k|          }
  732|  2.46M|          workspace[9] = (JCOEF)pred;
  733|  2.46M|        }
  734|       |        /* AC02 */
  735|  2.69M|        if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
  ------------------
  |  Branch (735:13): [True: 2.55M, False: 138k]
  |  Branch (735:41): [True: 2.46M, False: 97.2k]
  ------------------
  736|  2.46M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (736:24): [True: 1.71M, False: 741k]
  ------------------
  737|  1.71M|                (2 * DC07 - 5 * DC08 + 2 * DC09 + DC11 + 7 * DC12 - 14 * DC13 +
  738|  1.71M|                 7 * DC14 + DC15 + 2 * DC17 - 5 * DC18 + 2 * DC19) :
  739|  2.46M|                (-DC11 + 13 * DC12 - 24 * DC13 + 13 * DC14 - DC15));
  740|  2.46M|          if (num >= 0) {
  ------------------
  |  Branch (740:15): [True: 1.27M, False: 1.18M]
  ------------------
  741|  1.27M|            pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
  742|  1.27M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (742:17): [True: 356k, False: 919k]
  |  Branch (742:27): [True: 2.75k, False: 353k]
  ------------------
  743|  2.75k|              pred = (1 << Al) - 1;
  744|  1.27M|          } else {
  745|  1.18M|            pred = (int)(((Q02 << 7) - num) / (Q02 << 8));
  746|  1.18M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (746:17): [True: 338k, False: 845k]
  |  Branch (746:27): [True: 2.70k, False: 335k]
  ------------------
  747|  2.70k|              pred = (1 << Al) - 1;
  748|  1.18M|            pred = -pred;
  749|  1.18M|          }
  750|  2.46M|          workspace[2] = (JCOEF)pred;
  751|  2.46M|        }
  752|  2.69M|        if (change_dc) {
  ------------------
  |  Branch (752:13): [True: 1.71M, False: 977k]
  ------------------
  753|       |          /* AC03 */
  754|  1.71M|          if ((Al = coef_bits[6]) != 0 && workspace[3] == 0) {
  ------------------
  |  Branch (754:15): [True: 1.71M, False: 0]
  |  Branch (754:43): [True: 1.71M, False: 0]
  ------------------
  755|  1.71M|            num = Q00 * (DC07 - DC09 + 2 * DC12 - 2 * DC14 + DC17 - DC19);
  756|  1.71M|            if (num >= 0) {
  ------------------
  |  Branch (756:17): [True: 1.41M, False: 303k]
  ------------------
  757|  1.41M|              pred = (int)(((Q03 << 7) + num) / (Q03 << 8));
  758|  1.41M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (758:19): [True: 0, False: 1.41M]
  |  Branch (758:29): [True: 0, False: 0]
  ------------------
  759|      0|                pred = (1 << Al) - 1;
  760|  1.41M|            } else {
  761|   303k|              pred = (int)(((Q03 << 7) - num) / (Q03 << 8));
  762|   303k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (762:19): [True: 0, False: 303k]
  |  Branch (762:29): [True: 0, False: 0]
  ------------------
  763|      0|                pred = (1 << Al) - 1;
  764|   303k|              pred = -pred;
  765|   303k|            }
  766|  1.71M|            workspace[3] = (JCOEF)pred;
  767|  1.71M|          }
  768|       |          /* AC12 */
  769|  1.71M|          if ((Al = coef_bits[7]) != 0 && workspace[10] == 0) {
  ------------------
  |  Branch (769:15): [True: 1.71M, False: 0]
  |  Branch (769:43): [True: 1.71M, False: 0]
  ------------------
  770|  1.71M|            num = Q00 * (DC07 - 3 * DC08 + DC09 - DC17 + 3 * DC18 - DC19);
  771|  1.71M|            if (num >= 0) {
  ------------------
  |  Branch (771:17): [True: 370k, False: 1.34M]
  ------------------
  772|   370k|              pred = (int)(((Q12 << 7) + num) / (Q12 << 8));
  773|   370k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (773:19): [True: 0, False: 370k]
  |  Branch (773:29): [True: 0, False: 0]
  ------------------
  774|      0|                pred = (1 << Al) - 1;
  775|  1.34M|            } else {
  776|  1.34M|              pred = (int)(((Q12 << 7) - num) / (Q12 << 8));
  777|  1.34M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (777:19): [True: 0, False: 1.34M]
  |  Branch (777:29): [True: 0, False: 0]
  ------------------
  778|      0|                pred = (1 << Al) - 1;
  779|  1.34M|              pred = -pred;
  780|  1.34M|            }
  781|  1.71M|            workspace[10] = (JCOEF)pred;
  782|  1.71M|          }
  783|       |          /* AC21 */
  784|  1.71M|          if ((Al = coef_bits[8]) != 0 && workspace[17] == 0) {
  ------------------
  |  Branch (784:15): [True: 1.71M, False: 0]
  |  Branch (784:43): [True: 1.71M, False: 0]
  ------------------
  785|  1.71M|            num = Q00 * (DC07 - DC09 - 3 * DC12 + 3 * DC14 + DC17 - DC19);
  786|  1.71M|            if (num >= 0) {
  ------------------
  |  Branch (786:17): [True: 706k, False: 1.01M]
  ------------------
  787|   706k|              pred = (int)(((Q21 << 7) + num) / (Q21 << 8));
  788|   706k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (788:19): [True: 0, False: 706k]
  |  Branch (788:29): [True: 0, False: 0]
  ------------------
  789|      0|                pred = (1 << Al) - 1;
  790|  1.01M|            } else {
  791|  1.01M|              pred = (int)(((Q21 << 7) - num) / (Q21 << 8));
  792|  1.01M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (792:19): [True: 0, False: 1.01M]
  |  Branch (792:29): [True: 0, False: 0]
  ------------------
  793|      0|                pred = (1 << Al) - 1;
  794|  1.01M|              pred = -pred;
  795|  1.01M|            }
  796|  1.71M|            workspace[17] = (JCOEF)pred;
  797|  1.71M|          }
  798|       |          /* AC30 */
  799|  1.71M|          if ((Al = coef_bits[9]) != 0 && workspace[24] == 0) {
  ------------------
  |  Branch (799:15): [True: 1.71M, False: 0]
  |  Branch (799:43): [True: 1.71M, False: 0]
  ------------------
  800|  1.71M|            num = Q00 * (DC07 + 2 * DC08 + DC09 - DC17 - 2 * DC18 - DC19);
  801|  1.71M|            if (num >= 0) {
  ------------------
  |  Branch (801:17): [True: 1.41M, False: 308k]
  ------------------
  802|  1.41M|              pred = (int)(((Q30 << 7) + num) / (Q30 << 8));
  803|  1.41M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (803:19): [True: 0, False: 1.41M]
  |  Branch (803:29): [True: 0, False: 0]
  ------------------
  804|      0|                pred = (1 << Al) - 1;
  805|  1.41M|            } else {
  806|   308k|              pred = (int)(((Q30 << 7) - num) / (Q30 << 8));
  807|   308k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (807:19): [True: 0, False: 308k]
  |  Branch (807:29): [True: 0, False: 0]
  ------------------
  808|      0|                pred = (1 << Al) - 1;
  809|   308k|              pred = -pred;
  810|   308k|            }
  811|  1.71M|            workspace[24] = (JCOEF)pred;
  812|  1.71M|          }
  813|       |          /* coef_bits[0] is non-negative.  Otherwise this function would not
  814|       |           * be called.
  815|       |           */
  816|  1.71M|          num = Q00 *
  817|  1.71M|                (-2 * DC01 - 6 * DC02 - 8 * DC03 - 6 * DC04 - 2 * DC05 -
  818|  1.71M|                 6 * DC06 + 6 * DC07 + 42 * DC08 + 6 * DC09 - 6 * DC10 -
  819|  1.71M|                 8 * DC11 + 42 * DC12 + 152 * DC13 + 42 * DC14 - 8 * DC15 -
  820|  1.71M|                 6 * DC16 + 6 * DC17 + 42 * DC18 + 6 * DC19 - 6 * DC20 -
  821|  1.71M|                 2 * DC21 - 6 * DC22 - 8 * DC23 - 6 * DC24 - 2 * DC25);
  822|  1.71M|          if (num >= 0) {
  ------------------
  |  Branch (822:15): [True: 368k, False: 1.35M]
  ------------------
  823|   368k|            pred = (int)(((Q00 << 7) + num) / (Q00 << 8));
  824|  1.35M|          } else {
  825|  1.35M|            pred = (int)(((Q00 << 7) - num) / (Q00 << 8));
  826|  1.35M|            pred = -pred;
  827|  1.35M|          }
  828|  1.71M|          workspace[0] = (JCOEF)pred;
  829|  1.71M|        }  /* change_dc */
  830|       |
  831|       |        /* OK, do the IDCT */
  832|       |#ifdef WITH_PROFILE
  833|       |        cinfo->master->start = getTime();
  834|       |#endif
  835|  2.69M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
  836|  2.69M|                        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|  2.69M|        DC01 = DC02;  DC02 = DC03;  DC03 = DC04;  DC04 = DC05;
  843|  2.69M|        DC06 = DC07;  DC07 = DC08;  DC08 = DC09;  DC09 = DC10;
  844|  2.69M|        DC11 = DC12;  DC12 = DC13;  DC13 = DC14;  DC14 = DC15;
  845|  2.69M|        DC16 = DC17;  DC17 = DC18;  DC18 = DC19;  DC19 = DC20;
  846|  2.69M|        DC21 = DC22;  DC22 = DC23;  DC23 = DC24;  DC24 = DC25;
  847|  2.69M|        buffer_ptr++, prev_block_row++, next_block_row++,
  848|  2.69M|          prev_prev_block_row++, next_next_block_row++;
  849|  2.69M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  2.69M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  850|  2.69M|      }
  851|  89.3k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  89.3k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  852|  89.3k|    }
  853|  38.9k|  }
  854|       |
  855|  38.9k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (855:7): [True: 38.4k, False: 501]
  ------------------
  856|  38.4k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  38.4k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  857|    501|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    501|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  858|  38.9k|}
jdcoefct-8.c:consume_data:
  218|  99.0k|{
  219|  99.0k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|  99.0k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|  99.0k|  int blkn, ci, xindex, yindex, yoffset;
  222|  99.0k|  JDIMENSION start_col;
  223|  99.0k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|  99.0k|  JBLOCKROW buffer_ptr;
  225|  99.0k|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|   198k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 99.0k, False: 99.0k]
  ------------------
  229|  99.0k|    compptr = cinfo->cur_comp_info[ci];
  230|  99.0k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|  99.0k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|  99.0k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|  99.0k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  99.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|  99.0k|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|   313k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 214k, False: 99.0k]
  ------------------
  242|   214k|       yoffset++) {
  243|  7.80M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 7.58M, False: 214k]
  ------------------
  244|  7.58M|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|  7.58M|      blkn = 0;                 /* index of current DCT block within MCU */
  247|  15.1M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 7.58M, False: 7.58M]
  ------------------
  248|  7.58M|        compptr = cinfo->cur_comp_info[ci];
  249|  7.58M|        start_col = MCU_col_num * compptr->MCU_width;
  250|  15.1M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 7.58M, False: 7.58M]
  ------------------
  251|  7.58M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|  15.1M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 7.58M, False: 7.58M]
  ------------------
  253|  7.58M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|  7.58M|          }
  255|  7.58M|        }
  256|  7.58M|      }
  257|  7.58M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 7.58M, False: 0]
  ------------------
  258|  7.58M|        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|  7.58M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 7.58M]
  ------------------
  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|  7.58M|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|   214k|    coef->MCU_ctr = 0;
  282|   214k|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|  99.0k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 97.5k, False: 1.56k]
  ------------------
  285|  97.5k|    start_iMCU_row(cinfo);
  286|  97.5k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  97.5k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|  97.5k|  }
  288|       |  /* Completed the scan */
  289|  1.56k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|  1.56k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  1.56k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|  99.0k|}
jdcoefct-8.c:decompress_data:
  304|  7.73k|{
  305|  7.73k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  306|  7.73k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  307|  7.73k|  JDIMENSION block_num;
  308|  7.73k|  int ci, block_row, block_rows;
  309|  7.73k|  JBLOCKARRAY buffer;
  310|  7.73k|  JBLOCKROW buffer_ptr;
  311|  7.73k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  7.73k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  312|  7.73k|  JDIMENSION output_col;
  313|  7.73k|  jpeg_component_info *compptr;
  314|  7.73k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  7.73k|#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|  7.73k|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (317:10): [True: 0, False: 7.73k]
  ------------------
  318|  7.73k|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (318:11): [True: 7.73k, False: 0]
  ------------------
  319|  7.73k|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (319:11): [True: 0, False: 7.73k]
  ------------------
  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|  15.4k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (325:44): [True: 7.73k, False: 7.73k]
  ------------------
  326|  7.73k|       ci++, compptr++) {
  327|       |    /* Don't bother to IDCT an uninteresting component. */
  328|  7.73k|    if (!compptr->component_needed)
  ------------------
  |  Branch (328:9): [True: 0, False: 7.73k]
  ------------------
  329|      0|      continue;
  330|       |    /* Align the virtual buffer for this component. */
  331|  7.73k|    buffer = (*cinfo->mem->access_virt_barray)
  332|  7.73k|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  333|  7.73k|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  334|  7.73k|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|  7.73k|#define FALSE   0               /* values of boolean */
  ------------------
  335|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  336|  7.73k|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (336:9): [True: 7.54k, False: 193]
  ------------------
  337|  7.54k|      block_rows = compptr->v_samp_factor;
  338|    193|    else {
  339|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  340|    193|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  341|    193|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (341:11): [True: 115, False: 78]
  ------------------
  342|    193|    }
  343|  7.73k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|  7.73k|#define _inverse_DCT  inverse_DCT
  ------------------
  344|  7.73k|    output_ptr = output_buf[ci];
  345|       |    /* Loop over all DCT blocks to be processed. */
  346|  28.0k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (346:25): [True: 20.3k, False: 7.73k]
  ------------------
  347|  20.3k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  348|  20.3k|      output_col = 0;
  349|  20.3k|      for (block_num = cinfo->master->first_MCU_col[ci];
  350|   543k|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (350:12): [True: 522k, False: 20.3k]
  ------------------
  351|       |#ifdef WITH_PROFILE
  352|       |        cinfo->master->start = getTime();
  353|       |#endif
  354|   522k|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
  355|   522k|                        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|   522k|        buffer_ptr++;
  361|   522k|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   522k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  362|   522k|      }
  363|  20.3k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  20.3k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  364|  20.3k|    }
  365|  7.73k|  }
  366|       |
  367|  7.73k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (367:7): [True: 7.54k, False: 193]
  ------------------
  368|  7.54k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  7.54k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  369|    193|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    193|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  370|  7.73k|}
jdcoefct-8.c:decompress_onepass:
   90|  7.17k|{
   91|  7.17k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   92|  7.17k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   93|  7.17k|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   94|  7.17k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   95|  7.17k|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   96|  7.17k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  7.17k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
   97|  7.17k|  JDIMENSION start_col, output_col;
   98|  7.17k|  jpeg_component_info *compptr;
   99|  7.17k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  7.17k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  100|       |
  101|       |  /* Loop to process as much as one whole iMCU row */
  102|  20.7k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (102:41): [True: 13.5k, False: 7.17k]
  ------------------
  103|  13.5k|       yoffset++) {
  104|   600k|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (104:39): [True: 586k, False: 13.5k]
  ------------------
  105|   586k|         MCU_col_num++) {
  106|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  107|   586k|      jzero_far((void *)coef->MCU_buffer[0],
  108|   586k|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  109|   586k|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (109:11): [True: 586k, False: 0]
  ------------------
  110|   586k|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  111|       |#ifdef WITH_PROFILE
  112|       |      cinfo->master->start = getTime();
  113|       |#endif
  114|   586k|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (114:11): [True: 0, False: 586k]
  ------------------
  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|   586k|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (134:11): [True: 586k, False: 531]
  ------------------
  135|   586k|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (135:11): [True: 586k, 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|   586k|        blkn = 0;               /* index of current DCT block within MCU */
  142|  1.17M|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (142:22): [True: 590k, False: 586k]
  ------------------
  143|   590k|          compptr = cinfo->cur_comp_info[ci];
  144|       |          /* Don't bother to IDCT an uninteresting component. */
  145|   590k|          if (!compptr->component_needed) {
  ------------------
  |  Branch (145:15): [True: 0, False: 590k]
  ------------------
  146|      0|            blkn += compptr->MCU_blocks;
  147|      0|            continue;
  148|      0|          }
  149|   590k|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  263|   590k|#define _inverse_DCT  inverse_DCT
  ------------------
  150|   590k|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (150:26): [True: 576k, False: 13.8k]
  ------------------
  151|   576k|                         compptr->MCU_width : compptr->last_col_width;
  152|   590k|          output_ptr = output_buf[compptr->component_index] +
  153|   590k|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   590k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  154|   590k|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  155|   590k|                      compptr->MCU_sample_width;
  156|  1.18M|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (156:28): [True: 591k, False: 590k]
  ------------------
  157|   591k|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (157:17): [True: 571k, False: 20.1k]
  ------------------
  158|   591k|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (158:17): [True: 20.0k, False: 69]
  ------------------
  159|   591k|              output_col = start_col;
  160|  1.18M|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (160:32): [True: 593k, False: 591k]
  ------------------
  161|       |#ifdef WITH_PROFILE
  162|       |                cinfo->master->start = getTime();
  163|       |#endif
  164|   593k|                (*inverse_DCT) (cinfo, compptr,
  165|   593k|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  166|   593k|                                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|   593k|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   593k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  173|   593k|              }
  174|   591k|            }
  175|   591k|            blkn += compptr->MCU_width;
  176|   591k|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   591k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  177|   591k|          }
  178|   590k|        }
  179|   586k|      }
  180|   586k|    }
  181|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  182|  13.5k|    coef->MCU_ctr = 0;
  183|  13.5k|  }
  184|       |  /* Completed the iMCU row, advance counters for next one */
  185|  7.17k|  cinfo->output_iMCU_row++;
  186|  7.17k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (186:7): [True: 6.41k, False: 760]
  ------------------
  187|  6.41k|    start_iMCU_row(cinfo);
  188|  6.41k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  6.41k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  189|  6.41k|  }
  190|       |  /* Completed the scan */
  191|    760|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  192|    760|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    760|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  193|  7.17k|}
j12init_d_coef_controller:
  869|     98|{
  870|     98|  my_coef_ptr coef;
  871|       |
  872|     98|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|     98|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (872:7): [True: 0, False: 98]
  ------------------
  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|     98|  coef = (my_coef_ptr)
  876|     98|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     98|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|     98|                                sizeof(my_coef_controller));
  878|     98|  memset(coef, 0, sizeof(my_coef_controller));
  879|     98|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|     98|  coef->pub.start_input_pass = start_input_pass;
  881|     98|  coef->pub.start_output_pass = start_output_pass;
  882|     98|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|     98|  coef->coef_bits_latch = NULL;
  884|     98|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|     98|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 91, False: 7]
  ------------------
  888|     91|#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|     91|    int ci, access_rows;
  893|     91|    jpeg_component_info *compptr;
  894|       |
  895|    182|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 91, False: 91]
  ------------------
  896|     91|         ci++, compptr++) {
  897|     91|      access_rows = compptr->v_samp_factor;
  898|     91|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|     91|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 91, False: 0]
  ------------------
  901|     91|        access_rows *= 5;
  902|     91|#endif
  903|     91|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|     91|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|     91|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|     91|#define TRUE    1
  ------------------
  905|     91|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|     91|                               (long)compptr->h_samp_factor),
  907|     91|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|     91|                               (long)compptr->v_samp_factor),
  909|     91|         (JDIMENSION)access_rows);
  910|     91|    }
  911|     91|    coef->pub.consume_data = consume_data;
  912|     91|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|     91|#define _decompress_data  decompress_data_12
  ------------------
  913|     91|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|     91|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|      7|    JBLOCKROW buffer;
  920|      7|    int i;
  921|       |
  922|      7|    buffer = (JBLOCKROW)
  923|      7|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      7|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|      7|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|      7|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|     77|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|     77|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 70, False: 7]
  ------------------
  926|     70|      coef->MCU_buffer[i] = buffer + i;
  927|     70|    }
  928|      7|    coef->pub.consume_data = dummy_consume_data;
  929|      7|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  142|      7|#define _decompress_data  decompress_data_12
  ------------------
  930|      7|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|      7|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|     98|  coef->workspace = (JCOEF *)
  935|     98|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     98|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|     98|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|     98|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|     98|}
jdcoefct-12.c:start_input_pass:
   50|    335|{
   51|    335|  cinfo->input_iMCU_row = 0;
   52|    335|  start_iMCU_row(cinfo);
   53|    335|}
jdcoefct-12.c:start_output_pass:
   62|     27|{
   63|     27|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|     27|  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|     27|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 23, False: 4]
  ------------------
   68|     23|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 23, False: 0]
  |  Branch (68:38): [True: 10, False: 13]
  ------------------
   69|     10|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  142|     10|#define _decompress_data  decompress_data_12
  ------------------
   70|     13|    else
   71|     13|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|     13|#define _decompress_data  decompress_data_12
  ------------------
   72|     23|  }
   73|     27|#endif
   74|     27|  cinfo->output_iMCU_row = 0;
   75|     27|}
jdcoefct-12.c:smoothing_ok:
  405|     23|{
  406|     23|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|     23|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|     23|#define FALSE   0               /* values of boolean */
  ------------------
  408|     23|  int ci, coefi;
  409|     23|  jpeg_component_info *compptr;
  410|     23|  JQUANT_TBL *qtable;
  411|     23|  int *coef_bits, *prev_coef_bits;
  412|     23|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|     23|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 0, False: 23]
  |  Branch (414:35): [True: 0, False: 23]
  ------------------
  415|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|     23|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 23, False: 0]
  ------------------
  419|     23|    coef->coef_bits_latch = (int *)
  420|     23|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     23|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|     23|                                  cinfo->num_components * 2 *
  422|     23|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|     23|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|     23|  coef_bits_latch = coef->coef_bits_latch;
  424|     23|  prev_coef_bits_latch =
  425|     23|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|     23|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|     35|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 23, False: 12]
  ------------------
  428|     23|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|     23|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 0, False: 23]
  ------------------
  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|     23|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 1, False: 22]
  ------------------
  434|     22|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|     22|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 1, False: 21]
  ------------------
  435|     21|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|     21|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 1, False: 20]
  ------------------
  436|     20|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|     20|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 2, False: 18]
  ------------------
  437|     18|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|     18|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 1, False: 17]
  ------------------
  438|     17|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|     17|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 1, False: 16]
  ------------------
  439|     16|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|     16|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 1, False: 15]
  ------------------
  440|     15|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|     15|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 1, False: 14]
  ------------------
  441|     14|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|     14|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 1, False: 13]
  ------------------
  442|     13|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|     13|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 1, False: 12]
  ------------------
  443|     11|      return FALSE;
  ------------------
  |  |  207|     11|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|     12|    coef_bits = cinfo->coef_bits[ci];
  446|     12|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|     12|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 0, False: 12]
  ------------------
  448|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  449|     12|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|    120|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|    120|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 108, False: 12]
  ------------------
  452|    108|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 90, False: 18]
  ------------------
  453|     90|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|     18|      else
  455|     18|        prev_coef_bits_latch[coefi] = -1;
  456|    108|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|    108|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 55, False: 53]
  ------------------
  458|     55|        smoothing_useful = TRUE;
  ------------------
  |  |  210|     55|#define TRUE    1
  ------------------
  459|    108|    }
  460|     12|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|     12|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|     12|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|     12|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|     12|  }
  463|       |
  464|     12|  return smoothing_useful;
  465|     23|}
jdcoefct-12.c:consume_data:
  218|  22.1k|{
  219|  22.1k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|  22.1k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|  22.1k|  int blkn, ci, xindex, yindex, yoffset;
  222|  22.1k|  JDIMENSION start_col;
  223|  22.1k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|  22.1k|  JBLOCKROW buffer_ptr;
  225|  22.1k|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|  44.2k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 22.1k, False: 22.1k]
  ------------------
  229|  22.1k|    compptr = cinfo->cur_comp_info[ci];
  230|  22.1k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|  22.1k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|  22.1k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|  22.1k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  22.1k|#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|  22.1k|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|  66.2k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 44.0k, False: 22.1k]
  ------------------
  242|  44.0k|       yoffset++) {
  243|  2.07M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 2.02M, False: 44.0k]
  ------------------
  244|  2.02M|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|  2.02M|      blkn = 0;                 /* index of current DCT block within MCU */
  247|  4.05M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 2.02M, False: 2.02M]
  ------------------
  248|  2.02M|        compptr = cinfo->cur_comp_info[ci];
  249|  2.02M|        start_col = MCU_col_num * compptr->MCU_width;
  250|  4.05M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 2.02M, False: 2.02M]
  ------------------
  251|  2.02M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|  4.05M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 2.02M, False: 2.02M]
  ------------------
  253|  2.02M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|  2.02M|          }
  255|  2.02M|        }
  256|  2.02M|      }
  257|  2.02M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 2.02M, False: 0]
  ------------------
  258|  2.02M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  259|       |      /* Try to fetch the MCU. */
  260|       |#ifdef WITH_PROFILE
  261|       |      cinfo->master->start = getTime();
  262|       |#endif
  263|  2.02M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 2.02M]
  ------------------
  264|       |        /* Suspension forced; update state counters and exit */
  265|      0|        coef->MCU_vert_offset = yoffset;
  266|      0|        coef->MCU_ctr = MCU_col_num;
  267|       |#ifdef WITH_PROFILE
  268|       |        cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  269|       |        cinfo->master->entropy_mcoeffs +=
  270|       |          (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  271|       |#endif
  272|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  273|      0|      }
  274|       |#ifdef WITH_PROFILE
  275|       |      cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  276|       |      cinfo->master->entropy_mcoeffs +=
  277|       |        (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  278|       |#endif
  279|  2.02M|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|  44.0k|    coef->MCU_ctr = 0;
  282|  44.0k|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|  22.1k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 21.8k, False: 331]
  ------------------
  285|  21.8k|    start_iMCU_row(cinfo);
  286|  21.8k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  21.8k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|  21.8k|  }
  288|       |  /* Completed the scan */
  289|    331|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|    331|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    331|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|  22.1k|}

jdcoefct-8.c:start_iMCU_row:
   68|   106k|{
   69|   106k|  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|   106k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 460, False: 105k]
  ------------------
   76|    460|    coef->MCU_rows_per_iMCU_row = 1;
   77|   105k|  } else {
   78|   105k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 104k, False: 1.72k]
  ------------------
   79|   104k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|  1.72k|    else
   81|  1.72k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|   105k|  }
   83|       |
   84|   106k|  coef->MCU_ctr = 0;
   85|   106k|  coef->MCU_vert_offset = 0;
   86|   106k|}
jdcoefct-12.c:start_iMCU_row:
   68|  22.1k|{
   69|  22.1k|  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|  22.1k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 3, False: 22.1k]
  ------------------
   76|      3|    coef->MCU_rows_per_iMCU_row = 1;
   77|  22.1k|  } else {
   78|  22.1k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 21.8k, False: 280]
  ------------------
   79|  21.8k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|    280|    else
   81|    280|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|  22.1k|  }
   83|       |
   84|  22.1k|  coef->MCU_ctr = 0;
   85|  22.1k|  coef->MCU_vert_offset = 0;
   86|  22.1k|}

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

jinit_color_deconverter:
  625|  1.90k|{
  626|  1.90k|  my_cconvert_ptr cconvert;
  627|  1.90k|  int ci;
  628|       |
  629|  1.90k|#ifdef D_LOSSLESS_SUPPORTED
  630|  1.90k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 274, False: 1.63k]
  ------------------
  631|    274|#if BITS_IN_JSAMPLE == 8
  632|    274|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|    548|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (632:9): [True: 0, False: 274]
  |  Branch (632:52): [True: 0, False: 274]
  ------------------
  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|    274|  } else
  639|  1.63k|#endif
  640|  1.63k|  {
  641|  1.63k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.63k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (641:9): [True: 0, False: 1.63k]
  ------------------
  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.63k|  }
  644|       |
  645|  1.90k|  cconvert = (my_cconvert_ptr)
  646|  1.90k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.90k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|  1.90k|                                sizeof(my_color_deconverter));
  648|  1.90k|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|  1.90k|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|  1.90k|  switch (cinfo->jpeg_color_space) {
  653|  1.80k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 1.80k, False: 98]
  ------------------
  654|  1.80k|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 1.80k]
  ------------------
  655|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  656|  1.80k|    break;
  657|       |
  658|     49|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 49, False: 1.85k]
  ------------------
  659|     98|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 49, False: 1.85k]
  ------------------
  660|     98|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 98]
  ------------------
  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|     98|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 1.90k]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 1.90k]
  ------------------
  666|      0|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (666:9): [True: 0, False: 0]
  ------------------
  667|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  668|      0|    break;
  669|       |
  670|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 0, False: 1.90k]
  ------------------
  671|      0|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (671:9): [True: 0, False: 0]
  ------------------
  672|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  673|      0|    break;
  674|  1.90k|  }
  675|       |
  676|       |  /* Set out_color_components and conversion method based on requested space.
  677|       |   * Also clear the component_needed flags for any unused components,
  678|       |   * so that earlier pipeline stages can avoid useless computation.
  679|       |   * NOTE: We do not allow any lossy color conversion algorithms in lossless
  680|       |   * mode.
  681|       |   */
  682|       |
  683|  1.90k|  switch (cinfo->out_color_space) {
  684|  1.80k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 1.80k, False: 98]
  ------------------
  685|  1.80k|#ifdef D_LOSSLESS_SUPPORTED
  686|  1.80k|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 267, False: 1.54k]
  ------------------
  687|    267|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 267]
  ------------------
  688|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  689|  1.80k|#endif
  690|  1.80k|    cinfo->out_color_components = 1;
  691|  1.80k|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 1.80k, False: 0]
  ------------------
  692|  1.80k|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|  1.80k|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  267|  1.80k|#define _color_convert  color_convert
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|  1.80k|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 1.80k]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|  1.80k|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (697:16): [True: 0, False: 0]
  ------------------
  698|      0|      cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  699|      0|      build_rgb_y_table(cinfo);
  700|      0|    } else
  701|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  702|  1.80k|    break;
  703|       |
  704|     98|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 98, False: 1.80k]
  ------------------
  705|     98|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 1.90k]
  ------------------
  706|     98|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 1.90k]
  ------------------
  707|     98|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 1.90k]
  ------------------
  708|     98|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 1.90k]
  ------------------
  709|     98|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 1.90k]
  ------------------
  710|     98|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 1.90k]
  ------------------
  711|     98|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 1.90k]
  ------------------
  712|     98|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 1.90k]
  ------------------
  713|     98|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 1.90k]
  ------------------
  714|     98|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 1.90k]
  ------------------
  715|     98|#ifdef D_LOSSLESS_SUPPORTED
  716|     98|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 7, False: 91]
  |  Branch (716:36): [True: 1, False: 6]
  ------------------
  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|     98|#endif
  719|     98|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|     98|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 48, False: 50]
  ------------------
  721|     48|#ifdef WITH_SIMD
  722|     48|      if (jsimd_set_ycc_rgb(cinfo))
  ------------------
  |  Branch (722:11): [True: 0, False: 48]
  ------------------
  723|      0|        cconvert->pub._color_convert = jsimd_color_deconvert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  724|     48|      else
  725|     48|#endif
  726|     48|      {
  727|     48|        switch (cinfo->out_color_space) {
  728|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (728:9): [True: 0, False: 48]
  ------------------
  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: 48]
  ------------------
  732|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (732:9): [True: 0, False: 48]
  ------------------
  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: 48]
  ------------------
  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: 48]
  ------------------
  739|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (739:9): [True: 0, False: 48]
  ------------------
  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: 48]
  ------------------
  743|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (743:9): [True: 0, False: 48]
  ------------------
  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: 48]
  ------------------
  747|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (747:9): [True: 0, False: 48]
  ------------------
  748|      0|          cconvert->pub._color_convert = ycc_extxrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  749|      0|          break;
  750|     48|        default:
  ------------------
  |  Branch (750:9): [True: 48, False: 0]
  ------------------
  751|     48|          cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  267|     48|#define _color_convert  color_convert
  ------------------
  752|     48|        }
  753|     48|        build_ycc_rgb_table(cinfo);
  754|     48|      }
  755|     50|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 50]
  ------------------
  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|     50|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 49, False: 1]
  ------------------
  783|     49|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 49, False: 0]
  ------------------
  784|     49|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 49, False: 0]
  ------------------
  785|     49|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 49, False: 0]
  ------------------
  786|     49|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 49, False: 0]
  ------------------
  787|     49|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|     49|#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|     49|    } 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|     98|    break;
  819|       |
  820|     98|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 1.90k]
  ------------------
  821|      0|#ifdef D_LOSSLESS_SUPPORTED
  822|      0|    if (cinfo->master->lossless)
  ------------------
  |  Branch (822:9): [True: 0, False: 0]
  ------------------
  823|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  824|      0|#endif
  825|      0|    cinfo->out_color_components = 3;
  826|      0|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (826:9): [True: 0, False: 0]
  ------------------
  827|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (827:11): [True: 0, False: 0]
  ------------------
  828|      0|#ifdef WITH_SIMD
  829|      0|        if (jsimd_set_ycc_rgb565(cinfo))
  ------------------
  |  Branch (829:13): [True: 0, False: 0]
  ------------------
  830|      0|          cconvert->pub._color_convert = jsimd_color_deconvert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  831|      0|        else
  832|      0|#endif
  833|      0|        {
  834|      0|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  835|      0|          build_ycc_rgb_table(cinfo);
  836|      0|        }
  837|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (837:18): [True: 0, False: 0]
  ------------------
  838|      0|        cconvert->pub._color_convert = gray_rgb565_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  839|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (839:18): [True: 0, False: 0]
  ------------------
  840|      0|        cconvert->pub._color_convert = rgb_rgb565_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  841|      0|      } else
  842|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  843|      0|    } else {
  844|       |      /* only ordered dithering is supported */
  845|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (845:11): [True: 0, False: 0]
  ------------------
  846|      0|        cconvert->pub._color_convert = ycc_rgb565D_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  847|      0|        build_ycc_rgb_table(cinfo);
  848|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (848:18): [True: 0, False: 0]
  ------------------
  849|      0|        cconvert->pub._color_convert = gray_rgb565D_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  850|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (850:18): [True: 0, False: 0]
  ------------------
  851|      0|        cconvert->pub._color_convert = rgb_rgb565D_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  852|      0|      } else
  853|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  854|      0|    }
  855|      0|    break;
  856|       |
  857|      0|  case JCS_CMYK:
  ------------------
  |  Branch (857:3): [True: 0, False: 1.90k]
  ------------------
  858|      0|#ifdef D_LOSSLESS_SUPPORTED
  859|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (859:9): [True: 0, False: 0]
  ------------------
  860|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (860:9): [True: 0, False: 0]
  ------------------
  861|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  862|      0|#endif
  863|      0|    cinfo->out_color_components = 4;
  864|      0|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (864:9): [True: 0, False: 0]
  ------------------
  865|      0|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  866|      0|      build_ycc_rgb_table(cinfo);
  867|      0|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (867:16): [True: 0, False: 0]
  ------------------
  868|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  869|      0|    } else
  870|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  871|      0|    break;
  872|       |
  873|      0|  default:
  ------------------
  |  Branch (873:3): [True: 0, False: 1.90k]
  ------------------
  874|       |    /* Permit null conversion to same output space */
  875|      0|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (875:9): [True: 0, False: 0]
  ------------------
  876|      0|      cinfo->out_color_components = cinfo->num_components;
  877|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  878|      0|    } else                      /* unsupported non-null conversion */
  879|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  880|      0|    break;
  881|  1.90k|  }
  882|       |
  883|  1.90k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 1.90k]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|  1.90k|  else
  886|  1.90k|    cinfo->output_components = cinfo->out_color_components;
  887|  1.90k|}
jdcolor-8.c:start_pass_dcolor:
  614|  1.71k|{
  615|       |  /* no work needed */
  616|  1.71k|}
jdcolor-8.c:grayscale_convert:
  397|   989k|{
  398|   989k|  _jcopy_sample_rows(input_buf[0], (int)input_row, output_buf, 0, num_rows,
  ------------------
  |  |  297|   989k|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  399|   989k|                     cinfo->output_width);
  400|   989k|}
jdcolor-8.c:build_ycc_rgb_table:
  218|     48|{
  219|     48|#if BITS_IN_JSAMPLE != 16
  220|     48|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  221|     48|  int i;
  222|     48|  JLONG x;
  223|     48|  SHIFT_TEMPS
  224|       |
  225|     48|  cconvert->Cr_r_tab = (int *)
  226|     48|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     48|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  227|     48|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  226|     48|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|     48|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  228|     48|  cconvert->Cb_b_tab = (int *)
  229|     48|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     48|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  230|     48|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  226|     48|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|     48|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  231|     48|  cconvert->Cr_g_tab = (JLONG *)
  232|     48|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     48|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  233|     48|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  226|     48|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|     48|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  234|     48|  cconvert->Cb_g_tab = (JLONG *)
  235|     48|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     48|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  236|     48|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  226|     48|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|     48|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  237|       |
  238|  12.3k|  for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  227|     48|#define _CENTERJSAMPLE   CENTERJSAMPLE
  |  |  ------------------
  |  |  |  |   53|     48|#define CENTERJSAMPLE    128
  |  |  ------------------
  ------------------
                for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  226|  12.3k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  12.3k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  |  Branch (238:36): [True: 12.2k, False: 48]
  ------------------
  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|  12.2k|    cconvert->Cr_r_tab[i] = (int)
  243|  12.2k|                    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|  12.2k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  244|       |    /* Cb=>B value is nearest int to 1.77200 * x */
  245|  12.2k|    cconvert->Cb_b_tab[i] = (int)
  246|  12.2k|                    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|  12.2k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  247|       |    /* Cr=>G value is scaled-up -0.71414 * x */
  248|  12.2k|    cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
  ------------------
  |  |   84|  12.2k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|  12.2k|#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|  12.2k|    cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   84|  12.2k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|  12.2k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   83|  12.2k|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   82|  12.2k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  252|  12.2k|  }
  253|       |#else
  254|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  255|       |#endif
  256|     48|}
jdcolor-8.c:null_convert:
  336|  3.56k|{
  337|  3.56k|  register _JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
  338|  3.56k|  register JDIMENSION col;
  339|  3.56k|  register int num_components = cinfo->num_components;
  340|  3.56k|  JDIMENSION num_cols = cinfo->output_width;
  341|  3.56k|  int ci;
  342|       |
  343|  3.56k|  if (num_components == 3) {
  ------------------
  |  Branch (343:7): [True: 3.56k, False: 0]
  ------------------
  344|  7.12k|    while (--num_rows >= 0) {
  ------------------
  |  Branch (344:12): [True: 3.56k, False: 3.56k]
  ------------------
  345|  3.56k|      inptr0 = input_buf[0][input_row];
  346|  3.56k|      inptr1 = input_buf[1][input_row];
  347|  3.56k|      inptr2 = input_buf[2][input_row];
  348|  3.56k|      input_row++;
  349|  3.56k|      outptr = *output_buf++;
  350|   288k|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (350:21): [True: 284k, False: 3.56k]
  ------------------
  351|   284k|        *outptr++ = inptr0[col];
  352|   284k|        *outptr++ = inptr1[col];
  353|   284k|        *outptr++ = inptr2[col];
  354|   284k|      }
  355|  3.56k|    }
  356|  3.56k|  } else if (num_components == 4) {
  ------------------
  |  Branch (356:14): [True: 0, False: 0]
  ------------------
  357|      0|    while (--num_rows >= 0) {
  ------------------
  |  Branch (357:12): [True: 0, False: 0]
  ------------------
  358|      0|      inptr0 = input_buf[0][input_row];
  359|      0|      inptr1 = input_buf[1][input_row];
  360|      0|      inptr2 = input_buf[2][input_row];
  361|      0|      inptr3 = input_buf[3][input_row];
  362|      0|      input_row++;
  363|      0|      outptr = *output_buf++;
  364|      0|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (364:21): [True: 0, False: 0]
  ------------------
  365|      0|        *outptr++ = inptr0[col];
  366|      0|        *outptr++ = inptr1[col];
  367|      0|        *outptr++ = inptr2[col];
  368|      0|        *outptr++ = inptr3[col];
  369|      0|      }
  370|      0|    }
  371|      0|  } else {
  372|      0|    while (--num_rows >= 0) {
  ------------------
  |  Branch (372:12): [True: 0, False: 0]
  ------------------
  373|      0|      for (ci = 0; ci < num_components; ci++) {
  ------------------
  |  Branch (373:20): [True: 0, False: 0]
  ------------------
  374|      0|        inptr = input_buf[ci][input_row];
  375|      0|        outptr = *output_buf;
  376|      0|        for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (376:23): [True: 0, False: 0]
  ------------------
  377|      0|          outptr[ci] = inptr[col];
  378|      0|          outptr += num_components;
  379|      0|        }
  380|      0|      }
  381|      0|      output_buf++;
  382|      0|      input_row++;
  383|      0|    }
  384|      0|  }
  385|  3.56k|}
j12init_color_deconverter:
  625|    106|{
  626|    106|  my_cconvert_ptr cconvert;
  627|    106|  int ci;
  628|       |
  629|    106|#ifdef D_LOSSLESS_SUPPORTED
  630|    106|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 7, False: 99]
  ------------------
  631|       |#if BITS_IN_JSAMPLE == 8
  632|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  633|       |#else
  634|      7|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     14|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (634:9): [True: 0, False: 7]
  ------------------
  635|      7|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      7|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (635:9): [True: 0, False: 7]
  ------------------
  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|      7|  } else
  639|     99|#endif
  640|     99|  {
  641|     99|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|     99|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (641:9): [True: 0, False: 99]
  ------------------
  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|     99|  }
  644|       |
  645|    106|  cconvert = (my_cconvert_ptr)
  646|    106|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    106|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|    106|                                sizeof(my_color_deconverter));
  648|    106|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|    106|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|    106|  switch (cinfo->jpeg_color_space) {
  653|     99|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 99, False: 7]
  ------------------
  654|     99|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 99]
  ------------------
  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|     99|    break;
  657|       |
  658|      2|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 2, False: 104]
  ------------------
  659|      7|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 5, False: 101]
  ------------------
  660|      7|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 7]
  ------------------
  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|      7|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 106]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 106]
  ------------------
  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: 106]
  ------------------
  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|    106|  }
  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|    106|  switch (cinfo->out_color_space) {
  684|     99|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 99, False: 7]
  ------------------
  685|     99|#ifdef D_LOSSLESS_SUPPORTED
  686|     99|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 7, False: 92]
  ------------------
  687|      7|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 7]
  ------------------
  688|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  689|     99|#endif
  690|     99|    cinfo->out_color_components = 1;
  691|     99|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 99, False: 0]
  ------------------
  692|     99|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|     99|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  151|     99|#define _color_convert  color_convert_12
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|     99|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 99]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|     99|    } 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|     99|    break;
  703|       |
  704|      7|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 7, False: 99]
  ------------------
  705|      7|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 106]
  ------------------
  706|      7|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 106]
  ------------------
  707|      7|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 106]
  ------------------
  708|      7|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 106]
  ------------------
  709|      7|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 106]
  ------------------
  710|      7|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 106]
  ------------------
  711|      7|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 106]
  ------------------
  712|      7|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 106]
  ------------------
  713|      7|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 106]
  ------------------
  714|      7|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 106]
  ------------------
  715|      7|#ifdef D_LOSSLESS_SUPPORTED
  716|      7|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 0, False: 7]
  |  Branch (716:36): [True: 0, False: 0]
  ------------------
  717|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  718|      7|#endif
  719|      7|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|      7|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 5, False: 2]
  ------------------
  721|       |#ifdef WITH_SIMD
  722|       |      if (jsimd_set_ycc_rgb(cinfo))
  723|       |        cconvert->pub._color_convert = jsimd_color_deconvert;
  724|       |      else
  725|       |#endif
  726|      5|      {
  727|      5|        switch (cinfo->out_color_space) {
  728|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (728:9): [True: 0, False: 5]
  ------------------
  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: 5]
  ------------------
  732|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (732:9): [True: 0, False: 5]
  ------------------
  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: 5]
  ------------------
  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: 5]
  ------------------
  739|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (739:9): [True: 0, False: 5]
  ------------------
  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: 5]
  ------------------
  743|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (743:9): [True: 0, False: 5]
  ------------------
  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: 5]
  ------------------
  747|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (747:9): [True: 0, False: 5]
  ------------------
  748|      0|          cconvert->pub._color_convert = ycc_extxrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  749|      0|          break;
  750|      5|        default:
  ------------------
  |  Branch (750:9): [True: 5, False: 0]
  ------------------
  751|      5|          cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  151|      5|#define _color_convert  color_convert_12
  ------------------
  752|      5|        }
  753|      5|        build_ycc_rgb_table(cinfo);
  754|      5|      }
  755|      5|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 2]
  ------------------
  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|      2|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 2, False: 0]
  ------------------
  783|      2|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 2, False: 0]
  ------------------
  784|      2|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 2, False: 0]
  ------------------
  785|      2|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 2, False: 0]
  ------------------
  786|      2|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 2, False: 0]
  ------------------
  787|      2|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|      2|#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|      2|    } else
  817|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  818|      7|    break;
  819|       |
  820|      7|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 106]
  ------------------
  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: 106]
  ------------------
  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: 106]
  ------------------
  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|    106|  }
  882|       |
  883|    106|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 106]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|    106|  else
  886|    106|    cinfo->output_components = cinfo->out_color_components;
  887|    106|}
jdcolor-12.c:start_pass_dcolor:
  614|     29|{
  615|       |  /* no work needed */
  616|     29|}
jdcolor-12.c:build_ycc_rgb_table:
  218|      5|{
  219|      5|#if BITS_IN_JSAMPLE != 16
  220|      5|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  221|      5|  int i;
  222|      5|  JLONG x;
  223|      5|  SHIFT_TEMPS
  224|       |
  225|      5|  cconvert->Cr_r_tab = (int *)
  226|      5|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      5|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  227|      5|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  110|      5|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|      5|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  228|      5|  cconvert->Cb_b_tab = (int *)
  229|      5|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      5|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  230|      5|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  110|      5|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|      5|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  231|      5|  cconvert->Cr_g_tab = (JLONG *)
  232|      5|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      5|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  233|      5|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  110|      5|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|      5|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  234|      5|  cconvert->Cb_g_tab = (JLONG *)
  235|      5|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      5|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  236|      5|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  110|      5|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|      5|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  237|       |
  238|  20.4k|  for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  111|      5|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   61|      5|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
                for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  110|  20.4k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|  20.4k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  |  Branch (238:36): [True: 20.4k, False: 5]
  ------------------
  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|  20.4k|    cconvert->Cr_r_tab[i] = (int)
  243|  20.4k|                    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|  20.4k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  244|       |    /* Cb=>B value is nearest int to 1.77200 * x */
  245|  20.4k|    cconvert->Cb_b_tab[i] = (int)
  246|  20.4k|                    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|  20.4k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  247|       |    /* Cr=>G value is scaled-up -0.71414 * x */
  248|  20.4k|    cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
  ------------------
  |  |   84|  20.4k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|  20.4k|#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|  20.4k|    cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   84|  20.4k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|  20.4k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   83|  20.4k|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   82|  20.4k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  252|  20.4k|  }
  253|       |#else
  254|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  255|       |#endif
  256|      5|}
j16init_color_deconverter:
  625|      9|{
  626|      9|  my_cconvert_ptr cconvert;
  627|      9|  int ci;
  628|       |
  629|      9|#ifdef D_LOSSLESS_SUPPORTED
  630|      9|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 9, False: 0]
  ------------------
  631|       |#if BITS_IN_JSAMPLE == 8
  632|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  633|       |#else
  634|      9|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     18|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (634:9): [True: 0, False: 9]
  ------------------
  635|      9|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      9|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (635:9): [True: 0, False: 9]
  ------------------
  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|      9|  } 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|      9|  cconvert = (my_cconvert_ptr)
  646|      9|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      9|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|      9|                                sizeof(my_color_deconverter));
  648|      9|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|      9|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|      9|  switch (cinfo->jpeg_color_space) {
  653|      7|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 7, False: 2]
  ------------------
  654|      7|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 7]
  ------------------
  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|      7|    break;
  657|       |
  658|      1|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 1, False: 8]
  ------------------
  659|      2|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 1, False: 8]
  ------------------
  660|      2|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 2]
  ------------------
  661|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  662|      2|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 9]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 9]
  ------------------
  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: 9]
  ------------------
  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|      9|  }
  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|      9|  switch (cinfo->out_color_space) {
  684|      7|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 7, False: 2]
  ------------------
  685|      7|#ifdef D_LOSSLESS_SUPPORTED
  686|      7|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 7, False: 0]
  ------------------
  687|      7|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 7]
  ------------------
  688|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  689|      7|#endif
  690|      7|    cinfo->out_color_components = 1;
  691|      7|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 7, False: 0]
  ------------------
  692|      7|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|      7|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |   59|      7|#define _color_convert  color_convert_16
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|      7|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 7]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|      7|    } 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|      7|    break;
  703|       |
  704|      2|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 2, False: 7]
  ------------------
  705|      2|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 9]
  ------------------
  706|      2|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 9]
  ------------------
  707|      2|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 9]
  ------------------
  708|      2|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 9]
  ------------------
  709|      2|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 9]
  ------------------
  710|      2|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 9]
  ------------------
  711|      2|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 9]
  ------------------
  712|      2|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 9]
  ------------------
  713|      2|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 9]
  ------------------
  714|      2|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 9]
  ------------------
  715|      2|#ifdef D_LOSSLESS_SUPPORTED
  716|      2|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 2, False: 0]
  |  Branch (716:36): [True: 1, False: 1]
  ------------------
  717|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  718|      2|#endif
  719|      2|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|      2|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 0, False: 2]
  ------------------
  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|      2|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 2]
  ------------------
  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|      2|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 1, False: 1]
  ------------------
  783|      1|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 1, False: 0]
  ------------------
  784|      1|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 1, False: 0]
  ------------------
  785|      1|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 1, False: 0]
  ------------------
  786|      1|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 1, False: 0]
  ------------------
  787|      1|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |   59|      1|#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|      1|    } else
  817|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  818|      2|    break;
  819|       |
  820|      2|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 9]
  ------------------
  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: 9]
  ------------------
  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: 9]
  ------------------
  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|      9|  }
  882|       |
  883|      8|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 8]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|      8|  else
  886|      8|    cinfo->output_components = cinfo->out_color_components;
  887|      8|}
jdcolor-16.c:start_pass_dcolor:
  614|      3|{
  615|       |  /* no work needed */
  616|      3|}

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

jinit_d_diff_controller:
  348|    272|{
  349|    272|  my_diff_ptr diff;
  350|    272|  int ci;
  351|    272|  jpeg_component_info *compptr;
  352|       |
  353|    272|#if BITS_IN_JSAMPLE == 8
  354|    272|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|    544|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (354:7): [True: 0, False: 272]
  |  Branch (354:50): [True: 0, False: 272]
  ------------------
  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|    272|  diff = (my_diff_ptr)
  362|    272|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    272|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|    272|                                sizeof(my_diff_controller));
  364|    272|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|    272|  diff->pub.start_input_pass = start_input_pass;
  366|    272|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|    556|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 284, False: 272]
  ------------------
  370|    284|       ci++, compptr++) {
  371|    284|    diff->diff_buf[ci] =
  372|    284|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|    284|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|    284|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|    284|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|    284|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|    284|                                         (long)compptr->h_samp_factor),
  375|    284|                   (JDIMENSION)compptr->v_samp_factor);
  376|    284|    diff->undiff_buf[ci] =
  377|    284|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|    284|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|    284|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|    284|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|    284|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|    284|                                         (long)compptr->h_samp_factor),
  380|    284|                   (JDIMENSION)compptr->v_samp_factor);
  381|    284|  }
  382|       |
  383|    272|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 0, False: 272]
  ------------------
  384|      0|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|      0|    int access_rows;
  387|       |
  388|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 0, False: 0]
  ------------------
  389|      0|         ci++, compptr++) {
  390|      0|      access_rows = compptr->v_samp_factor;
  391|      0|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  393|      0|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|      0|                               (long)compptr->h_samp_factor),
  395|      0|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|      0|                               (long)compptr->v_samp_factor),
  397|      0|         (JDIMENSION)access_rows);
  398|      0|    }
  399|      0|    diff->pub.consume_data = consume_data;
  400|      0|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  258|      0|#define _decompress_data  decompress_data
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|    272|  } else {
  405|    272|    diff->pub.consume_data = dummy_consume_data;
  406|    272|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|    272|#define _decompress_data  decompress_data
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|    272|  }
  409|    272|}
jddiffct-8.c:start_input_pass:
   94|    265|{
   95|    265|  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|    265|  (*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|    265|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 0, False: 265]
  ------------------
  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|    265|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|    265|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|    265|  cinfo->input_iMCU_row = 0;
  115|    265|  start_iMCU_row(cinfo);
  116|    265|}
jddiffct-8.c:start_iMCU_row:
   67|  8.11k|{
   68|  8.11k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
   69|       |
   70|       |  /* In an interleaved scan, an MCU row is the same as an iMCU row.
   71|       |   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
   72|       |   * But at the bottom of the image, process only what's left.
   73|       |   */
   74|  8.11k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 0, False: 8.11k]
  ------------------
   75|      0|    diff->MCU_rows_per_iMCU_row = 1;
   76|  8.11k|  } else {
   77|  8.11k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 8.09k, False: 21]
  ------------------
   78|  8.09k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|     21|    else
   80|     21|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|  8.11k|  }
   82|       |
   83|  8.11k|  diff->MCU_ctr = 0;
   84|  8.11k|  diff->MCU_vert_offset = 0;
   85|  8.11k|}
jddiffct-8.c:start_output_pass:
  147|    257|{
  148|    257|  cinfo->output_iMCU_row = 0;
  149|    257|}
jddiffct-8.c:decompress_data:
  164|  8.11k|{
  165|  8.11k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  166|  8.11k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  167|  8.11k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  168|  8.11k|  JDIMENSION MCU_count;         /* number of MCUs decoded */
  169|  8.11k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  170|  8.11k|  int ci, compi, row, prev_row;
  171|  8.11k|  unsigned int yoffset;
  172|  8.11k|  jpeg_component_info *compptr;
  173|       |
  174|       |  /* Loop to process as much as one whole iMCU row */
  175|  24.0k|  for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (175:41): [True: 15.8k, False: 8.11k]
  ------------------
  176|  15.8k|       yoffset++) {
  177|       |
  178|       |    /* Process restart marker if needed; may have to suspend */
  179|  15.8k|    if (cinfo->restart_interval) {
  ------------------
  |  Branch (179:9): [True: 0, False: 15.8k]
  ------------------
  180|      0|      if (diff->restart_rows_to_go == 0)
  ------------------
  |  Branch (180:11): [True: 0, False: 0]
  ------------------
  181|      0|        if (!process_restart(cinfo))
  ------------------
  |  Branch (181:13): [True: 0, False: 0]
  ------------------
  182|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  183|      0|    }
  184|       |
  185|  15.8k|    MCU_col_num = diff->MCU_ctr;
  186|       |    /* Try to fetch an MCU row (or remaining portion of suspended MCU row). */
  187|  15.8k|    MCU_count =
  188|  15.8k|      (*cinfo->entropy->decode_mcus) (cinfo,
  189|  15.8k|                                      diff->diff_buf, yoffset, MCU_col_num,
  190|  15.8k|                                      cinfo->MCUs_per_row - MCU_col_num);
  191|  15.8k|    if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) {
  ------------------
  |  Branch (191:9): [True: 0, False: 15.8k]
  ------------------
  192|       |      /* Suspension forced; update state counters and exit */
  193|      0|      diff->MCU_vert_offset = yoffset;
  194|      0|      diff->MCU_ctr += MCU_count;
  195|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  196|      0|    }
  197|       |
  198|       |    /* Account for restart interval (no-op if not using restarts) */
  199|  15.8k|    if (cinfo->restart_interval)
  ------------------
  |  Branch (199:9): [True: 0, False: 15.8k]
  ------------------
  200|      0|      diff->restart_rows_to_go--;
  201|       |
  202|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  203|  15.8k|    diff->MCU_ctr = 0;
  204|  15.8k|  }
  205|       |
  206|       |  /*
  207|       |   * Undifference and scale each scanline of the disassembled MCU row
  208|       |   * separately.  We do not process dummy samples at the end of a scanline
  209|       |   * or dummy rows at the end of the image.
  210|       |   */
  211|  15.9k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (211:16): [True: 7.87k, False: 8.11k]
  ------------------
  212|  7.87k|    compptr = cinfo->cur_comp_info[ci];
  213|  7.87k|    compi = compptr->component_index;
  214|  7.87k|    for (row = 0, prev_row = compptr->v_samp_factor - 1;
  215|  23.4k|         row < (cinfo->input_iMCU_row == last_iMCU_row ?
  ------------------
  |  Branch (215:10): [True: 15.5k, False: 7.87k]
  |  Branch (215:17): [True: 53, False: 23.3k]
  ------------------
  216|  23.3k|                compptr->last_row_height : compptr->v_samp_factor);
  217|  15.5k|         prev_row = row, row++) {
  218|  15.5k|      (*losslessd->predict_undifference[compi])
  219|  15.5k|        (cinfo, compi, diff->diff_buf[compi][row],
  220|  15.5k|          diff->undiff_buf[compi][prev_row], diff->undiff_buf[compi][row],
  221|  15.5k|          compptr->width_in_blocks);
  222|  15.5k|      (*losslessd->scaler_scale) (cinfo, diff->undiff_buf[compi][row],
  223|  15.5k|                                  output_buf[compi][row],
  224|  15.5k|                                  compptr->width_in_blocks);
  225|  15.5k|    }
  226|  7.87k|  }
  227|       |
  228|       |  /* Completed the iMCU row, advance counters for next one.
  229|       |   *
  230|       |   * NB: output_data will increment output_iMCU_row.
  231|       |   * This counter is not needed for the single-pass case
  232|       |   * or the input side of the multi-pass case.
  233|       |   */
  234|  8.11k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (234:7): [True: 7.85k, False: 257]
  ------------------
  235|  7.85k|    start_iMCU_row(cinfo);
  236|  7.85k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  7.85k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  237|  7.85k|  }
  238|       |  /* Completed the scan */
  239|    257|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  240|    257|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    257|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  241|  8.11k|}
j12init_d_diff_controller:
  348|      7|{
  349|      7|  my_diff_ptr diff;
  350|      7|  int ci;
  351|      7|  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|      7|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     14|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (356:7): [True: 0, False: 7]
  ------------------
  357|      7|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      7|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (357:7): [True: 0, False: 7]
  ------------------
  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|      7|  diff = (my_diff_ptr)
  362|      7|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      7|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|      7|                                sizeof(my_diff_controller));
  364|      7|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|      7|  diff->pub.start_input_pass = start_input_pass;
  366|      7|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|     14|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 7, False: 7]
  ------------------
  370|      7|       ci++, compptr++) {
  371|      7|    diff->diff_buf[ci] =
  372|      7|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|      7|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|      7|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|      7|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|      7|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|      7|                                         (long)compptr->h_samp_factor),
  375|      7|                   (JDIMENSION)compptr->v_samp_factor);
  376|      7|    diff->undiff_buf[ci] =
  377|      7|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|      7|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|      7|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|      7|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|      7|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|      7|                                         (long)compptr->h_samp_factor),
  380|      7|                   (JDIMENSION)compptr->v_samp_factor);
  381|      7|  }
  382|       |
  383|      7|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 0, False: 7]
  ------------------
  384|      0|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|      0|    int access_rows;
  387|       |
  388|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 0, False: 0]
  ------------------
  389|      0|         ci++, compptr++) {
  390|      0|      access_rows = compptr->v_samp_factor;
  391|      0|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  393|      0|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|      0|                               (long)compptr->h_samp_factor),
  395|      0|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|      0|                               (long)compptr->v_samp_factor),
  397|      0|         (JDIMENSION)access_rows);
  398|      0|    }
  399|      0|    diff->pub.consume_data = consume_data;
  400|      0|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  142|      0|#define _decompress_data  decompress_data_12
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|      7|  } else {
  405|      7|    diff->pub.consume_data = dummy_consume_data;
  406|      7|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|      7|#define _decompress_data  decompress_data_12
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|      7|  }
  409|      7|}
jddiffct-12.c:start_input_pass:
   94|      7|{
   95|      7|  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|      7|  (*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|      7|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 0, False: 7]
  ------------------
  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|      7|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|      7|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|      7|  cinfo->input_iMCU_row = 0;
  115|      7|  start_iMCU_row(cinfo);
  116|      7|}
jddiffct-12.c:start_iMCU_row:
   67|      2|{
   68|      2|  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|      2|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 0, False: 2]
  ------------------
   75|      0|    diff->MCU_rows_per_iMCU_row = 1;
   76|      2|  } else {
   77|      2|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 1, False: 1]
  ------------------
   78|      1|      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|      2|  }
   82|       |
   83|      2|  diff->MCU_ctr = 0;
   84|      2|  diff->MCU_vert_offset = 0;
   85|      2|}
jddiffct-12.c:start_output_pass:
  147|      2|{
  148|      2|  cinfo->output_iMCU_row = 0;
  149|      2|}
j16init_d_diff_controller:
  348|      8|{
  349|      8|  my_diff_ptr diff;
  350|      8|  int ci;
  351|      8|  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|      8|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     16|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (356:7): [True: 0, False: 8]
  ------------------
  357|      8|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      8|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (357:7): [True: 0, False: 8]
  ------------------
  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|      8|  diff = (my_diff_ptr)
  362|      8|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      8|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|      8|                                sizeof(my_diff_controller));
  364|      8|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|      8|  diff->pub.start_input_pass = start_input_pass;
  366|      8|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|     18|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 10, False: 8]
  ------------------
  370|     10|       ci++, compptr++) {
  371|     10|    diff->diff_buf[ci] =
  372|     10|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|     10|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|     10|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|     10|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|     10|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|     10|                                         (long)compptr->h_samp_factor),
  375|     10|                   (JDIMENSION)compptr->v_samp_factor);
  376|     10|    diff->undiff_buf[ci] =
  377|     10|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|     10|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|     10|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|     10|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|     10|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|     10|                                         (long)compptr->h_samp_factor),
  380|     10|                   (JDIMENSION)compptr->v_samp_factor);
  381|     10|  }
  382|       |
  383|      8|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 0, False: 8]
  ------------------
  384|      0|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|      0|    int access_rows;
  387|       |
  388|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 0, False: 0]
  ------------------
  389|      0|         ci++, compptr++) {
  390|      0|      access_rows = compptr->v_samp_factor;
  391|      0|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  393|      0|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|      0|                               (long)compptr->h_samp_factor),
  395|      0|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|      0|                               (long)compptr->v_samp_factor),
  397|      0|         (JDIMENSION)access_rows);
  398|      0|    }
  399|      0|    diff->pub.consume_data = consume_data;
  400|      0|    diff->pub._decompress_data = output_data;
  ------------------
  |  |   53|      0|#define _decompress_data  decompress_data_16
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|      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|      8|}
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.77k|{
  146|  1.77k|  JHUFF_TBL *htbl;
  147|  1.77k|  d_derived_tbl *dtbl;
  148|  1.77k|  int p, i, l, si, numsymbols;
  149|  1.77k|  int lookbits, ctr;
  150|  1.77k|  char huffsize[257];
  151|  1.77k|  unsigned int huffcode[257];
  152|  1.77k|  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.77k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  1.77k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (159:7): [True: 0, False: 1.77k]
  |  Branch (159:20): [True: 8, False: 1.76k]
  ------------------
  160|      8|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|      8|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      8|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      8|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  161|  1.77k|  htbl =
  162|  1.77k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (162:5): [True: 1.06k, False: 715]
  ------------------
  163|  1.77k|  if (htbl == NULL)
  ------------------
  |  Branch (163:7): [True: 3, False: 1.77k]
  ------------------
  164|      3|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  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)))
  ------------------
  165|       |
  166|       |  /* Allocate a workspace if we haven't already done so. */
  167|  1.77k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (167:7): [True: 1.44k, False: 327]
  ------------------
  168|  1.44k|    *pdtbl = (d_derived_tbl *)
  169|  1.44k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.44k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  170|  1.44k|                                  sizeof(d_derived_tbl));
  171|  1.77k|  dtbl = *pdtbl;
  172|  1.77k|  dtbl->pub = htbl;             /* fill in back link */
  173|       |
  174|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  175|       |
  176|  1.77k|  p = 0;
  177|  29.9k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (177:15): [True: 28.2k, False: 1.77k]
  ------------------
  178|  28.2k|    i = (int)htbl->bits[l];
  179|  28.2k|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (179:9): [True: 0, False: 28.2k]
  |  Branch (179:18): [True: 0, False: 28.2k]
  ------------------
  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|   122k|    while (i--)
  ------------------
  |  Branch (181:12): [True: 94.0k, False: 28.2k]
  ------------------
  182|  94.0k|      huffsize[p++] = (char)l;
  183|  28.2k|  }
  184|  1.77k|  huffsize[p] = 0;
  185|  1.77k|  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.77k|  code = 0;
  191|  1.77k|  si = huffsize[0];
  192|  1.77k|  p = 0;
  193|  20.9k|  while (huffsize[p]) {
  ------------------
  |  Branch (193:10): [True: 19.1k, False: 1.77k]
  ------------------
  194|   112k|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (194:12): [True: 93.7k, False: 19.1k]
  ------------------
  195|  93.7k|      huffcode[p++] = code;
  196|  93.7k|      code++;
  197|  93.7k|    }
  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|  19.1k|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (201:9): [True: 8, False: 19.1k]
  ------------------
  202|      8|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      8|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      8|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|  19.1k|    code <<= 1;
  204|  19.1k|    si++;
  205|  19.1k|  }
  206|       |
  207|       |  /* Figure F.15: generate decoding tables for bit-sequential decoding */
  208|       |
  209|  1.77k|  p = 0;
  210|  29.8k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (210:15): [True: 28.0k, False: 1.77k]
  ------------------
  211|  28.0k|    if (htbl->bits[l]) {
  ------------------
  |  Branch (211:9): [True: 18.9k, False: 9.14k]
  ------------------
  212|       |      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
  213|       |       * minus the minimum code of length l
  214|       |       */
  215|  18.9k|      dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
  216|  18.9k|      p += htbl->bits[l];
  217|  18.9k|      dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
  218|  18.9k|    } else {
  219|  9.14k|      dtbl->maxcode[l] = -1;    /* -1 if no codes of this length */
  220|  9.14k|    }
  221|  28.0k|  }
  222|  1.77k|  dtbl->valoffset[17] = 0;
  223|  1.77k|  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|   451k|  for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
  ------------------
  |  |   25|   451k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (232:15): [True: 449k, False: 1.77k]
  ------------------
  233|   449k|    dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|   449k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
                  dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|   449k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  234|       |
  235|  1.77k|  p = 0;
  236|  15.8k|  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
  ------------------
  |  |   25|  15.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (236:15): [True: 14.0k, False: 1.77k]
  ------------------
  237|  37.5k|    for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
  ------------------
  |  Branch (237:17): [True: 23.5k, False: 14.0k]
  ------------------
  238|       |      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
  239|       |      /* Generate left-justified code followed by all possible bit sequences */
  240|  23.5k|      lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
  ------------------
  |  |   25|  23.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  241|   466k|      for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
  ------------------
  |  |   25|  23.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (241:45): [True: 442k, False: 23.5k]
  ------------------
  242|   442k|        dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
  ------------------
  |  |   25|   442k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  243|   442k|        lookbits++;
  244|   442k|      }
  245|  23.5k|    }
  246|  14.0k|  }
  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.77k|  if (isDC) {
  ------------------
  |  Branch (254:7): [True: 1.05k, False: 721]
  ------------------
  255|  13.6k|    for (i = 0; i < numsymbols; i++) {
  ------------------
  |  Branch (255:17): [True: 12.6k, False: 1.05k]
  ------------------
  256|  12.6k|      int sym = htbl->huffval[i];
  257|  12.6k|      if (sym < 0 || sym > (cinfo->master->lossless ? 16 : 15))
  ------------------
  |  Branch (257:11): [True: 0, False: 12.6k]
  |  Branch (257:22): [True: 11, False: 12.5k]
  |  Branch (257:29): [True: 3.52k, False: 9.08k]
  ------------------
  258|     11|        ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|     11|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     11|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  259|  12.6k|    }
  260|  1.05k|  }
  261|  1.77k|}
jpeg_fill_bit_buffer:
  291|  62.3k|{
  292|       |  /* Copy heavily used state fields into locals (hopefully registers) */
  293|  62.3k|  register const JOCTET *next_input_byte = state->next_input_byte;
  294|  62.3k|  register size_t bytes_in_buffer = state->bytes_in_buffer;
  295|  62.3k|  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|  62.3k|  if (cinfo->unread_marker == 0) {      /* cannot advance past a marker */
  ------------------
  |  Branch (301:7): [True: 61.2k, False: 1.18k]
  ------------------
  302|   488k|    while (bits_left < MIN_GET_BITS) {
  ------------------
  |  |  282|   488k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|   488k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  |  Branch (302:12): [True: 427k, False: 60.6k]
  ------------------
  303|   427k|      register int c;
  304|       |
  305|       |      /* Attempt to read a byte */
  306|   427k|      if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (306:11): [True: 134, False: 427k]
  ------------------
  307|    134|        if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (307:13): [True: 0, False: 134]
  ------------------
  308|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  309|    134|        next_input_byte = cinfo->src->next_input_byte;
  310|    134|        bytes_in_buffer = cinfo->src->bytes_in_buffer;
  311|    134|      }
  312|   427k|      bytes_in_buffer--;
  313|   427k|      c = *next_input_byte++;
  314|       |
  315|       |      /* If it's 0xFF, check and discard stuffed zero byte */
  316|   427k|      if (c == 0xFF) {
  ------------------
  |  Branch (316:11): [True: 7.42k, False: 420k]
  ------------------
  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|  31.7k|        do {
  323|  31.7k|          if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (323:15): [True: 2, False: 31.7k]
  ------------------
  324|      2|            if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (324:17): [True: 0, False: 2]
  ------------------
  325|      0|              return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  326|      2|            next_input_byte = cinfo->src->next_input_byte;
  327|      2|            bytes_in_buffer = cinfo->src->bytes_in_buffer;
  328|      2|          }
  329|  31.7k|          bytes_in_buffer--;
  330|  31.7k|          c = *next_input_byte++;
  331|  31.7k|        } while (c == 0xFF);
  ------------------
  |  Branch (331:18): [True: 24.3k, False: 7.42k]
  ------------------
  332|       |
  333|  7.42k|        if (c == 0) {
  ------------------
  |  Branch (333:13): [True: 6.89k, False: 528]
  ------------------
  334|       |          /* Found FF/00, which represents an FF data byte */
  335|  6.89k|          c = 0xFF;
  336|  6.89k|        } 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|    528|          cinfo->unread_marker = c;
  346|       |          /* See if we need to insert some fake zero bits. */
  347|    528|          goto no_more_bytes;
  348|    528|        }
  349|  7.42k|      }
  350|       |
  351|       |      /* OK, load c into get_buffer */
  352|   427k|      get_buffer = (get_buffer << 8) | c;
  353|   427k|      bits_left += 8;
  354|   427k|    } /* end while */
  355|  61.2k|  } else {
  356|  1.71k|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.71k|    if (nbits > bits_left) {
  ------------------
  |  Branch (361:9): [True: 509, False: 1.20k]
  ------------------
  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|    509|      if (!cinfo->entropy->insufficient_data) {
  ------------------
  |  Branch (367:11): [True: 509, False: 0]
  ------------------
  368|    509|        WARNMS(cinfo, JWRN_HIT_MARKER);
  ------------------
  |  |  283|    509|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    509|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  369|    509|        cinfo->entropy->insufficient_data = TRUE;
  ------------------
  |  |  210|    509|#define TRUE    1
  ------------------
  370|    509|      }
  371|       |      /* Fill the buffer with zero bits */
  372|    509|      get_buffer <<= MIN_GET_BITS - bits_left;
  ------------------
  |  |  282|    509|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|    509|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  373|    509|      bits_left = MIN_GET_BITS;
  ------------------
  |  |  282|    509|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|    509|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  374|    509|    }
  375|  1.71k|  }
  376|       |
  377|       |  /* Unload the local registers */
  378|  62.3k|  state->next_input_byte = next_input_byte;
  379|  62.3k|  state->bytes_in_buffer = bytes_in_buffer;
  380|  62.3k|  state->get_buffer = get_buffer;
  381|  62.3k|  state->bits_left = bits_left;
  382|       |
  383|  62.3k|  return TRUE;
  ------------------
  |  |  210|  62.3k|#define TRUE    1
  ------------------
  384|  62.3k|}
jpeg_huff_decode:
  439|  9.98k|{
  440|  9.98k|  register int l = min_bits;
  441|  9.98k|  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.98k|  CHECK_BIT_BUFFER(*state, l, return -1);
  ------------------
  |  |  160|  9.98k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  9.98k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 238, False: 9.74k]
  |  |  ------------------
  |  |  162|    238|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 238]
  |  |  ------------------
  |  |  163|    238|      { action; } \
  |  |  164|    238|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    238|  } \
  |  |  166|  9.98k|}
  ------------------
  447|  9.98k|  code = GET_BITS(l);
  ------------------
  |  |  169|  9.98k|  (((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|  32.0k|  while (code > htbl->maxcode[l]) {
  ------------------
  |  Branch (452:10): [True: 22.1k, False: 9.98k]
  ------------------
  453|  22.1k|    code <<= 1;
  454|  22.1k|    CHECK_BIT_BUFFER(*state, 1, return -1);
  ------------------
  |  |  160|  22.1k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  22.1k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 419, False: 21.6k]
  |  |  ------------------
  |  |  162|    419|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 419]
  |  |  ------------------
  |  |  163|    419|      { action; } \
  |  |  164|    419|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    419|  } \
  |  |  166|  22.1k|}
  ------------------
  455|  22.1k|    code |= GET_BITS(1);
  ------------------
  |  |  169|  22.1k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  456|  22.1k|    l++;
  457|  22.1k|  }
  458|       |
  459|       |  /* Unload the local registers */
  460|  9.98k|  state->get_buffer = get_buffer;
  461|  9.98k|  state->bits_left = bits_left;
  462|       |
  463|       |  /* With garbage input we may reach the sentinel value l = 17. */
  464|       |
  465|  9.98k|  if (l > 16) {
  ------------------
  |  Branch (465:7): [True: 135, False: 9.84k]
  ------------------
  466|    135|    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|    135|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    135|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  467|    135|    return 0;                   /* fake a zero as the safest result */
  468|    135|  }
  469|       |
  470|  9.84k|  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
  471|  9.98k|}
jinit_huff_decoder:
  815|    574|{
  816|    574|  huff_entropy_ptr entropy;
  817|    574|  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|    574|  std_huff_tables((j_common_ptr)cinfo);
  824|       |
  825|    574|  entropy = (huff_entropy_ptr)
  826|    574|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    574|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  827|    574|                                sizeof(huff_entropy_decoder));
  828|    574|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  829|    574|  entropy->pub.start_pass = start_pass_huff_decoder;
  830|    574|  entropy->pub.decode_mcu = decode_mcu;
  831|       |
  832|       |  /* Mark tables unallocated */
  833|  2.87k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  2.87k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (833:15): [True: 2.29k, False: 574]
  ------------------
  834|       |    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
  835|  2.29k|  }
  836|    574|}
jdhuff.c:start_pass_huff_decoder:
   80|    568|{
   81|    568|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   82|    568|  int ci, blkn, dctbl, actbl;
   83|    568|  d_derived_tbl **pdtbl;
   84|    568|  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|    568|  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|    567|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (90:7): [True: 1, False: 567]
  |  Branch (90:25): [True: 1, False: 566]
  ------------------
   91|    566|      cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (91:7): [True: 1, False: 565]
  |  Branch (91:25): [True: 1, False: 564]
  ------------------
   92|      4|    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      4|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
   93|       |
   94|  1.29k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (94:16): [True: 728, False: 568]
  ------------------
   95|    728|    compptr = cinfo->cur_comp_info[ci];
   96|    728|    dctbl = compptr->dc_tbl_no;
   97|    728|    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|    728|    pdtbl = (d_derived_tbl **)(entropy->dc_derived_tbls) + dctbl;
  101|    728|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
  ------------------
  |  |  210|    728|#define TRUE    1
  ------------------
  102|    728|    pdtbl = (d_derived_tbl **)(entropy->ac_derived_tbls) + actbl;
  103|    728|    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
  ------------------
  |  |  207|    728|#define FALSE   0               /* values of boolean */
  ------------------
  104|       |    /* Initialize DC predictions to 0 */
  105|    728|    entropy->saved.last_dc_val[ci] = 0;
  106|    728|  }
  107|       |
  108|       |  /* Precalculate decoding info for each block in an MCU of this scan */
  109|  1.50k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (109:18): [True: 936, False: 568]
  ------------------
  110|    936|    ci = cinfo->MCU_membership[blkn];
  111|    936|    compptr = cinfo->cur_comp_info[ci];
  112|       |    /* Precalculate which table to use for each block */
  113|    936|    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
  114|    936|    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
  115|       |    /* Decide whether we really care about the coefficient values */
  116|    936|    if (compptr->component_needed) {
  ------------------
  |  Branch (116:9): [True: 936, False: 0]
  ------------------
  117|    936|      entropy->dc_needed[blkn] = TRUE;
  ------------------
  |  |  210|    936|#define TRUE    1
  ------------------
  118|       |      /* we don't need the ACs if producing a 1/8th-size image */
  119|    936|      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
  ------------------
  |  |   24|    936|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  120|    936|    } else {
  121|      0|      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  122|      0|    }
  123|    936|  }
  124|       |
  125|       |  /* Initialize bitread state variables */
  126|    568|  entropy->bitstate.bits_left = 0;
  127|    568|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  128|    568|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|    568|#define FALSE   0               /* values of boolean */
  ------------------
  129|       |
  130|       |  /* Initialize restart counter */
  131|    568|  entropy->restarts_to_go = cinfo->restart_interval;
  132|    568|}
jdhuff.c:decode_mcu:
  771|   153k|{
  772|   153k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  773|   153k|  int usefast = 1;
  774|       |
  775|       |  /* Process restart marker if needed; may have to suspend */
  776|   153k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (776:7): [True: 0, False: 153k]
  ------------------
  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|   153k|  if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
  ------------------
  |  |  767|   153k|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  ------------------
  |  |  |  |   67|   153k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  ------------------
  |  Branch (783:7): [True: 28.0k, False: 125k]
  ------------------
  784|   125k|      cinfo->unread_marker != 0)
  ------------------
  |  Branch (784:7): [True: 46, False: 125k]
  ------------------
  785|  28.1k|    usefast = 0;
  786|       |
  787|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  788|       |   * This way, we return uniform gray for the remainder of the segment.
  789|       |   */
  790|   153k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (790:7): [True: 153k, False: 0]
  ------------------
  791|       |
  792|   153k|    if (usefast) {
  ------------------
  |  Branch (792:9): [True: 125k, False: 28.1k]
  ------------------
  793|   125k|      if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
  ------------------
  |  Branch (793:11): [True: 3.66k, False: 121k]
  ------------------
  794|   125k|    } else {
  795|  31.7k|use_slow:
  796|  31.7k|      if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (796:11): [True: 0, False: 31.7k]
  ------------------
  797|  31.7k|    }
  798|       |
  799|   153k|  }
  800|       |
  801|       |  /* Account for restart interval (no-op if not using restarts) */
  802|   153k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (802:7): [True: 0, False: 153k]
  ------------------
  803|      0|    entropy->restarts_to_go--;
  804|       |
  805|   153k|  return TRUE;
  ------------------
  |  |  210|   153k|#define TRUE    1
  ------------------
  806|   153k|}
jdhuff.c:decode_mcu_fast:
  664|   125k|{
  665|   125k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  666|   125k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   125k|  register bit_buf_type get_buffer; \
  |  |  126|   125k|  register int bits_left; \
  |  |  127|   125k|  bitread_working_state br_state
  ------------------
  667|   125k|  JOCTET *buffer;
  668|   125k|  int blkn;
  669|   125k|  savable_state state;
  670|       |  /* Outer loop handles each block in the MCU */
  671|       |
  672|       |  /* Load up working state */
  673|   125k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   125k|  br_state.cinfo = cinfop; \
  |  |  131|   125k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   125k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   125k|  get_buffer = permstate.get_buffer; \
  |  |  134|   125k|  bits_left = permstate.bits_left;
  ------------------
  674|   125k|  buffer = (JOCTET *)br_state.next_input_byte;
  675|   125k|  state = entropy->saved;
  676|       |
  677|   253k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (677:18): [True: 128k, False: 125k]
  ------------------
  678|   128k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (678:23): [True: 128k, False: 0]
  ------------------
  679|   128k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  680|   128k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  681|   128k|    register int s, k, r, l;
  682|       |
  683|   128k|    HUFF_DECODE_FAST(s, l, dctbl);
  ------------------
  |  |  224|   128k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   128k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 11.6k, False: 116k]
  |  |  |  |  ------------------
  |  |  |  |  416|  11.6k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.6k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.6k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.6k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.6k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 887, False: 10.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    887|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    887|    buffer++; \
  |  |  |  |  |  |  401|    887|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 223, False: 664]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    223|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    223|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    223|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    223|      buffer -= 2; \
  |  |  |  |  |  |  406|    223|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    223|    } \
  |  |  |  |  |  |  408|    887|  } \
  |  |  |  |  |  |  409|  11.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.6k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.6k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.6k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.6k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.12k, False: 10.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.12k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.12k|    buffer++; \
  |  |  |  |  |  |  401|  1.12k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 404, False: 719]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    404|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    404|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    404|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    404|      buffer -= 2; \
  |  |  |  |  |  |  406|    404|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    404|    } \
  |  |  |  |  |  |  408|  1.12k|  } \
  |  |  |  |  |  |  409|  11.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.6k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.6k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.6k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.6k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.03k, False: 10.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.03k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.03k|    buffer++; \
  |  |  |  |  |  |  401|  1.03k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 508, False: 525]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    508|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    508|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    508|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    508|      buffer -= 2; \
  |  |  |  |  |  |  406|    508|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    508|    } \
  |  |  |  |  |  |  408|  1.03k|  } \
  |  |  |  |  |  |  409|  11.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.6k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.6k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.6k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.6k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.48k, False: 10.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 541, False: 943]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    541|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    541|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    541|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    541|      buffer -= 2; \
  |  |  |  |  |  |  406|    541|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    541|    } \
  |  |  |  |  |  |  408|  1.48k|  } \
  |  |  |  |  |  |  409|  11.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.6k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.6k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.6k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.6k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 969, False: 10.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    969|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    969|    buffer++; \
  |  |  |  |  |  |  401|    969|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 634, False: 335]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    634|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    634|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    634|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    634|      buffer -= 2; \
  |  |  |  |  |  |  406|    634|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    634|    } \
  |  |  |  |  |  |  408|    969|  } \
  |  |  |  |  |  |  409|  11.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.6k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.6k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.6k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.6k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.12k, False: 9.49k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.12k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.12k|    buffer++; \
  |  |  |  |  |  |  401|  2.12k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 679, False: 1.44k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    679|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    679|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    679|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    679|      buffer -= 2; \
  |  |  |  |  |  |  406|    679|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    679|    } \
  |  |  |  |  |  |  408|  2.12k|  } \
  |  |  |  |  |  |  409|  11.6k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  11.6k|  }
  |  |  ------------------
  |  |  225|   128k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   128k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   128k|  s = htbl->lookup[s]; \
  |  |  227|   128k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   128k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   128k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   128k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   128k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   128k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   128k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   128k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   256k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 2.08k, False: 126k]
  |  |  ------------------
  |  |  232|  2.08k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  2.08k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  2.08k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|  8.22k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 6.14k, False: 2.08k]
  |  |  ------------------
  |  |  236|  6.14k|      s <<= 1; \
  |  |  237|  6.14k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|  6.14k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|  6.14k|      nb++; \
  |  |  239|  6.14k|    } \
  |  |  240|  2.08k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 766, False: 1.31k]
  |  |  ------------------
  |  |  241|  2.08k|      s = 0; \
  |  |  242|  2.08k|    else \
  |  |  243|  2.08k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  2.08k|  }
  ------------------
  684|   128k|    if (s) {
  ------------------
  |  Branch (684:9): [True: 120k, False: 8.34k]
  ------------------
  685|   120k|      FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|   120k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 7.17k, False: 112k]
  |  |  ------------------
  |  |  416|  7.17k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  7.17k|#define GET_BYTE { \
  |  |  |  |  392|  7.17k|  register int c0, c1; \
  |  |  |  |  393|  7.17k|  c0 = *buffer++; \
  |  |  |  |  394|  7.17k|  c1 = *buffer; \
  |  |  |  |  395|  7.17k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  7.17k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  7.17k|  bits_left += 8; \
  |  |  |  |  398|  7.17k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 575, False: 6.59k]
  |  |  |  |  ------------------
  |  |  |  |  399|    575|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    575|    buffer++; \
  |  |  |  |  401|    575|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 34, False: 541]
  |  |  |  |  ------------------
  |  |  |  |  402|     34|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     34|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     34|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     34|      buffer -= 2; \
  |  |  |  |  406|     34|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     34|    } \
  |  |  |  |  408|    575|  } \
  |  |  |  |  409|  7.17k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  7.17k|#define GET_BYTE { \
  |  |  |  |  392|  7.17k|  register int c0, c1; \
  |  |  |  |  393|  7.17k|  c0 = *buffer++; \
  |  |  |  |  394|  7.17k|  c1 = *buffer; \
  |  |  |  |  395|  7.17k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  7.17k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  7.17k|  bits_left += 8; \
  |  |  |  |  398|  7.17k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 401, False: 6.77k]
  |  |  |  |  ------------------
  |  |  |  |  399|    401|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    401|    buffer++; \
  |  |  |  |  401|    401|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 65, False: 336]
  |  |  |  |  ------------------
  |  |  |  |  402|     65|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     65|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     65|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     65|      buffer -= 2; \
  |  |  |  |  406|     65|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     65|    } \
  |  |  |  |  408|    401|  } \
  |  |  |  |  409|  7.17k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  7.17k|#define GET_BYTE { \
  |  |  |  |  392|  7.17k|  register int c0, c1; \
  |  |  |  |  393|  7.17k|  c0 = *buffer++; \
  |  |  |  |  394|  7.17k|  c1 = *buffer; \
  |  |  |  |  395|  7.17k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  7.17k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  7.17k|  bits_left += 8; \
  |  |  |  |  398|  7.17k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 598, False: 6.57k]
  |  |  |  |  ------------------
  |  |  |  |  399|    598|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    598|    buffer++; \
  |  |  |  |  401|    598|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 73, False: 525]
  |  |  |  |  ------------------
  |  |  |  |  402|     73|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     73|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     73|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     73|      buffer -= 2; \
  |  |  |  |  406|     73|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     73|    } \
  |  |  |  |  408|    598|  } \
  |  |  |  |  409|  7.17k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  7.17k|#define GET_BYTE { \
  |  |  |  |  392|  7.17k|  register int c0, c1; \
  |  |  |  |  393|  7.17k|  c0 = *buffer++; \
  |  |  |  |  394|  7.17k|  c1 = *buffer; \
  |  |  |  |  395|  7.17k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  7.17k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  7.17k|  bits_left += 8; \
  |  |  |  |  398|  7.17k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 357, False: 6.81k]
  |  |  |  |  ------------------
  |  |  |  |  399|    357|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    357|    buffer++; \
  |  |  |  |  401|    357|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 82, False: 275]
  |  |  |  |  ------------------
  |  |  |  |  402|     82|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     82|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     82|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     82|      buffer -= 2; \
  |  |  |  |  406|     82|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     82|    } \
  |  |  |  |  408|    357|  } \
  |  |  |  |  409|  7.17k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  7.17k|#define GET_BYTE { \
  |  |  |  |  392|  7.17k|  register int c0, c1; \
  |  |  |  |  393|  7.17k|  c0 = *buffer++; \
  |  |  |  |  394|  7.17k|  c1 = *buffer; \
  |  |  |  |  395|  7.17k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  7.17k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  7.17k|  bits_left += 8; \
  |  |  |  |  398|  7.17k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.07k, False: 6.10k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.07k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.07k|    buffer++; \
  |  |  |  |  401|  1.07k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 154, False: 917]
  |  |  |  |  ------------------
  |  |  |  |  402|    154|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    154|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    154|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    154|      buffer -= 2; \
  |  |  |  |  406|    154|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    154|    } \
  |  |  |  |  408|  1.07k|  } \
  |  |  |  |  409|  7.17k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  7.17k|#define GET_BYTE { \
  |  |  |  |  392|  7.17k|  register int c0, c1; \
  |  |  |  |  393|  7.17k|  c0 = *buffer++; \
  |  |  |  |  394|  7.17k|  c1 = *buffer; \
  |  |  |  |  395|  7.17k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  7.17k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  7.17k|  bits_left += 8; \
  |  |  |  |  398|  7.17k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 280, False: 6.89k]
  |  |  |  |  ------------------
  |  |  |  |  399|    280|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    280|    buffer++; \
  |  |  |  |  401|    280|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 161, False: 119]
  |  |  |  |  ------------------
  |  |  |  |  402|    161|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    161|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    161|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    161|      buffer -= 2; \
  |  |  |  |  406|    161|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    161|    } \
  |  |  |  |  408|    280|  } \
  |  |  |  |  409|  7.17k|}
  |  |  ------------------
  |  |  417|  7.17k|  }
  ------------------
  686|   120k|      r = GET_BITS(s);
  ------------------
  |  |  169|   120k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  687|   120k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   120k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   120k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  688|   120k|    }
  689|       |
  690|   128k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (690:9): [True: 128k, False: 0]
  ------------------
  691|   128k|      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|   128k|      s += state.last_dc_val[ci];
  696|   128k|      state.last_dc_val[ci] = s;
  697|   128k|      if (block)
  ------------------
  |  Branch (697:11): [True: 128k, False: 0]
  ------------------
  698|   128k|        (*block)[0] = (JCOEF)s;
  699|   128k|    }
  700|       |
  701|   128k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (701:9): [True: 128k, False: 0]
  |  Branch (701:37): [True: 128k, False: 0]
  ------------------
  702|       |
  703|  3.48M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  3.48M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (703:19): [True: 3.39M, False: 87.9k]
  ------------------
  704|  3.39M|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|  3.39M|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|  3.39M|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 108k, False: 3.28M]
  |  |  |  |  ------------------
  |  |  |  |  416|   108k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   108k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   108k|  register int c0, c1; \
  |  |  |  |  |  |  393|   108k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   108k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   108k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   108k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   108k|  bits_left += 8; \
  |  |  |  |  |  |  398|   108k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 4.52k, False: 103k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  4.52k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  4.52k|    buffer++; \
  |  |  |  |  |  |  401|  4.52k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 2.93k, False: 1.58k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  2.93k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  2.93k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  2.93k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  2.93k|      buffer -= 2; \
  |  |  |  |  |  |  406|  2.93k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  2.93k|    } \
  |  |  |  |  |  |  408|  4.52k|  } \
  |  |  |  |  |  |  409|   108k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   108k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   108k|  register int c0, c1; \
  |  |  |  |  |  |  393|   108k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   108k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   108k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   108k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   108k|  bits_left += 8; \
  |  |  |  |  |  |  398|   108k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 4.71k, False: 103k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3.26k, False: 1.45k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  3.26k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  3.26k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  3.26k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  3.26k|      buffer -= 2; \
  |  |  |  |  |  |  406|  3.26k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  3.26k|    } \
  |  |  |  |  |  |  408|  4.71k|  } \
  |  |  |  |  |  |  409|   108k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   108k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   108k|  register int c0, c1; \
  |  |  |  |  |  |  393|   108k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   108k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   108k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   108k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   108k|  bits_left += 8; \
  |  |  |  |  |  |  398|   108k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 5.68k, False: 102k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  5.68k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  5.68k|    buffer++; \
  |  |  |  |  |  |  401|  5.68k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 3.64k, False: 2.04k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  3.64k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  3.64k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  3.64k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  3.64k|      buffer -= 2; \
  |  |  |  |  |  |  406|  3.64k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  3.64k|    } \
  |  |  |  |  |  |  408|  5.68k|  } \
  |  |  |  |  |  |  409|   108k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   108k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   108k|  register int c0, c1; \
  |  |  |  |  |  |  393|   108k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   108k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   108k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   108k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   108k|  bits_left += 8; \
  |  |  |  |  |  |  398|   108k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 5.70k, False: 102k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  5.70k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  5.70k|    buffer++; \
  |  |  |  |  |  |  401|  5.70k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 3.84k, False: 1.85k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  3.84k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  3.84k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  3.84k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  3.84k|      buffer -= 2; \
  |  |  |  |  |  |  406|  3.84k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  3.84k|    } \
  |  |  |  |  |  |  408|  5.70k|  } \
  |  |  |  |  |  |  409|   108k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   108k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   108k|  register int c0, c1; \
  |  |  |  |  |  |  393|   108k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   108k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   108k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   108k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   108k|  bits_left += 8; \
  |  |  |  |  |  |  398|   108k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 6.40k, False: 102k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  6.40k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  6.40k|    buffer++; \
  |  |  |  |  |  |  401|  6.40k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 3.93k, False: 2.47k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  3.93k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  3.93k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  3.93k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  3.93k|      buffer -= 2; \
  |  |  |  |  |  |  406|  3.93k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  3.93k|    } \
  |  |  |  |  |  |  408|  6.40k|  } \
  |  |  |  |  |  |  409|   108k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   108k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   108k|  register int c0, c1; \
  |  |  |  |  |  |  393|   108k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   108k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   108k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   108k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   108k|  bits_left += 8; \
  |  |  |  |  |  |  398|   108k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 5.84k, False: 102k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  5.84k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  5.84k|    buffer++; \
  |  |  |  |  |  |  401|  5.84k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 4.09k, False: 1.74k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  4.09k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  4.09k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  4.09k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  4.09k|      buffer -= 2; \
  |  |  |  |  |  |  406|  4.09k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  4.09k|    } \
  |  |  |  |  |  |  408|  5.84k|  } \
  |  |  |  |  |  |  409|   108k|}
  |  |  |  |  ------------------
  |  |  |  |  417|   108k|  }
  |  |  ------------------
  |  |  225|  3.39M|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  3.39M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|  3.39M|  s = htbl->lookup[s]; \
  |  |  227|  3.39M|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|  3.39M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|  3.39M|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|  3.39M|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  3.39M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|  3.39M|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  3.39M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|  3.39M|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  6.79M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 48.5k, False: 3.34M]
  |  |  ------------------
  |  |  232|  48.5k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  48.5k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  48.5k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|   180k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 131k, False: 48.5k]
  |  |  ------------------
  |  |  236|   131k|      s <<= 1; \
  |  |  237|   131k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|   131k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|   131k|      nb++; \
  |  |  239|   131k|    } \
  |  |  240|  48.5k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 307, False: 48.1k]
  |  |  ------------------
  |  |  241|  48.5k|      s = 0; \
  |  |  242|  48.5k|    else \
  |  |  243|  48.5k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  48.5k|  }
  ------------------
  705|  3.39M|        r = s >> 4;
  706|  3.39M|        s &= 15;
  707|       |
  708|  3.39M|        if (s) {
  ------------------
  |  Branch (708:13): [True: 3.28M, False: 111k]
  ------------------
  709|  3.28M|          k += r;
  710|  3.28M|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  3.28M|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 146k, False: 3.13M]
  |  |  ------------------
  |  |  416|   146k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   146k|#define GET_BYTE { \
  |  |  |  |  392|   146k|  register int c0, c1; \
  |  |  |  |  393|   146k|  c0 = *buffer++; \
  |  |  |  |  394|   146k|  c1 = *buffer; \
  |  |  |  |  395|   146k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   146k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   146k|  bits_left += 8; \
  |  |  |  |  398|   146k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.70k, False: 141k]
  |  |  |  |  ------------------
  |  |  |  |  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: 3.28k, False: 1.41k]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.28k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.28k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.28k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.28k|      buffer -= 2; \
  |  |  |  |  406|  3.28k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.28k|    } \
  |  |  |  |  408|  4.70k|  } \
  |  |  |  |  409|   146k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   146k|#define GET_BYTE { \
  |  |  |  |  392|   146k|  register int c0, c1; \
  |  |  |  |  393|   146k|  c0 = *buffer++; \
  |  |  |  |  394|   146k|  c1 = *buffer; \
  |  |  |  |  395|   146k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   146k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   146k|  bits_left += 8; \
  |  |  |  |  398|   146k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 5.61k, False: 140k]
  |  |  |  |  ------------------
  |  |  |  |  399|  5.61k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  5.61k|    buffer++; \
  |  |  |  |  401|  5.61k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.39k, False: 2.21k]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.39k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.39k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.39k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.39k|      buffer -= 2; \
  |  |  |  |  406|  3.39k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.39k|    } \
  |  |  |  |  408|  5.61k|  } \
  |  |  |  |  409|   146k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   146k|#define GET_BYTE { \
  |  |  |  |  392|   146k|  register int c0, c1; \
  |  |  |  |  393|   146k|  c0 = *buffer++; \
  |  |  |  |  394|   146k|  c1 = *buffer; \
  |  |  |  |  395|   146k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   146k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   146k|  bits_left += 8; \
  |  |  |  |  398|   146k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.98k, False: 141k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.98k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.98k|    buffer++; \
  |  |  |  |  401|  4.98k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.61k, False: 1.37k]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.61k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.61k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.61k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.61k|      buffer -= 2; \
  |  |  |  |  406|  3.61k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.61k|    } \
  |  |  |  |  408|  4.98k|  } \
  |  |  |  |  409|   146k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   146k|#define GET_BYTE { \
  |  |  |  |  392|   146k|  register int c0, c1; \
  |  |  |  |  393|   146k|  c0 = *buffer++; \
  |  |  |  |  394|   146k|  c1 = *buffer; \
  |  |  |  |  395|   146k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   146k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   146k|  bits_left += 8; \
  |  |  |  |  398|   146k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 5.57k, False: 140k]
  |  |  |  |  ------------------
  |  |  |  |  399|  5.57k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  5.57k|    buffer++; \
  |  |  |  |  401|  5.57k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.88k, False: 1.69k]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.88k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.88k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.88k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.88k|      buffer -= 2; \
  |  |  |  |  406|  3.88k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.88k|    } \
  |  |  |  |  408|  5.57k|  } \
  |  |  |  |  409|   146k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   146k|#define GET_BYTE { \
  |  |  |  |  392|   146k|  register int c0, c1; \
  |  |  |  |  393|   146k|  c0 = *buffer++; \
  |  |  |  |  394|   146k|  c1 = *buffer; \
  |  |  |  |  395|   146k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   146k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   146k|  bits_left += 8; \
  |  |  |  |  398|   146k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 5.18k, False: 140k]
  |  |  |  |  ------------------
  |  |  |  |  399|  5.18k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  5.18k|    buffer++; \
  |  |  |  |  401|  5.18k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 4.20k, False: 977]
  |  |  |  |  ------------------
  |  |  |  |  402|  4.20k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  4.20k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  4.20k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  4.20k|      buffer -= 2; \
  |  |  |  |  406|  4.20k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  4.20k|    } \
  |  |  |  |  408|  5.18k|  } \
  |  |  |  |  409|   146k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   146k|#define GET_BYTE { \
  |  |  |  |  392|   146k|  register int c0, c1; \
  |  |  |  |  393|   146k|  c0 = *buffer++; \
  |  |  |  |  394|   146k|  c1 = *buffer; \
  |  |  |  |  395|   146k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   146k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   146k|  bits_left += 8; \
  |  |  |  |  398|   146k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 5.85k, False: 140k]
  |  |  |  |  ------------------
  |  |  |  |  399|  5.85k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  5.85k|    buffer++; \
  |  |  |  |  401|  5.85k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 4.43k, False: 1.42k]
  |  |  |  |  ------------------
  |  |  |  |  402|  4.43k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  4.43k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  4.43k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  4.43k|      buffer -= 2; \
  |  |  |  |  406|  4.43k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  4.43k|    } \
  |  |  |  |  408|  5.85k|  } \
  |  |  |  |  409|   146k|}
  |  |  ------------------
  |  |  417|   146k|  }
  ------------------
  711|  3.28M|          r = GET_BITS(s);
  ------------------
  |  |  169|  3.28M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  712|  3.28M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  3.28M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  3.28M|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  713|  3.28M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  714|  3.28M|        } else {
  715|   111k|          if (r != 15) break;
  ------------------
  |  Branch (715:15): [True: 40.5k, False: 71.2k]
  ------------------
  716|  71.2k|          k += 15;
  717|  71.2k|        }
  718|  3.39M|      }
  719|       |
  720|   128k|    } 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|   128k|  }
  738|       |
  739|   125k|  if (cinfo->unread_marker != 0) {
  ------------------
  |  Branch (739:7): [True: 3.66k, False: 121k]
  ------------------
  740|  3.66k|    cinfo->unread_marker = 0;
  741|  3.66k|    return FALSE;
  ------------------
  |  |  207|  3.66k|#define FALSE   0               /* values of boolean */
  ------------------
  742|  3.66k|  }
  743|       |
  744|   121k|  br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
  745|   121k|  br_state.next_input_byte = buffer;
  746|   121k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   121k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   121k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   121k|  permstate.get_buffer = get_buffer; \
  |  |  140|   121k|  permstate.bits_left = bits_left
  ------------------
  747|   121k|  entropy->saved = state;
  748|   121k|  return TRUE;
  ------------------
  |  |  210|   121k|#define TRUE    1
  ------------------
  749|   125k|}
jdhuff.c:decode_mcu_slow:
  553|  31.7k|{
  554|  31.7k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  555|  31.7k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  31.7k|  register bit_buf_type get_buffer; \
  |  |  126|  31.7k|  register int bits_left; \
  |  |  127|  31.7k|  bitread_working_state br_state
  ------------------
  556|  31.7k|  int blkn;
  557|  31.7k|  savable_state state;
  558|       |  /* Outer loop handles each block in the MCU */
  559|       |
  560|       |  /* Load up working state */
  561|  31.7k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  31.7k|  br_state.cinfo = cinfop; \
  |  |  131|  31.7k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  31.7k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  31.7k|  get_buffer = permstate.get_buffer; \
  |  |  134|  31.7k|  bits_left = permstate.bits_left;
  ------------------
  562|  31.7k|  state = entropy->saved;
  563|       |
  564|  68.5k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (564:18): [True: 36.8k, False: 31.6k]
  ------------------
  565|  36.8k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (565:23): [True: 36.8k, False: 0]
  ------------------
  566|  36.8k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  567|  36.8k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  568|  36.8k|    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|  36.8k|    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
  ------------------
  |  |  200|  36.8k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  36.8k|  register int nb, look; \
  |  |  202|  36.8k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  36.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 2.77k, False: 34.1k]
  |  |  ------------------
  |  |  203|  2.77k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 2.77k]
  |  |  ------------------
  |  |  204|  2.77k|      { failaction; } \
  |  |  205|  2.77k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  2.77k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.77k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 101, False: 2.67k]
  |  |  ------------------
  |  |  207|    101|      nb = 1;  goto slowlabel; \
  |  |  208|    101|    } \
  |  |  209|  2.77k|  } \
  |  |  210|  36.8k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  36.7k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  36.7k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  36.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  36.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 36.4k, False: 319]
  |  |  ------------------
  |  |  212|  36.4k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  36.4k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  36.4k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  36.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  36.4k|  } else { \
  |  |  215|    414|slowlabel: \
  |  |  216|    414|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 414]
  |  |  ------------------
  |  |  217|    414|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|    414|      { failaction; } \
  |  |  219|    414|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|    414|  } \
  |  |  221|  36.7k|}
  ------------------
  574|  36.8k|    if (s) {
  ------------------
  |  Branch (574:9): [True: 33.7k, False: 3.13k]
  ------------------
  575|  33.7k|      CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  33.7k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  33.7k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 316, False: 33.4k]
  |  |  ------------------
  |  |  162|    316|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 316]
  |  |  ------------------
  |  |  163|    316|      { action; } \
  |  |  164|    316|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    316|  } \
  |  |  166|  33.7k|}
  ------------------
  576|  33.7k|      r = GET_BITS(s);
  ------------------
  |  |  169|  33.7k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  577|  33.7k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  33.7k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  33.7k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  578|  33.7k|    }
  579|       |
  580|  36.8k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (580:9): [True: 36.7k, False: 141]
  ------------------
  581|       |      /* Convert DC difference to actual value, update last_dc_val */
  582|  36.7k|      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|  36.7k|      s += state.last_dc_val[ci];
  592|  36.7k|      state.last_dc_val[ci] = s;
  593|  36.7k|      if (block) {
  ------------------
  |  Branch (593:11): [True: 36.7k, False: 0]
  ------------------
  594|       |        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
  595|  36.7k|        (*block)[0] = (JCOEF)s;
  596|  36.7k|      }
  597|  36.7k|    }
  598|       |
  599|  36.8k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (599:9): [True: 36.7k, False: 141]
  |  Branch (599:37): [True: 36.7k, 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|   377k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|   377k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (603:19): [True: 366k, False: 11.3k]
  ------------------
  604|   366k|        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
  ------------------
  |  |  200|   366k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   366k|  register int nb, look; \
  |  |  202|   366k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   366k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 27.2k, False: 339k]
  |  |  ------------------
  |  |  203|  27.2k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 27.2k]
  |  |  ------------------
  |  |  204|  27.2k|      { failaction; } \
  |  |  205|  27.2k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  27.2k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  27.2k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 386, False: 26.8k]
  |  |  ------------------
  |  |  207|    386|      nb = 1;  goto slowlabel; \
  |  |  208|    386|    } \
  |  |  209|  27.2k|  } \
  |  |  210|   366k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   365k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   365k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   365k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   365k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 357k, False: 8.37k]
  |  |  ------------------
  |  |  212|   357k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   357k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   357k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   357k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   357k|  } else { \
  |  |  215|  8.67k|slowlabel: \
  |  |  216|  8.67k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 8.67k]
  |  |  ------------------
  |  |  217|  8.67k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  8.67k|      { failaction; } \
  |  |  219|  8.67k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  8.67k|  } \
  |  |  221|   365k|}
  ------------------
  605|       |
  606|   366k|        r = s >> 4;
  607|   366k|        s &= 15;
  608|       |
  609|   366k|        if (s) {
  ------------------
  |  Branch (609:13): [True: 328k, False: 37.2k]
  ------------------
  610|   328k|          k += r;
  611|   328k|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|   328k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   328k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 3.31k, False: 325k]
  |  |  ------------------
  |  |  162|  3.31k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 3.31k]
  |  |  ------------------
  |  |  163|  3.31k|      { action; } \
  |  |  164|  3.31k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  3.31k|  } \
  |  |  166|   328k|}
  ------------------
  612|   328k|          r = GET_BITS(s);
  ------------------
  |  |  169|   328k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  613|   328k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   328k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   328k|#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|   328k|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  619|   328k|        } else {
  620|  37.2k|          if (r != 15)
  ------------------
  |  Branch (620:15): [True: 25.2k, False: 12.0k]
  ------------------
  621|  25.2k|            break;
  622|  12.0k|          k += 15;
  623|  12.0k|        }
  624|   366k|      }
  625|       |
  626|  36.7k|    } else {
  627|       |
  628|       |      /* Section F.2.2.2: decode the AC coefficients */
  629|       |      /* In this path we just discard the values */
  630|    141|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|    141|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (630:19): [True: 0, False: 141]
  ------------------
  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|    141|    }
  647|  36.8k|  }
  648|       |
  649|       |  /* Completed MCU, so update state */
  650|  31.6k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  31.6k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  31.6k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  31.6k|  permstate.get_buffer = get_buffer; \
  |  |  140|  31.6k|  permstate.bits_left = bits_left
  ------------------
  651|  31.6k|  entropy->saved = state;
  652|  31.6k|  return TRUE;
  ------------------
  |  |  210|  31.6k|#define TRUE    1
  ------------------
  653|  31.7k|}

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

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

jinit_lossless_decompressor:
  281|    273|{
  282|    273|  lossless_decomp_ptr losslessd;
  283|       |
  284|    273|#if BITS_IN_JSAMPLE == 8
  285|    273|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|    546|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (285:7): [True: 0, False: 273]
  |  Branch (285:50): [True: 0, False: 273]
  ------------------
  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|    273|  losslessd = (lossless_decomp_ptr)
  294|    273|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    273|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|    273|                                sizeof(jpeg_lossless_decompressor));
  296|    273|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|    273|  losslessd->pub.start_pass = start_pass_lossless;
  298|    273|}
jdlossls-8.c:start_pass_lossless:
  243|    522|{
  244|    522|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|    522|  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|    522|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 4, False: 518]
  |  Branch (257:24): [True: 1, False: 517]
  ------------------
  258|    517|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 1, False: 516]
  |  Branch (258:25): [True: 1, False: 515]
  ------------------
  259|    515|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 515]
  |  Branch (259:24): [True: 1, False: 514]
  ------------------
  260|      8|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      8|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      8|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      8|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      8|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      8|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      8|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|    522|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|  1.03k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 514, False: 522]
  ------------------
  265|    514|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|    522|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 254, False: 268]
  ------------------
  269|    254|    losslessd->scaler_scale = simple_upscale;
  270|    268|  else
  271|    268|    losslessd->scaler_scale = noscale;
  272|    522|}
jdlossls-8.c:jpeg_undifference_first_row:
  177|    251|{
  178|    251|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|    251|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|    251|  int Ra; \
  |  |   60|    251|  \
  |  |   61|    251|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|    251|  *undiff_buf++ = Ra; \
  |  |   63|    251|  \
  |  |   64|  10.9k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 10.7k, False: 251]
  |  |  ------------------
  |  |   65|  10.7k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  10.7k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  10.7k|    *undiff_buf++ = Ra; \
  |  |   67|  10.7k|  }
  ------------------
  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|    251|  switch (cinfo->Ss) {
  188|     32|  case 1:
  ------------------
  |  Branch (188:3): [True: 32, False: 219]
  ------------------
  189|     32|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|     32|    break;
  191|     45|  case 2:
  ------------------
  |  Branch (191:3): [True: 45, False: 206]
  ------------------
  192|     45|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|     45|    break;
  194|     49|  case 3:
  ------------------
  |  Branch (194:3): [True: 49, False: 202]
  ------------------
  195|     49|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|     49|    break;
  197|     42|  case 4:
  ------------------
  |  Branch (197:3): [True: 42, False: 209]
  ------------------
  198|     42|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|     42|    break;
  200|     27|  case 5:
  ------------------
  |  Branch (200:3): [True: 27, False: 224]
  ------------------
  201|     27|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|     27|    break;
  203|     29|  case 6:
  ------------------
  |  Branch (203:3): [True: 29, False: 222]
  ------------------
  204|     29|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|     29|    break;
  206|     27|  case 7:
  ------------------
  |  Branch (206:3): [True: 27, False: 224]
  ------------------
  207|     27|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|     27|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 251]
  ------------------
  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|    251|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|    251|  }
  213|    251|}
jdlossls-8.c:jpeg_undifference1:
  111|  1.25k|{
  112|  1.25k|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|  1.25k|  int Ra; \
  |  |   60|  1.25k|  \
  |  |   61|  1.25k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  1.25k|  *undiff_buf++ = Ra; \
  |  |   63|  1.25k|  \
  |  |   64|  75.0k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 73.8k, False: 1.25k]
  |  |  ------------------
  |  |   65|  73.8k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  73.8k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  73.8k|    *undiff_buf++ = Ra; \
  |  |   67|  73.8k|  }
  ------------------
  113|  1.25k|}
jdlossls-8.c:jpeg_undifference2:
  119|  2.49k|{
  120|  2.49k|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|  2.49k|  int Ra, Rb, Rc; \
  |  |   87|  2.49k|  \
  |  |   88|  2.49k|  Rb = *prev_row++; \
  |  |   89|  2.49k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  2.49k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  2.49k|  *undiff_buf++ = Ra; \
  |  |   91|  2.49k|  \
  |  |   92|  53.6k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 51.1k, False: 2.49k]
  |  |  ------------------
  |  |   93|  51.1k|    Rc = Rb; \
  |  |   94|  51.1k|    Rb = *prev_row++; \
  |  |   95|  51.1k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  51.1k|    *undiff_buf++ = Ra; \
  |  |   97|  51.1k|  }
  ------------------
  121|  2.49k|  (void)(Rc);
  122|  2.49k|}
jdlossls-8.c:jpeg_undifference3:
  128|  1.20k|{
  129|  1.20k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  1.20k|  int Ra, Rb, Rc; \
  |  |   87|  1.20k|  \
  |  |   88|  1.20k|  Rb = *prev_row++; \
  |  |   89|  1.20k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.20k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.20k|  *undiff_buf++ = Ra; \
  |  |   91|  1.20k|  \
  |  |   92|  39.1k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 37.9k, False: 1.20k]
  |  |  ------------------
  |  |   93|  37.9k|    Rc = Rb; \
  |  |   94|  37.9k|    Rb = *prev_row++; \
  |  |   95|  37.9k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  37.9k|    *undiff_buf++ = Ra; \
  |  |   97|  37.9k|  }
  ------------------
  130|  1.20k|}
jdlossls-8.c:jpeg_undifference4:
  136|  4.51k|{
  137|  4.51k|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|  4.51k|  int Ra, Rb, Rc; \
  |  |   87|  4.51k|  \
  |  |   88|  4.51k|  Rb = *prev_row++; \
  |  |   89|  4.51k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  4.51k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  4.51k|  *undiff_buf++ = Ra; \
  |  |   91|  4.51k|  \
  |  |   92|  22.7k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 18.2k, False: 4.51k]
  |  |  ------------------
  |  |   93|  18.2k|    Rc = Rb; \
  |  |   94|  18.2k|    Rb = *prev_row++; \
  |  |   95|  18.2k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  18.2k|    *undiff_buf++ = Ra; \
  |  |   97|  18.2k|  }
  ------------------
  138|  4.51k|}
jdlossls-8.c:jpeg_undifference5:
  144|  1.54k|{
  145|  1.54k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|  1.54k|  int Ra, Rb, Rc; \
  |  |   87|  1.54k|  \
  |  |   88|  1.54k|  Rb = *prev_row++; \
  |  |   89|  1.54k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.54k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.54k|  *undiff_buf++ = Ra; \
  |  |   91|  1.54k|  \
  |  |   92|  14.2k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 12.7k, False: 1.54k]
  |  |  ------------------
  |  |   93|  12.7k|    Rc = Rb; \
  |  |   94|  12.7k|    Rb = *prev_row++; \
  |  |   95|  12.7k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  12.7k|    *undiff_buf++ = Ra; \
  |  |   97|  12.7k|  }
  ------------------
  146|  1.54k|}
jdlossls-8.c:jpeg_undifference6:
  152|  2.14k|{
  153|  2.14k|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|  2.14k|  int Ra, Rb, Rc; \
  |  |   87|  2.14k|  \
  |  |   88|  2.14k|  Rb = *prev_row++; \
  |  |   89|  2.14k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  2.14k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  2.14k|  *undiff_buf++ = Ra; \
  |  |   91|  2.14k|  \
  |  |   92|  9.71k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 7.57k, False: 2.14k]
  |  |  ------------------
  |  |   93|  7.57k|    Rc = Rb; \
  |  |   94|  7.57k|    Rb = *prev_row++; \
  |  |   95|  7.57k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  7.57k|    *undiff_buf++ = Ra; \
  |  |   97|  7.57k|  }
  ------------------
  154|  2.14k|}
jdlossls-8.c:jpeg_undifference7:
  160|  2.15k|{
  161|  2.15k|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|  2.15k|  int Ra, Rb, Rc; \
  |  |   87|  2.15k|  \
  |  |   88|  2.15k|  Rb = *prev_row++; \
  |  |   89|  2.15k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  2.15k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  2.15k|  *undiff_buf++ = Ra; \
  |  |   91|  2.15k|  \
  |  |   92|  9.41k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 7.25k, False: 2.15k]
  |  |  ------------------
  |  |   93|  7.25k|    Rc = Rb; \
  |  |   94|  7.25k|    Rb = *prev_row++; \
  |  |   95|  7.25k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  7.25k|    *undiff_buf++ = Ra; \
  |  |   97|  7.25k|  }
  ------------------
  162|  2.15k|  (void)(Rc);
  163|  2.15k|}
jdlossls-8.c:simple_upscale:
  221|  7.29k|{
  222|   161k|  do {
  223|   161k|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|   161k|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 154k, False: 7.29k]
  ------------------
  225|  7.29k|}
jdlossls-8.c:noscale:
  230|  8.27k|{
  231|  73.1k|  do {
  232|  73.1k|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|  73.1k|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 64.9k, False: 8.27k]
  ------------------
  234|  8.27k|}
j12init_lossless_decompressor:
  281|      7|{
  282|      7|  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|      7|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     14|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (287:7): [True: 0, False: 7]
  ------------------
  288|      7|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      7|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (288:7): [True: 0, False: 7]
  ------------------
  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|      7|  losslessd = (lossless_decomp_ptr)
  294|      7|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|      7|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|      7|                                sizeof(jpeg_lossless_decompressor));
  296|      7|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|      7|  losslessd->pub.start_pass = start_pass_lossless;
  298|      7|}
jdlossls-12.c:start_pass_lossless:
  243|      9|{
  244|      9|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|      9|  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|      9|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 1, False: 8]
  |  Branch (257:24): [True: 1, False: 7]
  ------------------
  258|      7|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 1, False: 6]
  |  Branch (258:25): [True: 1, False: 5]
  ------------------
  259|      5|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 5]
  |  Branch (259:24): [True: 1, False: 4]
  ------------------
  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|      9|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|     13|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 4, False: 9]
  ------------------
  265|      4|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|      9|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 2, False: 7]
  ------------------
  269|      2|    losslessd->scaler_scale = simple_upscale;
  270|      7|  else
  271|      7|    losslessd->scaler_scale = noscale;
  272|      9|}
j16init_lossless_decompressor:
  281|      8|{
  282|      8|  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|      8|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     16|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (287:7): [True: 0, False: 8]
  ------------------
  288|      8|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      8|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (288:7): [True: 0, False: 8]
  ------------------
  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|      8|  losslessd = (lossless_decomp_ptr)
  294|      8|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|      8|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|      8|                                sizeof(jpeg_lossless_decompressor));
  296|      8|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|      8|  losslessd->pub.start_pass = start_pass_lossless;
  298|      8|}
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: 2, False: 9]
  ------------------
  269|      2|    losslessd->scaler_scale = simple_upscale;
  270|      9|  else
  271|      9|    losslessd->scaler_scale = noscale;
  272|     11|}

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

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

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

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

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

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

jinit_upsampler:
  438|  1.90k|{
  439|  1.90k|  my_upsample_ptr upsample;
  440|  1.90k|  int ci;
  441|  1.90k|  jpeg_component_info *compptr;
  442|  1.90k|  boolean need_buffer, do_fancy;
  443|  1.90k|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|  1.90k|#ifdef D_LOSSLESS_SUPPORTED
  446|  1.90k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 273, False: 1.63k]
  ------------------
  447|    273|#if BITS_IN_JSAMPLE == 8
  448|    273|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|    546|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (448:9): [True: 0, False: 273]
  |  Branch (448:52): [True: 0, False: 273]
  ------------------
  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|    273|  } else
  455|  1.63k|#endif
  456|  1.63k|  {
  457|  1.63k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.63k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (457:9): [True: 0, False: 1.63k]
  ------------------
  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.63k|  }
  460|       |
  461|  1.90k|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 1.90k, False: 0]
  ------------------
  462|  1.90k|    upsample = (my_upsample_ptr)
  463|  1.90k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.90k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|  1.90k|                                  sizeof(my_upsampler));
  465|  1.90k|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|  1.90k|    upsample->pub.start_pass = start_pass_upsample;
  467|  1.90k|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  265|  1.90k|#define _upsample  upsample
  ------------------
  468|  1.90k|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|  1.90k|#define FALSE   0               /* values of boolean */
  ------------------
  469|  1.90k|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|  1.90k|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 1.90k]
  ------------------
  473|      0|    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  474|       |
  475|       |  /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,
  476|       |   * so don't ask for it.
  477|       |   */
  478|  1.90k|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|  1.90k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 1.90k, False: 0]
  |  Branch (478:44): [True: 1.63k, False: 273]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|  3.99k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 2.09k, False: 1.90k]
  ------------------
  484|  2.09k|       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.09k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  2.09k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|  2.09k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  2.09k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|  2.09k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  2.09k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|  2.09k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  2.09k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|  2.09k|    h_out_group = cinfo->max_h_samp_factor;
  493|  2.09k|    v_out_group = cinfo->max_v_samp_factor;
  494|  2.09k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|  2.09k|    need_buffer = TRUE;
  ------------------
  |  |  210|  2.09k|#define TRUE    1
  ------------------
  496|  2.09k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 2.09k]
  ------------------
  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.09k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 1.92k, False: 170]
  |  Branch (500:45): [True: 1.88k, False: 36]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|  1.88k|      upsample->methods[ci] = fullsize_upsample;
  503|  1.88k|      need_buffer = FALSE;
  ------------------
  |  |  207|  1.88k|#define FALSE   0               /* values of boolean */
  ------------------
  504|  1.88k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 152, False: 54]
  |  Branch (504:49): [True: 61, False: 91]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|     61|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 57, False: 4]
  |  Branch (506:23): [True: 35, False: 22]
  ------------------
  507|     35|#ifdef WITH_SIMD
  508|     35|        if (jsimd_set_h2v1_fancy_upsample(cinfo))
  ------------------
  |  Branch (508:13): [True: 0, False: 35]
  ------------------
  509|      0|          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  510|     35|        else
  511|     35|#endif
  512|     35|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|     35|      } else {
  514|     26|#ifdef WITH_SIMD
  515|     26|        if (jsimd_set_h2v1_upsample(cinfo))
  ------------------
  |  Branch (515:13): [True: 0, False: 26]
  ------------------
  516|      0|          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|     26|        else
  518|     26|#endif
  519|     26|          upsample->methods[ci] = h2v1_upsample;
  520|     26|      }
  521|    145|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 36, False: 109]
  ------------------
  522|     36|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 25, False: 11]
  |  Branch (522:49): [True: 25, False: 0]
  ------------------
  523|       |      /* Non-fancy upsampling is handled by the generic method */
  524|       |#if defined(WITH_SIMD) && (SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM)
  525|       |      if (jsimd_set_h1v2_fancy_upsample(cinfo))
  526|       |        upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
  527|       |      else
  528|       |#endif
  529|     25|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|     25|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|     25|#define TRUE    1
  ------------------
  531|    120|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 91, False: 29]
  ------------------
  532|     91|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 72, False: 19]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|     72|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 66, False: 6]
  |  Branch (534:23): [True: 55, False: 11]
  ------------------
  535|     55|#ifdef WITH_SIMD
  536|     55|        if (jsimd_set_h2v2_fancy_upsample(cinfo))
  ------------------
  |  Branch (536:13): [True: 0, False: 55]
  ------------------
  537|      0|          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  538|     55|        else
  539|     55|#endif
  540|     55|          upsample->methods[ci] = h2v2_fancy_upsample;
  541|     55|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|     55|#define TRUE    1
  ------------------
  542|     55|      } else {
  543|     17|#ifdef WITH_SIMD
  544|     17|        if (jsimd_set_h2v2_upsample(cinfo))
  ------------------
  |  Branch (544:13): [True: 0, False: 17]
  ------------------
  545|      0|          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|     17|        else
  547|     17|#endif
  548|     17|          upsample->methods[ci] = h2v2_upsample;
  549|     17|      }
  550|     72|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 46, False: 2]
  ------------------
  551|     46|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 45, False: 1]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|     45|      upsample->methods[ci] = int_upsample;
  554|     45|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|     45|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|     45|    } 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|  2.09k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 203, False: 1.89k]
  |  Branch (558:24): [True: 203, False: 0]
  ------------------
  559|    203|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|    203|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    203|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|    203|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|    203|                               (long)cinfo->max_h_samp_factor),
  563|    203|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|    203|    }
  565|  2.09k|  }
  566|  1.90k|}
jdsample-8.c:start_pass_upsample:
   47|  1.71k|{
   48|  1.71k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|  1.71k|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|  1.71k|  upsample->rows_to_go = cinfo->output_height;
   54|  1.71k|}
jdsample-8.c:sep_upsample:
   70|   994k|{
   71|   994k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   72|   994k|  int ci;
   73|   994k|  jpeg_component_info *compptr;
   74|   994k|  JDIMENSION num_rows;
   75|       |
   76|       |  /* Fill the conversion buffer, if it's empty */
   77|   994k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (77:7): [True: 430k, False: 563k]
  ------------------
   78|   868k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (78:46): [True: 437k, False: 430k]
  ------------------
   79|   437k|         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|   437k|      (*upsample->methods[ci]) (cinfo, compptr,
   87|   437k|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   88|   437k|        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|   437k|    }
   95|   430k|    upsample->next_row_out = 0;
   96|   430k|  }
   97|       |
   98|       |  /* Color-convert and emit rows */
   99|       |
  100|       |  /* How many we have in the buffer: */
  101|   994k|  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|   994k|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (105:7): [True: 904, False: 993k]
  ------------------
  106|    904|    num_rows = upsample->rows_to_go;
  107|       |  /* And not more than what the client can accept: */
  108|   994k|  out_rows_avail -= *out_row_ctr;
  109|   994k|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (109:7): [True: 563k, False: 430k]
  ------------------
  110|   563k|    num_rows = out_rows_avail;
  111|       |
  112|       |#ifdef WITH_PROFILE
  113|       |  cinfo->master->start = getTime();
  114|       |#endif
  115|   994k|  (*cinfo->cconvert->_color_convert) (cinfo, upsample->color_buf,
  ------------------
  |  |  267|   994k|#define _color_convert  color_convert
  ------------------
  116|   994k|                                      (JDIMENSION)upsample->next_row_out,
  117|   994k|                                      output_buf + *out_row_ctr,
  118|   994k|                                      (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|   994k|  *out_row_ctr += num_rows;
  127|   994k|  upsample->rows_to_go -= num_rows;
  128|   994k|  upsample->next_row_out += num_rows;
  129|       |  /* When the buffer is emptied, declare this input row group consumed */
  130|   994k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (130:7): [True: 430k, False: 564k]
  ------------------
  131|   430k|    (*in_row_group_ctr)++;
  132|   994k|}
jdsample-8.c:fullsize_upsample:
  151|   430k|{
  152|   430k|  *output_data_ptr = input_data;
  153|   430k|}
jdsample-8.c:h2v1_fancy_upsample:
  298|  2.45k|{
  299|  2.45k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|  2.45k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  300|  2.45k|  register _JSAMPROW inptr, outptr;
  301|  2.45k|  register int invalue;
  302|  2.45k|  register JDIMENSION colctr;
  303|  2.45k|  int inrow;
  304|       |
  305|  5.34k|  for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
  ------------------
  |  Branch (305:19): [True: 2.88k, False: 2.45k]
  ------------------
  306|  2.88k|    inptr = input_data[inrow];
  307|  2.88k|    outptr = output_data[inrow];
  308|       |    /* Special case for first column */
  309|  2.88k|    invalue = *inptr++;
  310|  2.88k|    *outptr++ = (_JSAMPLE)invalue;
  311|  2.88k|    *outptr++ = (_JSAMPLE)((invalue * 3 + inptr[0] + 2) >> 2);
  312|       |
  313|  60.8k|    for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
  ------------------
  |  Branch (313:51): [True: 57.9k, False: 2.88k]
  ------------------
  314|       |      /* General case: 3/4 * nearer component + 1/4 * further component */
  315|  57.9k|      invalue = (*inptr++) * 3;
  316|  57.9k|      *outptr++ = (_JSAMPLE)((invalue + inptr[-2] + 1) >> 2);
  317|  57.9k|      *outptr++ = (_JSAMPLE)((invalue + inptr[0] + 2) >> 2);
  318|  57.9k|    }
  319|       |
  320|       |    /* Special case for last column */
  321|  2.88k|    invalue = *inptr;
  322|  2.88k|    *outptr++ = (_JSAMPLE)((invalue * 3 + inptr[-1] + 1) >> 2);
  323|  2.88k|    *outptr++ = (_JSAMPLE)invalue;
  324|  2.88k|  }
  325|  2.45k|}
jdsample-8.c:h2v1_upsample:
  227|    805|{
  228|    805|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|    805|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  229|    805|  register _JSAMPROW inptr, outptr;
  230|    805|  register _JSAMPLE invalue;
  231|    805|  _JSAMPROW outend;
  ------------------
  |  |  229|    805|#define _JSAMPROW  JSAMPROW
  ------------------
  232|    805|  int inrow;
  233|       |
  234|  2.44k|  for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
  ------------------
  |  Branch (234:19): [True: 1.63k, False: 805]
  ------------------
  235|  1.63k|    inptr = input_data[inrow];
  236|  1.63k|    outptr = output_data[inrow];
  237|  1.63k|    outend = outptr + cinfo->output_width;
  238|  4.44k|    while (outptr < outend) {
  ------------------
  |  Branch (238:12): [True: 2.80k, False: 1.63k]
  ------------------
  239|  2.80k|      invalue = *inptr++;
  240|  2.80k|      *outptr++ = invalue;
  241|  2.80k|      *outptr++ = invalue;
  242|  2.80k|    }
  243|  1.63k|  }
  244|    805|}
jdsample-8.c:h1v2_fancy_upsample:
  338|    819|{
  339|    819|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|    819|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  340|    819|  _JSAMPROW inptr0, inptr1, outptr;
  ------------------
  |  |  229|    819|#define _JSAMPROW  JSAMPROW
  ------------------
  341|    819|#if BITS_IN_JSAMPLE == 8
  342|    819|  int thiscolsum, bias;
  343|       |#else
  344|       |  JLONG thiscolsum, bias;
  345|       |#endif
  346|    819|  JDIMENSION colctr;
  347|    819|  int inrow, outrow, v;
  348|       |
  349|    819|  inrow = outrow = 0;
  350|  1.98k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (350:10): [True: 1.16k, False: 819]
  ------------------
  351|  3.49k|    for (v = 0; v < 2; v++) {
  ------------------
  |  Branch (351:17): [True: 2.33k, False: 1.16k]
  ------------------
  352|       |      /* inptr0 points to nearest input row, inptr1 points to next nearest */
  353|  2.33k|      inptr0 = input_data[inrow];
  354|  2.33k|      if (v == 0) {             /* next nearest is row above */
  ------------------
  |  Branch (354:11): [True: 1.16k, False: 1.16k]
  ------------------
  355|  1.16k|        inptr1 = input_data[inrow - 1];
  356|  1.16k|        bias = 1;
  357|  1.16k|      } else {                  /* next nearest is row below */
  358|  1.16k|        inptr1 = input_data[inrow + 1];
  359|  1.16k|        bias = 2;
  360|  1.16k|      }
  361|  2.33k|      outptr = output_data[outrow++];
  362|       |
  363|  46.6k|      for (colctr = 0; colctr < compptr->downsampled_width; colctr++) {
  ------------------
  |  Branch (363:24): [True: 44.3k, False: 2.33k]
  ------------------
  364|  44.3k|        thiscolsum = (*inptr0++) * 3 + (*inptr1++);
  365|  44.3k|        *outptr++ = (_JSAMPLE)((thiscolsum + bias) >> 2);
  366|  44.3k|      }
  367|  2.33k|    }
  368|  1.16k|    inrow++;
  369|  1.16k|  }
  370|    819|}
jdsample-8.c:h2v2_fancy_upsample:
  384|  1.58k|{
  385|  1.58k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|  1.58k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  386|  1.58k|  register _JSAMPROW inptr0, inptr1, outptr;
  387|  1.58k|#if BITS_IN_JSAMPLE == 8
  388|  1.58k|  register int thiscolsum, lastcolsum, nextcolsum;
  389|       |#else
  390|       |  register JLONG thiscolsum, lastcolsum, nextcolsum;
  391|       |#endif
  392|  1.58k|  register JDIMENSION colctr;
  393|  1.58k|  int inrow, outrow, v;
  394|       |
  395|  1.58k|  inrow = outrow = 0;
  396|  3.16k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (396:10): [True: 1.58k, False: 1.58k]
  ------------------
  397|  4.74k|    for (v = 0; v < 2; v++) {
  ------------------
  |  Branch (397:17): [True: 3.16k, False: 1.58k]
  ------------------
  398|       |      /* inptr0 points to nearest input row, inptr1 points to next nearest */
  399|  3.16k|      inptr0 = input_data[inrow];
  400|  3.16k|      if (v == 0)               /* next nearest is row above */
  ------------------
  |  Branch (400:11): [True: 1.58k, False: 1.58k]
  ------------------
  401|  1.58k|        inptr1 = input_data[inrow - 1];
  402|  1.58k|      else                      /* next nearest is row below */
  403|  1.58k|        inptr1 = input_data[inrow + 1];
  404|  3.16k|      outptr = output_data[outrow++];
  405|       |
  406|       |      /* Special case for first column */
  407|  3.16k|      thiscolsum = (*inptr0++) * 3 + (*inptr1++);
  408|  3.16k|      nextcolsum = (*inptr0++) * 3 + (*inptr1++);
  409|  3.16k|      *outptr++ = (_JSAMPLE)((thiscolsum * 4 + 8) >> 4);
  410|  3.16k|      *outptr++ = (_JSAMPLE)((thiscolsum * 3 + nextcolsum + 7) >> 4);
  411|  3.16k|      lastcolsum = thiscolsum;  thiscolsum = nextcolsum;
  412|       |
  413|   149k|      for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
  ------------------
  |  Branch (413:53): [True: 146k, False: 3.16k]
  ------------------
  414|       |        /* General case: 3/4 * nearer component + 1/4 * further component in
  415|       |         * each dimension, thus 9/16, 3/16, 3/16, 1/16 overall
  416|       |         */
  417|   146k|        nextcolsum = (*inptr0++) * 3 + (*inptr1++);
  418|   146k|        *outptr++ = (_JSAMPLE)((thiscolsum * 3 + lastcolsum + 8) >> 4);
  419|   146k|        *outptr++ = (_JSAMPLE)((thiscolsum * 3 + nextcolsum + 7) >> 4);
  420|   146k|        lastcolsum = thiscolsum;  thiscolsum = nextcolsum;
  421|   146k|      }
  422|       |
  423|       |      /* Special case for last column */
  424|  3.16k|      *outptr++ = (_JSAMPLE)((thiscolsum * 3 + lastcolsum + 8) >> 4);
  425|  3.16k|      *outptr++ = (_JSAMPLE)((thiscolsum * 4 + 7) >> 4);
  426|  3.16k|    }
  427|  1.58k|    inrow++;
  428|  1.58k|  }
  429|  1.58k|}
jdsample-8.c:h2v2_upsample:
  255|    380|{
  256|    380|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|    380|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  257|    380|  register _JSAMPROW inptr, outptr;
  258|    380|  register _JSAMPLE invalue;
  259|    380|  _JSAMPROW outend;
  ------------------
  |  |  229|    380|#define _JSAMPROW  JSAMPROW
  ------------------
  260|    380|  int inrow, outrow;
  261|       |
  262|    380|  inrow = outrow = 0;
  263|    792|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (263:10): [True: 412, False: 380]
  ------------------
  264|    412|    inptr = input_data[inrow];
  265|    412|    outptr = output_data[outrow];
  266|    412|    outend = outptr + cinfo->output_width;
  267|  1.23k|    while (outptr < outend) {
  ------------------
  |  Branch (267:12): [True: 824, False: 412]
  ------------------
  268|    824|      invalue = *inptr++;
  269|    824|      *outptr++ = invalue;
  270|    824|      *outptr++ = invalue;
  271|    824|    }
  272|    412|    _jcopy_sample_rows(output_data, outrow, output_data, outrow + 1, 1,
  ------------------
  |  |  297|    412|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  273|    412|                       cinfo->output_width);
  274|    412|    inrow++;
  275|    412|    outrow += 2;
  276|    412|  }
  277|    380|}
jdsample-8.c:int_upsample:
  183|    756|{
  184|    756|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
  185|    756|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|    756|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  186|    756|  register _JSAMPROW inptr, outptr;
  187|    756|  register _JSAMPLE invalue;
  188|    756|  register int h;
  189|    756|  _JSAMPROW outend;
  ------------------
  |  |  229|    756|#define _JSAMPROW  JSAMPROW
  ------------------
  190|    756|  int h_expand, v_expand;
  191|    756|  int inrow, outrow;
  192|       |
  193|    756|  h_expand = upsample->h_expand[compptr->component_index];
  194|    756|  v_expand = upsample->v_expand[compptr->component_index];
  195|       |
  196|    756|  inrow = outrow = 0;
  197|  1.51k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (197:10): [True: 756, False: 756]
  ------------------
  198|       |    /* Generate one output row with proper horizontal expansion */
  199|    756|    inptr = input_data[inrow];
  200|    756|    outptr = output_data[outrow];
  201|    756|    outend = outptr + cinfo->output_width;
  202|  47.2k|    while (outptr < outend) {
  ------------------
  |  Branch (202:12): [True: 46.5k, False: 756]
  ------------------
  203|  46.5k|      invalue = *inptr++;
  204|   111k|      for (h = h_expand; h > 0; h--) {
  ------------------
  |  Branch (204:26): [True: 64.9k, False: 46.5k]
  ------------------
  205|  64.9k|        *outptr++ = invalue;
  206|  64.9k|      }
  207|  46.5k|    }
  208|       |    /* Generate any additional output rows by duplicating the first one */
  209|    756|    if (v_expand > 1) {
  ------------------
  |  Branch (209:9): [True: 540, False: 216]
  ------------------
  210|    540|      _jcopy_sample_rows(output_data, outrow, output_data, outrow + 1,
  ------------------
  |  |  297|    540|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  211|    540|                         v_expand - 1, cinfo->output_width);
  212|    540|    }
  213|    756|    inrow++;
  214|    756|    outrow += v_expand;
  215|    756|  }
  216|    756|}
j12init_upsampler:
  438|    106|{
  439|    106|  my_upsample_ptr upsample;
  440|    106|  int ci;
  441|    106|  jpeg_component_info *compptr;
  442|    106|  boolean need_buffer, do_fancy;
  443|    106|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|    106|#ifdef D_LOSSLESS_SUPPORTED
  446|    106|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 7, False: 99]
  ------------------
  447|       |#if BITS_IN_JSAMPLE == 8
  448|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  449|       |#else
  450|      7|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     14|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (450:9): [True: 0, False: 7]
  ------------------
  451|      7|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      7|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (451:9): [True: 0, False: 7]
  ------------------
  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|      7|  } else
  455|     99|#endif
  456|     99|  {
  457|     99|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|     99|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (457:9): [True: 0, False: 99]
  ------------------
  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|     99|  }
  460|       |
  461|    106|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 106, False: 0]
  ------------------
  462|    106|    upsample = (my_upsample_ptr)
  463|    106|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    106|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|    106|                                  sizeof(my_upsampler));
  465|    106|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|    106|    upsample->pub.start_pass = start_pass_upsample;
  467|    106|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  149|    106|#define _upsample  upsample_12
  ------------------
  468|    106|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|    106|#define FALSE   0               /* values of boolean */
  ------------------
  469|    106|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|    106|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 106]
  ------------------
  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|    106|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|    106|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 106, False: 0]
  |  Branch (478:44): [True: 99, False: 7]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|    224|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 118, False: 106]
  ------------------
  484|    118|       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|    118|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    118|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|    118|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    118|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|    118|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    118|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|    118|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    118|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|    118|    h_out_group = cinfo->max_h_samp_factor;
  493|    118|    v_out_group = cinfo->max_v_samp_factor;
  494|    118|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|    118|    need_buffer = TRUE;
  ------------------
  |  |  210|    118|#define TRUE    1
  ------------------
  496|    118|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 118]
  ------------------
  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|    118|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 106, False: 12]
  |  Branch (500:45): [True: 105, False: 1]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|    105|      upsample->methods[ci] = fullsize_upsample;
  503|    105|      need_buffer = FALSE;
  ------------------
  |  |  207|    105|#define FALSE   0               /* values of boolean */
  ------------------
  504|    105|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 11, False: 2]
  |  Branch (504:49): [True: 2, False: 9]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|      2|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 2, False: 0]
  |  Branch (506:23): [True: 2, 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|      2|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|      2|      } else {
  514|       |#ifdef WITH_SIMD
  515|       |        if (jsimd_set_h2v1_upsample(cinfo))
  516|       |          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|       |        else
  518|       |#endif
  519|      0|          upsample->methods[ci] = h2v1_upsample;
  520|      0|      }
  521|     11|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 1, False: 10]
  ------------------
  522|      1|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 1, False: 0]
  |  Branch (522:49): [True: 1, False: 0]
  ------------------
  523|       |      /* Non-fancy upsampling is handled by the generic method */
  524|       |#if defined(WITH_SIMD) && (SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM)
  525|       |      if (jsimd_set_h1v2_fancy_upsample(cinfo))
  526|       |        upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
  527|       |      else
  528|       |#endif
  529|      1|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|      1|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      1|#define TRUE    1
  ------------------
  531|     10|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 9, False: 1]
  ------------------
  532|      9|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 7, False: 2]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|      7|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 7, False: 0]
  |  Branch (534:23): [True: 3, False: 4]
  ------------------
  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|      4|      } else {
  543|       |#ifdef WITH_SIMD
  544|       |        if (jsimd_set_h2v2_upsample(cinfo))
  545|       |          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|       |        else
  547|       |#endif
  548|      4|          upsample->methods[ci] = h2v2_upsample;
  549|      4|      }
  550|      7|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 2, False: 1]
  ------------------
  551|      2|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 2, False: 0]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|      2|      upsample->methods[ci] = int_upsample;
  554|      2|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|      2|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|      2|    } else
  557|      1|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  558|    118|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 12, False: 106]
  |  Branch (558:24): [True: 12, False: 0]
  ------------------
  559|     12|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|     12|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     12|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|     12|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|     12|                               (long)cinfo->max_h_samp_factor),
  563|     12|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|     12|    }
  565|    118|  }
  566|    106|}
jdsample-12.c:start_pass_upsample:
   47|     29|{
   48|     29|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|     29|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|     29|  upsample->rows_to_go = cinfo->output_height;
   54|     29|}
j16init_upsampler:
  438|      8|{
  439|      8|  my_upsample_ptr upsample;
  440|      8|  int ci;
  441|      8|  jpeg_component_info *compptr;
  442|      8|  boolean need_buffer, do_fancy;
  443|      8|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|      8|#ifdef D_LOSSLESS_SUPPORTED
  446|      8|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 8, False: 0]
  ------------------
  447|       |#if BITS_IN_JSAMPLE == 8
  448|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  449|       |#else
  450|      8|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     16|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (450:9): [True: 0, False: 8]
  ------------------
  451|      8|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      8|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (451:9): [True: 0, False: 8]
  ------------------
  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|      8|  } 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|      8|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 8, False: 0]
  ------------------
  462|      8|    upsample = (my_upsample_ptr)
  463|      8|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      8|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|      8|                                  sizeof(my_upsampler));
  465|      8|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|      8|    upsample->pub.start_pass = start_pass_upsample;
  467|      8|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |   57|      8|#define _upsample  upsample_16
  ------------------
  468|      8|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|      8|#define FALSE   0               /* values of boolean */
  ------------------
  469|      8|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|      8|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 8]
  ------------------
  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|      8|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|      8|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 8, False: 0]
  |  Branch (478:44): [True: 0, False: 8]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|     18|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 10, False: 8]
  ------------------
  484|     10|       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|     10|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|     10|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|     10|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|     10|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|     10|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|     10|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|     10|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|     10|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|     10|    h_out_group = cinfo->max_h_samp_factor;
  493|     10|    v_out_group = cinfo->max_v_samp_factor;
  494|     10|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|     10|    need_buffer = TRUE;
  ------------------
  |  |  210|     10|#define TRUE    1
  ------------------
  496|     10|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 10]
  ------------------
  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|     10|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 8, False: 2]
  |  Branch (500:45): [True: 8, False: 0]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|      8|      upsample->methods[ci] = fullsize_upsample;
  503|      8|      need_buffer = FALSE;
  ------------------
  |  |  207|      8|#define FALSE   0               /* values of boolean */
  ------------------
  504|      8|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 2, False: 0]
  |  Branch (504:49): [True: 0, False: 2]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|      0|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 0, False: 0]
  |  Branch (506:23): [True: 0, False: 0]
  ------------------
  507|       |#ifdef WITH_SIMD
  508|       |        if (jsimd_set_h2v1_fancy_upsample(cinfo))
  509|       |          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  510|       |        else
  511|       |#endif
  512|      0|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|      0|      } else {
  514|       |#ifdef WITH_SIMD
  515|       |        if (jsimd_set_h2v1_upsample(cinfo))
  516|       |          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|       |        else
  518|       |#endif
  519|      0|          upsample->methods[ci] = h2v1_upsample;
  520|      0|      }
  521|      2|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 0, False: 2]
  ------------------
  522|      0|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 0, False: 0]
  |  Branch (522:49): [True: 0, False: 0]
  ------------------
  523|       |      /* Non-fancy upsampling is handled by the generic method */
  524|       |#if defined(WITH_SIMD) && (SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM)
  525|       |      if (jsimd_set_h1v2_fancy_upsample(cinfo))
  526|       |        upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
  527|       |      else
  528|       |#endif
  529|      0|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|      0|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  531|      2|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 2, False: 0]
  ------------------
  532|      2|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 2, False: 0]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|      2|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 0, False: 2]
  |  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|      2|      } else {
  543|       |#ifdef WITH_SIMD
  544|       |        if (jsimd_set_h2v2_upsample(cinfo))
  545|       |          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|       |        else
  547|       |#endif
  548|      2|          upsample->methods[ci] = h2v2_upsample;
  549|      2|      }
  550|      2|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 0, False: 0]
  ------------------
  551|      0|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 0, False: 0]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|      0|      upsample->methods[ci] = int_upsample;
  554|      0|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|      0|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|      0|    } else
  557|      0|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  558|     10|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 2, False: 8]
  |  Branch (558:24): [True: 2, False: 0]
  ------------------
  559|      2|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|      2|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|      2|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|      2|                               (long)cinfo->max_h_samp_factor),
  563|      2|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|      2|    }
  565|     10|  }
  566|      8|}
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|  4.68k|{
  230|  4.68k|  memset(err, 0, sizeof(struct jpeg_error_mgr));
  231|       |
  232|  4.68k|  err->error_exit = error_exit;
  233|  4.68k|  err->emit_message = emit_message;
  234|  4.68k|  err->output_message = output_message;
  235|  4.68k|  err->format_message = format_message;
  236|  4.68k|  err->reset_error_mgr = reset_error_mgr;
  237|       |
  238|       |  /* Initialize message table pointers */
  239|  4.68k|  err->jpeg_message_table = jpeg_std_message_table;
  240|  4.68k|  err->last_jpeg_message = (int)JMSG_LASTMSGCODE - 1;
  241|       |
  242|  4.68k|  return err;
  243|  4.68k|}
jerror.c:format_message:
  155|    448|{
  156|    448|  struct jpeg_error_mgr *err = cinfo->err;
  157|    448|  int msg_code = err->msg_code;
  158|    448|  const char *msgtext = NULL;
  159|    448|  const char *msgptr;
  160|    448|  char ch;
  161|    448|  boolean isstring;
  162|       |
  163|       |  /* Look up message string in proper table */
  164|    448|  if (msg_code > 0 && msg_code <= err->last_jpeg_message) {
  ------------------
  |  Branch (164:7): [True: 448, False: 0]
  |  Branch (164:23): [True: 448, False: 0]
  ------------------
  165|    448|    msgtext = err->jpeg_message_table[msg_code];
  166|    448|  } 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|    448|  if (msgtext == NULL) {
  ------------------
  |  Branch (173:7): [True: 0, False: 448]
  ------------------
  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|    448|  isstring = FALSE;
  ------------------
  |  |  207|    448|#define FALSE   0               /* values of boolean */
  ------------------
  180|    448|  msgptr = msgtext;
  181|  12.7k|  while ((ch = *msgptr++) != '\0') {
  ------------------
  |  Branch (181:10): [True: 12.5k, False: 121]
  ------------------
  182|  12.5k|    if (ch == '%') {
  ------------------
  |  Branch (182:9): [True: 327, False: 12.2k]
  ------------------
  183|    327|      if (*msgptr == 's') isstring = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (183:11): [True: 0, False: 327]
  ------------------
  184|    327|      break;
  185|    327|    }
  186|  12.5k|  }
  187|       |
  188|       |  /* Format the message into the passed buffer */
  189|    448|  if (isstring)
  ------------------
  |  Branch (189:7): [True: 0, False: 448]
  ------------------
  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|    448|  else
  192|    448|    SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
  ------------------
  |  |   55|    448|#define SNPRINTF  snprintf
  ------------------
                  SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
  ------------------
  |  |  792|    448|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  193|    448|             err->msg_parm.i[0], err->msg_parm.i[1],
  194|    448|             err->msg_parm.i[2], err->msg_parm.i[3],
  195|    448|             err->msg_parm.i[4], err->msg_parm.i[5],
  196|    448|             err->msg_parm.i[6], err->msg_parm.i[7]);
  197|    448|}
jerror.c:reset_error_mgr:
  210|  2.34k|{
  211|  2.34k|  cinfo->err->num_warnings = 0;
  212|       |  /* trace_level is not reset since it is an application-supplied parameter */
  213|  2.34k|  cinfo->err->msg_code = 0;     /* may be useful as a flag for "no error" */
  214|  2.34k|}

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

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

jinit_memory_mgr:
 1196|  2.34k|{
 1197|  2.34k|  my_mem_ptr mem;
 1198|  2.34k|  long max_to_use;
 1199|  2.34k|  int pool;
 1200|  2.34k|  size_t test_mac;
 1201|       |
 1202|  2.34k|  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.34k|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  2.34k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  2.34k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1211:7): [Folded, False: 2.34k]
  ------------------
 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.34k|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  2.34k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1219|  2.34k|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|  4.68k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1219:7): [True: 0, False: 2.34k]
  ------------------
 1220|  2.34k|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|  2.34k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  2.34k|#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.34k|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1224|       |
 1225|       |  /* Attempt to allocate memory manager's control block */
 1226|  2.34k|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1227|       |
 1228|  2.34k|  if (mem == NULL) {
  ------------------
  |  Branch (1228:7): [True: 0, False: 2.34k]
  ------------------
 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.34k|  mem->pub.alloc_small = alloc_small;
 1235|  2.34k|  mem->pub.alloc_large = alloc_large;
 1236|  2.34k|  mem->pub.alloc_sarray = alloc_sarray;
 1237|  2.34k|  mem->pub.alloc_barray = alloc_barray;
 1238|  2.34k|  mem->pub.request_virt_sarray = request_virt_sarray;
 1239|  2.34k|  mem->pub.request_virt_barray = request_virt_barray;
 1240|  2.34k|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1241|  2.34k|  mem->pub.access_virt_sarray = access_virt_sarray;
 1242|  2.34k|  mem->pub.access_virt_barray = access_virt_barray;
 1243|  2.34k|  mem->pub.free_pool = free_pool;
 1244|  2.34k|  mem->pub.self_destruct = self_destruct;
 1245|       |
 1246|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1247|  2.34k|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  2.34k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1248|       |
 1249|       |  /* Initialize working state */
 1250|  2.34k|  mem->pub.max_memory_to_use = max_to_use;
 1251|       |
 1252|  7.02k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  2.34k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  7.02k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1252:35): [True: 4.68k, False: 2.34k]
  ------------------
 1253|  4.68k|    mem->small_list[pool] = NULL;
 1254|  4.68k|    mem->large_list[pool] = NULL;
 1255|  4.68k|  }
 1256|  2.34k|  mem->virt_sarray_list = NULL;
 1257|  2.34k|  mem->virt_barray_list = NULL;
 1258|       |
 1259|  2.34k|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1260|       |
 1261|       |  /* Declare ourselves open for business */
 1262|  2.34k|  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.34k|#ifndef NO_GETENV
 1271|  2.34k|  {
 1272|  2.34k|    char memenv[30] = { 0 };
 1273|       |
 1274|  2.34k|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1274:9): [True: 2.34k, False: 0]
  |  Branch (1274:45): [True: 0, False: 2.34k]
  ------------------
 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.34k|  }
 1288|  2.34k|#endif
 1289|       |
 1290|  2.34k|}
jmemmgr.c:alloc_small:
  269|  50.9k|{
  270|  50.9k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  271|  50.9k|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  272|  50.9k|  char *data_ptr;
  273|  50.9k|  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|  50.9k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  50.9k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (281:7): [True: 0, False: 50.9k]
  ------------------
  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|  50.9k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  50.9k|#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|  50.9k|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  50.9k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (289:7): [True: 0, False: 50.9k]
  ------------------
  290|  50.9k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  50.9k|#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|  50.9k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  50.9k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (294:7): [True: 0, False: 50.9k]
  |  Branch (294:22): [True: 0, False: 50.9k]
  ------------------
  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|  50.9k|  prev_hdr_ptr = NULL;
  297|  50.9k|  hdr_ptr = mem->small_list[pool_id];
  298|  51.8k|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (298:10): [True: 46.5k, False: 5.26k]
  ------------------
  299|  46.5k|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (299:9): [True: 45.7k, False: 840]
  ------------------
  300|  45.7k|      break;                    /* found pool with enough space */
  301|    840|    prev_hdr_ptr = hdr_ptr;
  302|    840|    hdr_ptr = hdr_ptr->next;
  303|    840|  }
  304|       |
  305|       |  /* Time to make a new pool? */
  306|  50.9k|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (306:7): [True: 5.26k, False: 45.7k]
  ------------------
  307|       |    /* min_request is what we need now, slop is what will be leftover */
  308|  5.26k|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  5.26k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  309|  5.26k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (309:9): [True: 4.50k, False: 762]
  ------------------
  310|  4.50k|      slop = first_pool_slop[pool_id];
  311|    762|    else
  312|    762|      slop = extra_pool_slop[pool_id];
  313|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  314|  5.26k|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|  5.26k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (314:9): [True: 0, False: 5.26k]
  ------------------
  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.26k|    for (;;) {
  318|  5.26k|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  319|  5.26k|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (319:11): [True: 5.26k, False: 0]
  ------------------
  320|  5.26k|        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.26k|    mem->total_space_allocated += min_request + slop;
  326|       |    /* Success, initialize the new pool header and add to end of list */
  327|  5.26k|    hdr_ptr->next = NULL;
  328|  5.26k|    hdr_ptr->bytes_used = 0;
  329|  5.26k|    hdr_ptr->bytes_left = sizeofobject + slop;
  330|  5.26k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (330:9): [True: 4.50k, False: 762]
  ------------------
  331|  4.50k|      mem->small_list[pool_id] = hdr_ptr;
  332|    762|    else
  333|    762|      prev_hdr_ptr->next = hdr_ptr;
  334|  5.26k|  }
  335|       |
  336|       |  /* OK, allocate the object from the current pool */
  337|  50.9k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  338|  50.9k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  339|  50.9k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  50.9k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (339:7): [True: 50.9k, False: 0]
  ------------------
  340|  50.9k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  50.9k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  50.9k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  341|  50.9k|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  342|  50.9k|  hdr_ptr->bytes_used += sizeofobject;
  343|  50.9k|  hdr_ptr->bytes_left -= sizeofobject;
  344|       |
  345|  50.9k|  return (void *)data_ptr;
  346|  50.9k|}
jmemmgr.c:round_up_pow2:
   45|  62.8k|{
   46|  62.8k|  return ((a + b - 1) & (~(b - 1)));
   47|  62.8k|}
jmemmgr.c:alloc_large:
  366|  6.78k|{
  367|  6.78k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  368|  6.78k|  large_pool_ptr hdr_ptr;
  369|  6.78k|  char *data_ptr;
  370|       |
  371|       |  /*
  372|       |   * Round up the requested size to a multiple of ALIGN_SIZE so that
  373|       |   * algorithms can straddle outside the proper area up to the next
  374|       |   * alignment.
  375|       |   */
  376|  6.78k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  6.78k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (376:7): [True: 0, False: 6.78k]
  ------------------
  377|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  378|       |       is close to SIZE_MAX. */
  379|      0|    out_of_memory(cinfo, 8);
  380|      0|  }
  381|  6.78k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  6.78k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  382|       |
  383|       |  /* Check for unsatisfiable request (do now to ensure no overflow below) */
  384|  6.78k|  if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  6.78k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (384:7): [True: 0, False: 6.78k]
  ------------------
  385|  6.78k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  6.78k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  386|      0|    out_of_memory(cinfo, 3);    /* request exceeds malloc's ability */
  387|       |
  388|       |  /* Always make a new pool */
  389|  6.78k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  6.78k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (389:7): [True: 0, False: 6.78k]
  |  Branch (389:22): [True: 0, False: 6.78k]
  ------------------
  390|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  391|       |
  392|  6.78k|  hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
  393|  6.78k|                                           sizeof(large_pool_hdr) +
  394|  6.78k|                                           ALIGN_SIZE - 1);
  ------------------
  |  |   89|  6.78k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  395|  6.78k|  if (hdr_ptr == NULL)
  ------------------
  |  Branch (395:7): [True: 0, False: 6.78k]
  ------------------
  396|      0|    out_of_memory(cinfo, 4);    /* jpeg_get_large failed */
  397|  6.78k|  mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
  398|  6.78k|                                ALIGN_SIZE - 1;
  ------------------
  |  |   89|  6.78k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  399|       |
  400|       |  /* Success, initialize the new pool header and add to list */
  401|  6.78k|  hdr_ptr->next = mem->large_list[pool_id];
  402|       |  /* We maintain space counts in each pool header for statistical purposes,
  403|       |   * even though they are not needed for allocation.
  404|       |   */
  405|  6.78k|  hdr_ptr->bytes_used = sizeofobject;
  406|  6.78k|  hdr_ptr->bytes_left = 0;
  407|  6.78k|  mem->large_list[pool_id] = hdr_ptr;
  408|       |
  409|  6.78k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  410|  6.78k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  411|  6.78k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  6.78k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (411:7): [True: 6.78k, False: 0]
  ------------------
  412|  6.78k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  6.78k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  6.78k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  413|       |
  414|  6.78k|  return (void *)data_ptr;
  415|  6.78k|}
jmemmgr.c:alloc_sarray:
  438|  5.05k|{
  439|  5.05k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  440|  5.05k|  JSAMPARRAY result;
  441|  5.05k|  JSAMPROW workspace;
  442|  5.05k|  JDIMENSION rowsperchunk, currow, i;
  443|  5.05k|  long ltemp;
  444|  5.05k|  J12SAMPARRAY result12;
  445|  5.05k|  J12SAMPROW workspace12;
  446|  5.05k|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  447|  5.05k|  J16SAMPARRAY result16;
  448|  5.05k|  J16SAMPROW workspace16;
  449|  5.05k|#endif
  450|  5.05k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (450:24): [True: 5.05k, False: 0]
  ------------------
  451|  5.05k|                        ((j_decompress_ptr)cinfo)->data_precision :
  452|  5.05k|                        ((j_compress_ptr)cinfo)->data_precision;
  453|  5.05k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (453:24): [True: 41, False: 5.01k]
  ------------------
  454|  5.01k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (454:45): [True: 249, False: 4.76k]
  ------------------
  455|    249|                                            sizeof(J12SAMPLE) :
  456|  5.01k|                                            sizeof(JSAMPLE));
  457|       |
  458|       |  /* Make sure each row is properly aligned */
  459|  5.05k|  if ((ALIGN_SIZE % sample_size) != 0)
  ------------------
  |  |   89|  5.05k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (459:7): [True: 0, False: 5.05k]
  ------------------
  460|      0|    out_of_memory(cinfo, 5);    /* safety check */
  461|       |
  462|  5.05k|  if (samplesperrow == 0 || samplesperrow > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  5.05k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (462:7): [True: 0, False: 5.05k]
  |  Branch (462:29): [True: 0, False: 5.05k]
  ------------------
  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.05k|  samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) /
  ------------------
  |  |   89|  5.05k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  468|  5.05k|                                                           sample_size);
  469|       |
  470|       |  /* Calculate max # of rows allowed in one allocation chunk */
  471|  5.05k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  5.05k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  472|  5.05k|          ((long)samplesperrow * (long)sample_size);
  473|  5.05k|  if (ltemp <= 0)
  ------------------
  |  Branch (473:7): [True: 0, False: 5.05k]
  ------------------
  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.05k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (475:7): [True: 0, False: 5.05k]
  ------------------
  476|      0|    rowsperchunk = (JDIMENSION)ltemp;
  477|  5.05k|  else
  478|  5.05k|    rowsperchunk = numrows;
  479|  5.05k|  mem->last_rowsperchunk = rowsperchunk;
  480|       |
  481|  5.05k|  if (data_precision <= 8) {
  ------------------
  |  Branch (481:7): [True: 4.76k, False: 290]
  ------------------
  482|       |    /* Get space for row pointers (small object) */
  483|  4.76k|    result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
  484|  4.76k|                                     (size_t)(numrows * sizeof(JSAMPROW)));
  485|       |
  486|       |    /* Get the rows themselves (large objects) */
  487|  4.76k|    currow = 0;
  488|  9.52k|    while (currow < numrows) {
  ------------------
  |  Branch (488:12): [True: 4.76k, False: 4.76k]
  ------------------
  489|  4.76k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|  4.76k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 4.76k]
  |  |  ------------------
  ------------------
  490|  4.76k|      workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
  491|  4.76k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  492|  39.0k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (492:30): [True: 34.3k, False: 4.76k]
  ------------------
  493|  34.3k|        result[currow++] = workspace;
  494|  34.3k|        workspace += samplesperrow;
  495|  34.3k|      }
  496|  4.76k|    }
  497|       |
  498|  4.76k|    return result;
  499|  4.76k|  } else if (data_precision <= 12) {
  ------------------
  |  Branch (499:14): [True: 249, False: 41]
  ------------------
  500|       |    /* Get space for row pointers (small object) */
  501|    249|    result12 = (J12SAMPARRAY)alloc_small(cinfo, pool_id,
  502|    249|                                         (size_t)(numrows *
  503|    249|                                                  sizeof(J12SAMPROW)));
  504|       |
  505|       |    /* Get the rows themselves (large objects) */
  506|    249|    currow = 0;
  507|    498|    while (currow < numrows) {
  ------------------
  |  Branch (507:12): [True: 249, False: 249]
  ------------------
  508|    249|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|    249|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 249]
  |  |  ------------------
  ------------------
  509|    249|      workspace12 = (J12SAMPROW)alloc_large(cinfo, pool_id,
  510|    249|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  511|  2.09k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (511:30): [True: 1.84k, False: 249]
  ------------------
  512|  1.84k|        result12[currow++] = workspace12;
  513|  1.84k|        workspace12 += samplesperrow;
  514|  1.84k|      }
  515|    249|    }
  516|       |
  517|    249|    return (JSAMPARRAY)result12;
  518|    249|  } else {
  519|     41|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  520|       |    /* Get space for row pointers (small object) */
  521|     41|    result16 = (J16SAMPARRAY)alloc_small(cinfo, pool_id,
  522|     41|                                         (size_t)(numrows *
  523|     41|                                                  sizeof(J16SAMPROW)));
  524|       |
  525|       |    /* Get the rows themselves (large objects) */
  526|     41|    currow = 0;
  527|     82|    while (currow < numrows) {
  ------------------
  |  Branch (527:12): [True: 41, False: 41]
  ------------------
  528|     41|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|     41|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 41]
  |  |  ------------------
  ------------------
  529|     41|      workspace16 = (J16SAMPROW)alloc_large(cinfo, pool_id,
  530|     41|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  531|    114|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (531:30): [True: 73, False: 41]
  ------------------
  532|     73|        result16[currow++] = workspace16;
  533|     73|        workspace16 += samplesperrow;
  534|     73|      }
  535|     41|    }
  536|       |
  537|     41|    return (JSAMPARRAY)result16;
  538|       |#else
  539|       |    ERREXIT1(cinfo, JERR_BAD_PRECISION, data_precision);
  540|       |    return NULL;
  541|       |#endif
  542|     41|  }
  543|  5.05k|}
jmemmgr.c:alloc_barray:
  555|    924|{
  556|    924|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  557|    924|  JBLOCKARRAY result;
  558|    924|  JBLOCKROW workspace;
  559|    924|  JDIMENSION rowsperchunk, currow, i;
  560|    924|  long ltemp;
  561|       |
  562|       |  /* Make sure each row is properly aligned */
  563|    924|  if (blocksperrow == 0 || (sizeof(JBLOCK) % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|    924|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (563:7): [True: 0, False: 924]
  |  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|    924|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|    924|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  568|    924|          ((long)blocksperrow * sizeof(JBLOCK));
  569|    924|  if (ltemp <= 0)
  ------------------
  |  Branch (569:7): [True: 0, False: 924]
  ------------------
  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|    924|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (571:7): [True: 0, False: 924]
  ------------------
  572|      0|    rowsperchunk = (JDIMENSION)ltemp;
  573|    924|  else
  574|    924|    rowsperchunk = numrows;
  575|    924|  mem->last_rowsperchunk = rowsperchunk;
  576|       |
  577|       |  /* Get space for row pointers (small object) */
  578|    924|  result = (JBLOCKARRAY)alloc_small(cinfo, pool_id,
  579|    924|                                    (size_t)(numrows * sizeof(JBLOCKROW)));
  580|       |
  581|       |  /* Get the rows themselves (large objects) */
  582|    924|  currow = 0;
  583|  1.84k|  while (currow < numrows) {
  ------------------
  |  Branch (583:10): [True: 924, False: 924]
  ------------------
  584|    924|    rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|    924|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 924]
  |  |  ------------------
  ------------------
  585|    924|    workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
  586|    924|        (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
  587|    924|                  sizeof(JBLOCK)));
  588|   147k|    for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (588:28): [True: 146k, False: 924]
  ------------------
  589|   146k|      result[currow++] = workspace;
  590|   146k|      workspace += blocksperrow;
  591|   146k|    }
  592|    924|  }
  593|       |
  594|    924|  return result;
  595|    924|}
jmemmgr.c:request_virt_barray:
  670|    924|{
  671|    924|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  672|    924|  jvirt_barray_ptr result;
  673|       |
  674|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  675|    924|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|    924|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (675:7): [True: 0, False: 924]
  ------------------
  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|    924|  result = (jvirt_barray_ptr)alloc_small(cinfo, pool_id,
  680|    924|                                         sizeof(struct jvirt_barray_control));
  681|       |
  682|    924|  result->mem_buffer = NULL;    /* marks array not yet realized */
  683|    924|  result->rows_in_array = numrows;
  684|    924|  result->blocksperrow = blocksperrow;
  685|    924|  result->maxaccess = maxaccess;
  686|    924|  result->pre_zero = pre_zero;
  687|    924|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|    924|#define FALSE   0               /* values of boolean */
  ------------------
  688|    924|  result->next = mem->virt_barray_list; /* add to list of virtual arrays */
  689|    924|  mem->virt_barray_list = result;
  690|       |
  691|    924|  return result;
  692|    924|}
jmemmgr.c:realize_virt_arrays:
  698|  2.01k|{
  699|  2.01k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  700|  2.01k|  size_t space_per_minheight, maximum_space, avail_mem;
  701|  2.01k|  size_t minheights, max_minheights;
  702|  2.01k|  jvirt_sarray_ptr sptr;
  703|  2.01k|  jvirt_barray_ptr bptr;
  704|  2.01k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (704:24): [True: 2.01k, False: 0]
  ------------------
  705|  2.01k|                        ((j_decompress_ptr)cinfo)->data_precision :
  706|  2.01k|                        ((j_compress_ptr)cinfo)->data_precision;
  707|  2.01k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (707:24): [True: 8, False: 2.00k]
  ------------------
  708|  2.00k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (708:45): [True: 105, False: 1.90k]
  ------------------
  709|    105|                                            sizeof(J12SAMPLE) :
  710|  2.00k|                                            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.01k|  space_per_minheight = 0;
  717|  2.01k|  maximum_space = 0;
  718|  2.01k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (718:38): [True: 0, False: 2.01k]
  ------------------
  719|      0|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (719:9): [True: 0, False: 0]
  ------------------
  720|      0|      size_t new_space = (size_t)sptr->rows_in_array *
  721|      0|                         (size_t)sptr->samplesperrow * sample_size;
  722|       |
  723|      0|      space_per_minheight += (size_t)sptr->maxaccess *
  724|      0|                             (size_t)sptr->samplesperrow * sample_size;
  725|      0|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (725:11): [True: 0, False: 0]
  ------------------
  726|      0|        out_of_memory(cinfo, 10);
  727|      0|      maximum_space += new_space;
  728|      0|    }
  729|      0|  }
  730|  2.93k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (730:38): [True: 924, False: 2.01k]
  ------------------
  731|    924|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (731:9): [True: 924, False: 0]
  ------------------
  732|    924|      size_t new_space = (size_t)bptr->rows_in_array *
  733|    924|                         (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  734|       |
  735|    924|      space_per_minheight += (size_t)bptr->maxaccess *
  736|    924|                             (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  737|    924|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (737:11): [True: 0, False: 924]
  ------------------
  738|      0|        out_of_memory(cinfo, 11);
  739|    924|      maximum_space += new_space;
  740|    924|    }
  741|    924|  }
  742|       |
  743|  2.01k|  if (space_per_minheight <= 0)
  ------------------
  |  Branch (743:7): [True: 1.09k, False: 920]
  ------------------
  744|  1.09k|    return;                     /* no unrealized arrays, no work */
  745|       |
  746|       |  /* Determine amount of memory to actually use; this is system-dependent. */
  747|    920|  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
  748|    920|                                 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|    920|  if (avail_mem >= maximum_space)
  ------------------
  |  Branch (754:7): [True: 920, False: 0]
  ------------------
  755|    920|    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|    920|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (767:38): [True: 0, False: 920]
  ------------------
  768|      0|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (768:9): [True: 0, False: 0]
  ------------------
  769|      0|      minheights = ((long)sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
  770|      0|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (770:11): [True: 0, False: 0]
  ------------------
  771|       |        /* This buffer fits in memory */
  772|      0|        sptr->rows_in_mem = sptr->rows_in_array;
  773|      0|      } else {
  774|       |        /* It doesn't fit in memory, create backing store. */
  775|      0|        sptr->rows_in_mem = (JDIMENSION)(max_minheights * sptr->maxaccess);
  776|      0|        jpeg_open_backing_store(cinfo, &sptr->b_s_info,
  777|      0|                                (long)((size_t)sptr->rows_in_array *
  778|      0|                                       (size_t)sptr->samplesperrow *
  779|      0|                                       sample_size));
  780|      0|        sptr->b_s_open = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  781|      0|      }
  782|      0|      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  783|      0|                                      sptr->samplesperrow, sptr->rows_in_mem);
  784|      0|      sptr->rowsperchunk = mem->last_rowsperchunk;
  785|      0|      sptr->cur_start_row = 0;
  786|      0|      sptr->first_undef_row = 0;
  787|      0|      sptr->dirty = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  788|      0|    }
  789|      0|  }
  790|       |
  791|  1.84k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (791:38): [True: 924, False: 920]
  ------------------
  792|    924|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (792:9): [True: 924, False: 0]
  ------------------
  793|    924|      minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
  794|    924|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (794:11): [True: 924, False: 0]
  ------------------
  795|       |        /* This buffer fits in memory */
  796|    924|        bptr->rows_in_mem = bptr->rows_in_array;
  797|    924|      } 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|    924|      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    924|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  807|    924|                                      bptr->blocksperrow, bptr->rows_in_mem);
  808|    924|      bptr->rowsperchunk = mem->last_rowsperchunk;
  809|    924|      bptr->cur_start_row = 0;
  810|    924|      bptr->first_undef_row = 0;
  811|    924|      bptr->dirty = FALSE;
  ------------------
  |  |  207|    924|#define FALSE   0               /* values of boolean */
  ------------------
  812|    924|    }
  813|    924|  }
  814|    920|}
jmemmgr.c:access_virt_barray:
 1015|   167k|{
 1016|   167k|  JDIMENSION end_row = start_row + num_rows;
 1017|   167k|  JDIMENSION undef_row;
 1018|       |
 1019|       |  /* debugging check */
 1020|   167k|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (1020:7): [True: 0, False: 167k]
  |  Branch (1020:39): [True: 0, False: 167k]
  ------------------
 1021|   167k|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (1021:7): [True: 0, False: 167k]
  ------------------
 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|   167k|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (1025:7): [True: 0, False: 167k]
  ------------------
 1026|   167k|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (1026:7): [True: 0, False: 167k]
  ------------------
 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|   167k|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (1062:7): [True: 57.1k, False: 110k]
  ------------------
 1063|  57.1k|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (1063:9): [True: 0, False: 57.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|  57.1k|    } else {
 1068|  57.1k|      undef_row = ptr->first_undef_row;
 1069|  57.1k|    }
 1070|  57.1k|    if (writable)
  ------------------
  |  Branch (1070:9): [True: 57.1k, False: 0]
  ------------------
 1071|  57.1k|      ptr->first_undef_row = end_row;
 1072|  57.1k|    if (ptr->pre_zero) {
  ------------------
  |  Branch (1072:9): [True: 57.1k, False: 0]
  ------------------
 1073|  57.1k|      size_t bytesperrow = (size_t)ptr->blocksperrow * sizeof(JBLOCK);
 1074|  57.1k|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
 1075|  57.1k|      end_row -= ptr->cur_start_row;
 1076|   191k|      while (undef_row < end_row) {
  ------------------
  |  Branch (1076:14): [True: 134k, False: 57.1k]
  ------------------
 1077|   134k|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
 1078|   134k|        undef_row++;
 1079|   134k|      }
 1080|  57.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|  57.1k|  }
 1085|       |  /* Flag the buffer dirty if caller will write in it */
 1086|   167k|  if (writable)
  ------------------
  |  Branch (1086:7): [True: 121k, False: 46.6k]
  ------------------
 1087|   121k|    ptr->dirty = TRUE;
  ------------------
  |  |  210|   121k|#define TRUE    1
  ------------------
 1088|       |  /* Return address of proper part of the buffer */
 1089|   167k|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1090|   167k|}
jmemmgr.c:free_pool:
 1099|  5.40k|{
 1100|  5.40k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
 1101|  5.40k|  small_pool_ptr shdr_ptr;
 1102|  5.40k|  large_pool_ptr lhdr_ptr;
 1103|  5.40k|  size_t space_freed;
 1104|       |
 1105|  5.40k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  5.40k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (1105:7): [True: 0, False: 5.40k]
  |  Branch (1105:22): [True: 0, False: 5.40k]
  ------------------
 1106|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1107|       |
 1108|       |#ifdef MEM_STATS
 1109|       |  if (cinfo->err->trace_level > 1)
 1110|       |    print_mem_stats(cinfo, pool_id); /* print pool's memory usage statistics */
 1111|       |#endif
 1112|       |
 1113|       |  /* If freeing IMAGE pool, close any virtual arrays first */
 1114|  5.40k|  if (pool_id == JPOOL_IMAGE) {
  ------------------
  |  |  889|  5.40k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (1114:7): [True: 3.06k, False: 2.34k]
  ------------------
 1115|  3.06k|    jvirt_sarray_ptr sptr;
 1116|  3.06k|    jvirt_barray_ptr bptr;
 1117|       |
 1118|  3.06k|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1118:40): [True: 0, False: 3.06k]
  ------------------
 1119|      0|      if (sptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1119:11): [True: 0, False: 0]
  ------------------
 1120|      0|        sptr->b_s_open = FALSE; /* prevent recursive close if error */
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1121|      0|        (*sptr->b_s_info.close_backing_store) (cinfo, &sptr->b_s_info);
 1122|      0|      }
 1123|      0|    }
 1124|  3.06k|    mem->virt_sarray_list = NULL;
 1125|  3.99k|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1125:40): [True: 924, False: 3.06k]
  ------------------
 1126|    924|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1126:11): [True: 0, False: 924]
  ------------------
 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|    924|    }
 1131|  3.06k|    mem->virt_barray_list = NULL;
 1132|  3.06k|  }
 1133|       |
 1134|       |  /* Release large objects */
 1135|  5.40k|  lhdr_ptr = mem->large_list[pool_id];
 1136|  5.40k|  mem->large_list[pool_id] = NULL;
 1137|       |
 1138|  12.1k|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1138:10): [True: 6.78k, False: 5.40k]
  ------------------
 1139|  6.78k|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1140|  6.78k|    space_freed = lhdr_ptr->bytes_used +
 1141|  6.78k|                  lhdr_ptr->bytes_left +
 1142|  6.78k|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  6.78k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1143|  6.78k|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1144|  6.78k|    mem->total_space_allocated -= space_freed;
 1145|  6.78k|    lhdr_ptr = next_lhdr_ptr;
 1146|  6.78k|  }
 1147|       |
 1148|       |  /* Release small objects */
 1149|  5.40k|  shdr_ptr = mem->small_list[pool_id];
 1150|  5.40k|  mem->small_list[pool_id] = NULL;
 1151|       |
 1152|  10.6k|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1152:10): [True: 5.26k, False: 5.40k]
  ------------------
 1153|  5.26k|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1154|  5.26k|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1155|  5.26k|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  5.26k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1156|  5.26k|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1157|  5.26k|    mem->total_space_allocated -= space_freed;
 1158|  5.26k|    shdr_ptr = next_shdr_ptr;
 1159|  5.26k|  }
 1160|  5.40k|}
jmemmgr.c:self_destruct:
 1170|  2.34k|{
 1171|  2.34k|  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.02k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  2.34k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  7.02k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1177:35): [True: 4.68k, False: 2.34k]
  ------------------
 1178|  4.68k|    free_pool(cinfo, pool);
 1179|  4.68k|  }
 1180|       |
 1181|       |  /* Release the memory manager control block too. */
 1182|  2.34k|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1183|  2.34k|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1184|       |
 1185|  2.34k|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1186|  2.34k|}

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

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

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

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

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

_ZN4JSON10JSON_valueC2ENS_12value_type_eE:
  306|   690k|            type_code(type_code)
  307|   690k|        {
  308|   690k|        }
_ZN4JSON15JSON_dictionaryC2Ev:
  316|  55.5k|            JSON_value(vt_dictionary)
  317|  55.5k|        {
  318|  55.5k|        }
_ZN4JSON9JSON_nullC2Ev:
  350|  44.9k|            JSON_value(vt_null)
  351|  44.9k|        {
  352|  44.9k|        }
_ZN4JSON10JSON_arrayC2Ev:
  396|  34.8k|        JSON_value(vt_array)
  397|  34.8k|    {
  398|  34.8k|    }
_ZN4JSON10JSON_valueD2Ev:
  309|   690k|        virtual ~JSON_value() = default;
_ZN4JSONC2Ev:
   50|  2.00M|    JSON() = default;
_ZN4JSON15JSON_dictionaryD2Ev:
  319|  55.5k|        ~JSON_dictionary() override = default;
_ZN4JSON10JSON_arrayD2Ev:
  399|  34.8k|    ~JSON_array() override = default;
_ZN4JSON11JSON_stringD2Ev:
  327|   426k|        ~JSON_string() override = default;
_ZN4JSON11JSON_numberD2Ev:
  336|   126k|        ~JSON_number() override = default;
_ZN4JSON7MembersD2Ev:
  378|   690k|        ~Members() = default;

_ZN4qpdf10BaseHandleD2Ev:
  131|  73.2M|        ~BaseHandle() = default;
_ZN4qpdf10BaseHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  120|  24.7M|            obj(obj) {};
_ZN4qpdf10BaseHandleC2ERKS0_:
  123|  28.2M|        BaseHandle(BaseHandle const&) = default;
_ZNK4qpdf10BaseHandleeqERKS0_:
   67|  72.0k|        {
   68|  72.0k|            return obj == other.obj;
   69|  72.0k|        }
_ZNK4qpdf10BaseHandle5emptyEv:
   82|  4.39k|        {
   83|  4.39k|            return size() == 0;
   84|  4.39k|        }
_ZN4qpdf10BaseHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
  122|  7.43M|            obj(std::move(obj)) {};
_ZN4qpdf10BaseHandleC2Ev:
  118|  1.50M|        BaseHandle() = default;
_ZN4qpdf10BaseHandleaSEOS0_:
  126|   816k|        BaseHandle& operator=(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleC2EOS0_:
  125|  8.35M|        BaseHandle(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleaSERKS0_:
  124|   558k|        BaseHandle& operator=(BaseHandle const&) = default;

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

_ZN5QIntC11range_checkIxEEvRKT_S3_:
  274|   175k|    {
  275|   175k|        if ((delta > 0) != (cur > 0)) {
  ------------------
  |  Branch (275:13): [True: 161k, False: 14.1k]
  ------------------
  276|   161k|            return;
  277|   161k|        }
  278|  14.1k|        QIntC::range_check_error<T>(cur, delta);
  279|  14.1k|    }
_ZN5QIntC17range_check_errorIxEEvRKT_S3_:
  257|  14.1k|    {
  258|  14.1k|        if ((delta > 0) && ((std::numeric_limits<T>::max() - cur) < delta)) {
  ------------------
  |  Branch (258:13): [True: 14.1k, False: 5]
  |  Branch (258:28): [True: 49, False: 14.1k]
  ------------------
  259|     49|            std::ostringstream msg;
  260|     49|            msg.imbue(std::locale::classic());
  261|     49|            msg << "adding " << delta << " to " << cur << " would cause an integer overflow";
  262|     49|            throw std::range_error(msg.str());
  263|  14.1k|        } else if ((delta < 0) && ((std::numeric_limits<T>::min() - cur) > delta)) {
  ------------------
  |  Branch (263:20): [True: 0, False: 14.1k]
  |  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|  14.1k|    }
_ZN5QIntC7to_sizeIxEEmRKT_:
  215|  51.6M|    {
  216|  51.6M|        return IntConverter<T, size_t>::convert(i);
  217|  51.6M|    }
_ZN5QIntC12IntConverterIxmLb1ELb0EE7convertERKx:
  119|  51.6M|        {
  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|  51.6M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  51.6M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 51.6M]
  |  Branch (124:28): [True: 0, False: 51.6M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  51.6M|            return static_cast<To>(i);
  128|  51.6M|        }
_ZN5QIntC9to_offsetImEExRKT_:
  222|  10.2M|    {
  223|  10.2M|        return IntConverter<T, qpdf_offset_t>::convert(i);
  224|  10.2M|    }
_ZN5QIntC12IntConverterImxLb0ELb1EE7convertERKm:
  147|  10.2M|        {
  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.2M|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  10.2M|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 10.2M]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|  10.2M|            return static_cast<To>(i);
  155|  10.2M|        }
_ZN5QIntC7to_sizeIlEEmRKT_:
  215|   790k|    {
  216|   790k|        return IntConverter<T, size_t>::convert(i);
  217|   790k|    }
_ZN5QIntC12IntConverterIlmLb1ELb0EE7convertERKl:
  119|   790k|        {
  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|   790k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   790k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 790k]
  |  Branch (124:28): [True: 0, False: 790k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   790k|            return static_cast<To>(i);
  128|   790k|        }
_ZN5QIntC6to_intImEEiRKT_:
  201|   604k|    {
  202|   604k|        return IntConverter<T, int>::convert(i);
  203|   604k|    }
_ZN5QIntC12IntConverterImiLb0ELb1EE7convertERKm:
  147|   604k|        {
  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|   604k|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|   604k|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 24, False: 604k]
  ------------------
  152|     24|                error(i);
  153|     24|            }
  154|   604k|            return static_cast<To>(i);
  155|   604k|        }
_ZN5QIntC12IntConverterImiLb0ELb1EE5errorEm:
  159|     24|        {
  160|     24|            std::ostringstream msg;
  161|     24|            msg.imbue(std::locale::classic());
  162|     24|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  163|     24|                << "-byte unsigned type to a " << sizeof(To) << "-byte signed type";
  164|     24|            throw std::range_error(msg.str());
  165|     24|        }
_ZN5QIntC7to_sizeIiEEmRKT_:
  215|   185k|    {
  216|   185k|        return IntConverter<T, size_t>::convert(i);
  217|   185k|    }
_ZN5QIntC12IntConverterIimLb1ELb0EE7convertERKi:
  119|   235M|        {
  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|   235M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   235M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 235M]
  |  Branch (124:28): [True: 0, False: 235M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   235M|            return static_cast<To>(i);
  128|   235M|        }
_ZN5QIntC6to_intIxEEiRKT_:
  201|  4.63M|    {
  202|  4.63M|        return IntConverter<T, int>::convert(i);
  203|  4.63M|    }
_ZN5QIntC12IntConverterIxiLb1ELb1EE7convertERKx:
   94|  4.63M|        {
   95|       |            // From and To are both signed.
   96|  4.63M|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 683, False: 4.63M]
  |  Branch (96:57): [True: 581, False: 4.63M]
  ------------------
   97|  1.26k|                error(i);
   98|  1.26k|            }
   99|  4.63M|            return static_cast<To>(i);
  100|  4.63M|        }
_ZN5QIntC12IntConverterIxiLb1ELb1EE5errorEx:
  104|  1.26k|        {
  105|  1.26k|            std::ostringstream msg;
  106|  1.26k|            msg.imbue(std::locale::classic());
  107|  1.26k|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  108|  1.26k|                << "-byte signed type to a " << sizeof(To) << "-byte signed type";
  109|  1.26k|            throw std::range_error(msg.str());
  110|  1.26k|        }
_ZN5QIntC7to_sizeImEEmRKT_:
  215|    316|    {
  216|    316|        return IntConverter<T, size_t>::convert(i);
  217|    316|    }
_ZN5QIntC12IntConverterImmLb0ELb0EE7convertERKm:
   69|  60.5k|        {
   70|       |            // From and To are both unsigned.
   71|  60.5k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 60.5k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  60.5k|            return static_cast<To>(i);
   75|  60.5k|        }
_ZN5QIntC7to_uintIiEEjRKT_:
  208|  24.4k|    {
  209|  24.4k|        return IntConverter<T, unsigned int>::convert(i);
  210|  24.4k|    }
_ZN5QIntC12IntConverterIijLb1ELb0EE7convertERKi:
  119|  24.4k|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|  24.4k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  24.4k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 24.4k]
  |  Branch (124:28): [True: 0, False: 24.4k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  24.4k|            return static_cast<To>(i);
  128|  24.4k|        }
_ZN5QIntC6to_intIlEEiRKT_:
  201|  7.20k|    {
  202|  7.20k|        return IntConverter<T, int>::convert(i);
  203|  7.20k|    }
_ZN5QIntC12IntConverterIliLb1ELb1EE7convertERKl:
   94|  7.20k|        {
   95|       |            // From and To are both signed.
   96|  7.20k|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 0, False: 7.20k]
  |  Branch (96:57): [True: 0, False: 7.20k]
  ------------------
   97|      0|                error(i);
   98|      0|            }
   99|  7.20k|            return static_cast<To>(i);
  100|  7.20k|        }
_ZN5QIntC7to_sizeIyEEmRKT_:
  215|  13.6k|    {
  216|  13.6k|        return IntConverter<T, size_t>::convert(i);
  217|  13.6k|    }
_ZN5QIntC12IntConverterIymLb0ELb0EE7convertERKy:
   69|  13.6k|        {
   70|       |            // From and To are both unsigned.
   71|  13.6k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 13.6k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  13.6k|            return static_cast<To>(i);
   75|  13.6k|        }
_ZN5QIntC8to_ulongIcEEmRKT_:
  236|   815k|    {
  237|   815k|        return IntConverter<T, unsigned long>::convert(i);
  238|   815k|    }
_ZN5QIntC12IntConverterIcmLb1ELb0EE7convertERKc:
  119|   815k|        {
  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|   815k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   815k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 815k]
  |  Branch (124:28): [True: 0, False: 815k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   815k|            return static_cast<To>(i);
  128|   815k|        }
_ZN5QIntC8to_ulongIhEEmRKT_:
  236|   660M|    {
  237|   660M|        return IntConverter<T, unsigned long>::convert(i);
  238|   660M|    }
_ZN5QIntC12IntConverterIhmLb0ELb0EE7convertERKh:
   69|   660M|        {
   70|       |            // From and To are both unsigned.
   71|   660M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 660M]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   660M|            return static_cast<To>(i);
   75|   660M|        }
_ZN5QIntC8to_ulongIiEEmRKT_:
  236|   235M|    {
  237|   235M|        return IntConverter<T, unsigned long>::convert(i);
  238|   235M|    }
_ZN5QIntC9to_ushortIiEEtRKT_:
  194|  30.9M|    {
  195|  30.9M|        return IntConverter<T, unsigned short>::convert(i);
  196|  30.9M|    }
_ZN5QIntC12IntConverterIitLb1ELb0EE7convertERKi:
  119|  30.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|  30.9M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  30.9M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 30.9M]
  |  Branch (124:28): [True: 0, False: 30.9M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  30.9M|            return static_cast<To>(i);
  128|  30.9M|        }
_ZN5QIntC20range_check_subtractIxEEvRKT_S3_:
  302|    871|    {
  303|    871|        if ((delta >= 0) == (cur >= 0)) {
  ------------------
  |  Branch (303:13): [True: 736, False: 135]
  ------------------
  304|    736|            return;
  305|    736|        }
  306|    135|        QIntC::range_check_subtract_error<T>(cur, delta);
  307|    135|    }
_ZN5QIntC26range_check_subtract_errorIxEEvRKT_S3_:
  284|    135|    {
  285|    135|        if ((delta > 0) && ((std::numeric_limits<T>::min() + delta) > cur)) {
  ------------------
  |  Branch (285:13): [True: 0, False: 135]
  |  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|    135|        } else if ((delta < 0) && ((std::numeric_limits<T>::max() + delta) < cur)) {
  ------------------
  |  Branch (291:20): [True: 135, False: 0]
  |  Branch (291:35): [True: 1, False: 134]
  ------------------
  292|      1|            std::ostringstream msg;
  293|      1|            msg.imbue(std::locale::classic());
  294|      1|            msg << "subtracting " << delta << " from " << cur << " would cause an integer overflow";
  295|      1|            throw std::range_error(msg.str());
  296|      1|        }
  297|    135|    }
_ZN5QIntC7to_sizeIjEEmRKT_:
  215|  18.7k|    {
  216|  18.7k|        return IntConverter<T, size_t>::convert(i);
  217|  18.7k|    }
_ZN5QIntC12IntConverterIjmLb0ELb0EE7convertERKj:
   69|  18.7k|        {
   70|       |            // From and To are both unsigned.
   71|  18.7k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 18.7k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  18.7k|            return static_cast<To>(i);
   75|  18.7k|        }
_ZN5QIntC7to_uintImEEjRKT_:
  208|   576k|    {
  209|   576k|        return IntConverter<T, unsigned int>::convert(i);
  210|   576k|    }
_ZN5QIntC12IntConverterImjLb0ELb0EE7convertERKm:
   69|   576k|        {
   70|       |            // From and To are both unsigned.
   71|   576k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 576k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   576k|            return static_cast<To>(i);
   75|   576k|        }
_ZN5QIntC8to_ulongImEEmRKT_:
  236|  60.2k|    {
  237|  60.2k|        return IntConverter<T, unsigned long>::convert(i);
  238|  60.2k|    }

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

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

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

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

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

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

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

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

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

_ZN10QPDFObjGenC2Eii:
   40|  1.74M|        obj(obj),
   41|  1.74M|        gen(gen)
   42|  1.74M|    {
   43|  1.74M|    }
_ZNK10QPDFObjGenltERKS_:
   46|  58.5M|    {
   47|  58.5M|        return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen);
  ------------------
  |  Branch (47:16): [True: 34.1M, False: 24.4M]
  |  Branch (47:36): [True: 7.06M, False: 17.3M]
  |  Branch (47:54): [True: 91.9k, False: 6.97M]
  ------------------
   48|  58.5M|    }
_ZNK10QPDFObjGeneqERKS_:
   51|   170k|    {
   52|   170k|        return obj == rhs.obj && gen == rhs.gen;
  ------------------
  |  Branch (52:16): [True: 162k, False: 7.24k]
  |  Branch (52:34): [True: 162k, False: 110]
  ------------------
   53|   170k|    }
_ZNK10QPDFObjGenneERKS_:
   56|   152k|    {
   57|   152k|        return !(*this == rhs);
   58|   152k|    }
_ZNK10QPDFObjGen6getObjEv:
   61|  2.06M|    {
   62|  2.06M|        return obj;
   63|  2.06M|    }
_ZNK10QPDFObjGen6getGenEv:
   66|  5.56k|    {
   67|  5.56k|        return gen;
   68|  5.56k|    }
_ZNK10QPDFObjGen10isIndirectEv:
   71|  4.26M|    {
   72|  4.26M|        return obj != 0;
   73|  4.26M|    }
_ZNK10QPDFObjGen7unparseEc:
   76|   640k|    {
   77|   640k|        return std::to_string(obj) + separator + std::to_string(gen);
   78|   640k|    }
_ZN10QPDFObjGen3set3addES_:
  111|   303k|        {
  112|   303k|            if (og.isIndirect()) {
  ------------------
  |  Branch (112:17): [True: 189k, False: 114k]
  ------------------
  113|   189k|                if (count(og)) {
  ------------------
  |  Branch (113:21): [True: 13.9k, False: 175k]
  ------------------
  114|  13.9k|                    return false;
  115|  13.9k|                }
  116|   175k|                emplace(og);
  117|   175k|            }
  118|   289k|            return true;
  119|   303k|        }
_ZN10QPDFObjGenC2Ev:
   38|  31.2M|    QPDFObjGen() = default;

_ZN16QPDFObjectHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
 1315|  23.8M|        qpdf::BaseHandle(obj)
 1316|  23.8M|    {
 1317|  23.8M|    }
_ZN16QPDFObjectHandleC2ERKS_:
  290|  27.9M|    QPDFObjectHandle(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilter16PipelineAccessor11setPipelineEPS0_P8Pipeline:
  176|  34.7k|            {
  177|  34.7k|                f->setPipeline(p);
  178|  34.7k|            }
_ZN16QPDFObjectHandle9RectangleC2Ev:
  236|  1.41k|            llx(0.0),
  237|  1.41k|            lly(0.0),
  238|  1.41k|            urx(0.0),
  239|  1.41k|            ury(0.0)
  240|  1.41k|        {
  241|  1.41k|        }
_ZN16QPDFObjectHandle9RectangleC2Edddd:
  243|  47.3k|            llx(llx),
  244|  47.3k|            lly(lly),
  245|  47.3k|            urx(urx),
  246|  47.3k|            ury(ury)
  247|  47.3k|        {
  248|  47.3k|        }
_ZN16QPDFObjectHandle6MatrixC2Edddddd:
  272|    375|            a(a),
  273|    375|            b(b),
  274|    375|            c(c),
  275|    375|            d(d),
  276|    375|            e(e),
  277|    375|            f(f)
  278|    375|        {
  279|    375|        }
_ZN16QPDFObjectHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
 1319|  6.85M|        qpdf::BaseHandle(std::move(obj))
 1320|  6.85M|    {
 1321|  6.85M|    }
_ZN16QPDFObjectHandle6getObjEv:
 1324|   196k|    {
 1325|   196k|        return obj;
 1326|   196k|    }
_ZNK16QPDFObjectHandle14QPDFArrayItems8iteratorneERKS1_:
 1518|   254k|        {
 1519|   254k|            return !operator==(other);
 1520|   254k|        }
_ZNK4qpdf10BaseHandlecvbEv:
 1559|  49.5M|    {
 1560|  49.5M|        return static_cast<bool>(obj);
 1561|  49.5M|    }
_ZNK4qpdf10BaseHandlecv16QPDFObjectHandleEv:
 1565|   284k|    {
 1566|   284k|        return {obj};
 1567|   284k|    }
_ZN16QPDFObjectHandleC2Ev:
  289|  1.47M|    QPDFObjectHandle() = default;
_ZN16QPDFObjectHandleaSEOS_:
  293|   737k|    QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleC2EOS_:
  292|  8.34M|    QPDFObjectHandle(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorD2Ev:
 1491|  10.7k|        virtual ~iterator() = default;
_ZN16QPDFObjectHandleaSERKS_:
  291|   526k|    QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilterC2Ev:
  163|  67.5k|        TokenFilter() = default;
_ZN16QPDFObjectHandle11TokenFilterD2Ev:
  164|  17.3k|        virtual ~TokenFilter() = default;

_ZN16QPDFObjectHelper15getObjectHandleEv:
   45|  69.5k|    {
   46|  69.5k|        return {obj};
   47|  69.5k|    }
_ZN16QPDFObjectHelperC2E16QPDFObjectHandle:
   38|   196k|        qpdf::BaseHandle(oh.getObj())
   39|   196k|    {
   40|   196k|    }
_ZNK16QPDFObjectHelper15getObjectHandleEv:
   50|  26.5k|    {
   51|  26.5k|        return {obj};
   52|  26.5k|    }
_ZN16QPDFObjectHelper2ohEv:
   58|   320k|    {
   59|   320k|        return {obj};
   60|   320k|    }

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

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

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

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

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

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

_ZN13QPDFTokenizer5TokenC2Ev:
   71|  4.42M|            type(tt_bad)
   72|  4.42M|        {
   73|  4.42M|        }
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES8_S8_:
   81|  4.42M|            type(type),
   82|  4.42M|            value(value),
   83|  4.42M|            raw_value(raw_value),
   84|  4.42M|            error_message(error_message)
   85|  4.42M|        {
   86|  4.42M|        }
_ZNK13QPDFTokenizer5Token7getTypeEv:
   89|  6.31M|        {
   90|  6.31M|            return this->type;
   91|  6.31M|        }
_ZNK13QPDFTokenizer5Token8getValueEv:
   94|  3.65M|        {
   95|  3.65M|            return this->value;
   96|  3.65M|        }
_ZNK13QPDFTokenizer5Token11getRawValueEv:
   99|   644k|        {
  100|   644k|            return this->raw_value;
  101|   644k|        }
_ZNK13QPDFTokenizer5Token9isIntegerEv:
  116|  2.76M|        {
  117|  2.76M|            return this->type == tt_integer;
  118|  2.76M|        }
_ZNK13QPDFTokenizer5Token6isWordERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  126|  4.96M|        {
  127|  4.96M|            return this->type == tt_word && this->value == value;
  ------------------
  |  Branch (127:20): [True: 2.41M, False: 2.55M]
  |  Branch (127:45): [True: 670k, False: 1.74M]
  ------------------
  128|  4.96M|        }

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

_ZN3QTC2TCEPKcS1_i:
   36|  30.1M|    {
   37|       |#ifndef QPDF_DISABLE_QTC
   38|       |        TC_real(scope, ccase, n);
   39|       |#endif // QPDF_DISABLE_QTC
   40|  30.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|  25.4k|    {
  184|  25.4k|        return std::shared_ptr<T>(new T[n], std::default_delete<T[]>());
  185|  25.4k|    }

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

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

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

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

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

_ZN17BufferInputSourceC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEP6Bufferb:
  170|  24.5k|    m(std::make_unique<Members>(description, buf, own_memory))
  171|  24.5k|{
  172|  24.5k|}
_ZN17BufferInputSourceD2Ev:
  178|  24.5k|BufferInputSource::~BufferInputSource() = default;
_ZN17BufferInputSource18findAndSkipNextEOLEv:
  182|  1.98M|{
  183|  1.98M|    auto result = m->is.findAndSkipNextEOL();
  184|  1.98M|    last_offset = m->is.getLastOffset();
  185|  1.98M|    return result;
  186|  1.98M|}
_ZNK17BufferInputSource7getNameEv:
  189|  1.10M|{
  190|  1.10M|    return m->is.getName();
  191|  1.10M|}
_ZN17BufferInputSource4tellEv:
  194|  19.8M|{
  195|  19.8M|    return m->is.tell();
  196|  19.8M|}
_ZN17BufferInputSource4seekExi:
  199|  13.9M|{
  200|  13.9M|    m->is.seek(offset, whence);
  201|  13.9M|}
_ZN17BufferInputSource4readEPcm:
  209|  3.38M|{
  210|  3.38M|    auto result = m->is.read(buffer, length);
  211|  3.38M|    last_offset = m->is.getLastOffset();
  212|  3.38M|    return result;
  213|  3.38M|}
_ZN17BufferInputSource8unreadChEc:
  216|  17.1k|{
  217|  17.1k|    m->is.unreadCh(ch);
  218|  17.1k|}
_ZN4qpdf2is12OffsetBuffer18findAndSkipNextEOLEv:
  224|  1.98M|{
  225|  1.98M|    util::internal_error_if(pos < 0, "is::OffsetBuffer offset < 0");
  226|  1.98M|    auto end_pos = static_cast<qpdf_offset_t>(view_.size());
  227|  1.98M|    if (pos >= end_pos) {
  ------------------
  |  Branch (227:9): [True: 6.72k, False: 1.97M]
  ------------------
  228|  6.72k|        last_offset = end_pos + global_offset;
  229|  6.72k|        pos = end_pos;
  230|  6.72k|        return end_pos + global_offset;
  231|  6.72k|    }
  232|       |
  233|  1.97M|    qpdf_offset_t result = 0;
  234|  1.97M|    auto buffer = view_.begin();
  235|  1.97M|    auto end = view_.end();
  236|  1.97M|    auto p = buffer + static_cast<std::ptrdiff_t>(pos);
  237|       |
  238|   257M|    while (p < end && !(*p == '\r' || *p == '\n')) {
  ------------------
  |  Branch (238:12): [True: 257M, False: 16.8k]
  |  Branch (238:25): [True: 525k, False: 257M]
  |  Branch (238:39): [True: 1.43M, False: 255M]
  ------------------
  239|   255M|        ++p;
  240|   255M|    }
  241|  1.97M|    if (p < end) {
  ------------------
  |  Branch (241:9): [True: 1.96M, False: 16.8k]
  ------------------
  242|  1.96M|        result = p - buffer;
  243|  1.96M|        pos = result + 1;
  244|  1.96M|        ++p;
  245|  2.27M|        while (pos < end_pos && (*p == '\r' || *p == '\n')) {
  ------------------
  |  Branch (245:16): [True: 2.27M, False: 2.04k]
  |  Branch (245:34): [True: 15.8k, False: 2.25M]
  |  Branch (245:48): [True: 295k, False: 1.95M]
  ------------------
  246|   311k|            ++p;
  247|   311k|            ++pos;
  248|   311k|        }
  249|  1.96M|    } else {
  250|  16.8k|        pos = end_pos;
  251|  16.8k|        result = end_pos;
  252|  16.8k|    }
  253|  1.97M|    return result + global_offset;
  254|  1.98M|}
_ZN4qpdf2is12OffsetBuffer4seekExi:
  258|  86.6M|{
  259|  86.6M|    switch (whence) {
  260|  86.4M|    case SEEK_SET:
  ------------------
  |  Branch (260:5): [True: 86.4M, False: 174k]
  ------------------
  261|  86.4M|        pos = offset - global_offset;
  262|  86.4M|        break;
  263|       |
  264|  48.2k|    case SEEK_END:
  ------------------
  |  Branch (264:5): [True: 48.2k, False: 86.5M]
  ------------------
  265|  48.2k|        QIntC::range_check(static_cast<qpdf_offset_t>(view_.size()), offset);
  266|  48.2k|        pos = static_cast<qpdf_offset_t>(view_.size()) + offset;
  267|  48.2k|        break;
  268|       |
  269|   126k|    default:
  ------------------
  |  Branch (269:5): [True: 126k, False: 86.4M]
  ------------------
  270|   126k|        util::assertion(whence == SEEK_CUR, "invalid argument to BufferInputSource::seek");
  271|   126k|        QIntC::range_check(pos, offset);
  272|   126k|        pos += offset;
  273|  86.6M|    }
  274|       |
  275|  86.6M|    if (pos < 0) {
  ------------------
  |  Branch (275:9): [True: 366, False: 86.6M]
  ------------------
  276|    366|        throw std::runtime_error(description + ": seek before beginning of buffer");
  277|    366|    }
  278|  86.6M|}
_ZN4qpdf2is12OffsetBuffer4readEPcm:
  282|  8.31M|{
  283|  8.31M|    util::internal_error_if(pos < 0, "is::OffsetBuffer offset < 0");
  284|  8.31M|    auto end_pos = static_cast<qpdf_offset_t>(view_.size());
  285|  8.31M|    if (pos >= end_pos) {
  ------------------
  |  Branch (285:9): [True: 133k, False: 8.18M]
  ------------------
  286|   133k|        last_offset = end_pos + global_offset;
  287|   133k|        return 0;
  288|   133k|    }
  289|       |
  290|  8.18M|    last_offset = pos + global_offset;
  291|  8.18M|    size_t len = std::min(QIntC::to_size(end_pos - pos), length);
  292|  8.18M|    memcpy(buffer, view_.data() + pos, len);
  293|  8.18M|    pos += QIntC::to_offset(len);
  294|  8.18M|    return len;
  295|  8.31M|}
_ZN17BufferInputSource7MembersC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6Bufferb:
  148|  24.5k|        buf(own_memory ? buf : nullptr),
  ------------------
  |  Branch (148:13): [True: 0, False: 24.5k]
  ------------------
  149|  24.5k|        is(description,
  150|  24.5k|           buf && buf->getSize() > 0
  ------------------
  |  Branch (150:12): [True: 24.5k, False: 0]
  |  Branch (150:19): [True: 24.5k, False: 0]
  ------------------
  151|  24.5k|               ? std::string_view(reinterpret_cast<const char*>(buf->getBuffer()), buf->getSize())
  152|  24.5k|               : std::string_view())
  153|  24.5k|    {
  154|  24.5k|    }
_ZN17BufferInputSource7MembersD2Ev:
  162|  24.5k|    ~Members() = default;

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

_ZN11InputSource13setLastOffsetEx:
   15|  56.9M|{
   16|  56.9M|    this->last_offset = offset;
   17|  56.9M|}
_ZNK11InputSource13getLastOffsetEv:
   21|  34.0M|{
   22|  34.0M|    return this->last_offset;
   23|  34.0M|}
_ZN11InputSource9read_lineERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   27|  12.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|  12.9k|    read(str, count, at);
   34|  12.9k|    auto eol = str.find_first_of("\n\r"sv);
   35|  12.9k|    if (eol != std::string::npos) {
  ------------------
  |  Branch (35:9): [True: 10.0k, False: 2.86k]
  ------------------
   36|  10.0k|        auto next_line = str.find_first_not_of("\n\r"sv, eol);
   37|  10.0k|        str.resize(eol);
   38|  10.0k|        if (next_line != std::string::npos) {
  ------------------
  |  Branch (38:13): [True: 9.40k, False: 662]
  ------------------
   39|  9.40k|            seek(last_offset + static_cast<qpdf_offset_t>(next_line), SEEK_SET);
   40|  9.40k|            return eol;
   41|  9.40k|        }
   42|  10.0k|    }
   43|       |    // We did not necessarily find the end of the trailing newline sequence.
   44|  3.52k|    seek(last_offset, SEEK_SET);
   45|  3.52k|    findAndSkipNextEOL();
   46|  3.52k|    return eol;
   47|  12.9k|}
_ZN11InputSource8readLineEm:
   51|  12.9k|{
   52|  12.9k|    return read_line(max_line_length);
   53|  12.9k|}
_ZN11InputSource9findFirstEPKcxmRNS_6FinderE:
   65|  88.3k|{
   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|  88.3k|    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|  88.3k|    size_t size = sizeof(buf) - 1;
   79|  88.3k|    util::assertion(
   80|  88.3k|        !(strlen(start_chars) < 1 || strlen(start_chars) > size),
  ------------------
  |  Branch (80:11): [True: 0, False: 88.3k]
  |  Branch (80:38): [True: 0, False: 88.3k]
  ------------------
   81|  88.3k|        "InputSource::findSource called with too small or too large of a character sequence" //
   82|  88.3k|    );
   83|       |
   84|  88.3k|    char* p = nullptr;
   85|  88.3k|    qpdf_offset_t buf_offset = offset;
   86|  88.3k|    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|   834k|    while (true) {
  ------------------
  |  Branch (91:12): [True: 834k, 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|   834k|        if ((p == nullptr) || ((p + strlen(start_chars)) > (buf + bytes_read))) {
  ------------------
  |  Branch (97:13): [True: 88.3k, False: 746k]
  |  Branch (97:31): [True: 411k, False: 335k]
  ------------------
   98|   499k|            if (p) {
  ------------------
  |  Branch (98:17): [True: 411k, False: 88.3k]
  ------------------
   99|   411k|                QTC::TC(
  100|   411k|                    "libtests", "InputSource read next block", ((p == buf + bytes_read) ? 0 : 1));
  ------------------
  |  Branch (100:65): [True: 407k, False: 3.63k]
  ------------------
  101|   411k|                buf_offset += (p - buf);
  102|   411k|            }
  103|   499k|            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|   499k|            bytes_read = this->read(buf, size);
  108|   499k|            if (bytes_read < strlen(start_chars)) {
  ------------------
  |  Branch (108:17): [True: 45.8k, False: 453k]
  ------------------
  109|  45.8k|                QTC::TC("libtests", "InputSource find EOF", bytes_read == 0 ? 0 : 1);
  ------------------
  |  Branch (109:61): [True: 39.3k, False: 6.51k]
  ------------------
  110|  45.8k|                return false;
  111|  45.8k|            }
  112|   453k|            memset(buf + bytes_read, '\0', 1 + (size - bytes_read));
  113|   453k|            p = buf;
  114|   453k|        }
  115|       |
  116|       |        // Search for the first character.
  117|   788k|        if ((p = static_cast<char*>(
  ------------------
  |  Branch (117:13): [True: 381k, False: 407k]
  ------------------
  118|       |                 // line-break
  119|   788k|                 memchr(p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) != nullptr) {
  120|   381k|            if (p == buf) {
  ------------------
  |  Branch (120:17): [True: 5.46k, False: 375k]
  ------------------
  121|  5.46k|                QTC::TC("libtests", "InputSource found match at buf[0]");
  122|  5.46k|            }
  123|       |            // Found first letter.
  124|   381k|            if (len != 0) {
  ------------------
  |  Branch (124:17): [True: 59.5k, False: 321k]
  ------------------
  125|       |                // Make sure it's in range.
  126|  59.5k|                size_t p_relative_offset = QIntC::to_size((p - buf) + (buf_offset - offset));
  127|  59.5k|                if (p_relative_offset >= len) {
  ------------------
  |  Branch (127:21): [True: 3.06k, False: 56.5k]
  ------------------
  128|       |                    // out of range
  129|  3.06k|                    QTC::TC("libtests", "InputSource out of range");
  130|  3.06k|                    return false;
  131|  3.06k|                }
  132|  59.5k|            }
  133|   378k|            if ((p + strlen(start_chars)) > (buf + bytes_read)) {
  ------------------
  |  Branch (133:17): [True: 2.94k, False: 375k]
  ------------------
  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|  2.94k|                QTC::TC("libtests", "InputSource not enough bytes");
  137|  2.94k|                continue;
  138|  2.94k|            }
  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|   375k|            if (strncmp(p, start_chars, strlen(start_chars)) == 0) {
  ------------------
  |  Branch (142:17): [True: 71.5k, False: 303k]
  ------------------
  143|       |                // Call finder.check() with the input source positioned to the point of the match.
  144|  71.5k|                this->seek(buf_offset + (p - buf), SEEK_SET);
  145|  71.5k|                if (finder.check()) {
  ------------------
  |  Branch (145:21): [True: 39.4k, False: 32.1k]
  ------------------
  146|  39.4k|                    return true;
  147|  39.4k|                } else {
  148|  32.1k|                    QTC::TC("libtests", "InputSource start_chars matched but not check");
  149|  32.1k|                }
  150|   303k|            } else {
  151|   303k|                QTC::TC("libtests", "InputSource first char matched but not string");
  152|   303k|            }
  153|       |            // This occurrence of the first character wasn't a match. Skip over it and keep
  154|       |            // searching.
  155|   335k|            ++p;
  156|   407k|        } else {
  157|       |            // Trigger reading the next block
  158|   407k|            p = buf + bytes_read;
  159|   407k|        }
  160|   788k|    }
  161|  88.3k|}
_ZN11InputSource8findLastEPKcxmRNS_6FinderE:
  165|  24.5k|{
  166|  24.5k|    bool found = false;
  167|  24.5k|    qpdf_offset_t after_found_offset = 0;
  168|  24.5k|    qpdf_offset_t cur_offset = offset;
  169|  24.5k|    size_t cur_len = len;
  170|  30.1k|    while (this->findFirst(start_chars, cur_offset, cur_len, finder)) {
  ------------------
  |  Branch (170:12): [True: 5.54k, False: 24.5k]
  ------------------
  171|  5.54k|        if (found) {
  ------------------
  |  Branch (171:13): [True: 523, False: 5.02k]
  ------------------
  172|    523|            QTC::TC("libtests", "InputSource findLast found more than one");
  173|  5.02k|        } else {
  174|  5.02k|            found = true;
  175|  5.02k|        }
  176|  5.54k|        after_found_offset = this->tell();
  177|  5.54k|        cur_offset = after_found_offset;
  178|  5.54k|        cur_len = len - QIntC::to_size((cur_offset - offset));
  179|  5.54k|    }
  180|  24.5k|    if (found) {
  ------------------
  |  Branch (180:9): [True: 5.02k, False: 19.5k]
  ------------------
  181|       |        this->seek(after_found_offset, SEEK_SET);
  182|  5.02k|    }
  183|  24.5k|    return found;
  184|  24.5k|}
_ZN11InputSource9read_lineEmx:
   57|  12.9k|{
   58|  12.9k|    std::string result(count, '\0');
   59|  12.9k|    read_line(result, count, at);
   60|  12.9k|    return result;
   61|  12.9k|}

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

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

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

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

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

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

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

_ZN17Pl_ASCII85DecoderC2EPKcP8Pipeline:
   12|  3.08k|    Pipeline(identifier, next)
   13|  3.08k|{
   14|  3.08k|    util::assertion(next, "Attempt to create Pl_ASCII85Decoder with nullptr as next");
   15|  3.08k|}
_ZN17Pl_ASCII85Decoder5writeEPKhm:
   19|  2.73k|{
   20|  2.73k|    if (eod > 1) {
  ------------------
  |  Branch (20:9): [True: 207, False: 2.52k]
  ------------------
   21|    207|        return;
   22|    207|    }
   23|   150k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (23:24): [True: 148k, False: 1.53k]
  ------------------
   24|   148k|        switch (buf[i]) {
  ------------------
  |  Branch (24:17): [True: 9.04k, False: 139k]
  ------------------
   25|  3.64k|        case ' ':
  ------------------
  |  Branch (25:9): [True: 3.64k, False: 145k]
  ------------------
   26|  3.87k|        case '\f':
  ------------------
  |  Branch (26:9): [True: 227, False: 148k]
  ------------------
   27|  4.09k|        case '\v':
  ------------------
  |  Branch (27:9): [True: 218, False: 148k]
  ------------------
   28|  4.29k|        case '\t':
  ------------------
  |  Branch (28:9): [True: 207, False: 148k]
  ------------------
   29|  6.15k|        case '\r':
  ------------------
  |  Branch (29:9): [True: 1.85k, False: 147k]
  ------------------
   30|  9.04k|        case '\n':
  ------------------
  |  Branch (30:9): [True: 2.89k, False: 146k]
  ------------------
   31|  9.04k|            QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
   32|       |            // ignore whitespace
   33|  9.04k|            continue;
   34|   148k|        }
   35|   139k|        if (eod > 1) {
  ------------------
  |  Branch (35:13): [True: 615, False: 139k]
  ------------------
   36|    615|            break;
   37|   139k|        } else if (eod == 1) {
  ------------------
  |  Branch (37:20): [True: 661, False: 138k]
  ------------------
   38|    661|            util::no_ci_rt_error_if(buf[i] != '>', "broken end-of-data sequence in base 85 data");
   39|    661|            flush();
   40|    661|            eod = 2;
   41|   138k|        } else {
   42|   138k|            switch (buf[i]) {
   43|    656|            case '~':
  ------------------
  |  Branch (43:13): [True: 656, False: 137k]
  ------------------
   44|    656|                eod = 1;
   45|    656|                break;
   46|       |
   47|  1.66k|            case 'z':
  ------------------
  |  Branch (47:13): [True: 1.66k, False: 136k]
  ------------------
   48|  1.66k|                if (pos != 0) {
  ------------------
  |  Branch (48:21): [True: 34, False: 1.62k]
  ------------------
   49|     34|                    throw std::runtime_error("unexpected z during base 85 decode");
   50|     34|                }
   51|  1.62k|                unsigned char zeroes[4];
   52|  1.62k|                memset(zeroes, '\0', 4);
   53|  1.62k|                next()->write(zeroes, 4);
   54|  1.62k|                break;
   55|       |
   56|   136k|            default:
  ------------------
  |  Branch (56:13): [True: 136k, False: 2.31k]
  ------------------
   57|   136k|                if (buf[i] < 33 || buf[i] > 117) {
  ------------------
  |  Branch (57:21): [True: 116, False: 136k]
  |  Branch (57:36): [True: 92, False: 136k]
  ------------------
   58|    208|                    error = true;
   59|    208|                    throw std::runtime_error("character out of range during base 85 decode");
   60|   136k|                } else {
   61|   136k|                    this->inbuf[this->pos++] = buf[i];
   62|   136k|                    if (pos == 5) {
  ------------------
  |  Branch (62:25): [True: 26.6k, False: 109k]
  ------------------
   63|  26.6k|                        flush();
   64|  26.6k|                    }
   65|   136k|                }
   66|   136k|                break;
   67|   138k|            }
   68|   138k|        }
   69|   139k|    }
   70|  2.52k|}
_ZN17Pl_ASCII85Decoder5flushEv:
   74|  30.1k|{
   75|  30.1k|    if (this->pos == 0) {
  ------------------
  |  Branch (75:9): [True: 2.37k, False: 27.8k]
  ------------------
   76|  2.37k|        return;
   77|  2.37k|    }
   78|  27.8k|    unsigned long lval = 0;
   79|   166k|    for (int i = 0; i < 5; ++i) {
  ------------------
  |  Branch (79:21): [True: 139k, False: 27.8k]
  ------------------
   80|   139k|        lval *= 85;
   81|   139k|        lval += (this->inbuf[i] - 33U);
   82|   139k|    }
   83|       |
   84|  27.8k|    unsigned char outbuf[4];
   85|  27.8k|    memset(outbuf, 0, 4);
   86|   139k|    for (int i = 3; i >= 0; --i) {
  ------------------
  |  Branch (86:21): [True: 111k, False: 27.8k]
  ------------------
   87|   111k|        outbuf[i] = lval & 0xff;
   88|   111k|        lval >>= 8;
   89|   111k|    }
   90|       |
   91|  27.8k|    QTC::TC("libtests", "Pl_ASCII85Decoder partial flush", (this->pos == 5) ? 0 : 1);
  ------------------
  |  Branch (91:60): [True: 26.6k, False: 1.12k]
  ------------------
   92|       |    // Reset before calling getNext()->write in case that throws an exception.
   93|  27.8k|    auto t = this->pos - 1;
   94|  27.8k|    this->pos = 0;
   95|  27.8k|    memset(this->inbuf, 117, 5);
   96|       |
   97|  27.8k|    next()->write(outbuf, t);
   98|  27.8k|}
_ZN17Pl_ASCII85Decoder6finishEv:
  102|  3.05k|{
  103|  3.05k|    if (error) {
  ------------------
  |  Branch (103:9): [True: 173, False: 2.87k]
  ------------------
  104|    173|        return;
  105|    173|    }
  106|  2.87k|    flush();
  107|  2.87k|    next()->finish();
  108|  2.87k|}

_ZN18Pl_ASCIIHexDecoderC2EPKcP8Pipeline:
   13|  1.30k|    Pipeline(identifier, next)
   14|  1.30k|{
   15|  1.30k|    util::assertion(next, "Attempt to create Pl_ASCIIHexDecoder with nullptr as next");
   16|  1.30k|}
_ZN18Pl_ASCIIHexDecoder5writeEPKhm:
   20|  1.89k|{
   21|  1.89k|    if (eod) {
  ------------------
  |  Branch (21:9): [True: 384, False: 1.51k]
  ------------------
   22|    384|        return;
   23|    384|    }
   24|  6.81k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (24:24): [True: 5.48k, False: 1.32k]
  ------------------
   25|  5.48k|        char ch = static_cast<char>(toupper(buf[i]));
   26|  5.48k|        switch (ch) {
   27|    250|        case ' ':
  ------------------
  |  Branch (27:9): [True: 250, False: 5.23k]
  ------------------
   28|    561|        case '\f':
  ------------------
  |  Branch (28:9): [True: 311, False: 5.17k]
  ------------------
   29|    845|        case '\v':
  ------------------
  |  Branch (29:9): [True: 284, False: 5.20k]
  ------------------
   30|  1.12k|        case '\t':
  ------------------
  |  Branch (30:9): [True: 282, False: 5.20k]
  ------------------
   31|  1.48k|        case '\r':
  ------------------
  |  Branch (31:9): [True: 358, False: 5.13k]
  ------------------
   32|  1.86k|        case '\n':
  ------------------
  |  Branch (32:9): [True: 375, False: 5.11k]
  ------------------
   33|  1.86k|            QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space");
   34|       |            // ignore whitespace
   35|  1.86k|            break;
   36|       |
   37|     43|        case '>':
  ------------------
  |  Branch (37:9): [True: 43, False: 5.44k]
  ------------------
   38|     43|            eod = true;
   39|     43|            flush();
   40|     43|            break;
   41|       |
   42|  3.58k|        default:
  ------------------
  |  Branch (42:9): [True: 3.58k, False: 1.90k]
  ------------------
   43|  3.58k|            if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F')) {
  ------------------
  |  Branch (43:18): [True: 3.50k, False: 84]
  |  Branch (43:31): [True: 2.31k, False: 1.18k]
  |  Branch (43:46): [True: 1.17k, False: 91]
  |  Branch (43:59): [True: 1.12k, False: 52]
  ------------------
   44|  3.44k|                inbuf[pos++] = ch;
   45|  3.44k|                if (pos == 2) {
  ------------------
  |  Branch (45:21): [True: 1.67k, False: 1.76k]
  ------------------
   46|  1.67k|                    flush();
   47|  1.67k|                }
   48|  3.44k|            } else {
   49|    143|                char t[2];
   50|    143|                t[0] = ch;
   51|    143|                t[1] = 0;
   52|    143|                throw std::runtime_error("character out of range during base Hex decode: "s + t);
   53|    143|            }
   54|  3.44k|            break;
   55|  5.48k|        }
   56|  5.34k|        if (eod) {
  ------------------
  |  Branch (56:13): [True: 43, False: 5.29k]
  ------------------
   57|     43|            break;
   58|     43|        }
   59|  5.34k|    }
   60|  1.51k|}
_ZN18Pl_ASCIIHexDecoder5flushEv:
   64|  2.94k|{
   65|  2.94k|    if (pos == 0) {
  ------------------
  |  Branch (65:9): [True: 1.18k, False: 1.75k]
  ------------------
   66|  1.18k|        QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush");
   67|  1.18k|        return;
   68|  1.18k|    }
   69|  1.75k|    int b[2];
   70|  5.27k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (70:21): [True: 3.51k, False: 1.75k]
  ------------------
   71|  3.51k|        if (inbuf[i] >= 'A') {
  ------------------
  |  Branch (71:13): [True: 1.12k, False: 2.39k]
  ------------------
   72|  1.12k|            b[i] = inbuf[i] - 'A' + 10;
   73|  2.39k|        } else {
   74|  2.39k|            b[i] = inbuf[i] - '0';
   75|  2.39k|        }
   76|  3.51k|    }
   77|  1.75k|    auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
   78|       |
   79|  1.75k|    QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", (pos == 2) ? 0 : 1);
  ------------------
  |  Branch (79:61): [True: 1.67k, False: 86]
  ------------------
   80|       |    // Reset before calling getNext()->write in case that throws an exception.
   81|  1.75k|    pos = 0;
   82|  1.75k|    inbuf[0] = '0';
   83|  1.75k|    inbuf[1] = '0';
   84|  1.75k|    inbuf[2] = '\0';
   85|       |
   86|  1.75k|    next()->write(&ch, 1);
   87|  1.75k|}
_ZN18Pl_ASCIIHexDecoder6finishEv:
   91|  1.22k|{
   92|  1.22k|    flush();
   93|  1.22k|    next()->finish();
   94|  1.22k|}

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

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

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

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

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

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

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

_ZN12Pl_PNGFilterC2EPKcP8PipelineNS_8action_eEjjj:
   30|  1.94k|    Pipeline(identifier, next),
   31|  1.94k|    action(action)
   32|  1.94k|{
   33|  1.94k|    util::assertion(next, "Attempt to create Pl_PNGFilter with nullptr as next");
   34|  1.94k|    util::no_ci_rt_error_if(
   35|  1.94k|        samples_per_pixel < 1, "PNGFilter created with invalid samples_per_pixel");
   36|  1.94k|    util::no_ci_rt_error_if(
   37|  1.94k|        !(bits_per_sample == 1 || bits_per_sample == 2 || bits_per_sample == 4 ||
  ------------------
  |  Branch (37:11): [True: 88, False: 1.86k]
  |  Branch (37:35): [True: 68, False: 1.79k]
  |  Branch (37:59): [True: 66, False: 1.72k]
  ------------------
   38|  1.72k|          bits_per_sample == 8 || bits_per_sample == 16),
  ------------------
  |  Branch (38:11): [True: 1.60k, False: 121]
  |  Branch (38:35): [True: 107, False: 14]
  ------------------
   39|  1.94k|        "PNGFilter created with invalid bits_per_sample not 1, 2, 4, 8, or 16");
   40|  1.94k|    auto bits_per_pixel = 1ULL * bits_per_sample * samples_per_pixel;
   41|  1.94k|    util::no_ci_rt_error_if(
   42|  1.94k|        !util::fits<uint32_t>(bits_per_pixel + 7),
   43|  1.94k|        "PNGFilter created with bits_per_sample and samples_per_pixel values that cause overflow");
   44|  1.94k|    util::no_ci_rt_error_if(
   45|  1.94k|        !util::fits<uint32_t>(columns),
   46|  1.94k|        "PNGFilter created with columns value that causes overflow");
   47|  1.94k|    bytes_per_pixel = static_cast<uint32_t>((bits_per_pixel + 7) / 8);
   48|  1.94k|    auto bpr = ((columns * bits_per_pixel) + 7) / 8;
   49|  1.94k|    util::no_ci_rt_error_if(
   50|  1.94k|        bpr == 0 || !util::fits<uint32_t>(bpr), "PNGFilter created with invalid columns value");
  ------------------
  |  Branch (50:9): [True: 20, False: 1.92k]
  |  Branch (50:21): [True: 0, False: 1.92k]
  ------------------
   51|  1.94k|    util::no_ci_rt_error_if(
   52|  1.94k|        memory_limit > 0 && bpr > (memory_limit / 2U), "PNGFilter memory limit exceeded");
  ------------------
  |  Branch (52:9): [True: 1.92k, False: 20]
  |  Branch (52:29): [True: 10, False: 1.91k]
  ------------------
   53|  1.94k|    bytes_per_row = static_cast<uint32_t>(bpr);
   54|  1.94k|    buf1 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   55|  1.94k|    buf2 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   56|  1.94k|    memset(buf1.get(), 0, bytes_per_row + 1);
   57|  1.94k|    memset(buf2.get(), 0, bytes_per_row + 1);
   58|  1.94k|    cur_row = buf1.get();
   59|  1.94k|    prev_row = buf2.get();
   60|       |
   61|       |    // number of bytes per incoming row
   62|  1.94k|    incoming = (action == a_encode ? bytes_per_row : bytes_per_row + 1);
  ------------------
  |  Branch (62:17): [True: 0, False: 1.94k]
  ------------------
   63|  1.94k|}
_ZN12Pl_PNGFilter5writeEPKhm:
   73|  12.0k|{
   74|  12.0k|    size_t left = incoming - pos;
   75|  12.0k|    size_t offset = 0;
   76|  2.91M|    while (len >= left) {
  ------------------
  |  Branch (76:12): [True: 2.90M, False: 12.0k]
  ------------------
   77|       |        // finish off current row
   78|  2.90M|        memcpy(cur_row + pos, data + offset, left);
   79|  2.90M|        offset += left;
   80|  2.90M|        len -= left;
   81|       |
   82|  2.90M|        processRow();
   83|       |
   84|       |        // Swap rows
   85|  2.90M|        unsigned char* t = prev_row;
   86|  2.90M|        prev_row = cur_row;
   87|  2.90M|        cur_row = t ? t : buf2.get();
  ------------------
  |  Branch (87:19): [True: 2.90M, False: 5]
  ------------------
   88|  2.90M|        memset(cur_row, 0, bytes_per_row + 1);
   89|  2.90M|        left = incoming;
   90|  2.90M|        pos = 0;
   91|  2.90M|    }
   92|  12.0k|    if (len) {
  ------------------
  |  Branch (92:9): [True: 11.3k, False: 644]
  ------------------
   93|  11.3k|        memcpy(cur_row + pos, data + offset, len);
   94|  11.3k|    }
   95|  12.0k|    pos += len;
   96|  12.0k|}
_ZN12Pl_PNGFilter10processRowEv:
  100|  2.90M|{
  101|  2.90M|    if (action == a_encode) {
  ------------------
  |  Branch (101:9): [True: 0, False: 2.90M]
  ------------------
  102|      0|        encodeRow();
  103|  2.90M|    } else {
  104|  2.90M|        decodeRow();
  105|  2.90M|    }
  106|  2.90M|}
_ZN12Pl_PNGFilter9decodeRowEv:
  110|  2.90M|{
  111|  2.90M|    int filter = cur_row[0];
  112|  2.90M|    if (prev_row) {
  ------------------
  |  Branch (112:9): [True: 2.90M, False: 0]
  ------------------
  113|  2.90M|        switch (filter) {
  114|   952k|        case 0:
  ------------------
  |  Branch (114:9): [True: 952k, False: 1.95M]
  ------------------
  115|   952k|            break;
  116|   629k|        case 1:
  ------------------
  |  Branch (116:9): [True: 629k, False: 2.27M]
  ------------------
  117|   629k|            decodeSub();
  118|   629k|            break;
  119|   695k|        case 2:
  ------------------
  |  Branch (119:9): [True: 695k, False: 2.21M]
  ------------------
  120|   695k|            decodeUp();
  121|   695k|            break;
  122|  16.9k|        case 3:
  ------------------
  |  Branch (122:9): [True: 16.9k, False: 2.89M]
  ------------------
  123|  16.9k|            decodeAverage();
  124|  16.9k|            break;
  125|  2.45k|        case 4:
  ------------------
  |  Branch (125:9): [True: 2.45k, False: 2.90M]
  ------------------
  126|  2.45k|            decodePaeth();
  127|  2.45k|            break;
  128|   611k|        default:
  ------------------
  |  Branch (128:9): [True: 611k, False: 2.29M]
  ------------------
  129|       |            // ignore
  130|   611k|            break;
  131|  2.90M|        }
  132|  2.90M|    }
  133|       |
  134|  2.90M|    next()->write(cur_row + 1, bytes_per_row);
  135|  2.90M|}
_ZN12Pl_PNGFilter9decodeSubEv:
  139|   629k|{
  140|   629k|    unsigned char* buffer = cur_row + 1;
  141|   629k|    unsigned int bpp = bytes_per_pixel;
  142|       |
  143|  2.93M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (143:30): [True: 2.30M, False: 629k]
  ------------------
  144|  2.30M|        unsigned char left = 0;
  145|       |
  146|  2.30M|        if (i >= bpp) {
  ------------------
  |  Branch (146:13): [True: 1.50M, False: 792k]
  ------------------
  147|  1.50M|            left = buffer[i - bpp];
  148|  1.50M|        }
  149|       |
  150|  2.30M|        buffer[i] = static_cast<unsigned char>(buffer[i] + left);
  151|  2.30M|    }
  152|   629k|}
_ZN12Pl_PNGFilter8decodeUpEv:
  156|   695k|{
  157|   695k|    unsigned char* buffer = cur_row + 1;
  158|   695k|    unsigned char* above_buffer = prev_row + 1;
  159|       |
  160|  3.57M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (160:30): [True: 2.87M, False: 695k]
  ------------------
  161|  2.87M|        unsigned char up = above_buffer[i];
  162|  2.87M|        buffer[i] = static_cast<unsigned char>(buffer[i] + up);
  163|  2.87M|    }
  164|   695k|}
_ZN12Pl_PNGFilter13decodeAverageEv:
  168|  16.9k|{
  169|  16.9k|    unsigned char* buffer = cur_row + 1;
  170|  16.9k|    unsigned char* above_buffer = prev_row + 1;
  171|  16.9k|    auto bpp = bytes_per_pixel;
  172|       |
  173|   265k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (173:30): [True: 248k, False: 16.9k]
  ------------------
  174|   248k|        int left = 0;
  175|   248k|        int up = 0;
  176|       |
  177|   248k|        if (i >= bpp) {
  ------------------
  |  Branch (177:13): [True: 231k, False: 17.1k]
  ------------------
  178|   231k|            left = buffer[i - bpp];
  179|   231k|        }
  180|       |
  181|   248k|        up = above_buffer[i];
  182|   248k|        buffer[i] = static_cast<unsigned char>(buffer[i] + (left + up) / 2);
  183|   248k|    }
  184|  16.9k|}
_ZN12Pl_PNGFilter11decodePaethEv:
  188|  2.45k|{
  189|  2.45k|    unsigned char* buffer = cur_row + 1;
  190|  2.45k|    unsigned char* above_buffer = prev_row + 1;
  191|  2.45k|    auto bpp = bytes_per_pixel;
  192|       |
  193|   315k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (193:30): [True: 313k, False: 2.45k]
  ------------------
  194|   313k|        int left = 0;
  195|   313k|        int up = above_buffer[i];
  196|   313k|        int upper_left = 0;
  197|       |
  198|   313k|        if (i >= bpp) {
  ------------------
  |  Branch (198:13): [True: 310k, False: 2.45k]
  ------------------
  199|   310k|            left = buffer[i - bpp];
  200|   310k|            upper_left = above_buffer[i - bpp];
  201|   310k|        }
  202|       |
  203|   313k|        buffer[i] = static_cast<unsigned char>(buffer[i] + PaethPredictor(left, up, upper_left));
  204|   313k|    }
  205|  2.45k|}
_ZN12Pl_PNGFilter14PaethPredictorEiii:
  209|   313k|{
  210|   313k|    int p = a + b - c;
  211|   313k|    int pa = abs_diff(p, a);
  212|   313k|    int pb = abs_diff(p, b);
  213|   313k|    int pc = abs_diff(p, c);
  214|       |
  215|   313k|    if (pa <= pb && pa <= pc) {
  ------------------
  |  Branch (215:9): [True: 309k, False: 4.16k]
  |  Branch (215:21): [True: 308k, False: 488]
  ------------------
  216|   308k|        return a;
  217|   308k|    }
  218|  4.65k|    if (pb <= pc) {
  ------------------
  |  Branch (218:9): [True: 4.08k, False: 562]
  ------------------
  219|  4.08k|        return b;
  220|  4.08k|    }
  221|    562|    return c;
  222|  4.65k|}
_ZN12Pl_PNGFilter6finishEv:
  242|  1.86k|{
  243|  1.86k|    if (pos) {
  ------------------
  |  Branch (243:9): [True: 815, False: 1.04k]
  ------------------
  244|       |        // write partial row
  245|    815|        processRow();
  246|    815|    }
  247|  1.86k|    prev_row = nullptr;
  248|  1.86k|    cur_row = buf1.get();
  249|  1.86k|    pos = 0;
  250|  1.86k|    memset(cur_row, 0, bytes_per_row + 1);
  251|       |
  252|  1.86k|    next()->finish();
  253|  1.86k|}
Pl_PNGFilter.cc:_ZL8abs_diffii:
   19|   939k|{
   20|   939k|    return a > b ? a - b : b - a;
  ------------------
  |  Branch (20:12): [True: 15.1k, False: 924k]
  ------------------
   21|   939k|}

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

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

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

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

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

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

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

_ZN26QPDFAcroFormDocumentHelperC2ER4QPDF:
   24|  19.0k|    QPDFDocumentHelper(qpdf),
   25|  19.0k|    m(std::make_shared<Members>(qpdf))
   26|  19.0k|{
   27|  19.0k|}
_ZN4qpdf4impl8AcroForm8validateEb:
   43|  19.0k|{
   44|  19.0k|    invalidateCache();
   45|  19.0k|    analyze();
   46|  19.0k|}
_ZN4qpdf4impl8AcroForm15invalidateCacheEv:
   56|  19.0k|{
   57|  19.0k|    cache_valid_ = false;
   58|  19.0k|    fields_.clear();
   59|  19.0k|    annotation_to_field_.clear();
   60|  19.0k|    bad_fields_.clear();
   61|  19.0k|    unnamed_fields_.clear();
   62|  19.0k|    name_to_fields_.clear();
   63|  19.0k|}
_ZN26QPDFAcroFormDocumentHelper27getWidgetAnnotationsForPageE20QPDFPageObjectHelper:
  279|  15.2k|{
  280|  15.2k|    return m->getWidgetAnnotationsForPage(h);
  281|  15.2k|}
_ZN4qpdf4impl8AcroForm27getWidgetAnnotationsForPageE20QPDFPageObjectHelper:
  285|  29.6k|{
  286|  29.6k|    return h.getAnnotations("/Widget");
  287|  29.6k|}
_ZN26QPDFAcroFormDocumentHelper21getFieldForAnnotationE26QPDFAnnotationObjectHelper:
  312|  1.92k|{
  313|  1.92k|    return m->getFieldForAnnotation(h);
  314|  1.92k|}
_ZN4qpdf4impl8AcroForm21getFieldForAnnotationE26QPDFAnnotationObjectHelper:
  318|  26.0k|{
  319|  26.0k|    QPDFObjectHandle oh = h.getObjectHandle();
  320|  26.0k|    if (!oh.isDictionaryOfType("", "/Widget")) {
  ------------------
  |  Branch (320:9): [True: 0, False: 26.0k]
  ------------------
  321|      0|        return Null::temp();
  322|      0|    }
  323|  26.0k|    analyze();
  324|  26.0k|    QPDFObjGen og(oh.getObjGen());
  325|  26.0k|    if (annotation_to_field_.contains(og)) {
  ------------------
  |  Branch (325:9): [True: 24.0k, False: 1.95k]
  ------------------
  326|  24.0k|        return annotation_to_field_[og];
  327|  24.0k|    }
  328|  1.95k|    return Null::temp();
  329|  26.0k|}
_ZN4qpdf4impl8AcroForm7analyzeEv:
  333|  45.0k|{
  334|  45.0k|    if (cache_valid_) {
  ------------------
  |  Branch (334:9): [True: 26.0k, False: 19.0k]
  ------------------
  335|  26.0k|        return;
  336|  26.0k|    }
  337|  19.0k|    cache_valid_ = true;
  338|  19.0k|    QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
  339|  19.0k|    if (!(acroform.isDictionary() && acroform.hasKey("/Fields"))) {
  ------------------
  |  Branch (339:9): [True: 10.5k, False: 8.50k]
  |  Branch (339:11): [True: 8.57k, False: 10.4k]
  |  Branch (339:38): [True: 8.50k, False: 67]
  ------------------
  340|  10.5k|        return;
  341|  10.5k|    }
  342|  8.50k|    QPDFObjectHandle fields = acroform.getKey("/Fields");
  343|  8.50k|    if (Array fa = fields) {
  ------------------
  |  Branch (343:15): [True: 8.46k, False: 43]
  ------------------
  344|       |        // Traverse /AcroForm to find annotations and map them bidirectionally to fields.
  345|  67.7k|        for (auto const& field: fa) {
  ------------------
  |  Branch (345:31): [True: 67.7k, False: 8.46k]
  ------------------
  346|  67.7k|            traverseField(field, {}, 0);
  347|  67.7k|        }
  348|  8.46k|    } else {
  349|     43|        acroform.warn("/Fields key of /AcroForm dictionary is not an array; ignoring");
  350|     43|        fields = Array::empty();
  351|     43|    }
  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|  9.57k|    for (QPDFPageObjectHelper ph: pages) {
  ------------------
  |  Branch (360:33): [True: 9.57k, False: 8.50k]
  ------------------
  361|  26.5k|        for (auto const& iter: getWidgetAnnotationsForPage(ph)) {
  ------------------
  |  Branch (361:30): [True: 26.5k, False: 9.57k]
  ------------------
  362|  26.5k|            QPDFObjectHandle annot(iter.getObjectHandle());
  363|  26.5k|            QPDFObjGen og(annot.getObjGen());
  364|  26.5k|            if (!annotation_to_field_.contains(og)) {
  ------------------
  |  Branch (364:17): [True: 18.8k, False: 7.64k]
  ------------------
  365|       |                // This is not supposed to happen, but it's easy enough for us to handle this case.
  366|       |                // Treat the annotation as its own field. This could allow qpdf to sensibly handle a
  367|       |                // case such as a PDF creator adding a self-contained annotation (merged with the
  368|       |                // field dictionary) to the page's /Annots array and forgetting to also put it in
  369|       |                // /AcroForm.
  370|  18.8k|                annot.warn(
  371|  18.8k|                    "this widget annotation is not reachable from /AcroForm in the document "
  372|  18.8k|                    "catalog");
  373|  18.8k|                annotation_to_field_[og] = QPDFFormFieldObjectHelper(annot);
  374|  18.8k|                fields_[og].annotations.emplace_back(annot);
  375|  18.8k|            }
  376|  26.5k|        }
  377|  9.57k|    }
  378|  8.50k|}
_ZN4qpdf4impl8AcroForm13traverseFieldE16QPDFObjectHandleRKS2_i:
  382|  97.4k|{
  383|  97.4k|    if (depth > 100) {
  ------------------
  |  Branch (383:9): [True: 0, False: 97.4k]
  ------------------
  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|  97.4k|    if (!field.indirect()) {
  ------------------
  |  Branch (388:9): [True: 52.8k, False: 44.6k]
  ------------------
  389|  52.8k|        field.warn(
  390|  52.8k|            "encountered a direct object as a field or annotation while traversing /AcroForm; "
  391|  52.8k|            "ignoring field or annotation");
  392|  52.8k|        return false;
  393|  52.8k|    }
  394|  44.6k|    if (field == parent) {
  ------------------
  |  Branch (394:9): [True: 125, False: 44.5k]
  ------------------
  395|    125|        field.warn("loop detected while traversing /AcroForm");
  396|    125|        return false;
  397|    125|    }
  398|  44.5k|    if (!field.isDictionary()) {
  ------------------
  |  Branch (398:9): [True: 28.8k, False: 15.7k]
  ------------------
  399|  28.8k|        field.warn(
  400|  28.8k|            "encountered a non-dictionary as a field or annotation while traversing /AcroForm; "
  401|  28.8k|            "ignoring field or annotation");
  402|  28.8k|        return false;
  403|  28.8k|    }
  404|  15.7k|    QPDFObjGen og(field.getObjGen());
  405|  15.7k|    if (unnamed_fields_.contains(og)) {
  ------------------
  |  Branch (405:9): [True: 865, False: 14.8k]
  ------------------
  406|    865|        bad_fields_.insert(og);
  407|    865|    }
  408|  15.7k|    if (fields_.contains(og) || annotation_to_field_.contains(og) || bad_fields_.contains(og)) {
  ------------------
  |  Branch (408:9): [True: 650, False: 15.0k]
  |  Branch (408:33): [True: 370, False: 14.7k]
  |  Branch (408:70): [True: 905, False: 13.7k]
  ------------------
  409|  1.92k|        field.warn("loop detected while traversing /AcroForm");
  410|  1.92k|        return false;
  411|  1.92k|    }
  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|  13.7k|    FormNode node = field;
  420|  13.7k|    const bool is_field = node.field();
  421|  13.7k|    const bool is_annotation = node.widget();
  422|       |
  423|  13.7k|    QTC::TC("qpdf", "QPDFAcroFormDocumentHelper field found", (depth == 0) ? 0 : 1);
  ------------------
  |  Branch (423:63): [True: 4.93k, False: 8.86k]
  ------------------
  424|  13.7k|    QTC::TC("qpdf", "QPDFAcroFormDocumentHelper annotation found", (is_field ? 0 : 1));
  ------------------
  |  Branch (424:69): [True: 10.6k, False: 3.11k]
  ------------------
  425|       |
  426|  13.7k|    if (!is_field && !is_annotation) {
  ------------------
  |  Branch (426:9): [True: 3.11k, False: 10.6k]
  |  Branch (426:22): [True: 2.57k, False: 535]
  ------------------
  427|  2.57k|        field.warn(
  428|  2.57k|            "encountered an object that is neither field nor annotation while traversing "
  429|  2.57k|            "/AcroForm");
  430|  2.57k|        return false;
  431|  2.57k|    }
  432|       |
  433|  11.2k|    if (is_annotation) {
  ------------------
  |  Branch (433:9): [True: 6.87k, False: 4.34k]
  ------------------
  434|  6.87k|        auto our_field = (is_field ? field : parent);
  ------------------
  |  Branch (434:27): [True: 6.34k, False: 535]
  ------------------
  435|  6.87k|        fields_[our_field].annotations.emplace_back(field);
  436|  6.87k|        annotation_to_field_[og] = QPDFFormFieldObjectHelper(our_field);
  437|  6.87k|    }
  438|       |
  439|  11.2k|    if (!is_field) {
  ------------------
  |  Branch (439:9): [True: 535, False: 10.6k]
  ------------------
  440|    535|        return true;
  441|    535|    }
  442|       |
  443|  10.6k|    if (depth != 0 && field["/Parent"] != parent) {
  ------------------
  |  Branch (443:9): [True: 7.79k, False: 2.89k]
  |  Branch (443:9): [True: 1.53k, False: 9.15k]
  |  Branch (443:23): [True: 1.53k, False: 6.25k]
  ------------------
  444|  11.9k|        for (auto const& kid: Array(field["/Parent"]["/Kids"])) {
  ------------------
  |  Branch (444:29): [True: 11.9k, False: 1.34k]
  ------------------
  445|  11.9k|            if (kid == field) {
  ------------------
  |  Branch (445:17): [True: 195, False: 11.8k]
  ------------------
  446|    195|                field.warn("while traversing /AcroForm found field with two parents");
  447|    195|                return true;
  448|    195|            }
  449|  11.9k|        }
  450|  5.12k|        for (auto const& kid: Array(field["/Parent"]["/Kids"])) {
  ------------------
  |  Branch (450:29): [True: 5.12k, False: 1.23k]
  ------------------
  451|  5.12k|            if (kid == parent) {
  ------------------
  |  Branch (451:17): [True: 105, False: 5.01k]
  ------------------
  452|    105|                field.warn("loop detected while traversing /AcroForm");
  453|    105|                return false;
  454|    105|            }
  455|  5.12k|        }
  456|  1.23k|        field.warn("encountered invalid /Parent entry while traversing /AcroForm; correcting");
  457|  1.23k|        field.replaceKey("/Parent", parent);
  458|  1.23k|    }
  459|       |
  460|  10.3k|    if (node.T()) {
  ------------------
  |  Branch (460:9): [True: 8.28k, False: 2.09k]
  ------------------
  461|  8.28k|        auto old = fields_.find(og);
  462|  8.28k|        if (old != fields_.end() && !old->second.name.empty()) {
  ------------------
  |  Branch (462:13): [True: 5.42k, False: 2.86k]
  |  Branch (462:13): [True: 0, False: 8.28k]
  |  Branch (462:37): [True: 0, False: 5.42k]
  ------------------
  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.28k|        std::string name = node.fully_qualified_name();
  467|  8.28k|        fields_[og].name = name;
  468|  8.28k|        name_to_fields_[name].insert(og);
  469|  8.28k|    } else if (!is_annotation) {
  ------------------
  |  Branch (469:16): [True: 1.32k, False: 778]
  ------------------
  470|  1.32k|        unnamed_fields_.insert(og);
  471|  1.32k|    }
  472|       |
  473|  48.0k|    for (auto const& kid: node.Kids()) {
  ------------------
  |  Branch (473:25): [True: 48.0k, False: 10.3k]
  ------------------
  474|  48.0k|        if (bad_fields_.contains(kid)) {
  ------------------
  |  Branch (474:13): [True: 18.3k, False: 29.7k]
  ------------------
  475|  18.3k|            continue;
  476|  18.3k|        }
  477|       |
  478|  29.7k|        if (!traverseField(kid, field, 1 + depth)) {
  ------------------
  |  Branch (478:13): [True: 21.7k, False: 8.01k]
  ------------------
  479|  21.7k|            bad_fields_.insert(kid);
  480|  21.7k|        }
  481|  29.7k|    }
  482|  10.3k|    return true;
  483|  10.6k|}
_ZN4qpdf4impl8AcroForm18getNeedAppearancesEv:
  493|  45.5k|{
  494|  45.5k|    bool result = false;
  495|  45.5k|    QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
  496|  45.5k|    if (acroform.isDictionary() && acroform.getKey("/NeedAppearances").isBool()) {
  ------------------
  |  Branch (496:9): [True: 15.9k, False: 29.5k]
  |  Branch (496:9): [True: 4.45k, False: 41.0k]
  |  Branch (496:36): [True: 4.45k, False: 11.5k]
  ------------------
  497|  4.45k|        result = acroform.getKey("/NeedAppearances").getBoolValue();
  498|  4.45k|    }
  499|  45.5k|    return result;
  500|  45.5k|}
_ZN4qpdf4impl8AcroForm18setNeedAppearancesEb:
  510|  2.75k|{
  511|  2.75k|    QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
  512|  2.75k|    if (!acroform.isDictionary()) {
  ------------------
  |  Branch (512:9): [True: 0, False: 2.75k]
  ------------------
  513|      0|        qpdf.getRoot().warn(
  514|      0|            "ignoring call to QPDFAcroFormDocumentHelper::setNeedAppearances"
  515|      0|            " on a file that lacks an /AcroForm dictionary");
  516|      0|        return;
  517|      0|    }
  518|  2.75k|    if (val) {
  ------------------
  |  Branch (518:9): [True: 0, False: 2.75k]
  ------------------
  519|      0|        acroform.replaceKey("/NeedAppearances", QPDFObjectHandle::newBool(true));
  520|  2.75k|    } else {
  521|  2.75k|        acroform.removeKey("/NeedAppearances");
  522|  2.75k|    }
  523|  2.75k|}
_ZN26QPDFAcroFormDocumentHelper27generateAppearancesIfNeededEv:
  527|  10.3k|{
  528|  10.3k|    m->generateAppearancesIfNeeded();
  529|  10.3k|}
_ZN4qpdf4impl8AcroForm27generateAppearancesIfNeededEv:
  533|  10.3k|{
  534|  10.3k|    if (!getNeedAppearances()) {
  ------------------
  |  Branch (534:9): [True: 5.90k, False: 4.43k]
  ------------------
  535|  5.90k|        return;
  536|  5.90k|    }
  537|       |
  538|  4.85k|    for (auto const& page: QPDFPageDocumentHelper(qpdf).getAllPages()) {
  ------------------
  |  Branch (538:26): [True: 4.85k, False: 4.43k]
  ------------------
  539|  13.4k|        for (auto& aoh: getWidgetAnnotationsForPage(page)) {
  ------------------
  |  Branch (539:23): [True: 13.4k, False: 4.85k]
  ------------------
  540|  13.4k|            QPDFFormFieldObjectHelper ffh = getFieldForAnnotation(aoh);
  541|  13.4k|            if (ffh.getFieldType() == "/Btn") {
  ------------------
  |  Branch (541:17): [True: 569, False: 12.8k]
  ------------------
  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|    569|                if (ffh.isRadioButton() || ffh.isCheckbox()) {
  ------------------
  |  Branch (546:21): [True: 270, False: 299]
  |  Branch (546:44): [True: 280, False: 19]
  ------------------
  547|    550|                    ffh.setV(ffh.getValue());
  548|    550|                }
  549|  12.8k|            } else {
  550|  12.8k|                ffh.generateAppearance(aoh);
  551|  12.8k|            }
  552|  13.4k|        }
  553|  4.85k|    }
  554|  4.43k|    setNeedAppearances(false);
  555|  4.43k|}

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

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

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

_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_:
    9|   803k|    std::runtime_error(createWhat(filename, object, (offset ? offset : -1), message)),
  ------------------
  |  Branch (9:54): [True: 539k, False: 263k]
  ------------------
   10|   803k|    error_code(error_code),
   11|   803k|    filename(filename),
   12|   803k|    object(object),
   13|   803k|    offset(offset ? offset : -1),
  ------------------
  |  Branch (13:12): [True: 539k, False: 263k]
  ------------------
   14|   803k|    message(message)
   15|   803k|{
   16|   803k|}
_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_b:
   25|   348k|    std::runtime_error(
   26|   348k|        createWhat(filename, object, (offset || zero_offset_valid ? offset : -1), message)),
  ------------------
  |  Branch (26:39): [True: 348k, False: 69]
  |  Branch (26:49): [True: 69, False: 0]
  ------------------
   27|   348k|    error_code(error_code),
   28|   348k|    filename(filename),
   29|   348k|    object(object),
   30|   348k|    offset(offset || zero_offset_valid ? offset : -1),
  ------------------
  |  Branch (30:12): [True: 348k, False: 69]
  |  Branch (30:22): [True: 69, False: 0]
  ------------------
   31|   348k|    message(message)
   32|   348k|{
   33|   348k|}
_ZN7QPDFExc10createWhatERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_xS8_:
   41|  1.15M|{
   42|  1.15M|    std::string result;
   43|  1.15M|    if (!filename.empty()) {
  ------------------
  |  Branch (43:9): [True: 900k, False: 251k]
  ------------------
   44|   900k|        result += filename;
   45|   900k|    }
   46|  1.15M|    if (!(object.empty() && offset < 0)) {
  ------------------
  |  Branch (46:11): [True: 168k, False: 983k]
  |  Branch (46:29): [True: 122k, False: 46.2k]
  ------------------
   47|  1.02M|        if (!filename.empty()) {
  ------------------
  |  Branch (47:13): [True: 778k, False: 251k]
  ------------------
   48|   778k|            result += " (";
   49|   778k|        }
   50|  1.02M|        if (!object.empty()) {
  ------------------
  |  Branch (50:13): [True: 983k, False: 46.2k]
  ------------------
   51|   983k|            result += object;
   52|   983k|            if (offset >= 0) {
  ------------------
  |  Branch (52:17): [True: 720k, False: 263k]
  ------------------
   53|   720k|                result += ", ";
   54|   720k|            }
   55|   983k|        }
   56|  1.02M|        if (offset >= 0) {
  ------------------
  |  Branch (56:13): [True: 766k, False: 263k]
  ------------------
   57|   766k|            result += "offset " + std::to_string(offset);
   58|   766k|        }
   59|  1.02M|        if (!filename.empty()) {
  ------------------
  |  Branch (59:13): [True: 778k, False: 251k]
  ------------------
   60|   778k|            result += ")";
   61|   778k|        }
   62|  1.02M|    }
   63|  1.15M|    if (!result.empty()) {
  ------------------
  |  Branch (63:9): [True: 1.15M, False: 196]
  ------------------
   64|  1.15M|        result += ": ";
   65|  1.15M|    }
   66|  1.15M|    result += message;
   67|  1.15M|    return result;
   68|  1.15M|}

_ZN25QPDFFormFieldObjectHelperC2E16QPDFObjectHandle:
   34|  27.7k|    QPDFObjectHelper(o),
   35|  27.7k|    m(std::make_shared<Members>(oh()))
   36|  27.7k|{
   37|  27.7k|}
_ZN25QPDFFormFieldObjectHelperC2Ev:
   40|  25.7k|    QPDFObjectHelper(Null::temp()),
   41|  25.7k|    m(std::make_shared<Members>(QPDFObjectHandle()))
   42|  25.7k|{
   43|  25.7k|}
_ZNK4qpdf4impl8FormNode9inheritedERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
   92|  20.6k|{
   93|  20.6k|    if (!obj) {
  ------------------
  |  Branch (93:9): [True: 798, False: 19.8k]
  ------------------
   94|    798|        return null_oh;
   95|    798|    }
   96|  19.8k|    auto node = *this;
   97|  19.8k|    QPDFObjGen::set seen;
   98|  19.8k|    size_t depth = 0; // Don't bother with loop detection until depth becomes suspicious
   99|  35.5k|    while (node.Parent() && (++depth < 10 || seen.add(node))) {
  ------------------
  |  Branch (99:12): [True: 18.2k, False: 17.3k]
  |  Branch (99:12): [True: 17.3k, False: 18.2k]
  |  Branch (99:30): [True: 15.0k, False: 3.17k]
  |  Branch (99:46): [True: 2.24k, False: 928]
  ------------------
  100|  17.3k|        node = node.Parent();
  101|  17.3k|        if (auto const& result = node[name]) {
  ------------------
  |  Branch (101:25): [True: 1.60k, False: 15.7k]
  ------------------
  102|  1.60k|            return {result};
  103|  1.60k|        }
  104|  17.3k|    }
  105|  18.2k|    return acroform ? from_AcroForm(name) : null_oh;
  ------------------
  |  Branch (105:12): [True: 0, False: 18.2k]
  ------------------
  106|  19.8k|}
_ZNK4qpdf4impl8FormNode18inheritable_stringERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  116|  8.69k|{
  117|  8.69k|    if (auto fv = inheritable_value<String>(name)) {
  ------------------
  |  Branch (117:14): [True: 810, False: 7.88k]
  ------------------
  118|    810|        return fv.utf8_value();
  119|    810|    }
  120|  7.88k|    return {};
  121|  8.69k|}
_ZN25QPDFFormFieldObjectHelper12getFieldTypeEv:
  134|  13.4k|{
  135|  13.4k|    if (auto ft = m->FT()) {
  ------------------
  |  Branch (135:14): [True: 11.9k, False: 1.52k]
  ------------------
  136|  11.9k|        return ft;
  137|  11.9k|    }
  138|  1.52k|    return {};
  139|  13.4k|}
_ZNK4qpdf4impl8FormNode20fully_qualified_nameEv:
  149|  8.28k|{
  150|  8.28k|    std::string result;
  151|  8.28k|    auto node = *this;
  152|  8.28k|    QPDFObjGen::set seen;
  153|  8.28k|    size_t depth = 0; // Don't bother with loop detection until depth becomes suspicious
  154|  45.5k|    while (node && (++depth < 10 || seen.add(node))) {
  ------------------
  |  Branch (154:12): [True: 38.9k, False: 6.57k]
  |  Branch (154:21): [True: 32.1k, False: 6.79k]
  |  Branch (154:37): [True: 5.08k, False: 1.71k]
  ------------------
  155|  37.2k|        if (auto T = node.T()) {
  ------------------
  |  Branch (155:18): [True: 35.0k, False: 2.25k]
  ------------------
  156|  35.0k|            if (!result.empty()) {
  ------------------
  |  Branch (156:17): [True: 26.6k, False: 8.39k]
  ------------------
  157|  26.6k|                result.insert(0, 1, '.');
  158|  26.6k|            }
  159|  35.0k|            result.insert(0, T.utf8_value());
  160|  35.0k|        }
  161|  37.2k|        node = node.Parent();
  162|  37.2k|    }
  163|  8.28k|    return result;
  164|  8.28k|}
_ZN25QPDFFormFieldObjectHelper8getValueEv:
  213|    550|{
  214|    550|    return Null::if_null(m->V<QPDFObjectHandle>());
  215|    550|}
_ZNK4qpdf4impl8FormNode5valueEv:
  225|  8.69k|{
  226|  8.69k|    return inheritable_string("/V");
  227|  8.69k|}
_ZN25QPDFFormFieldObjectHelper19getDefaultResourcesEv:
  249|  10.6k|{
  250|  10.6k|    return Null::if_null(m->getDefaultResources());
  251|  10.6k|}
_ZN4qpdf4impl8FormNode19getDefaultResourcesEv:
  255|  16.2k|{
  256|  16.2k|    return from_AcroForm("/DR");
  257|  16.2k|}
_ZNK4qpdf4impl8FormNode18default_appearanceEv:
  267|  8.69k|{
  268|  8.69k|    if (auto DA = inheritable_value<String>("/DA")) {
  ------------------
  |  Branch (268:14): [True: 7.05k, False: 1.64k]
  ------------------
  269|  7.05k|        return DA.utf8_value();
  270|  7.05k|    }
  271|  1.64k|    if (String DA = from_AcroForm("/DA")) {
  ------------------
  |  Branch (271:16): [True: 14, False: 1.63k]
  ------------------
  272|     14|        return DA.utf8_value();
  273|     14|    }
  274|  1.63k|    return {};
  275|  1.64k|}
_ZN4qpdf4impl8FormNode8getFlagsEv:
  307|  4.22k|{
  308|  4.22k|    auto f = inheritable_value<QPDFObjectHandle>("/Ff");
  309|  4.22k|    return f.isInteger() ? f.getIntValueAsInt() : 0;
  ------------------
  |  Branch (309:12): [True: 1.45k, False: 2.77k]
  ------------------
  310|  4.22k|}
_ZN25QPDFFormFieldObjectHelper10isCheckboxEv:
  326|    299|{
  327|    299|    return m->isCheckbox();
  328|    299|}
_ZN4qpdf4impl8FormNode10isCheckboxEv:
  332|    849|{
  333|    849|    return FT() == "/Btn" && (getFlags() & (ff_btn_radio | ff_btn_pushbutton)) == 0;
  ------------------
  |  Branch (333:12): [True: 849, False: 0]
  |  Branch (333:30): [True: 560, False: 289]
  ------------------
  334|    849|}
_ZN25QPDFFormFieldObjectHelper13isRadioButtonEv:
  350|    569|{
  351|    569|    return m->isRadioButton();
  352|    569|}
_ZN4qpdf4impl8FormNode13isRadioButtonEv:
  356|  1.08k|{
  357|  1.08k|    return FT() == "/Btn" && (getFlags() & ff_btn_radio) == ff_btn_radio;
  ------------------
  |  Branch (357:12): [True: 1.06k, False: 27]
  |  Branch (357:30): [True: 763, False: 299]
  ------------------
  358|  1.08k|}
_ZN4qpdf4impl8FormNode8isChoiceEv:
  380|  10.8k|{
  381|  10.8k|    return FT() == "/Ch";
  382|  10.8k|}
_ZN4qpdf4impl8FormNode10getChoicesEv:
  392|  2.11k|{
  393|  2.11k|    if (!isChoice()) {
  ------------------
  |  Branch (393:9): [True: 0, False: 2.11k]
  ------------------
  394|      0|        return {};
  395|      0|    }
  396|  2.11k|    std::vector<std::string> result;
  397|   131k|    for (auto const& item: inheritable_value<Array>("/Opt")) {
  ------------------
  |  Branch (397:26): [True: 131k, False: 2.11k]
  ------------------
  398|   131k|        if (item.isString()) {
  ------------------
  |  Branch (398:13): [True: 121k, False: 10.3k]
  ------------------
  399|   121k|            result.emplace_back(item.getUTF8Value());
  400|   121k|        } else if (item.size() == 2) {
  ------------------
  |  Branch (400:20): [True: 253, False: 10.0k]
  ------------------
  401|    253|            auto display = item.getArrayItem(1);
  402|    253|            if (display.isString()) {
  ------------------
  |  Branch (402:17): [True: 177, False: 76]
  ------------------
  403|    177|                result.emplace_back(display.getUTF8Value());
  404|    177|            }
  405|    253|        }
  406|   131k|    }
  407|  2.11k|    return result;
  408|  2.11k|}
_ZN4qpdf4impl8FormNode17setFieldAttributeERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKNS_4NameE:
  424|    222|{
  425|    222|    replace(key, value);
  426|    222|}
_ZN25QPDFFormFieldObjectHelper4setVE16QPDFObjectHandleb:
  442|    550|{
  443|    550|    m->setV(value, need_appearances);
  444|    550|}
_ZN4qpdf4impl8FormNode4setVE16QPDFObjectHandleb:
  448|    550|{
  449|    550|    if (FT() == "/Btn") {
  ------------------
  |  Branch (449:9): [True: 550, False: 0]
  ------------------
  450|    550|        Name name = value;
  451|    550|        if (isCheckbox()) {
  ------------------
  |  Branch (451:13): [True: 280, False: 270]
  ------------------
  452|    280|            if (!name) {
  ------------------
  |  Branch (452:17): [True: 58, False: 222]
  ------------------
  453|     58|                warn("ignoring attempt to set a checkbox field to a value whose type is not name");
  454|     58|                return;
  455|     58|            }
  456|       |            // Accept any value other than /Off to mean checked. Files have been seen that use
  457|       |            // /1 or other values.
  458|    222|            setCheckBoxValue(name != "/Off");
  459|    222|            return;
  460|    280|        }
  461|    270|        if (isRadioButton()) {
  ------------------
  |  Branch (461:13): [True: 270, False: 0]
  ------------------
  462|    270|            if (!name) {
  ------------------
  |  Branch (462:17): [True: 20, False: 250]
  ------------------
  463|     20|                warn(
  464|     20|                    "ignoring attempt to set a radio button field to an object that is not a name");
  465|     20|                return;
  466|     20|            }
  467|    250|            setRadioButtonValue(name);
  468|    250|            return;
  469|    270|        }
  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|    270|    }
  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|    333|{
  503|    333|    qpdf_expect(name);
  ------------------
  |  |   13|    333|#define qpdf_expect assert
  ------------------
  |  Branch (503:5): [True: 333, 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|    333|    auto kids = Kids();
  512|    333|    if (!kids) {
  ------------------
  |  Branch (512:9): [True: 134, False: 199]
  ------------------
  513|       |        // This is most likely one of the individual buttons. Try calling on the parent.
  514|    134|        auto parent = Parent();
  515|    134|        if (parent.Kids()) {
  ------------------
  |  Branch (515:13): [True: 83, False: 51]
  ------------------
  516|     83|            parent.setRadioButtonValue(name);
  517|     83|            return;
  518|     83|        }
  519|    134|    }
  520|    250|    if (!isRadioButton() || !kids) {
  ------------------
  |  Branch (520:9): [True: 27, False: 223]
  |  Branch (520:29): [True: 51, False: 172]
  ------------------
  521|     78|        warn("don't know how to set the value of this field as a radio button");
  522|     78|        return;
  523|     78|    }
  524|    172|    replace("/V", name);
  525|  3.18k|    for (FormNode kid: kids) {
  ------------------
  |  Branch (525:22): [True: 3.18k, False: 172]
  ------------------
  526|  3.18k|        auto ap = kid.AP();
  527|  3.18k|        QPDFObjectHandle annot;
  528|  3.18k|        if (!ap) {
  ------------------
  |  Branch (528:13): [True: 3.05k, False: 125]
  ------------------
  529|       |            // The widget may be below. If there is more than one, just find the first one.
  530|  18.0k|            for (FormNode grandkid: kid.Kids()) {
  ------------------
  |  Branch (530:35): [True: 18.0k, False: 2.78k]
  ------------------
  531|  18.0k|                ap = grandkid.AP();
  532|  18.0k|                if (ap) {
  ------------------
  |  Branch (532:21): [True: 271, False: 17.8k]
  ------------------
  533|    271|                    annot = grandkid;
  534|    271|                    break;
  535|    271|                }
  536|  18.0k|            }
  537|  3.05k|        } else {
  538|    125|            annot = kid;
  539|    125|        }
  540|  3.18k|        if (!annot) {
  ------------------
  |  Branch (540:13): [True: 2.78k, False: 396]
  ------------------
  541|  2.78k|            warn("unable to set the value of this radio button");
  542|  2.78k|            continue;
  543|  2.78k|        }
  544|    396|        if (ap["/N"].contains(name.value())) {
  ------------------
  |  Branch (544:13): [True: 82, False: 314]
  ------------------
  545|     82|            annot.replace("/AS", name);
  546|    314|        } else {
  547|    314|            annot.replace("/AS", Name("/Off"));
  548|    314|        }
  549|    396|    }
  550|    172|}
_ZN4qpdf4impl8FormNode16setCheckBoxValueEb:
  554|    222|{
  555|    222|    auto ap = AP();
  556|    222|    QPDFObjectHandle annot;
  557|    222|    if (ap) {
  ------------------
  |  Branch (557:9): [True: 130, False: 92]
  ------------------
  558|    130|        annot = oh();
  559|    130|    } else {
  560|       |        // The widget may be below. If there is more than one, just find the first one.
  561|    924|        for (FormNode kid: Kids()) {
  ------------------
  |  Branch (561:26): [True: 924, False: 79]
  ------------------
  562|    924|            ap = kid.AP();
  563|    924|            if (ap) {
  ------------------
  |  Branch (563:17): [True: 13, False: 911]
  ------------------
  564|     13|                annot = kid;
  565|     13|                break;
  566|     13|            }
  567|    924|        }
  568|     92|    }
  569|    222|    std::string on_value;
  570|    222|    if (value) {
  ------------------
  |  Branch (570:9): [True: 191, False: 31]
  ------------------
  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|    191|        if (ap) {
  ------------------
  |  Branch (573:13): [True: 129, False: 62]
  ------------------
  574|    143|            for (auto const& item: Dictionary(ap["/N"])) {
  ------------------
  |  Branch (574:34): [True: 143, False: 44]
  ------------------
  575|    143|                if (item.first != "/Off") {
  ------------------
  |  Branch (575:21): [True: 85, False: 58]
  ------------------
  576|     85|                    on_value = item.first;
  577|     85|                    break;
  578|     85|                }
  579|    143|            }
  580|    129|        }
  581|    191|        if (on_value.empty()) {
  ------------------
  |  Branch (581:13): [True: 106, False: 85]
  ------------------
  582|    106|            on_value = "/Yes";
  583|    106|        }
  584|    191|    }
  585|       |
  586|       |    // Set /AS to the on value or /Off in addition to setting /V.
  587|    222|    auto name = Name(value ? on_value : "/Off");
  ------------------
  |  Branch (587:22): [True: 191, False: 31]
  ------------------
  588|    222|    setFieldAttribute("/V", name);
  589|    222|    if (!annot) {
  ------------------
  |  Branch (589:9): [True: 79, False: 143]
  ------------------
  590|     79|        warn("unable to set the value of this checkbox");
  591|     79|        return;
  592|     79|    }
  593|    143|    annot.replace("/AS", name);
  594|    143|}
_ZN25QPDFFormFieldObjectHelper18generateAppearanceER26QPDFAnnotationObjectHelper:
  598|  12.8k|{
  599|  12.8k|    m->generateAppearance(aoh);
  600|  12.8k|}
_ZN4qpdf4impl8FormNode18generateAppearanceER26QPDFAnnotationObjectHelper:
  604|  12.8k|{
  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|  12.8k|    auto ft = FT();
  608|  12.8k|    if (ft == "/Tx" || ft == "/Ch") {
  ------------------
  |  Branch (608:9): [True: 8.86k, False: 4.01k]
  |  Branch (608:24): [True: 2.36k, False: 1.65k]
  ------------------
  609|  11.2k|        generateTextAppearance(aoh);
  610|  11.2k|    }
  611|  12.8k|}
_ZN4qpdf4impl8FormNode22generateTextAppearanceER26QPDFAnnotationObjectHelper:
  881|  11.2k|{
  882|  11.2k|    no_ci_warn_if(
  883|  11.2k|        !Dictionary(aoh), // There is no guarantee that aoh is a dictionary
  884|  11.2k|        "cannot generate appearance for non-dictionary annotation" //
  885|  11.2k|    );
  886|  11.2k|    Stream AS = aoh.getAppearanceStream("/N"); // getAppearanceStream returns a stream or null.
  887|  11.2k|    if (!AS) {
  ------------------
  |  Branch (887:9): [True: 4.01k, False: 7.20k]
  ------------------
  888|  4.01k|        QPDFObjectHandle::Rectangle rect = aoh.getRect(); // may silently be invalid / all zeros
  889|  4.01k|        QPDFObjectHandle::Rectangle bbox(0, 0, rect.urx - rect.llx, rect.ury - rect.lly);
  890|  4.01k|        auto* pdf = qpdf();
  891|  4.01k|        no_ci_stop_damaged_if(!pdf, "unable to get owning QPDF for appearance generation");
  892|  4.01k|        AS = pdf->newStream("/Tx BMC\nEMC\n");
  893|  4.01k|        AS.replaceDict(Dictionary(
  894|  4.01k|            {{"/BBox", QPDFObjectHandle::newFromRectangle(bbox)},
  895|  4.01k|             {"/Resources", Dictionary({{"/ProcSet", Array({Name("/PDF"), Name("/Text")})}})},
  896|  4.01k|             {"/Type", Name("/XObject")},
  897|  4.01k|             {"/Subtype", Name("/Form")}}));
  898|  4.01k|        if (auto ap = AP()) {
  ------------------
  |  Branch (898:18): [True: 955, False: 3.06k]
  ------------------
  899|    955|            ap.replace("/N", AS);
  900|  3.06k|        } else {
  901|  3.06k|            aoh.replace("/AP", Dictionary({{"/N", AS}}));
  902|  3.06k|        }
  903|  4.01k|    }
  904|       |
  905|  11.2k|    if (AS.obj_sp().use_count() > 3) {
  ------------------
  |  Branch (905:9): [True: 2.75k, False: 8.46k]
  ------------------
  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.75k|        auto data = AS.getStreamData(qpdf_dl_all);
  918|  2.75k|        AS = AS.copy();
  919|  2.75k|        AS.replaceStreamData(std::move(data), Null::temp(), Null::temp());
  920|  2.75k|        if (Dictionary AP = aoh.getAppearanceDictionary()) {
  ------------------
  |  Branch (920:24): [True: 1.14k, False: 1.60k]
  ------------------
  921|  1.14k|            AP.replace("/N", AS);
  922|  1.60k|        } else {
  923|  1.60k|            aoh.replace("/AP", Dictionary({{"/N", AS}}));
  924|       |            // aoh is a dictionary, so insertion will succeed. No need to check by retrieving it.
  925|  1.60k|        }
  926|  2.75k|    }
  927|  11.2k|    QPDFObjectHandle bbox_obj = AS.getDict()["/BBox"];
  928|  11.2k|    if (!bbox_obj.isRectangle()) {
  ------------------
  |  Branch (928:9): [True: 920, False: 10.3k]
  ------------------
  929|    920|        aoh.warn("unable to get appearance stream bounding box");
  930|    920|        return;
  931|    920|    }
  932|  10.3k|    QPDFObjectHandle::Rectangle bbox = bbox_obj.getArrayAsRectangle();
  933|  10.3k|    std::string DA = default_appearance();
  934|  10.3k|    std::string V = value();
  935|       |
  936|  10.3k|    TfFinder tff;
  937|  10.3k|    Pl_QPDFTokenizer tok("tf", &tff);
  938|  10.3k|    tok.writeString(DA);
  939|  10.3k|    tok.finish();
  940|  10.3k|    double tf = tff.getTf();
  941|  10.3k|    DA = tff.getDA();
  942|       |
  943|  10.3k|    std::string (*encoder)(std::string const&, char) = &QUtil::utf8_to_ascii;
  944|  10.3k|    std::string font_name = tff.getFontName();
  945|  10.3k|    if (!font_name.empty()) {
  ------------------
  |  Branch (945:9): [True: 5.60k, False: 4.69k]
  ------------------
  946|       |        // See if the font is encoded with something we know about.
  947|  5.60k|        Dictionary resources = AS.getDict()["/Resources"];
  948|  5.60k|        Dictionary font = resources["/Font"][font_name];
  949|  5.60k|        if (!font) {
  ------------------
  |  Branch (949:13): [True: 5.56k, False: 45]
  ------------------
  950|  5.56k|            font = getDefaultResources()["/Font"][font_name];
  951|  5.56k|            if (resources) {
  ------------------
  |  Branch (951:17): [True: 3.12k, False: 2.43k]
  ------------------
  952|  3.12k|                if (resources.indirect()) {
  ------------------
  |  Branch (952:21): [True: 303, False: 2.82k]
  ------------------
  953|    303|                    resources = resources.qpdf()->makeIndirectObject(resources.copy());
  954|    303|                    AS.getDict().replace("/Resources", resources);
  955|    303|                }
  956|       |                // Use mergeResources to force /Font to be local
  957|  3.12k|                QPDFObjectHandle res = resources;
  958|  3.12k|                res.mergeResources(Dictionary({{"/Font", Dictionary::empty()}}));
  959|  3.12k|                res.getKey("/Font").replace(font_name, font);
  960|  3.12k|            }
  961|  5.56k|        }
  962|       |
  963|  5.60k|        if (Name Encoding = font["/Encoding"]) {
  ------------------
  |  Branch (963:18): [True: 177, False: 5.42k]
  ------------------
  964|    177|            if (Encoding == "/WinAnsiEncoding") {
  ------------------
  |  Branch (964:17): [True: 63, False: 114]
  ------------------
  965|     63|                encoder = &QUtil::utf8_to_win_ansi;
  966|    114|            } else if (Encoding == "/MacRomanEncoding") {
  ------------------
  |  Branch (966:24): [True: 44, False: 70]
  ------------------
  967|     44|                encoder = &QUtil::utf8_to_mac_roman;
  968|     44|            }
  969|    177|        }
  970|  5.60k|    }
  971|       |
  972|  10.3k|    V = (*encoder)(V, '?');
  973|       |
  974|  10.3k|    std::vector<std::string> opt;
  975|  10.3k|    if (isChoice() && (getFlags() & ff_ch_combo) == 0) {
  ------------------
  |  Branch (975:9): [True: 2.31k, False: 7.99k]
  |  Branch (975:23): [True: 2.11k, False: 196]
  ------------------
  976|  2.11k|        opt = getChoices();
  977|   121k|        for (auto& o: opt) {
  ------------------
  |  Branch (977:21): [True: 121k, False: 2.11k]
  ------------------
  978|   121k|            o = (*encoder)(o, '?');
  979|   121k|        }
  980|  2.11k|    }
  981|       |
  982|  10.3k|    std::string result;
  983|  10.3k|    pl::String pl(result);
  984|  10.3k|    ValueSetter vs(DA, V, opt, tf, bbox);
  985|  10.3k|    Pl_QPDFTokenizer vs_tok("", &vs, &pl);
  986|  10.3k|    vs_tok.writeString(AS.getStreamData(qpdf_dl_all));
  987|  10.3k|    vs_tok.finish();
  988|  10.3k|    AS.replaceStreamData(std::move(result), Null::temp(), Null::temp());
  989|  10.3k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinderC2Ev:
  800|  8.69k|        TfFinder() = default;
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinder11handleTokenERKN13QPDFTokenizer5TokenE:
  805|   391k|        {
  806|   391k|            auto ttype = token.getType();
  807|   391k|            auto const& value = token.getValue();
  808|   391k|            DA.emplace_back(token.getRawValue());
  809|   391k|            switch (ttype) {
  810|  50.7k|            case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (810:13): [True: 50.7k, False: 340k]
  ------------------
  811|  63.7k|            case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (811:13): [True: 12.9k, False: 378k]
  ------------------
  812|  63.7k|                last_num = strtod(value.c_str(), nullptr);
  813|  63.7k|                last_num_idx = QIntC::to_int(DA.size() - 1);
  814|  63.7k|                break;
  815|       |
  816|  44.0k|            case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (816:13): [True: 44.0k, False: 346k]
  ------------------
  817|  44.0k|                last_name = value;
  818|  44.0k|                break;
  819|       |
  820|  54.6k|            case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (820:13): [True: 54.6k, False: 336k]
  ------------------
  821|  54.6k|                if (token.isWord("Tf")) {
  ------------------
  |  Branch (821:21): [True: 7.33k, False: 47.3k]
  ------------------
  822|  7.33k|                    if ((last_num > 1.0) && (last_num < 1000.0)) {
  ------------------
  |  Branch (822:25): [True: 6.42k, False: 909]
  |  Branch (822:45): [True: 6.02k, False: 405]
  ------------------
  823|       |                        // These ranges are arbitrary but keep us from doing insane things or
  824|       |                        // suffering from over/underflow
  825|  6.02k|                        tf = last_num;
  826|  6.02k|                    }
  827|  7.33k|                    tf_idx = last_num_idx;
  828|  7.33k|                    font_name = last_name;
  829|  7.33k|                }
  830|  54.6k|                break;
  831|       |
  832|   228k|            default:
  ------------------
  |  Branch (832:13): [True: 228k, False: 162k]
  ------------------
  833|   228k|                break;
  834|   391k|            }
  835|   391k|        }
QPDFFormFieldObjectHelper.cc:_ZNK12_GLOBAL__N_18TfFinder5getTfEv:
  839|  8.69k|        {
  840|  8.69k|            return tf;
  841|  8.69k|        }
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinder5getDAEv:
  850|  8.69k|        {
  851|  8.69k|            std::string result;
  852|  8.69k|            int i = -1;
  853|   391k|            for (auto const& cur: DA) {
  ------------------
  |  Branch (853:33): [True: 391k, False: 8.69k]
  ------------------
  854|   391k|                if (++i == tf_idx) {
  ------------------
  |  Branch (854:21): [True: 5.66k, False: 385k]
  ------------------
  855|  5.66k|                    double delta = strtod(cur.c_str(), nullptr) - tf;
  856|  5.66k|                    if (delta > 0.001 || delta < -0.001) {
  ------------------
  |  Branch (856:25): [True: 56, False: 5.61k]
  |  Branch (856:42): [True: 503, False: 5.11k]
  ------------------
  857|       |                        // tf doesn't match the font size passed to Tf, so substitute.
  858|    559|                        QTC::TC("qpdf", "QPDFFormFieldObjectHelper fallback Tf");
  859|    559|                        result += QUtil::double_to_string(tf);
  860|    559|                        continue;
  861|    559|                    }
  862|  5.66k|                }
  863|   390k|                result += cur;
  864|   390k|            }
  865|  8.69k|            return result;
  866|  8.69k|        }
QPDFFormFieldObjectHelper.cc:_ZNK12_GLOBAL__N_18TfFinder11getFontNameEv:
  844|  8.69k|        {
  845|  8.69k|            return font_name;
  846|  8.69k|        }
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetterC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_RKNS1_6vectorIS7_NS5_IS7_EEEEdRKN16QPDFObjectHandle9RectangleE:
  646|  8.69k|    DA(DA),
  647|  8.69k|    V(V),
  648|  8.69k|    opt(opt),
  649|  8.69k|    tf(tf),
  650|  8.69k|    bbox(bbox)
  651|  8.69k|{
  652|  8.69k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetter11handleTokenERKN13QPDFTokenizer5TokenE:
  656|   552k|{
  657|   552k|    QPDFTokenizer::token_type_e ttype = token.getType();
  658|   552k|    std::string value = token.getValue();
  659|   552k|    bool do_replace = false;
  660|   552k|    switch (state) {
  ------------------
  |  Branch (660:13): [True: 552k, False: 0]
  ------------------
  661|   233k|    case st_top:
  ------------------
  |  Branch (661:5): [True: 233k, False: 319k]
  ------------------
  662|   233k|        writeToken(token);
  663|   233k|        if (token.isWord("BMC")) {
  ------------------
  |  Branch (663:13): [True: 6.57k, False: 227k]
  ------------------
  664|  6.57k|            state = st_bmc;
  665|  6.57k|        }
  666|   233k|        break;
  667|       |
  668|  13.1k|    case st_bmc:
  ------------------
  |  Branch (668:5): [True: 13.1k, False: 539k]
  ------------------
  669|  13.1k|        if ((ttype == QPDFTokenizer::tt_space) || (ttype == QPDFTokenizer::tt_comment)) {
  ------------------
  |  Branch (669:13): [True: 6.58k, False: 6.59k]
  |  Branch (669:51): [True: 18, False: 6.57k]
  ------------------
  670|  6.60k|            writeToken(token);
  671|  6.60k|        } else {
  672|  6.57k|            state = st_emc;
  673|  6.57k|        }
  674|       |        // fall through to emc
  675|       |
  676|   306k|    case st_emc:
  ------------------
  |  Branch (676:5): [True: 293k, False: 259k]
  ------------------
  677|   306k|        if (token.isWord("EMC")) {
  ------------------
  |  Branch (677:13): [True: 6.52k, False: 299k]
  ------------------
  678|  6.52k|            do_replace = true;
  679|  6.52k|            state = st_end;
  680|  6.52k|        }
  681|   306k|        break;
  682|       |
  683|  12.7k|    case st_end:
  ------------------
  |  Branch (683:5): [True: 12.7k, False: 540k]
  ------------------
  684|  12.7k|        writeToken(token);
  685|  12.7k|        break;
  686|   552k|    }
  687|   552k|    if (do_replace) {
  ------------------
  |  Branch (687:9): [True: 6.52k, False: 546k]
  ------------------
  688|  6.52k|        writeAppearance();
  689|  6.52k|    }
  690|   552k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetter15writeAppearanceEv:
  704|  8.64k|{
  705|  8.64k|    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|  8.64k|    double tfh = 1.2 * tf;
  711|  8.64k|    int dx = 1;
  712|       |
  713|       |    // Write one or more lines, centered vertically, possibly with one row highlighted.
  714|       |
  715|  8.64k|    auto max_rows = static_cast<size_t>((bbox.ury - bbox.lly) / tfh);
  716|  8.64k|    bool highlight = false;
  717|  8.64k|    size_t highlight_idx = 0;
  718|       |
  719|  8.64k|    std::vector<std::string> lines;
  720|  8.64k|    if (opt.empty() || (max_rows < 2)) {
  ------------------
  |  Branch (720:9): [True: 7.74k, False: 901]
  |  Branch (720:24): [True: 189, False: 712]
  ------------------
  721|  7.93k|        lines.push_back(V);
  722|  7.93k|    } else {
  723|       |        // Figure out what rows to write
  724|    712|        size_t nopt = opt.size();
  725|    712|        size_t found_idx = 0;
  726|    712|        bool found = false;
  727|  93.3k|        for (found_idx = 0; found_idx < nopt; ++found_idx) {
  ------------------
  |  Branch (727:29): [True: 93.0k, False: 331]
  ------------------
  728|  93.0k|            if (opt.at(found_idx) == V) {
  ------------------
  |  Branch (728:17): [True: 381, False: 92.6k]
  ------------------
  729|    381|                found = true;
  730|    381|                break;
  731|    381|            }
  732|  93.0k|        }
  733|    712|        if (found) {
  ------------------
  |  Branch (733:13): [True: 381, False: 331]
  ------------------
  734|       |            // Try to make the found item the second one, but adjust for under/overflow.
  735|    381|            int wanted_first = QIntC::to_int(found_idx) - 1;
  736|    381|            int wanted_last = QIntC::to_int(found_idx + max_rows) - 2;
  737|    381|            QTC::TC("qpdf", "QPDFFormFieldObjectHelper list found");
  738|    381|            if (wanted_first < 0) {
  ------------------
  |  Branch (738:17): [True: 138, False: 243]
  ------------------
  739|    138|                QTC::TC("qpdf", "QPDFFormFieldObjectHelper list first too low");
  740|    138|                wanted_last -= wanted_first;
  741|    138|                wanted_first = 0;
  742|    138|            }
  743|    381|            if (wanted_last >= QIntC::to_int(nopt)) {
  ------------------
  |  Branch (743:17): [True: 330, False: 51]
  ------------------
  744|    330|                QTC::TC("qpdf", "QPDFFormFieldObjectHelper list last too high");
  745|    330|                auto diff = wanted_last - QIntC::to_int(nopt) + 1;
  746|    330|                wanted_first = std::max(0, wanted_first - diff);
  747|    330|                wanted_last -= diff;
  748|    330|            }
  749|    381|            highlight = true;
  750|    381|            highlight_idx = found_idx - QIntC::to_size(wanted_first);
  751|  11.0k|            for (size_t i = QIntC::to_size(wanted_first); i <= QIntC::to_size(wanted_last); ++i) {
  ------------------
  |  Branch (751:59): [True: 10.6k, False: 381]
  ------------------
  752|  10.6k|                lines.push_back(opt.at(i));
  753|  10.6k|            }
  754|    381|        } else {
  755|    331|            QTC::TC("qpdf", "QPDFFormFieldObjectHelper list not found");
  756|       |            // include our value and the first n-1 rows
  757|    331|            highlight_idx = 0;
  758|    331|            highlight = true;
  759|    331|            lines.push_back(V);
  760|  14.9k|            for (size_t i = 0; ((i < nopt) && (i < (max_rows - 1))); ++i) {
  ------------------
  |  Branch (760:33): [True: 14.6k, False: 326]
  |  Branch (760:47): [True: 14.6k, False: 5]
  ------------------
  761|  14.6k|                lines.push_back(opt.at(i));
  762|  14.6k|            }
  763|    331|        }
  764|    712|    }
  765|       |
  766|       |    // Write the lines centered vertically, highlighting if needed
  767|  8.64k|    size_t nlines = lines.size();
  768|  8.64k|    double dy = bbox.ury - ((bbox.ury - bbox.lly - (static_cast<double>(nlines) * tfh)) / 2.0);
  769|  8.64k|    if (highlight) {
  ------------------
  |  Branch (769:9): [True: 688, False: 7.95k]
  ------------------
  770|    688|        write(
  771|    688|            "q\n0.85 0.85 0.85 rg\n" + QUtil::double_to_string(bbox.llx) + " " +
  772|    688|            QUtil::double_to_string(
  773|    688|                bbox.lly + dy - (tfh * (static_cast<double>(highlight_idx + 1)))) +
  774|    688|            " " + QUtil::double_to_string(bbox.urx - bbox.llx) + " " +
  775|    688|            QUtil::double_to_string(tfh) + " re f\nQ\n");
  776|    688|    }
  777|  8.64k|    dy -= tf;
  778|  8.64k|    write("q\nBT\n" + DA + "\n");
  779|  42.1k|    for (size_t i = 0; i < nlines; ++i) {
  ------------------
  |  Branch (779:24): [True: 33.5k, False: 8.64k]
  ------------------
  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|  33.5k|        if (i == 0) {
  ------------------
  |  Branch (783:13): [True: 8.62k, False: 24.8k]
  ------------------
  784|  8.62k|            write(
  785|  8.62k|                QUtil::double_to_string(bbox.llx + static_cast<double>(dx)) + " " +
  786|  8.62k|                QUtil::double_to_string(bbox.lly + static_cast<double>(dy)) + " Td\n");
  787|  24.8k|        } else {
  788|  24.8k|            write("0 " + QUtil::double_to_string(-tfh) + " Td\n");
  789|  24.8k|        }
  790|  33.5k|        write(QPDFObjectHandle::newString(lines.at(i)).unparse() + " Tj\n");
  791|  33.5k|    }
  792|  8.64k|    write("ET\nQ\nEMC");
  793|  8.64k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetter9handleEOFEv:
  694|  8.62k|{
  695|  8.62k|    if (!replaced) {
  ------------------
  |  Branch (695:9): [True: 2.12k, False: 6.50k]
  ------------------
  696|  2.12k|        QTC::TC("qpdf", "QPDFFormFieldObjectHelper replaced BMC at EOF");
  697|  2.12k|        write("/Tx BMC\n");
  698|  2.12k|        writeAppearance();
  699|  2.12k|    }
  700|  8.62k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetterD2Ev:
  624|  8.69k|        ~ValueSetter() override = default;
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinderD2Ev:
  801|  8.69k|        ~TfFinder() final = default;
_ZN25QPDFFormFieldObjectHelper7MembersC2ERK16QPDFObjectHandle:
   28|  53.4k|        FormNode(oh)
   29|  53.4k|    {
   30|  53.4k|    }

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

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

_ZNK4qpdf10BaseHandlecv10QPDFObjGenEv:
   34|   392k|{
   35|   392k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (35:12): [True: 392k, False: 210]
  ------------------
   36|   392k|}
_ZN16QPDFObjectHandle18StreamDataProviderC2Eb:
   46|  29.0k|    supports_retry(supports_retry)
   47|  29.0k|{
   48|  29.0k|}
_ZN16QPDFObjectHandle18StreamDataProviderD2Ev:
   51|  29.0k|{
   52|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   53|  29.0k|}
_ZN16QPDFObjectHandle18StreamDataProvider13supportsRetryEv:
   85|  4.51k|{
   86|  4.51k|    return supports_retry;
   87|  4.51k|}
_ZN16QPDFObjectHandle11TokenFilter9handleEOFEv:
  119|  8.69k|{
  120|  8.69k|}
_ZN16QPDFObjectHandle11TokenFilter11setPipelineEP8Pipeline:
  124|  34.7k|{
  125|  34.7k|    pipeline = p;
  126|  34.7k|}
_ZN16QPDFObjectHandle11TokenFilter5writeEPKcm:
  130|   340k|{
  131|   340k|    if (!pipeline) {
  ------------------
  |  Branch (131:9): [True: 0, False: 340k]
  ------------------
  132|      0|        return;
  133|      0|    }
  134|   340k|    if (len) {
  ------------------
  |  Branch (134:9): [True: 331k, False: 8.57k]
  ------------------
  135|   331k|        pipeline->write(data, len);
  136|   331k|    }
  137|   340k|}
_ZN16QPDFObjectHandle11TokenFilter5writeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  141|  87.0k|{
  142|  87.0k|    write(str.c_str(), str.length());
  143|  87.0k|}
_ZN16QPDFObjectHandle11TokenFilter10writeTokenERKN13QPDFTokenizer5TokenE:
  147|   253k|{
  148|   253k|    std::string const& value = token.getRawValue();
  149|   253k|    write(value.c_str(), value.length());
  150|   253k|}
_ZN4qpdf4Name19analyzeJSONEncodingERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  180|   385k|{
  181|   385k|    int tail = 0;       // Number of continuation characters expected.
  182|   385k|    bool tail2 = false; // Potential overlong 3 octet utf-8.
  183|   385k|    bool tail3 = false; // potential overlong 4 octet
  184|   385k|    bool needs_escaping = false;
  185|  14.7M|    for (auto const& it: name) {
  ------------------
  |  Branch (185:24): [True: 14.7M, False: 370k]
  ------------------
  186|  14.7M|        auto c = static_cast<unsigned char>(it);
  187|  14.7M|        if (tail) {
  ------------------
  |  Branch (187:13): [True: 6.50k, False: 14.7M]
  ------------------
  188|  6.50k|            if ((c & 0xc0) != 0x80) {
  ------------------
  |  Branch (188:17): [True: 4.98k, False: 1.52k]
  ------------------
  189|  4.98k|                return {false, false};
  190|  4.98k|            }
  191|  1.52k|            if (tail2) {
  ------------------
  |  Branch (191:17): [True: 160, False: 1.36k]
  ------------------
  192|    160|                if ((c & 0xe0) == 0x80) {
  ------------------
  |  Branch (192:21): [True: 94, False: 66]
  ------------------
  193|     94|                    return {false, false};
  194|     94|                }
  195|     66|                tail2 = false;
  196|  1.36k|            } else if (tail3) {
  ------------------
  |  Branch (196:24): [True: 181, False: 1.18k]
  ------------------
  197|    181|                if ((c & 0xf0) == 0x80) {
  ------------------
  |  Branch (197:21): [True: 74, False: 107]
  ------------------
  198|     74|                    return {false, false};
  199|     74|                }
  200|    107|                tail3 = false;
  201|    107|            }
  202|  1.35k|            tail--;
  203|  14.7M|        } else if (c < 0x80) {
  ------------------
  |  Branch (203:20): [True: 14.7M, False: 17.2k]
  ------------------
  204|  14.7M|            if (!needs_escaping) {
  ------------------
  |  Branch (204:17): [True: 2.04M, False: 12.6M]
  ------------------
  205|  2.04M|                needs_escaping = !((c > 34 && c != '\\') || c == ' ' || c == 33);
  ------------------
  |  Branch (205:37): [True: 2.03M, False: 13.7k]
  |  Branch (205:47): [True: 2.03M, False: 789]
  |  Branch (205:61): [True: 76, False: 14.5k]
  |  Branch (205:73): [True: 348, False: 14.1k]
  ------------------
  206|  2.04M|            }
  207|  14.7M|        } else if ((c & 0xe0) == 0xc0) {
  ------------------
  |  Branch (207:20): [True: 4.57k, False: 12.6k]
  ------------------
  208|  4.57k|            if ((c & 0xfe) == 0xc0) {
  ------------------
  |  Branch (208:17): [True: 109, False: 4.47k]
  ------------------
  209|    109|                return {false, false};
  210|    109|            }
  211|  4.47k|            tail = 1;
  212|  12.6k|        } else if ((c & 0xf0) == 0xe0) {
  ------------------
  |  Branch (212:20): [True: 1.38k, False: 11.3k]
  ------------------
  213|  1.38k|            tail2 = (c == 0xe0);
  214|  1.38k|            tail = 2;
  215|  11.3k|        } else if ((c & 0xf8) == 0xf0) {
  ------------------
  |  Branch (215:20): [True: 1.63k, False: 9.67k]
  ------------------
  216|  1.63k|            tail3 = (c == 0xf0);
  217|  1.63k|            tail = 3;
  218|  9.67k|        } else {
  219|  9.67k|            return {false, false};
  220|  9.67k|        }
  221|  14.7M|    }
  222|   370k|    return {tail == 0, !needs_escaping};
  223|   385k|}
_ZN4qpdf4Name9normalizeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  227|  64.2k|{
  228|  64.2k|    if (name.empty()) {
  ------------------
  |  Branch (228:9): [True: 0, False: 64.2k]
  ------------------
  229|      0|        return name;
  230|      0|    }
  231|  64.2k|    std::string result;
  232|  64.2k|    result += name.at(0);
  233|  77.1M|    for (size_t i = 1; i < name.length(); ++i) {
  ------------------
  |  Branch (233:24): [True: 77.1M, False: 64.2k]
  ------------------
  234|  77.1M|        char ch = name.at(i);
  235|       |        // Don't use locale/ctype here; follow PDF spec guidelines.
  236|  77.1M|        if (ch == '\0') {
  ------------------
  |  Branch (236:13): [True: 2.31M, False: 74.8M]
  ------------------
  237|       |            // QPDFTokenizer embeds a null character to encode an invalid #.
  238|  2.31M|            result += "#";
  239|  74.8M|        } else if (
  240|  74.8M|            ch < 33 || ch == '#' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (240:13): [True: 74.2M, False: 616k]
  |  Branch (240:24): [True: 90, False: 615k]
  |  Branch (240:37): [True: 202, False: 615k]
  |  Branch (240:50): [True: 326, False: 615k]
  |  Branch (240:63): [True: 106, False: 615k]
  |  Branch (240:76): [True: 258, False: 615k]
  |  Branch (240:89): [True: 196, False: 614k]
  ------------------
  241|  74.4M|            ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch > 126) {
  ------------------
  |  Branch (241:13): [True: 203, False: 614k]
  |  Branch (241:26): [True: 813, False: 613k]
  |  Branch (241:39): [True: 78, False: 613k]
  |  Branch (241:52): [True: 1.31k, False: 612k]
  |  Branch (241:65): [True: 218, False: 612k]
  |  Branch (241:78): [True: 192k, False: 420k]
  ------------------
  242|  74.4M|            result += util::hex_encode_char(ch);
  243|  74.4M|        } else {
  244|   420k|            result += ch;
  245|   420k|        }
  246|  77.1M|    }
  247|  64.2k|    return result;
  248|  64.2k|}
_ZNK4qpdf10BaseHandle4copyEb:
  252|   483k|{
  253|   483k|    switch (resolved_type_code()) {
  ------------------
  |  Branch (253:13): [True: 483k, False: 0]
  ------------------
  254|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (254:5): [True: 0, False: 483k]
  ------------------
  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: 483k]
  ------------------
  258|      0|        return QPDFObject::create<QPDF_Reserved>();
  259|  36.7k|    case ::ot_null:
  ------------------
  |  Branch (259:5): [True: 36.7k, False: 446k]
  ------------------
  260|  36.7k|        return QPDFObject::create<QPDF_Null>();
  261|    893|    case ::ot_boolean:
  ------------------
  |  Branch (261:5): [True: 893, False: 482k]
  ------------------
  262|    893|        return QPDFObject::create<QPDF_Bool>(std::get<QPDF_Bool>(obj->value).val);
  263|  50.4k|    case ::ot_integer:
  ------------------
  |  Branch (263:5): [True: 50.4k, False: 433k]
  ------------------
  264|  50.4k|        return QPDFObject::create<QPDF_Integer>(std::get<QPDF_Integer>(obj->value).val);
  265|  20.9k|    case ::ot_real:
  ------------------
  |  Branch (265:5): [True: 20.9k, False: 462k]
  ------------------
  266|  20.9k|        return QPDFObject::create<QPDF_Real>(std::get<QPDF_Real>(obj->value).val);
  267|   172k|    case ::ot_string:
  ------------------
  |  Branch (267:5): [True: 172k, False: 311k]
  ------------------
  268|   172k|        return QPDFObject::create<QPDF_String>(std::get<QPDF_String>(obj->value).val);
  269|   157k|    case ::ot_name:
  ------------------
  |  Branch (269:5): [True: 157k, False: 326k]
  ------------------
  270|   157k|        return QPDFObject::create<QPDF_Name>(std::get<QPDF_Name>(obj->value).name);
  271|  16.4k|    case ::ot_array:
  ------------------
  |  Branch (271:5): [True: 16.4k, False: 467k]
  ------------------
  272|  16.4k|        {
  273|  16.4k|            auto const& a = std::get<QPDF_Array>(obj->value);
  274|  16.4k|            if (shallow) {
  ------------------
  |  Branch (274:17): [True: 0, False: 16.4k]
  ------------------
  275|      0|                return QPDFObject::create<QPDF_Array>(a);
  276|  16.4k|            } else {
  277|  16.4k|                QTC::TC("qpdf", "QPDF_Array copy", a.sp ? 0 : 1);
  ------------------
  |  Branch (277:52): [True: 438, False: 16.0k]
  ------------------
  278|  16.4k|                if (a.sp) {
  ------------------
  |  Branch (278:21): [True: 438, False: 16.0k]
  ------------------
  279|    438|                    QPDF_Array result;
  280|    438|                    result.sp = std::make_unique<QPDF_Array::Sparse>();
  281|    438|                    result.sp->size = a.sp->size;
  282|  7.92k|                    for (auto const& [idx, oh]: a.sp->elements) {
  ------------------
  |  Branch (282:47): [True: 7.92k, False: 438]
  ------------------
  283|  7.92k|                        result.sp->elements[idx] = oh.indirect() ? oh : oh.copy();
  ------------------
  |  Branch (283:52): [True: 973, False: 6.95k]
  ------------------
  284|  7.92k|                    }
  285|    438|                    return QPDFObject::create<QPDF_Array>(std::move(result));
  286|  16.0k|                } else {
  287|  16.0k|                    std::vector<QPDFObjectHandle> result;
  288|  16.0k|                    result.reserve(a.elements.size());
  289|   425k|                    for (auto const& element: a.elements) {
  ------------------
  |  Branch (289:45): [True: 425k, False: 16.0k]
  ------------------
  290|   425k|                        result.emplace_back(
  291|   425k|                            element ? (element.indirect() ? element : element.copy()) : element);
  ------------------
  |  Branch (291:29): [True: 425k, False: 0]
  |  Branch (291:40): [True: 81.7k, False: 344k]
  ------------------
  292|   425k|                    }
  293|  16.0k|                    return QPDFObject::create<QPDF_Array>(std::move(result), false);
  294|  16.0k|                }
  295|  16.4k|            }
  296|  16.4k|        }
  297|  28.9k|    case ::ot_dictionary:
  ------------------
  |  Branch (297:5): [True: 28.9k, False: 454k]
  ------------------
  298|  28.9k|        {
  299|  28.9k|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  300|  28.9k|            if (shallow) {
  ------------------
  |  Branch (300:17): [True: 0, False: 28.9k]
  ------------------
  301|      0|                return QPDFObject::create<QPDF_Dictionary>(d.items);
  302|  28.9k|            } else {
  303|  28.9k|                std::map<std::string, QPDFObjectHandle> new_items;
  304|   137k|                for (auto const& [key, val]: d.items) {
  ------------------
  |  Branch (304:44): [True: 137k, False: 28.9k]
  ------------------
  305|   137k|                    new_items[key] = val.indirect() ? val : val.copy();
  ------------------
  |  Branch (305:38): [True: 34.4k, False: 102k]
  ------------------
  306|   137k|                }
  307|  28.9k|                return QPDFObject::create<QPDF_Dictionary>(new_items);
  308|  28.9k|            }
  309|  28.9k|        }
  310|      9|    case ::ot_stream:
  ------------------
  |  Branch (310:5): [True: 9, False: 483k]
  ------------------
  311|      9|        QTC::TC("qpdf", "QPDF_Stream ERR shallow copy stream");
  312|      9|        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: 483k]
  ------------------
  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: 483k]
  ------------------
  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: 483k]
  ------------------
  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: 483k]
  ------------------
  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: 483k]
  ------------------
  325|      0|        return referenced_object().obj_sp();
  326|   483k|    }
  327|      0|    return {}; // unreachable
  328|   483k|}
_ZNK4qpdf10BaseHandle7unparseEv:
  474|   276k|{
  475|   276k|    switch (resolved_type_code()) {
  ------------------
  |  Branch (475:13): [True: 276k, False: 0]
  ------------------
  476|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (476:5): [True: 0, False: 276k]
  ------------------
  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: 276k]
  ------------------
  480|      0|        throw std::logic_error("QPDFObjectHandle: attempting to unparse a reserved object");
  481|      0|        return ""; // does not return
  482|  21.2k|    case ::ot_null:
  ------------------
  |  Branch (482:5): [True: 21.2k, False: 255k]
  ------------------
  483|  21.2k|        return "null";
  484|    354|    case ::ot_boolean:
  ------------------
  |  Branch (484:5): [True: 354, False: 276k]
  ------------------
  485|    354|        return std::get<QPDF_Bool>(obj->value).val ? "true" : "false";
  ------------------
  |  Branch (485:16): [True: 324, False: 30]
  ------------------
  486|  4.00k|    case ::ot_integer:
  ------------------
  |  Branch (486:5): [True: 4.00k, False: 272k]
  ------------------
  487|  4.00k|        return std::to_string(std::get<QPDF_Integer>(obj->value).val);
  488|  1.49k|    case ::ot_real:
  ------------------
  |  Branch (488:5): [True: 1.49k, False: 275k]
  ------------------
  489|  1.49k|        return std::get<QPDF_Real>(obj->value).val;
  490|   201k|    case ::ot_string:
  ------------------
  |  Branch (490:5): [True: 201k, False: 74.6k]
  ------------------
  491|   201k|        return std::get<QPDF_String>(obj->value).unparse(false);
  492|  47.5k|    case ::ot_name:
  ------------------
  |  Branch (492:5): [True: 47.5k, False: 229k]
  ------------------
  493|  47.5k|        return Name::normalize(std::get<QPDF_Name>(obj->value).name);
  494|      0|    case ::ot_array:
  ------------------
  |  Branch (494:5): [True: 0, False: 276k]
  ------------------
  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: 276k]
  ------------------
  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: 276k]
  ------------------
  531|      0|        return obj->og.unparse(' ') + " R";
  532|      0|    case ::ot_operator:
  ------------------
  |  Branch (532:5): [True: 0, False: 276k]
  ------------------
  533|      0|        return std::get<QPDF_Operator>(obj->value).val;
  534|      0|    case ::ot_inlineimage:
  ------------------
  |  Branch (534:5): [True: 0, False: 276k]
  ------------------
  535|      0|        return std::get<QPDF_InlineImage>(obj->value).val;
  536|      0|    case ::ot_unresolved:
  ------------------
  |  Branch (536:5): [True: 0, False: 276k]
  ------------------
  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: 276k]
  ------------------
  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: 276k]
  ------------------
  543|      0|        return obj->og.unparse(' ') + " R";
  544|   276k|    }
  545|      0|    return {}; // unreachable
  546|   276k|}
_ZNK4qpdf10BaseHandle10write_jsonEiRN4JSON6WriterE:
  550|   484k|{
  551|   484k|    switch (resolved_type_code()) {
  552|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (552:5): [True: 0, False: 484k]
  ------------------
  553|      0|        throw std::logic_error(
  554|      0|            "QPDFObjectHandle: attempting to get JSON from a uninitialized object");
  555|      0|        break; // unreachable
  556|  9.68k|    case ::ot_null:
  ------------------
  |  Branch (556:5): [True: 9.68k, False: 474k]
  ------------------
  557|  9.68k|    case ::ot_operator:
  ------------------
  |  Branch (557:5): [True: 0, False: 484k]
  ------------------
  558|  9.68k|    case ::ot_inlineimage:
  ------------------
  |  Branch (558:5): [True: 0, False: 484k]
  ------------------
  559|  9.68k|        p << "null";
  560|  9.68k|        break;
  561|  3.12k|    case ::ot_boolean:
  ------------------
  |  Branch (561:5): [True: 3.12k, False: 481k]
  ------------------
  562|  3.12k|        p << std::get<QPDF_Bool>(obj->value).val;
  563|  3.12k|        break;
  564|  75.7k|    case ::ot_integer:
  ------------------
  |  Branch (564:5): [True: 75.7k, False: 408k]
  ------------------
  565|  75.7k|        p << std::to_string(std::get<QPDF_Integer>(obj->value).val);
  566|  75.7k|        break;
  567|  50.4k|    case ::ot_real:
  ------------------
  |  Branch (567:5): [True: 50.4k, False: 433k]
  ------------------
  568|  50.4k|        {
  569|  50.4k|            auto const& val = std::get<QPDF_Real>(obj->value).val;
  570|  50.4k|            if (val.empty()) {
  ------------------
  |  Branch (570:17): [True: 0, False: 50.4k]
  ------------------
  571|       |                // Can't really happen...
  572|      0|                p << "0";
  573|  50.4k|            } else if (val.at(0) == '.') {
  ------------------
  |  Branch (573:24): [True: 467, False: 49.9k]
  ------------------
  574|    467|                p << "0" << val;
  575|  49.9k|            } else if (val.length() >= 2 && val.at(0) == '-' && val.at(1) == '.') {
  ------------------
  |  Branch (575:24): [True: 28.2k, False: 21.6k]
  |  Branch (575:45): [True: 214, False: 28.0k]
  |  Branch (575:65): [True: 98, False: 116]
  ------------------
  576|     98|                p << "-0." << val.substr(2);
  577|  49.8k|            } else if (val.at(0) == '0') {
  ------------------
  |  Branch (577:24): [True: 23.4k, False: 26.4k]
  ------------------
  578|  23.4k|                auto i = val.find_first_not_of('0');
  579|  23.4k|                if (i == std::string::npos) {
  ------------------
  |  Branch (579:21): [True: 21.6k, False: 1.74k]
  ------------------
  580|  21.6k|                    p << "0";
  581|  21.6k|                } else if (val.at(i) == '.') {
  ------------------
  |  Branch (581:28): [True: 996, False: 752]
  ------------------
  582|    996|                    p << "0" << val.substr(i);
  583|    996|                } else {
  584|    752|                    p << val.substr(i);
  585|    752|                }
  586|  26.4k|            } else {
  587|  26.4k|                p << val;
  588|  26.4k|            }
  589|  50.4k|            if (val.back() == '.') {
  ------------------
  |  Branch (589:17): [True: 708, False: 49.7k]
  ------------------
  590|    708|                p << "0";
  591|    708|            }
  592|  50.4k|        }
  593|  50.4k|        break;
  594|  79.4k|    case ::ot_string:
  ------------------
  |  Branch (594:5): [True: 79.4k, False: 404k]
  ------------------
  595|  79.4k|        std::get<QPDF_String>(obj->value).writeJSON(json_version, p);
  596|  79.4k|        break;
  597|   175k|    case ::ot_name:
  ------------------
  |  Branch (597:5): [True: 175k, False: 309k]
  ------------------
  598|   175k|        {
  599|   175k|            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|   175k|            if (json_version == 1) {
  ------------------
  |  Branch (602:17): [True: 0, False: 175k]
  ------------------
  603|      0|                p << "\"" << JSON::Writer::encode_string(Name::normalize(n.name)) << "\"";
  604|   175k|            } else {
  605|   175k|                if (auto res = Name::analyzeJSONEncoding(n.name); res.first) {
  ------------------
  |  Branch (605:67): [True: 166k, False: 8.22k]
  ------------------
  606|   166k|                    if (res.second) {
  ------------------
  |  Branch (606:25): [True: 159k, False: 7.63k]
  ------------------
  607|   159k|                        p << "\"" << n.name << "\"";
  608|   159k|                    } else {
  609|  7.63k|                        p << "\"" << JSON::Writer::encode_string(n.name) << "\"";
  610|  7.63k|                    }
  611|   166k|                } else {
  612|  8.22k|                    p << "\"n:" << JSON::Writer::encode_string(Name::normalize(n.name)) << "\"";
  613|  8.22k|                }
  614|   175k|            }
  615|   175k|        }
  616|   175k|        break;
  617|  34.8k|    case ::ot_array:
  ------------------
  |  Branch (617:5): [True: 34.8k, False: 449k]
  ------------------
  618|  34.8k|        {
  619|  34.8k|            auto const& a = std::get<QPDF_Array>(obj->value);
  620|  34.8k|            p.writeStart('[');
  621|  34.8k|            if (a.sp) {
  ------------------
  |  Branch (621:17): [True: 340, False: 34.5k]
  ------------------
  622|    340|                size_t next = 0;
  623|  4.09k|                for (auto& [key, value]: a.sp->elements) {
  ------------------
  |  Branch (623:40): [True: 4.09k, False: 340]
  ------------------
  624|  33.5k|                    for (size_t j = next; j < key; ++j) {
  ------------------
  |  Branch (624:43): [True: 29.4k, False: 4.09k]
  ------------------
  625|  29.4k|                        p.writeNext() << "null";
  626|  29.4k|                    }
  627|  4.09k|                    p.writeNext();
  628|  4.09k|                    auto item_og = value.id_gen();
  629|  4.09k|                    if (item_og.isIndirect()) {
  ------------------
  |  Branch (629:25): [True: 952, False: 3.14k]
  ------------------
  630|    952|                        p << "\"" << item_og.unparse(' ') << " R\"";
  631|  3.14k|                    } else {
  632|  3.14k|                        value.write_json(json_version, p);
  633|  3.14k|                    }
  634|  4.09k|                    next = key + 1;
  635|  4.09k|                }
  636|  6.11k|                for (size_t j = next; j < a.sp->size; ++j) {
  ------------------
  |  Branch (636:39): [True: 5.77k, False: 340]
  ------------------
  637|  5.77k|                    p.writeNext() << "null";
  638|  5.77k|                }
  639|  34.5k|            } else {
  640|   425k|                for (auto const& item: a.elements) {
  ------------------
  |  Branch (640:38): [True: 425k, False: 34.5k]
  ------------------
  641|   425k|                    p.writeNext();
  642|   425k|                    auto item_og = item.id_gen();
  643|   425k|                    if (item_og.isIndirect()) {
  ------------------
  |  Branch (643:25): [True: 138k, False: 287k]
  ------------------
  644|   138k|                        p << "\"" << item_og.unparse(' ') << " R\"";
  645|   287k|                    } else {
  646|   287k|                        item.write_json(json_version, p);
  647|   287k|                    }
  648|   425k|                }
  649|  34.5k|            }
  650|  34.8k|            p.writeEnd(']');
  651|  34.8k|        }
  652|  34.8k|        break;
  653|  55.6k|    case ::ot_dictionary:
  ------------------
  |  Branch (653:5): [True: 55.6k, False: 428k]
  ------------------
  654|  55.6k|        {
  655|  55.6k|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  656|  55.6k|            p.writeStart('{');
  657|   244k|            for (auto& iter: d.items) {
  ------------------
  |  Branch (657:28): [True: 244k, False: 55.6k]
  ------------------
  658|   244k|                if (!iter.second.null()) {
  ------------------
  |  Branch (658:21): [True: 210k, False: 34.1k]
  ------------------
  659|   210k|                    p.writeNext();
  660|   210k|                    if (json_version == 1) {
  ------------------
  |  Branch (660:25): [True: 0, False: 210k]
  ------------------
  661|      0|                        p << "\"" << JSON::Writer::encode_string(Name::normalize(iter.first))
  662|      0|                          << "\": ";
  663|   210k|                    } else if (auto res = Name::analyzeJSONEncoding(iter.first); res.first) {
  ------------------
  |  Branch (663:82): [True: 202k, False: 8.42k]
  ------------------
  664|   202k|                        if (res.second) {
  ------------------
  |  Branch (664:29): [True: 199k, False: 2.88k]
  ------------------
  665|   199k|                            p << "\"" << iter.first << "\": ";
  666|   199k|                        } else {
  667|  2.88k|                            p << "\"" << JSON::Writer::encode_string(iter.first) << "\": ";
  668|  2.88k|                        }
  669|   202k|                    } else {
  670|  8.42k|                        p << "\"n:" << JSON::Writer::encode_string(Name::normalize(iter.first))
  671|  8.42k|                          << "\": ";
  672|  8.42k|                    }
  673|   210k|                    iter.second.writeJSON(json_version, p);
  674|   210k|                }
  675|   244k|            }
  676|  55.6k|            p.writeEnd('}');
  677|  55.6k|        }
  678|  55.6k|        break;
  679|      0|    case ::ot_stream:
  ------------------
  |  Branch (679:5): [True: 0, False: 484k]
  ------------------
  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: 484k]
  ------------------
  683|      0|        p << "\"" << obj->og.unparse(' ') << " R\"";
  684|      0|        break;
  685|      0|    default:
  ------------------
  |  Branch (685:5): [True: 0, False: 484k]
  ------------------
  686|      0|        throw std::logic_error("attempted to write an unsuitable object as JSON");
  687|   484k|    }
  688|   484k|}
_ZN4qpdf10BaseHandle10disconnectEb:
  692|  2.77M|{
  693|       |    // QPDF::~QPDF() calls disconnect for indirect objects, so we don't do that here.
  694|  2.77M|    if (only_direct && indirect()) {
  ------------------
  |  Branch (694:9): [True: 2.36M, False: 416k]
  |  Branch (694:24): [True: 250k, False: 2.11M]
  ------------------
  695|   250k|        return;
  696|   250k|    }
  697|       |
  698|  2.52M|    switch (raw_type_code()) {
  699|   141k|    case ::ot_array:
  ------------------
  |  Branch (699:5): [True: 141k, False: 2.38M]
  ------------------
  700|   141k|        {
  701|   141k|            auto& a = std::get<QPDF_Array>(obj->value);
  702|   141k|            if (a.sp) {
  ------------------
  |  Branch (702:17): [True: 660, False: 140k]
  ------------------
  703|  26.4k|                for (auto& item: a.sp->elements) {
  ------------------
  |  Branch (703:32): [True: 26.4k, False: 660]
  ------------------
  704|  26.4k|                    item.second.disconnect();
  705|  26.4k|                }
  706|   140k|            } else {
  707|  1.29M|                for (auto& oh: a.elements) {
  ------------------
  |  Branch (707:30): [True: 1.29M, False: 140k]
  ------------------
  708|  1.29M|                    oh.disconnect();
  709|  1.29M|                }
  710|   140k|            }
  711|   141k|        }
  712|   141k|        break;
  713|   244k|    case ::ot_dictionary:
  ------------------
  |  Branch (713:5): [True: 244k, False: 2.28M]
  ------------------
  714|  1.00M|        for (auto& iter: std::get<QPDF_Dictionary>(obj->value).items) {
  ------------------
  |  Branch (714:24): [True: 1.00M, False: 244k]
  ------------------
  715|  1.00M|            iter.second.disconnect();
  716|  1.00M|        }
  717|   244k|        break;
  718|  41.7k|    case ::ot_stream:
  ------------------
  |  Branch (718:5): [True: 41.7k, False: 2.48M]
  ------------------
  719|  41.7k|        {
  720|  41.7k|            auto& s = std::get<QPDF_Stream>(obj->value);
  721|  41.7k|            s.m->stream_provider = nullptr;
  722|  41.7k|            s.m->stream_dict.disconnect();
  723|  41.7k|        }
  724|  41.7k|        break;
  725|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (725:5): [True: 0, False: 2.52M]
  ------------------
  726|      0|        return;
  727|  2.10M|    default:
  ------------------
  |  Branch (727:5): [True: 2.10M, False: 427k]
  ------------------
  728|  2.10M|        break;
  729|  2.52M|    }
  730|  2.52M|    obj->qpdf = nullptr;
  731|  2.52M|    obj->og = QPDFObjGen();
  732|  2.52M|}
_ZNK16QPDFObjectHandle14isSameObjectAsERKS_:
  736|  2.81k|{
  737|  2.81k|    return obj == rhs.obj;
  738|  2.81k|}
_ZNK4qpdf10BaseHandle9type_nameEv:
  748|  14.4k|{
  749|  14.4k|    static constexpr std::array<char const*, 16> tn{
  750|  14.4k|        "uninitialized",
  751|  14.4k|        "reserved",
  752|  14.4k|        "null",
  753|  14.4k|        "boolean",
  754|  14.4k|        "integer",
  755|  14.4k|        "real",
  756|  14.4k|        "string",
  757|  14.4k|        "name",
  758|  14.4k|        "array",
  759|  14.4k|        "dictionary",
  760|  14.4k|        "stream",
  761|  14.4k|        "operator",
  762|  14.4k|        "inline-image",
  763|  14.4k|        "unresolved",
  764|  14.4k|        "destroyed",
  765|  14.4k|        "reference"};
  766|  14.4k|    return tn[type_code()];
  767|  14.4k|}
_ZNK16QPDFObjectHandle6isBoolEv:
  783|   268k|{
  784|   268k|    return type_code() == ::ot_boolean;
  785|   268k|}
_ZNK16QPDFObjectHandle6isNullEv:
  797|   215k|{
  798|   215k|    return type_code() == ::ot_null;
  799|   215k|}
_ZNK16QPDFObjectHandle9isIntegerEv:
  803|   733k|{
  804|   733k|    return type_code() == ::ot_integer;
  805|   733k|}
_ZNK16QPDFObjectHandle6isRealEv:
  809|   468k|{
  810|   468k|    return type_code() == ::ot_real;
  811|   468k|}
_ZNK16QPDFObjectHandle8isNumberEv:
  815|   267k|{
  816|   267k|    return (isInteger() || isReal());
  ------------------
  |  Branch (816:13): [True: 63.2k, False: 203k]
  |  Branch (816:28): [True: 202k, False: 1.47k]
  ------------------
  817|   267k|}
_ZNK16QPDFObjectHandle15getNumericValueEv:
  821|   107k|{
  822|   107k|    if (isInteger()) {
  ------------------
  |  Branch (822:9): [True: 18.4k, False: 89.3k]
  ------------------
  823|  18.4k|        return static_cast<double>(getIntValue());
  824|  89.3k|    } else if (isReal()) {
  ------------------
  |  Branch (824:16): [True: 89.3k, False: 0]
  ------------------
  825|  89.3k|        return atof(getRealValue().c_str());
  826|  89.3k|    } else {
  827|      0|        typeWarning("number", "returning 0");
  828|      0|        QTC::TC("qpdf", "QPDFObjectHandle numeric non-numeric");
  829|      0|        return 0;
  830|      0|    }
  831|   107k|}
_ZNK16QPDFObjectHandle16getValueAsNumberERd:
  835|   107k|{
  836|   107k|    if (!isNumber()) {
  ------------------
  |  Branch (836:9): [True: 157, False: 107k]
  ------------------
  837|    157|        return false;
  838|    157|    }
  839|   107k|    value = getNumericValue();
  840|   107k|    return true;
  841|   107k|}
_ZNK16QPDFObjectHandle6isNameEv:
  845|   273k|{
  846|   273k|    return type_code() == ::ot_name;
  847|   273k|}
_ZNK16QPDFObjectHandle8isStringEv:
  851|   314k|{
  852|   314k|    return type_code() == ::ot_string;
  853|   314k|}
_ZNK16QPDFObjectHandle10isOperatorEv:
  857|  21.6M|{
  858|  21.6M|    return type_code() == ::ot_operator;
  859|  21.6M|}
_ZNK16QPDFObjectHandle7isArrayEv:
  869|  96.1k|{
  870|  96.1k|    return type_code() == ::ot_array;
  871|  96.1k|}
_ZNK16QPDFObjectHandle12isDictionaryEv:
  875|  1.75M|{
  876|  1.75M|    return type_code() == ::ot_dictionary;
  877|  1.75M|}
_ZNK16QPDFObjectHandle8isStreamEv:
  881|   198k|{
  882|   198k|    return type_code() == ::ot_stream;
  883|   198k|}
_ZNK16QPDFObjectHandle8isScalarEv:
  893|   251k|{
  894|   251k|    return isBool() || isInteger() || isName() || isNull() || isReal() || isString();
  ------------------
  |  Branch (894:12): [True: 355, False: 250k]
  |  Branch (894:24): [True: 5.00k, False: 245k]
  |  Branch (894:39): [True: 47.6k, False: 198k]
  |  Branch (894:51): [True: 23.1k, False: 174k]
  |  Branch (894:63): [True: 1.49k, False: 173k]
  |  Branch (894:75): [True: 170k, False: 3.02k]
  ------------------
  895|   251k|}
_ZNK16QPDFObjectHandle15isNameAndEqualsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  899|  8.67k|{
  900|  8.67k|    return Name(*this) == name;
  901|  8.67k|}
_ZNK16QPDFObjectHandle18isDictionaryOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  905|   833k|{
  906|   833k|    return isDictionary() && (type.empty() || Name((*this)["/Type"]) == type) &&
  ------------------
  |  Branch (906:12): [True: 249k, False: 583k]
  |  Branch (906:31): [True: 96.8k, False: 152k]
  |  Branch (906:47): [True: 27.6k, False: 125k]
  ------------------
  907|   124k|        (subtype.empty() || Name((*this)["/Subtype"]) == subtype);
  ------------------
  |  Branch (907:10): [True: 46.7k, False: 77.8k]
  |  Branch (907:29): [True: 68.1k, False: 9.67k]
  ------------------
  908|   833k|}
_ZNK16QPDFObjectHandle14isStreamOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  912|   196k|{
  913|   196k|    if (auto stream = as_stream()) {
  ------------------
  |  Branch (913:14): [True: 35.9k, False: 160k]
  ------------------
  914|  35.9k|        return stream && (type.empty() || stream.Type() == type) &&
  ------------------
  |  Branch (914:16): [True: 35.9k, False: 0]
  |  Branch (914:27): [True: 8.65k, False: 27.2k]
  |  Branch (914:43): [True: 12.9k, False: 14.3k]
  ------------------
  915|  21.6k|            (subtype.empty() || stream.Subtype() == subtype);
  ------------------
  |  Branch (915:14): [True: 12.9k, False: 8.65k]
  |  Branch (915:33): [True: 790, False: 7.86k]
  ------------------
  916|  35.9k|    }
  917|   160k|    return false;
  918|   196k|}
_ZNK16QPDFObjectHandle12getBoolValueEv:
  924|  4.49k|{
  925|  4.49k|    if (auto boolean = as<QPDF_Bool>()) {
  ------------------
  |  Branch (925:14): [True: 4.49k, False: 0]
  ------------------
  926|  4.49k|        return boolean->val;
  927|  4.49k|    } else {
  928|      0|        typeWarning("boolean", "returning false");
  929|      0|        QTC::TC("qpdf", "QPDFObjectHandle boolean returning false");
  930|      0|        return false;
  931|      0|    }
  932|  4.49k|}
_ZN4qpdf7IntegerC2Ex:
  947|  30.2k|    BaseHandle(QPDFObject::create<QPDF_Integer>(value))
  948|  30.2k|{
  949|  30.2k|}
_ZN16QPDFObjectHandle10newIntegerEx:
  953|  3.51k|{
  954|  3.51k|    return {QPDFObject::create<QPDF_Integer>(value)};
  955|  3.51k|}
_ZNK4qpdf7Integer5valueEv:
  959|   151k|{
  960|   151k|    auto* i = as<QPDF_Integer>();
  961|   151k|    if (!i) {
  ------------------
  |  Branch (961:9): [True: 939, False: 150k]
  ------------------
  962|    939|        throw invalid_error("Integer");
  963|    939|    }
  964|   150k|    return i->val;
  965|   151k|}
_ZNK16QPDFObjectHandle11getIntValueEv:
  969|  50.0k|{
  970|  50.0k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (970:20): [True: 50.0k, False: 0]
  ------------------
  971|  50.0k|        return integer;
  972|  50.0k|    } else {
  973|      0|        typeWarning("integer", "returning 0");
  974|      0|        return 0;
  975|      0|    }
  976|  50.0k|}
_ZNK16QPDFObjectHandle13getValueAsIntERx:
  980|  6.97k|{
  981|  6.97k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (981:20): [True: 6.92k, False: 51]
  ------------------
  982|  6.92k|        value = integer;
  983|  6.92k|        return true;
  984|  6.92k|    }
  985|     51|    return false;
  986|  6.97k|}
_ZNK16QPDFObjectHandle16getIntValueAsIntEv:
  990|  41.9k|{
  991|  41.9k|    try {
  992|  41.9k|        return Integer(*this).value<int>();
  993|  41.9k|    } catch (std::invalid_argument&) {
  994|      9|        typeWarning("integer", "returning 0");
  995|      9|        return 0;
  996|      9|    }
  997|  41.9k|}
_ZNK16QPDFObjectHandle13getValueAsIntERi:
 1001|  1.20k|{
 1002|  1.20k|    if (!isInteger()) {
  ------------------
  |  Branch (1002:9): [True: 44, False: 1.15k]
  ------------------
 1003|     44|        return false;
 1004|     44|    }
 1005|  1.15k|    value = getIntValueAsInt();
 1006|  1.15k|    return true;
 1007|  1.20k|}
_ZNK16QPDFObjectHandle12getUIntValueEv:
 1011|  25.1k|{
 1012|  25.1k|    try {
 1013|  25.1k|        return Integer(*this).value<unsigned long long>();
 1014|  25.1k|    } catch (std::invalid_argument&) {
 1015|    594|        typeWarning("integer", "returning 0");
 1016|    594|        return 0;
 1017|    594|    }
 1018|  25.1k|}
_ZNK16QPDFObjectHandle18getUIntValueAsUIntEv:
 1032|  6.77k|{
 1033|  6.77k|    try {
 1034|  6.77k|        return Integer(*this).value<unsigned int>();
 1035|  6.77k|    } catch (std::invalid_argument&) {
 1036|    336|        typeWarning("integer", "returning 0");
 1037|    336|        return 0;
 1038|    336|    }
 1039|  6.77k|}
_ZNK16QPDFObjectHandle14getValueAsUIntERj:
 1043|  1.32k|{
 1044|  1.32k|    if (!isInteger()) {
  ------------------
  |  Branch (1044:9): [True: 122, False: 1.20k]
  ------------------
 1045|    122|        return false;
 1046|    122|    }
 1047|  1.20k|    value = getUIntValueAsUInt();
 1048|  1.20k|    return true;
 1049|  1.32k|}
_ZNK16QPDFObjectHandle12getRealValueEv:
 1055|  89.3k|{
 1056|  89.3k|    if (auto* real = as<QPDF_Real>()) {
  ------------------
  |  Branch (1056:15): [True: 89.3k, False: 0]
  ------------------
 1057|  89.3k|        return real->val;
 1058|  89.3k|    }
 1059|      0|    typeWarning("real", "returning 0.0");
 1060|      0|    return "0.0";
 1061|  89.3k|}
_ZN16QPDFObjectHandle7newNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1077|  7.41k|{
 1078|  7.41k|    return {QPDFObject::create<QPDF_Name>(name)};
 1079|  7.41k|}
_ZN4qpdf4NameC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1087|  38.8k|    BaseHandle(QPDFObject::create<QPDF_Name>(std::move(name)))
 1088|  38.8k|{
 1089|  38.8k|}
_ZNK4qpdf4Name5valueEv:
 1093|   287k|{
 1094|   287k|    auto* n = as<QPDF_Name>();
 1095|   287k|    if (!n) {
  ------------------
  |  Branch (1095:9): [True: 0, False: 287k]
  ------------------
 1096|      0|        throw invalid_error("Name");
 1097|      0|    }
 1098|   287k|    return n->name;
 1099|   287k|}
_ZNK16QPDFObjectHandle7getNameEv:
 1103|  36.8k|{
 1104|  36.8k|    if (auto* name = as<QPDF_Name>()) {
  ------------------
  |  Branch (1104:15): [True: 33.5k, False: 3.24k]
  ------------------
 1105|  33.5k|        return name->name;
 1106|  33.5k|    }
 1107|  3.24k|    typeWarning("name", "returning dummy name");
 1108|  3.24k|    return "/QPDFFakeName";
 1109|  36.8k|}
_ZN16QPDFObjectHandle9newStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1125|  33.5k|{
 1126|  33.5k|    return {QPDFObject::create<QPDF_String>(str)};
 1127|  33.5k|}
_ZN16QPDFObjectHandle16newUnicodeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1131|  1.30k|{
 1132|  1.30k|    return {String::utf16(utf8_str).obj_sp()};
 1133|  1.30k|}
_ZN4qpdf6StringC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1136|    728|    BaseHandle(QPDFObject::create<QPDF_String>(str))
 1137|    728|{
 1138|    728|}
_ZN4qpdf6StringC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1141|    572|    BaseHandle(QPDFObject::create<QPDF_String>(std::move(str)))
 1142|    572|{
 1143|    572|}
_ZN4qpdf6String5utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1147|  1.30k|{
 1148|  1.30k|    std::string result;
 1149|  1.30k|    if (QUtil::utf8_to_pdf_doc(utf8_str, result, '?')) {
  ------------------
  |  Branch (1149:9): [True: 728, False: 572]
  ------------------
 1150|    728|        return String(result);
 1151|    728|    }
 1152|    572|    return String(QUtil::utf8_to_utf16(utf8_str));
 1153|  1.30k|}
_ZNK4qpdf6String5valueEv:
 1157|  4.33k|{
 1158|  4.33k|    auto* s = as<QPDF_String>();
 1159|  4.33k|    if (!s) {
  ------------------
  |  Branch (1159:9): [True: 0, False: 4.33k]
  ------------------
 1160|      0|        throw invalid_error("String");
 1161|      0|    }
 1162|  4.33k|    return s->val;
 1163|  4.33k|}
_ZNK4qpdf6String10utf8_valueEv:
 1167|   457k|{
 1168|   457k|    auto* s = as<QPDF_String>();
 1169|   457k|    if (!s) {
  ------------------
  |  Branch (1169:9): [True: 0, False: 457k]
  ------------------
 1170|      0|        throw invalid_error("String");
 1171|      0|    }
 1172|   457k|    if (util::is_utf16(s->val)) {
  ------------------
  |  Branch (1172:9): [True: 39.2k, False: 418k]
  ------------------
 1173|  39.2k|        return QUtil::utf16_to_utf8(s->val);
 1174|  39.2k|    }
 1175|   418k|    if (util::is_explicit_utf8(s->val)) {
  ------------------
  |  Branch (1175:9): [True: 2.34k, False: 416k]
  ------------------
 1176|       |        // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte representation
 1177|       |        // of U+FEFF.
 1178|  2.34k|        return s->val.substr(3);
 1179|  2.34k|    }
 1180|   416k|    return QUtil::pdf_doc_to_utf8(s->val);
 1181|   418k|}
_ZNK16QPDFObjectHandle14getStringValueEv:
 1185|  4.33k|{
 1186|  4.33k|    try {
 1187|  4.33k|        return String(obj).value();
 1188|  4.33k|    } catch (std::invalid_argument&) {
 1189|      0|        typeWarning("string", "returning empty string");
 1190|      0|        return {};
 1191|      0|    }
 1192|  4.33k|}
_ZNK16QPDFObjectHandle12getUTF8ValueEv:
 1207|   415k|{
 1208|   415k|    try {
 1209|   415k|        return String(obj).utf8_value();
 1210|   415k|    } catch (std::invalid_argument&) {
 1211|      0|        typeWarning("string", "returning empty string");
 1212|      0|        return {};
 1213|      0|    }
 1214|   415k|}
_ZNK16QPDFObjectHandle16getOperatorValueEv:
 1231|  21.4M|{
 1232|  21.4M|    if (auto* op = as<QPDF_Operator>()) {
  ------------------
  |  Branch (1232:15): [True: 21.4M, False: 0]
  ------------------
 1233|  21.4M|        return op->val;
 1234|  21.4M|    }
 1235|      0|    typeWarning("operator", "returning fake value");
 1236|      0|    return "QPDFFAKE";
 1237|  21.4M|}
_ZN16QPDFObjectHandle6aitemsEv:
 1273|  5.39k|{
 1274|  5.39k|    return *this;
 1275|  5.39k|}
_ZNK16QPDFObjectHandle11isOrHasNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1289|  5.47k|{
 1290|  5.47k|    if (isNameAndEquals(value)) {
  ------------------
  |  Branch (1290:9): [True: 2.96k, False: 2.51k]
  ------------------
 1291|  2.96k|        return true;
 1292|  2.96k|    } else if (isArray()) {
  ------------------
  |  Branch (1292:16): [True: 1.11k, False: 1.39k]
  ------------------
 1293|  3.13k|        for (auto& item: getArrayAsVector()) {
  ------------------
  |  Branch (1293:24): [True: 3.13k, False: 1.10k]
  ------------------
 1294|  3.13k|            if (item.isNameAndEquals(value)) {
  ------------------
  |  Branch (1294:17): [True: 6, False: 3.12k]
  ------------------
 1295|      6|                return true;
 1296|      6|            }
 1297|  3.13k|        }
 1298|  1.11k|    }
 1299|  2.50k|    return false;
 1300|  5.47k|}
_ZN16QPDFObjectHandle14mergeResourcesES_PNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS1_IS7_S7_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S7_EEEEEES9_NS5_INSA_ISB_SE_EEEEEE:
 1317|  21.1k|{
 1318|  21.1k|    if (!(isDictionary() && other.isDictionary())) {
  ------------------
  |  Branch (1318:11): [True: 16.4k, False: 4.76k]
  |  Branch (1318:29): [True: 13.4k, False: 2.93k]
  ------------------
 1319|  7.69k|        QTC::TC("qpdf", "QPDFObjectHandle merge top type mismatch");
 1320|  7.69k|        return;
 1321|  7.69k|    }
 1322|       |
 1323|  13.4k|    auto make_og_to_name = [](QPDFObjectHandle& dict,
 1324|  13.4k|                              std::map<QPDFObjGen, std::string>& og_to_name) {
 1325|  13.4k|        for (auto const& [key, value]: dict.as_dictionary()) {
 1326|  13.4k|            if (!value.null() && value.isIndirect()) {
 1327|  13.4k|                og_to_name.insert_or_assign(value.getObjGen(), key);
 1328|  13.4k|            }
 1329|  13.4k|        }
 1330|  13.4k|    };
 1331|       |
 1332|       |    // This algorithm is described in comments in QPDFObjectHandle.hh
 1333|       |    // above the declaration of mergeResources.
 1334|  28.5k|    for (auto const& [rtype, value1]: other.as_dictionary()) {
  ------------------
  |  Branch (1334:37): [True: 28.5k, False: 13.4k]
  ------------------
 1335|  28.5k|        auto other_val = value1;
 1336|  28.5k|        if (hasKey(rtype)) {
  ------------------
  |  Branch (1336:13): [True: 14.8k, False: 13.7k]
  ------------------
 1337|  14.8k|            QPDFObjectHandle this_val = getKey(rtype);
 1338|  14.8k|            if (this_val.isDictionary() && other_val.isDictionary()) {
  ------------------
  |  Branch (1338:17): [True: 9.61k, False: 5.19k]
  |  Branch (1338:44): [True: 8.74k, False: 867]
  ------------------
 1339|  8.74k|                if (this_val.isIndirect()) {
  ------------------
  |  Branch (1339:21): [True: 636, False: 8.11k]
  ------------------
 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|    636|                    QTC::TC("qpdf", "QPDFObjectHandle replace with copy");
 1344|    636|                    this_val = replaceKeyAndGetNew(rtype, this_val.shallowCopy());
 1345|    636|                }
 1346|  8.74k|                std::map<QPDFObjGen, std::string> og_to_name;
 1347|  8.74k|                std::set<std::string> rnames;
 1348|  8.74k|                int min_suffix = 1;
 1349|  8.74k|                bool initialized_maps = false;
 1350|  21.5k|                for (auto const& [key, value2]: other_val.as_dictionary()) {
  ------------------
  |  Branch (1350:47): [True: 21.5k, False: 8.74k]
  ------------------
 1351|  21.5k|                    QPDFObjectHandle rval = value2;
 1352|  21.5k|                    if (!this_val.hasKey(key)) {
  ------------------
  |  Branch (1352:25): [True: 14.0k, False: 7.46k]
  ------------------
 1353|  14.0k|                        if (!rval.isIndirect()) {
  ------------------
  |  Branch (1353:29): [True: 4.97k, False: 9.06k]
  ------------------
 1354|  4.97k|                            QTC::TC("qpdf", "QPDFObjectHandle merge shallow copy");
 1355|  4.97k|                            rval = rval.shallowCopy();
 1356|  4.97k|                        }
 1357|  14.0k|                        this_val.replaceKey(key, rval);
 1358|  14.0k|                    } else if (conflicts) {
  ------------------
  |  Branch (1358:32): [True: 0, False: 7.46k]
  ------------------
 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|  21.5k|                }
 1380|  8.74k|            } else if (this_val.isArray() && other_val.isArray()) {
  ------------------
  |  Branch (1380:24): [True: 2.76k, False: 3.29k]
  |  Branch (1380:46): [True: 2.69k, False: 71]
  ------------------
 1381|  2.69k|                std::set<std::string> scalars;
 1382|   135k|                for (auto this_item: this_val.aitems()) {
  ------------------
  |  Branch (1382:36): [True: 135k, False: 2.69k]
  ------------------
 1383|   135k|                    if (this_item.isScalar()) {
  ------------------
  |  Branch (1383:25): [True: 134k, False: 977]
  ------------------
 1384|   134k|                        scalars.insert(this_item.unparse());
 1385|   134k|                    }
 1386|   135k|                }
 1387|   113k|                for (auto other_item: other_val.aitems()) {
  ------------------
  |  Branch (1387:37): [True: 113k, False: 2.69k]
  ------------------
 1388|   113k|                    if (other_item.isScalar()) {
  ------------------
  |  Branch (1388:25): [True: 112k, False: 1.37k]
  ------------------
 1389|   112k|                        if (!scalars.contains(other_item.unparse())) {
  ------------------
  |  Branch (1389:29): [True: 8.61k, False: 103k]
  ------------------
 1390|  8.61k|                            QTC::TC("qpdf", "QPDFObjectHandle merge array");
 1391|  8.61k|                            this_val.appendItem(other_item);
 1392|   103k|                        } else {
 1393|   103k|                            QTC::TC("qpdf", "QPDFObjectHandle merge array dup");
 1394|   103k|                        }
 1395|   112k|                    }
 1396|   113k|                }
 1397|  2.69k|            }
 1398|  14.8k|        } else {
 1399|  13.7k|            QTC::TC("qpdf", "QPDFObjectHandle merge copy from other");
 1400|  13.7k|            replaceKey(rtype, other_val.shallowCopy());
 1401|  13.7k|        }
 1402|  28.5k|    }
 1403|  13.4k|}
_ZNK16QPDFObjectHandle16getResourceNamesEv:
 1407|  11.9k|{
 1408|       |    // Return second-level dictionary keys
 1409|  11.9k|    std::set<std::string> result;
 1410|  27.0k|    for (auto const& item: as_dictionary(strict)) {
  ------------------
  |  Branch (1410:26): [True: 27.0k, False: 11.9k]
  ------------------
 1411|   163k|        for (auto const& [key2, val2]: item.second.as_dictionary(strict)) {
  ------------------
  |  Branch (1411:38): [True: 163k, False: 27.0k]
  ------------------
 1412|   163k|            if (!val2.null()) {
  ------------------
  |  Branch (1412:17): [True: 130k, False: 32.2k]
  ------------------
 1413|   130k|                result.insert(key2);
 1414|   130k|            }
 1415|   163k|        }
 1416|  27.0k|    }
 1417|  11.9k|    return result;
 1418|  11.9k|}
_ZNK16QPDFObjectHandle21getUniqueResourceNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERiPNS0_3setIS6_NS0_4lessIS6_EENS4_IS6_EEEE:
 1423|  11.9k|{
 1424|  11.9k|    std::set<std::string> names = (namesp ? *namesp : getResourceNames());
  ------------------
  |  Branch (1424:36): [True: 0, False: 11.9k]
  ------------------
 1425|  11.9k|    int max_suffix = min_suffix + QIntC::to_int(names.size());
 1426|  11.9k|    while (min_suffix <= max_suffix) {
  ------------------
  |  Branch (1426:12): [True: 11.9k, False: 0]
  ------------------
 1427|  11.9k|        std::string candidate = prefix + std::to_string(min_suffix);
 1428|  11.9k|        if (!names.contains(candidate)) {
  ------------------
  |  Branch (1428:13): [True: 11.9k, False: 10]
  ------------------
 1429|  11.9k|            return candidate;
 1430|  11.9k|        }
 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|  11.9k|}
_ZN16QPDFObjectHandle26arrayOrStreamToStreamArrayERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_:
 1455|  29.6k|{
 1456|  29.6k|    all_description = description;
 1457|  29.6k|    std::vector<QPDFObjectHandle> result;
 1458|  29.6k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (1458:14): [True: 8.18k, False: 21.4k]
  ------------------
 1459|  8.18k|        int n_items = static_cast<int>(array.size());
 1460|  82.4k|        for (int i = 0; i < n_items; ++i) {
  ------------------
  |  Branch (1460:25): [True: 74.2k, False: 8.18k]
  ------------------
 1461|  74.2k|            QPDFObjectHandle item = array[i];
 1462|  74.2k|            if (item.isStream()) {
  ------------------
  |  Branch (1462:17): [True: 31.0k, False: 43.1k]
  ------------------
 1463|  31.0k|                result.emplace_back(item);
 1464|  43.1k|            } else {
 1465|  43.1k|                item.warn(
 1466|  43.1k|                    {qpdf_e_damaged_pdf,
 1467|  43.1k|                     "",
 1468|  43.1k|                     description + ": item index " + std::to_string(i) + " (from 0)",
 1469|  43.1k|                     0,
 1470|  43.1k|                     "ignoring non-stream in an array of streams"});
 1471|  43.1k|            }
 1472|  74.2k|        }
 1473|  21.4k|    } else if (isStream()) {
  ------------------
  |  Branch (1473:16): [True: 6.64k, False: 14.8k]
  ------------------
 1474|  6.64k|        result.emplace_back(*this);
 1475|  14.8k|    } else if (!null()) {
  ------------------
  |  Branch (1475:16): [True: 478, False: 14.3k]
  ------------------
 1476|    478|        warn(
 1477|    478|            {qpdf_e_damaged_pdf,
 1478|    478|             "",
 1479|    478|             description,
 1480|    478|             0,
 1481|    478|             " object is supposed to be a stream or an array of streams but is neither"});
 1482|    478|    }
 1483|       |
 1484|  29.6k|    bool first = true;
 1485|  37.6k|    for (auto const& item: result) {
  ------------------
  |  Branch (1485:26): [True: 37.6k, False: 29.6k]
  ------------------
 1486|  37.6k|        if (first) {
  ------------------
  |  Branch (1486:13): [True: 14.4k, False: 23.2k]
  ------------------
 1487|  14.4k|            first = false;
 1488|  23.2k|        } else {
 1489|  23.2k|            all_description += ",";
 1490|  23.2k|        }
 1491|  37.6k|        all_description += " stream " + item.getObjGen().unparse(' ');
 1492|  37.6k|    }
 1493|       |
 1494|  29.6k|    return result;
 1495|  29.6k|}
_ZN16QPDFObjectHandle15getPageContentsEv:
 1499|  7.27k|{
 1500|  7.27k|    std::string description = "page object " + getObjGen().unparse(' ');
 1501|  7.27k|    std::string all_description;
 1502|  7.27k|    return getKey("/Contents").arrayOrStreamToStreamArray(description, all_description);
 1503|  7.27k|}
_ZN16QPDFObjectHandle15addPageContentsES_b:
 1507|  7.27k|{
 1508|  7.27k|    new_contents.assertStream();
 1509|       |
 1510|  7.27k|    std::vector<QPDFObjectHandle> content_streams;
 1511|  7.27k|    if (first) {
  ------------------
  |  Branch (1511:9): [True: 3.63k, False: 3.63k]
  ------------------
 1512|  3.63k|        QTC::TC("qpdf", "QPDFObjectHandle prepend page contents");
 1513|  3.63k|        content_streams.push_back(new_contents);
 1514|  3.63k|    }
 1515|  7.27k|    for (auto const& iter: getPageContents()) {
  ------------------
  |  Branch (1515:26): [True: 4.31k, False: 7.27k]
  ------------------
 1516|  4.31k|        QTC::TC("qpdf", "QPDFObjectHandle append page contents");
 1517|  4.31k|        content_streams.push_back(iter);
 1518|  4.31k|    }
 1519|  7.27k|    if (!first) {
  ------------------
  |  Branch (1519:9): [True: 3.63k, False: 3.63k]
  ------------------
 1520|  3.63k|        content_streams.push_back(new_contents);
 1521|  3.63k|    }
 1522|       |
 1523|  7.27k|    replaceKey("/Contents", newArray(content_streams));
 1524|  7.27k|}
_ZN16QPDFObjectHandle22coalesceContentStreamsEv:
 1561|  17.8k|{
 1562|  17.8k|    QPDFObjectHandle contents = getKey("/Contents");
 1563|  17.8k|    if (contents.isStream()) {
  ------------------
  |  Branch (1563:9): [True: 2.04k, False: 15.8k]
  ------------------
 1564|  2.04k|        QTC::TC("qpdf", "QPDFObjectHandle coalesce called on stream");
 1565|  2.04k|        return;
 1566|  15.8k|    } else if (!contents.isArray()) {
  ------------------
  |  Branch (1566:16): [True: 11.3k, False: 4.51k]
  ------------------
 1567|       |        // /Contents is optional for pages, and some very damaged files may have pages that are
 1568|       |        // invalid in other ways.
 1569|  11.3k|        return;
 1570|  11.3k|    }
 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.51k|    QPDF& qpdf = getQPDF("coalesceContentStreams called on object  with no associated PDF file");
 1576|       |
 1577|  4.51k|    QPDFObjectHandle new_contents = newStream(&qpdf);
 1578|  4.51k|    replaceKey("/Contents", new_contents);
 1579|       |
 1580|  4.51k|    auto provider = std::shared_ptr<StreamDataProvider>(new CoalesceProvider(*this, contents));
 1581|  4.51k|    new_contents.replaceStreamData(provider, newNull(), newNull());
 1582|  4.51k|}
_ZNK16QPDFObjectHandle7unparseEv:
 1586|   280k|{
 1587|   280k|    if (isIndirect()) {
  ------------------
  |  Branch (1587:9): [True: 3.87k, False: 276k]
  ------------------
 1588|  3.87k|        return getObjGen().unparse(' ') + " R";
 1589|   276k|    } else {
 1590|   276k|        return unparseResolved();
 1591|   276k|    }
 1592|   280k|}
_ZNK16QPDFObjectHandle15unparseResolvedEv:
 1596|   276k|{
 1597|   276k|    if (!obj) {
  ------------------
  |  Branch (1597:9): [True: 0, False: 276k]
  ------------------
 1598|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1599|      0|    }
 1600|   276k|    return BaseHandle::unparse();
 1601|   276k|}
_ZNK16QPDFObjectHandle7getJSONEib:
 1615|  15.8k|{
 1616|  15.8k|    if ((!dereference_indirect) && isIndirect()) {
  ------------------
  |  Branch (1616:9): [True: 0, False: 15.8k]
  |  Branch (1616:36): [True: 0, False: 0]
  ------------------
 1617|      0|        return JSON::makeString(unparse());
 1618|  15.8k|    } else if (!obj) {
  ------------------
  |  Branch (1618:16): [True: 0, False: 15.8k]
  ------------------
 1619|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1620|  15.8k|    } else {
 1621|  15.8k|        Pl_Buffer p{"json"};
 1622|  15.8k|        JSON::Writer jw{&p, 0};
 1623|  15.8k|        writeJSON(json_version, jw, dereference_indirect);
 1624|  15.8k|        p.finish();
 1625|  15.8k|        return JSON::parse(p.getString());
 1626|  15.8k|    }
 1627|  15.8k|}
_ZNK16QPDFObjectHandle9writeJSONEiRN4JSON6WriterEb:
 1631|   226k|{
 1632|   226k|    if (!dereference_indirect && isIndirect()) {
  ------------------
  |  Branch (1632:9): [True: 210k, False: 15.8k]
  |  Branch (1632:34): [True: 32.4k, False: 178k]
  ------------------
 1633|  32.4k|        p << "\"" << getObjGen().unparse(' ') << " R\"";
 1634|   193k|    } else if (!obj) {
  ------------------
  |  Branch (1634:16): [True: 0, False: 193k]
  ------------------
 1635|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1636|   193k|    } else {
 1637|   193k|        write_json(json_version, p);
 1638|   193k|    }
 1639|   226k|}
_ZN16QPDFObjectHandle18pipeContentStreamsEP8PipelineRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERS8_:
 1699|  22.3k|{
 1700|  22.3k|    bool need_newline = false;
 1701|  22.3k|    std::string buffer;
 1702|  22.3k|    pl::String buf(buffer);
 1703|  30.9k|    for (auto stream: arrayOrStreamToStreamArray(description, all_description)) {
  ------------------
  |  Branch (1703:21): [True: 30.9k, False: 21.6k]
  ------------------
 1704|  30.9k|        if (need_newline) {
  ------------------
  |  Branch (1704:13): [True: 10.2k, False: 20.7k]
  ------------------
 1705|  10.2k|            buf.writeCStr("\n");
 1706|  10.2k|        }
 1707|  30.9k|        if (!stream.pipeStreamData(&buf, 0, qpdf_dl_specialized)) {
  ------------------
  |  Branch (1707:13): [True: 723, False: 30.2k]
  ------------------
 1708|    723|            QTC::TC("qpdf", "QPDFObjectHandle errors in parsecontent");
 1709|    723|            throw QPDFExc(
 1710|    723|                qpdf_e_damaged_pdf,
 1711|    723|                "content stream",
 1712|    723|                "content stream object " + stream.getObjGen().unparse(' '),
 1713|    723|                0,
 1714|    723|                "errors while decoding content stream");
 1715|    723|        }
 1716|  30.2k|        need_newline = buffer.empty() || buffer.back() != '\n';
  ------------------
  |  Branch (1716:24): [True: 4.03k, False: 26.2k]
  |  Branch (1716:42): [True: 7.89k, False: 18.3k]
  ------------------
 1717|  30.2k|        QTC::TC("qpdf", "QPDFObjectHandle need_newline", need_newline ? 0 : 1);
  ------------------
  |  Branch (1717:58): [True: 11.6k, False: 18.5k]
  ------------------
 1718|  30.2k|        p->writeString(buffer);
 1719|  30.2k|        buffer.clear();
 1720|  30.2k|    }
 1721|  21.6k|    p->finish();
 1722|  21.6k|}
_ZN16QPDFObjectHandle17parsePageContentsEPNS_15ParserCallbacksE:
 1726|  17.8k|{
 1727|  17.8k|    std::string description = "page object " + getObjGen().unparse(' ');
 1728|  17.8k|    getKey("/Contents").parseContentStream_internal(description, callbacks);
 1729|  17.8k|}
_ZN16QPDFObjectHandle27parseContentStream_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPNS_15ParserCallbacksE:
 1763|  17.8k|{
 1764|  17.8k|    std::string stream_data;
 1765|  17.8k|    pl::String buf(stream_data);
 1766|  17.8k|    std::string all_description;
 1767|  17.8k|    pipeContentStreams(&buf, description, all_description);
 1768|  17.8k|    if (callbacks) {
  ------------------
  |  Branch (1768:9): [True: 0, False: 17.8k]
  ------------------
 1769|      0|        callbacks->contentSize(stream_data.size());
 1770|      0|    }
 1771|  17.8k|    try {
 1772|  17.8k|        parseContentStream_data(stream_data, all_description, callbacks, getOwningQPDF());
 1773|  17.8k|    } catch (TerminateParsing&) {
 1774|      0|        return;
 1775|      0|    }
 1776|  16.9k|    if (callbacks) {
  ------------------
  |  Branch (1776:9): [True: 0, False: 16.9k]
  ------------------
 1777|      0|        callbacks->handleEOF();
 1778|      0|    }
 1779|  16.9k|}
_ZN16QPDFObjectHandle23parseContentStream_dataENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEERKNS0_12basic_stringIcS3_NS0_9allocatorIcEEEEPNS_15ParserCallbacksEP4QPDF:
 1787|  16.9k|{
 1788|  16.9k|    size_t stream_length = stream_data.size();
 1789|  16.9k|    auto input = is::OffsetBuffer(description, stream_data);
 1790|  16.9k|    Tokenizer tokenizer;
 1791|  16.9k|    tokenizer.allowEOF();
 1792|  16.9k|    auto max_bad_count = Limits::parser_max_errors();
 1793|  16.9k|    auto sp_description = Parser::make_description(description, "content");
 1794|  21.6M|    while (QIntC::to_size(input.tell()) < stream_length) {
  ------------------
  |  Branch (1794:12): [True: 21.6M, False: 12.3k]
  ------------------
 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|  21.6M|        tokenizer.nextToken(input, "content", true);
 1799|  21.6M|        qpdf_offset_t offset = input.getLastOffset();
 1800|  21.6M|        input.seek(offset, SEEK_SET);
 1801|  21.6M|        auto [obj, empty] = Parser::parse_content(input, sp_description, tokenizer, context);
 1802|  21.6M|        if (empty) {
  ------------------
  |  Branch (1802:13): [True: 4.46k, False: 21.6M]
  ------------------
 1803|       |            // EOF
 1804|  4.46k|            return;
 1805|  4.46k|        }
 1806|  21.6M|        if (!obj) {
  ------------------
  |  Branch (1806:13): [True: 4.66k, False: 21.6M]
  ------------------
 1807|  4.66k|            if (max_bad_count && --max_bad_count == 0) {
  ------------------
  |  Branch (1807:17): [True: 4.66k, False: 0]
  |  Branch (1807:34): [True: 172, False: 4.49k]
  ------------------
 1808|    172|                Limits::error();
 1809|    172|                warn(
 1810|    172|                    context,
 1811|    172|                    {qpdf_e_damaged_pdf,
 1812|    172|                     description,
 1813|    172|                     "stream data",
 1814|    172|                     input.tell(),
 1815|    172|                     "limits error(parser-max-errors): too many errors during content stream "
 1816|    172|                     "parsing"});
 1817|    172|                return;
 1818|    172|            }
 1819|  4.49k|            obj = newNull();
 1820|  4.49k|        }
 1821|  21.6M|        size_t length = QIntC::to_size(input.tell() - offset);
 1822|  21.6M|        if (callbacks) {
  ------------------
  |  Branch (1822:13): [True: 0, False: 21.6M]
  ------------------
 1823|      0|            callbacks->handleObject(obj, QIntC::to_size(offset), length);
 1824|      0|        }
 1825|  21.6M|        if (obj.isOperator() && obj.getOperatorValue() == "ID") {
  ------------------
  |  Branch (1825:13): [True: 21.4M, False: 214k]
  |  Branch (1825:13): [True: 1.19k, False: 21.6M]
  |  Branch (1825:33): [True: 1.19k, False: 21.4M]
  ------------------
 1826|       |            // Discard next character; it is the space after ID that terminated the token.  Read
 1827|       |            // until end of inline image.
 1828|  1.19k|            char ch;
 1829|  1.19k|            input.read(&ch, 1);
 1830|  1.19k|            tokenizer.expectInlineImage(input);
 1831|  1.19k|            tokenizer.nextToken(input, description);
 1832|  1.19k|            offset = input.getLastOffset();
 1833|  1.19k|            length = QIntC::to_size(input.tell() - offset);
 1834|  1.19k|            if (tokenizer.getType() == QPDFTokenizer::tt_bad) {
  ------------------
  |  Branch (1834:17): [True: 68, False: 1.13k]
  ------------------
 1835|     68|                QTC::TC("qpdf", "QPDFObjectHandle EOF in inline image");
 1836|     68|                warn(
 1837|     68|                    context,
 1838|     68|                    {qpdf_e_damaged_pdf,
 1839|     68|                     description,
 1840|     68|                     "stream data",
 1841|     68|                     input.tell(),
 1842|     68|                     "EOF found while reading inline image"});
 1843|  1.13k|            } else {
 1844|  1.13k|                QTC::TC("qpdf", "QPDFObjectHandle inline image token");
 1845|  1.13k|                if (callbacks) {
  ------------------
  |  Branch (1845:21): [True: 0, False: 1.13k]
  ------------------
 1846|      0|                    callbacks->handleObject(
 1847|      0|                        QPDFObjectHandle::newInlineImage(tokenizer.getValue()),
 1848|      0|                        QIntC::to_size(offset),
 1849|      0|                        length);
 1850|      0|                }
 1851|  1.13k|            }
 1852|  1.19k|        }
 1853|  21.6M|    }
 1854|  16.9k|}
_ZN16QPDFObjectHandle7newNullEv:
 1895|  60.4k|{
 1896|  60.4k|    return {QPDFObject::create<QPDF_Null>()};
 1897|  60.4k|}
_ZN16QPDFObjectHandle7newRealEdib:
 1907|  53.8k|{
 1908|  53.8k|    return {QPDFObject::create<QPDF_Real>(value, decimal_places, trim_trailing_zeroes)};
 1909|  53.8k|}
_ZN16QPDFObjectHandle8newArrayERKNSt3__16vectorIS_NS0_9allocatorIS_EEEE:
 1931|  21.6k|{
 1932|  21.6k|    return {QPDFObject::create<QPDF_Array>(items)};
 1933|  21.6k|}
_ZN16QPDFObjectHandle8newArrayERKNS_9RectangleE:
 1937|  13.4k|{
 1938|  13.4k|    return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)});
 1939|  13.4k|}
_ZN16QPDFObjectHandle16newFromRectangleERKNS_9RectangleE:
 1967|  4.01k|{
 1968|  4.01k|    return newArray(rect);
 1969|  4.01k|}
_ZN16QPDFObjectHandle13newDictionaryEv:
 1985|  19.2k|{
 1986|  19.2k|    return newDictionary(std::map<std::string, QPDFObjectHandle>());
 1987|  19.2k|}
_ZN16QPDFObjectHandle13newDictionaryERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S_EEEEEE:
 1991|  19.2k|{
 1992|  19.2k|    return {QPDFObject::create<QPDF_Dictionary>(items)};
 1993|  19.2k|}
_ZN16QPDFObjectHandle9newStreamEP4QPDF:
 1997|  4.51k|{
 1998|  4.51k|    if (qpdf == nullptr) {
  ------------------
  |  Branch (1998:9): [True: 0, False: 4.51k]
  ------------------
 1999|      0|        throw std::runtime_error("attempt to create stream in null qpdf object");
 2000|      0|    }
 2001|  4.51k|    QTC::TC("qpdf", "QPDFObjectHandle newStream");
 2002|  4.51k|    return qpdf->newStream();
 2003|  4.51k|}
_ZNK4qpdf10BaseHandle11descriptionEv:
 2036|   207k|{
 2037|   207k|    return obj ? obj->getDescription() : ""s;
  ------------------
  |  Branch (2037:12): [True: 207k, False: 0]
  ------------------
 2038|   207k|}
_ZN16QPDFObjectHandle20setObjectDescriptionEP4QPDFRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2042|  20.9k|{
 2043|  20.9k|    if (obj) {
  ------------------
  |  Branch (2043:9): [True: 20.9k, False: 0]
  ------------------
 2044|  20.9k|        auto descr = std::make_shared<QPDFObject::Description>(object_description);
 2045|  20.9k|        obj->setDescription(owning_qpdf, descr);
 2046|  20.9k|    }
 2047|  20.9k|}
_ZNK16QPDFObjectHandle20hasObjectDescriptionEv:
 2051|  52.0k|{
 2052|  52.0k|    return obj && obj->hasDescription();
  ------------------
  |  Branch (2052:12): [True: 52.0k, False: 0]
  |  Branch (2052:19): [True: 31.1k, False: 20.9k]
  ------------------
 2053|  52.0k|}
_ZN16QPDFObjectHandle11shallowCopyEv:
 2057|  28.4k|{
 2058|  28.4k|    if (!obj) {
  ------------------
  |  Branch (2058:9): [True: 0, False: 28.4k]
  ------------------
 2059|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2060|      0|    }
 2061|  28.4k|    return {copy()};
 2062|  28.4k|}
_ZNK4qpdf10BaseHandle13invalid_errorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2137|    939|{
 2138|    939|    return std::invalid_argument(method + " operation attempted on invalid object");
 2139|    939|}
_ZNK4qpdf10BaseHandle10type_errorEPKcRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 2149|  14.4k|{
 2150|  14.4k|    return {
 2151|  14.4k|        qpdf_e_object,
 2152|  14.4k|        "",
 2153|  14.4k|        description(),
 2154|  14.4k|        0,
 2155|  14.4k|        "operation for "s + expected_type + " attempted on object of type " + type_name() + ": " +
 2156|  14.4k|            message};
 2157|  14.4k|}
_ZNK16QPDFObjectHandle11typeWarningEPKcRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2161|  14.4k|{
 2162|  14.4k|    if (!obj) {
  ------------------
  |  Branch (2162:9): [True: 0, False: 14.4k]
  ------------------
 2163|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 2164|      0|    }
 2165|  14.4k|    warn(type_error(expected_type, message));
 2166|  14.4k|}
_ZNK16QPDFObjectHandle10assertTypeEPKcb:
 2182|  7.27k|{
 2183|  7.27k|    if (!istype) {
  ------------------
  |  Branch (2183:9): [True: 0, False: 7.27k]
  ------------------
 2184|      0|        throw type_error(type_name);
 2185|      0|    }
 2186|  7.27k|}
_ZNK16QPDFObjectHandle12assertStreamEv:
 2250|  7.27k|{
 2251|  7.27k|    assertType("stream", isStream());
 2252|  7.27k|}
_ZNK16QPDFObjectHandle13isFormXObjectEv:
 2305|  69.6k|{
 2306|  69.6k|    return isStreamOfType("", "/Form");
 2307|  69.6k|}
_ZNK16QPDFObjectHandle7isImageEb:
 2311|  12.7k|{
 2312|  12.7k|    return (
 2313|  12.7k|        isStreamOfType("", "/Image") &&
  ------------------
  |  Branch (2313:9): [True: 790, False: 11.9k]
  ------------------
 2314|    790|        ((!exclude_imagemask) ||
  ------------------
  |  Branch (2314:10): [True: 0, False: 790]
  ------------------
 2315|    790|         (!(getDict().getKey("/ImageMask").isBool() &&
  ------------------
  |  Branch (2315:13): [True: 34, False: 756]
  ------------------
 2316|     34|            getDict().getKey("/ImageMask").getBoolValue()))));
  ------------------
  |  Branch (2316:13): [True: 34, False: 0]
  ------------------
 2317|  12.7k|}
_ZN4qpdf10BaseHandle4warnEP4QPDFO7QPDFExc:
 2329|    240|{
 2330|    240|    if (!qpdf) {
  ------------------
  |  Branch (2330:9): [True: 0, False: 240]
  ------------------
 2331|      0|        throw std::move(e);
 2332|      0|    }
 2333|    240|    qpdf->warn(std::move(e));
 2334|    240|}
_ZNK4qpdf10BaseHandle4warnEO7QPDFExc:
 2338|   251k|{
 2339|   251k|    if (!qpdf()) {
  ------------------
  |  Branch (2339:9): [True: 414, False: 250k]
  ------------------
 2340|    414|        throw std::move(e);
 2341|    414|    }
 2342|   250k|    qpdf()->warn(std::move(e));
 2343|   250k|}
_ZNK4qpdf10BaseHandle4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2347|   218k|{
 2348|   218k|    if (qpdf()) {
  ------------------
  |  Branch (2348:9): [True: 193k, False: 25.5k]
  ------------------
 2349|   193k|        warn({qpdf_e_damaged_pdf, "", description(), 0, warning});
 2350|   193k|    } else {
 2351|  25.5k|        *QPDFLogger::defaultLogger()->getError() << warning << "\n";
 2352|  25.5k|    }
 2353|   218k|}
_ZN16QPDFObjectHandle14QPDFArrayItemsC2ERKS_:
 2441|  5.39k|    oh(oh)
 2442|  5.39k|{
 2443|  5.39k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorppEv:
 2447|   249k|{
 2448|   249k|    if (!m->is_end) {
  ------------------
  |  Branch (2448:9): [True: 249k, False: 0]
  ------------------
 2449|   249k|        ++m->item_number;
 2450|   249k|        updateIValue();
 2451|   249k|    }
 2452|   249k|    return *this;
 2453|   249k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratordeEv:
 2467|   249k|{
 2468|   249k|    updateIValue();
 2469|   249k|    return ivalue;
 2470|   249k|}
_ZNK16QPDFObjectHandle14QPDFArrayItems8iteratoreqERKS1_:
 2481|   254k|{
 2482|   254k|    return (m->item_number == other.m->item_number);
 2483|   254k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorC2ERS_b:
 2486|  10.7k|    m(new Members(oh, for_begin))
 2487|  10.7k|{
 2488|  10.7k|    updateIValue();
 2489|  10.7k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iterator12updateIValueEv:
 2493|   509k|{
 2494|   509k|    m->is_end = (m->item_number >= m->oh.getArrayNItems());
 2495|   509k|    if (m->is_end) {
  ------------------
  |  Branch (2495:9): [True: 10.7k, False: 498k]
  ------------------
 2496|  10.7k|        ivalue = QPDFObjectHandle();
 2497|   498k|    } else {
 2498|   498k|        ivalue = m->oh.getArrayItem(m->item_number);
 2499|   498k|    }
 2500|   509k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iterator7MembersC2ERS_b:
 2503|  10.7k|    oh(oh)
 2504|  10.7k|{
 2505|  10.7k|    item_number = for_begin ? 0 : oh.getArrayNItems();
  ------------------
  |  Branch (2505:19): [True: 5.39k, False: 5.39k]
  ------------------
 2506|  10.7k|}
_ZN16QPDFObjectHandle14QPDFArrayItems5beginEv:
 2510|  5.39k|{
 2511|  5.39k|    return {oh, true};
 2512|  5.39k|}
_ZN16QPDFObjectHandle14QPDFArrayItems3endEv:
 2516|  5.39k|{
 2517|  5.39k|    return {oh, false};
 2518|  5.39k|}
_ZNK16QPDFObjectHandle9getObjGenEv:
 2522|   777k|{
 2523|   777k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (2523:12): [True: 777k, False: 0]
  ------------------
 2524|   777k|}
_ZNK16QPDFObjectHandle11getObjectIDEv:
 2528|   581k|{
 2529|   581k|    return getObjGen().getObj();
 2530|   581k|}
_ZNK16QPDFObjectHandle10isIndirectEv:
 2540|   572k|{
 2541|   572k|    return getObjectID() != 0;
 2542|   572k|}
_ZNK16QPDFObjectHandle13getOwningQPDFEv:
 2547|   369k|{
 2548|   369k|    return obj ? obj->getQPDF() : nullptr;
  ------------------
  |  Branch (2548:12): [True: 369k, False: 0]
  ------------------
 2549|   369k|}
_ZNK16QPDFObjectHandle7getQPDFERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2553|  4.51k|{
 2554|  4.51k|    if (auto result = obj ? obj->getQPDF() : nullptr) {
  ------------------
  |  Branch (2554:14): [True: 4.51k, False: 0]
  ------------------
 2555|  4.51k|        return *result;
 2556|  4.51k|    }
 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.51k|}
_ZN16QPDFObjectHandle15setParsedOffsetEx:
 2562|     10|{
 2563|     10|    if (obj) {
  ------------------
  |  Branch (2563:9): [True: 10, False: 0]
  ------------------
 2564|     10|        obj->setParsedOffset(offset);
 2565|     10|    }
 2566|     10|}
QPDFObjectHandle.cc:_ZN12_GLOBAL__N_116CoalesceProviderC2E16QPDFObjectHandleS1_:
   95|  4.51k|            containing_page(containing_page),
   96|  4.51k|            old_contents(old_contents)
   97|  4.51k|        {
   98|  4.51k|        }
QPDFObjectHandle.cc:_ZN12_GLOBAL__N_116CoalesceProviderD2Ev:
   99|  4.51k|        ~CoalesceProvider() override = default;
QPDFObjectHandle.cc:_ZN12_GLOBAL__N_116CoalesceProvider17provideStreamDataERK10QPDFObjGenP8Pipeline:
  110|  4.51k|{
  111|  4.51k|    QTC::TC("qpdf", "QPDFObjectHandle coalesce provide stream data");
  112|  4.51k|    std::string description = "page object " + containing_page.getObjGen().unparse(' ');
  113|  4.51k|    std::string all_description;
  114|  4.51k|    old_contents.pipeContentStreams(p, description, all_description);
  115|  4.51k|}

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

_ZN25QPDFOutlineDocumentHelper8Accessor9checkSeenERS_10QPDFObjGen:
   23|  4.58k|{
   24|  4.58k|    return !dh.m->seen.add(og);
   25|  4.58k|}
_ZN25QPDFOutlineDocumentHelperC2ER4QPDF:
   28|  10.3k|    QPDFDocumentHelper(qpdf),
   29|  10.3k|    m(std::make_shared<Members>())
   30|  10.3k|{
   31|  10.3k|    validate();
   32|  10.3k|}
_ZN25QPDFOutlineDocumentHelper8validateEb:
   42|  10.3k|{
   43|  10.3k|    m->outlines.clear();
   44|  10.3k|    m->names_dest = nullptr;
   45|       |
   46|  10.3k|    QPDFObjectHandle root = qpdf.getRoot();
   47|  10.3k|    if (!root.hasKey("/Outlines")) {
  ------------------
  |  Branch (47:9): [True: 9.53k, False: 812]
  ------------------
   48|  9.53k|        return;
   49|  9.53k|    }
   50|    812|    auto outlines = root.getKey("/Outlines");
   51|    812|    if (!(outlines.isDictionary() && outlines.hasKey("/First"))) {
  ------------------
  |  Branch (51:9): [True: 21, False: 791]
  |  Branch (51:11): [True: 801, False: 11]
  |  Branch (51:38): [True: 791, False: 10]
  ------------------
   52|     21|        return;
   53|     21|    }
   54|    791|    QPDFObjectHandle cur = outlines.getKey("/First");
   55|    791|    QPDFObjGen::set seen;
   56|  2.29k|    while (!cur.null()) {
  ------------------
  |  Branch (56:12): [True: 1.61k, False: 681]
  ------------------
   57|  1.61k|        if (!seen.add(cur)) {
  ------------------
  |  Branch (57:13): [True: 110, False: 1.50k]
  ------------------
   58|    110|            cur.warn("Loop detected loop in /Outlines tree");
   59|    110|            return;
   60|    110|        }
   61|  1.50k|        m->outlines.emplace_back(QPDFOutlineObjectHelper::Accessor::create(cur, *this, 1));
   62|  1.50k|        cur = cur.getKey("/Next");
   63|  1.50k|    }
   64|    791|}
_ZN25QPDFOutlineDocumentHelper16initializeByPageEv:
   80|  15.5k|{
   81|  15.5k|    std::list<QPDFOutlineObjectHelper> queue;
   82|  15.5k|    queue.insert(queue.end(), m->outlines.begin(), m->outlines.end());
   83|       |
   84|  20.5k|    while (!queue.empty()) {
  ------------------
  |  Branch (84:12): [True: 5.01k, False: 15.5k]
  ------------------
   85|  5.01k|        QPDFOutlineObjectHelper oh = queue.front();
   86|  5.01k|        queue.pop_front();
   87|  5.01k|        m->by_page[oh.getDestPage().getObjGen()].push_back(oh);
   88|  5.01k|        std::vector<QPDFOutlineObjectHelper> kids = oh.getKids();
   89|  5.01k|        queue.insert(queue.end(), kids.begin(), kids.end());
   90|  5.01k|    }
   91|  15.5k|}
_ZN25QPDFOutlineDocumentHelper18getOutlinesForPageE10QPDFObjGen:
   95|  15.8k|{
   96|  15.8k|    if (m->by_page.empty()) {
  ------------------
  |  Branch (96:9): [True: 15.5k, False: 361]
  ------------------
   97|  15.5k|        initializeByPage();
   98|  15.5k|    }
   99|  15.8k|    if (m->by_page.contains(og)) {
  ------------------
  |  Branch (99:9): [True: 81, False: 15.7k]
  ------------------
  100|     81|        return m->by_page[og];
  101|     81|    }
  102|  15.7k|    return {};
  103|  15.8k|}
_ZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandle:
  107|  1.81k|{
  108|  1.81k|    QPDFObjectHandle result;
  109|  1.81k|    if (name.isName()) {
  ------------------
  |  Branch (109:9): [True: 128, False: 1.68k]
  ------------------
  110|    128|        if (!m->dest_dict) {
  ------------------
  |  Branch (110:13): [True: 64, False: 64]
  ------------------
  111|     64|            m->dest_dict = qpdf.getRoot().getKey("/Dests");
  112|     64|        }
  113|    128|        result = m->dest_dict.getKeyIfDict(name.getName());
  114|  1.68k|    } else if (name.isString()) {
  ------------------
  |  Branch (114:16): [True: 1.68k, False: 0]
  ------------------
  115|  1.68k|        if (!m->names_dest) {
  ------------------
  |  Branch (115:13): [True: 823, False: 860]
  ------------------
  116|    823|            auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
  117|    823|            if (dests.isDictionary()) {
  ------------------
  |  Branch (117:17): [True: 588, False: 235]
  ------------------
  118|    588|                m->names_dest = std::make_unique<QPDFNameTreeObjectHelper>(
  119|    588|                    dests,
  120|    588|                    qpdf,
  121|    588|                    [](QPDFObjectHandle const& o) -> bool {
  122|    588|                        return o.isArray() || o.contains("/D");
  123|    588|                    },
  124|    588|                    true);
  125|    588|                m->names_dest->validate();
  126|    588|            }
  127|    823|        }
  128|  1.68k|        if (m->names_dest) {
  ------------------
  |  Branch (128:13): [True: 1.30k, False: 383]
  ------------------
  129|  1.30k|            if (m->names_dest->findObject(name.getUTF8Value(), result)) {
  ------------------
  |  Branch (129:17): [True: 136, False: 1.16k]
  ------------------
  130|    136|                QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest");
  131|    136|            }
  132|  1.30k|        }
  133|  1.68k|    }
  134|  1.81k|    if (!result) {
  ------------------
  |  Branch (134:9): [True: 925, False: 886]
  ------------------
  135|    925|        return QPDFObjectHandle::newNull();
  136|    925|    }
  137|    886|    if (result.isDictionary()) {
  ------------------
  |  Branch (137:9): [True: 130, False: 756]
  ------------------
  138|    130|        return result.getKey("/D");
  139|    130|    }
  140|    756|    return result;
  141|    886|}
_ZN25QPDFOutlineDocumentHelper7MembersC2Ev:
   10|  10.3k|    Members() = default;
_ZN25QPDFOutlineDocumentHelper7MembersD2Ev:
   12|  10.3k|    ~Members() = default;
QPDFOutlineDocumentHelper.cc:_ZZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandleENK3$_0clERKS0_:
  121|  48.8k|                    [](QPDFObjectHandle const& o) -> bool {
  122|  48.8k|                        return o.isArray() || o.contains("/D");
  ------------------
  |  Branch (122:32): [True: 44.4k, False: 4.39k]
  |  Branch (122:47): [True: 3.54k, False: 847]
  ------------------
  123|  48.8k|                    },

_ZN23QPDFOutlineObjectHelper7MembersC2ER25QPDFOutlineDocumentHelper:
    8|  4.58k|    dh(dh)
    9|  4.58k|{
   10|  4.58k|}
_ZN23QPDFOutlineObjectHelperC2E16QPDFObjectHandleR25QPDFOutlineDocumentHelperi:
   14|  4.58k|    QPDFObjectHelper(a_oh),
   15|  4.58k|    m(new Members(dh))
   16|  4.58k|{
   17|  4.58k|    if (depth > 50) {
  ------------------
  |  Branch (17:9): [True: 0, False: 4.58k]
  ------------------
   18|       |        // Not exercised in test suite, but was tested manually by temporarily changing max depth
   19|       |        // to 1.
   20|      0|        return;
   21|      0|    }
   22|  4.58k|    if (QPDFOutlineDocumentHelper::Accessor::checkSeen(m->dh, a_oh.getObjGen())) {
  ------------------
  |  Branch (22:9): [True: 2.38k, False: 2.19k]
  ------------------
   23|  2.38k|        a_oh.warn("Loop detected loop in /Outlines tree");
   24|  2.38k|        return;
   25|  2.38k|    }
   26|       |
   27|  2.19k|    QPDFObjGen::set children;
   28|  2.19k|    QPDFObjectHandle cur = a_oh.getKey("/First");
   29|  5.27k|    while (!cur.null() && cur.isIndirect()) {
  ------------------
  |  Branch (29:12): [True: 3.34k, False: 1.93k]
  |  Branch (29:27): [True: 3.28k, False: 63]
  ------------------
   30|  3.28k|        if (!children.add(cur)) {
  ------------------
  |  Branch (30:13): [True: 203, False: 3.07k]
  ------------------
   31|    203|            cur.warn("Loop detected loop in /Outlines tree");
   32|    203|            break;
   33|    203|        }
   34|  3.07k|        QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth);
   35|  3.07k|        new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this);
   36|  3.07k|        m->kids.emplace_back(new_ooh);
   37|  3.07k|        cur = cur.getKey("/Next");
   38|  3.07k|    }
   39|  2.19k|}
_ZN23QPDFOutlineObjectHelper7getKidsEv:
   49|  4.39k|{
   50|  4.39k|    return m->kids;
   51|  4.39k|}
_ZN23QPDFOutlineObjectHelper7getDestEv:
   55|  5.01k|{
   56|  5.01k|    auto dest = get("/Dest");
   57|  5.01k|    if (dest.null()) {
  ------------------
  |  Branch (57:9): [True: 3.77k, False: 1.24k]
  ------------------
   58|  3.77k|        auto const& A = get("/A");
   59|  3.77k|        if (Name(A["/S"]) == "/GoTo") {
  ------------------
  |  Branch (59:13): [True: 1.54k, False: 2.22k]
  ------------------
   60|  1.54k|            dest = A["/D"];
   61|  1.54k|        }
   62|  3.77k|    }
   63|  5.01k|    if (dest.null()) {
  ------------------
  |  Branch (63:9): [True: 2.27k, False: 2.74k]
  ------------------
   64|  2.27k|        return QPDFObjectHandle::newNull();
   65|  2.27k|    }
   66|  2.74k|    if (dest.isName() || dest.isString()) {
  ------------------
  |  Branch (66:9): [True: 128, False: 2.61k]
  |  Branch (66:26): [True: 1.68k, False: 929]
  ------------------
   67|  1.81k|        return m->dh.resolveNamedDest(dest);
   68|  1.81k|    }
   69|    929|    return dest;
   70|  2.74k|}
_ZN23QPDFOutlineObjectHelper11getDestPageEv:
   74|  5.01k|{
   75|  5.01k|    QPDFObjectHandle dest = getDest();
   76|  5.01k|    if (!dest.empty() && dest.isArray()) {
  ------------------
  |  Branch (76:9): [True: 1.06k, False: 3.94k]
  |  Branch (76:26): [True: 1.03k, False: 31]
  ------------------
   77|  1.03k|        return dest.getArrayItem(0);
   78|  1.03k|    }
   79|  3.97k|    return QPDFObjectHandle::newNull();
   80|  5.01k|}

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

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

_ZN4qpdf4impl6Parser13parse_contentER11InputSourceNSt3__110shared_ptrINS4_7variantIJNS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEN10QPDFObject10JSON_DescrENSD_10ChildDescrENSD_14ObjStreamDescrEEEEEERNS_9TokenizerEP4QPDF:
   75|  21.6M|{
   76|  21.6M|    static const std::string content("content"); // GCC12 - make constexpr
   77|  21.6M|    auto p = Parser(
   78|  21.6M|        input,
   79|  21.6M|        std::move(sp_description),
   80|  21.6M|        content,
   81|  21.6M|        tokenizer,
   82|  21.6M|        nullptr,
   83|  21.6M|        context,
   84|  21.6M|        true,
   85|  21.6M|        0,
   86|  21.6M|        0,
   87|  21.6M|        context && context->doc().reconstructed_xref());
  ------------------
  |  Branch (87:9): [True: 21.6M, False: 0]
  |  Branch (87:20): [True: 21.6M, False: 3.54k]
  ------------------
   88|  21.6M|    if (auto result = p.parse(true)) {
  ------------------
  |  Branch (88:14): [True: 21.6M, False: 9.12k]
  ------------------
   89|  21.6M|        return {result, false};
   90|  21.6M|    }
   91|  9.12k|    return {{}, p.empty_};
   92|  21.6M|}
_ZN4qpdf4impl6Parser5parseER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERNS_9TokenizerEPN16QPDFObjectHandle15StringDecrypterER4QPDFb:
  129|   164k|{
  130|   164k|    return Parser(
  131|   164k|               input,
  132|   164k|               make_description(input.getName(), object_description),
  133|   164k|               object_description,
  134|   164k|               tokenizer,
  135|   164k|               decrypter,
  136|   164k|               &context,
  137|   164k|               true,
  138|   164k|               0,
  139|   164k|               0,
  140|   164k|               sanity_checks)
  141|   164k|        .parse();
  142|   164k|}
_ZN4qpdf4impl6Parser5parseERNS_2is12OffsetBufferEiiRNS_9TokenizerER4QPDF:
  147|  21.0k|{
  148|  21.0k|    return Parser(
  149|  21.0k|               input,
  150|  21.0k|               std::make_shared<QPDFObject::Description>(
  151|  21.0k|                   QPDFObject::ObjStreamDescr(stream_id, obj_id)),
  152|  21.0k|               "",
  153|  21.0k|               tokenizer,
  154|  21.0k|               nullptr,
  155|  21.0k|               &context,
  156|  21.0k|               true,
  157|  21.0k|               stream_id,
  158|  21.0k|               obj_id)
  159|  21.0k|        .parse();
  160|  21.0k|}
_ZN4qpdf4impl6Parser5parseEb:
  164|  21.8M|{
  165|  21.8M|    try {
  166|  21.8M|        return parse_first(content_stream);
  167|  21.8M|    } catch (Error&) {
  168|  10.1k|        return {};
  169|  10.1k|    } catch (QPDFExc& e) {
  170|  4.03k|        throw e;
  171|  4.03k|    } catch (std::logic_error& e) {
  172|      8|        throw e;
  173|  1.52k|    } catch (std::exception& e) {
  174|  1.52k|        warn("treating object as null because of error during parsing: "s + e.what());
  175|  1.52k|        return {};
  176|  1.52k|    }
  177|  21.8M|}
_ZN4qpdf4impl6Parser11parse_firstEb:
  181|  21.8M|{
  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|  21.8M|    QPDF::Doc::ParseGuard pg(context_);
  188|  21.8M|    start_ = input_.tell();
  189|  21.8M|    if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (189:9): [True: 4.08k, False: 21.8M]
  ------------------
  190|  4.08k|        warn(tokenizer_.getErrorMessage());
  191|  4.08k|    }
  192|       |
  193|  21.8M|    switch (tokenizer_.getType()) {
  194|  4.84k|    case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (194:5): [True: 4.84k, False: 21.8M]
  ------------------
  195|  4.84k|        if (content_stream) {
  ------------------
  |  Branch (195:13): [True: 4.46k, False: 383]
  ------------------
  196|       |            // In content stream mode, leave object uninitialized to indicate EOF
  197|  4.46k|            empty_ = true;
  198|  4.46k|            return {};
  199|  4.46k|        }
  200|    383|        warn("unexpected EOF");
  201|    383|        return {};
  202|       |
  203|  3.98k|    case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (203:5): [True: 3.98k, False: 21.8M]
  ------------------
  204|  3.98k|        return {};
  205|       |
  206|    252|    case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (206:5): [True: 252, False: 21.8M]
  ------------------
  207|    985|    case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (207:5): [True: 733, False: 21.8M]
  ------------------
  208|    985|        warn("treating unexpected brace token as null");
  209|    985|        return {};
  210|       |
  211|  1.13k|    case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (211:5): [True: 1.13k, False: 21.8M]
  ------------------
  212|  1.13k|        warn("treating unexpected array close token as null");
  213|  1.13k|        return {};
  214|       |
  215|    600|    case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (215:5): [True: 600, False: 21.8M]
  ------------------
  216|    600|        warn("unexpected dictionary close token");
  217|    600|        return {};
  218|       |
  219|  18.8k|    case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (219:5): [True: 18.8k, False: 21.8M]
  ------------------
  220|   173k|    case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (220:5): [True: 154k, False: 21.7M]
  ------------------
  221|   173k|        stack_.clear();
  222|   173k|        stack_.emplace_back(
  223|   173k|            input_,
  224|   173k|            (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array : st_dictionary_key);
  ------------------
  |  Branch (224:13): [True: 18.8k, False: 154k]
  ------------------
  225|   173k|        frame_ = &stack_.back();
  226|   173k|        return parse_remainder(content_stream);
  227|       |
  228|  2.29k|    case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (228:5): [True: 2.29k, False: 21.8M]
  ------------------
  229|  2.29k|        return with_description<QPDF_Bool>(tokenizer_.getValue() == "true");
  230|       |
  231|    354|    case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (231:5): [True: 354, False: 21.8M]
  ------------------
  232|    354|        return {QPDFObject::create<QPDF_Null>()};
  233|       |
  234|   101k|    case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (234:5): [True: 101k, False: 21.7M]
  ------------------
  235|   101k|        return with_description<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  236|       |
  237|  43.4k|    case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (237:5): [True: 43.4k, False: 21.8M]
  ------------------
  238|  43.4k|        return with_description<QPDF_Real>(tokenizer_.getValue());
  239|       |
  240|  61.8k|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (240:5): [True: 61.8k, False: 21.8M]
  ------------------
  241|  61.8k|        return with_description<QPDF_Name>(tokenizer_.getValue());
  242|       |
  243|  21.4M|    case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (243:5): [True: 21.4M, False: 397k]
  ------------------
  244|  21.4M|        {
  245|  21.4M|            auto const& value = tokenizer_.getValue();
  246|  21.4M|            if (content_stream) {
  ------------------
  |  Branch (246:17): [True: 21.4M, False: 7.23k]
  ------------------
  247|  21.4M|                return with_description<QPDF_Operator>(value);
  248|  21.4M|            } else if (value == "endobj") {
  ------------------
  |  Branch (248:24): [True: 142, False: 7.09k]
  ------------------
  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|    142|                empty_ = true;
  254|    142|                input_.seek(input_.getLastOffset(), SEEK_SET);
  255|    142|                if (!content_stream) {
  ------------------
  |  Branch (255:21): [True: 142, False: 0]
  ------------------
  256|    142|                    warn("empty object treated as null");
  257|    142|                }
  258|    142|                return {};
  259|  7.09k|            } else {
  260|  7.09k|                warn("unknown token while reading object; treating as string");
  261|  7.09k|                return with_description<QPDF_String>(value);
  262|  7.09k|            }
  263|  21.4M|        }
  264|       |
  265|  2.63k|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (265:5): [True: 2.63k, False: 21.8M]
  ------------------
  266|  2.63k|        if (decrypter_) {
  ------------------
  |  Branch (266:13): [True: 133, False: 2.50k]
  ------------------
  267|    133|            std::string s{tokenizer_.getValue()};
  268|    133|            decrypter_->decryptString(s);
  269|    133|            return with_description<QPDF_String>(s);
  270|  2.50k|        } else {
  271|  2.50k|            return with_description<QPDF_String>(tokenizer_.getValue());
  272|  2.50k|        }
  273|       |
  274|      0|    default:
  ------------------
  |  Branch (274:5): [True: 0, False: 21.8M]
  ------------------
  275|      0|        warn("treating unknown token type as null while reading object");
  276|      0|        return {};
  277|  21.8M|    }
  278|  21.8M|}
_ZN4qpdf4impl6Parser15parse_remainderEb:
  282|   173k|{
  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|   173k|    bad_count_ = 0;
  289|   173k|    bool b_contents = false;
  290|       |
  291|  8.58M|    while (true) {
  ------------------
  |  Branch (291:12): [True: 8.56M, Folded]
  ------------------
  292|  8.56M|        if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (292:13): [True: 56.9k, False: 8.51M]
  ------------------
  293|  56.9k|            warn(tokenizer_.getErrorMessage());
  294|  56.9k|        }
  295|  8.56M|        ++good_count_; // optimistically
  296|       |
  297|  8.56M|        if (int_count_ != 0) {
  ------------------
  |  Branch (297:13): [True: 2.62M, False: 5.93M]
  ------------------
  298|       |            // Special handling of indirect references. Treat integer tokens as part of an indirect
  299|       |            // reference until proven otherwise.
  300|  2.62M|            if (tokenizer_.getType() == QPDFTokenizer::tt_integer) {
  ------------------
  |  Branch (300:17): [True: 1.80M, False: 821k]
  ------------------
  301|  1.80M|                if (++int_count_ > 2) {
  ------------------
  |  Branch (301:21): [True: 1.23M, False: 573k]
  ------------------
  302|       |                    // Process the oldest buffered integer.
  303|  1.23M|                    add_int(int_count_);
  304|  1.23M|                }
  305|  1.80M|                last_offset_buffer_[int_count_ % 2] = input_.getLastOffset();
  306|  1.80M|                int_buffer_[int_count_ % 2] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  307|  1.80M|                continue;
  308|       |
  309|  1.80M|            } else if (
  310|   821k|                int_count_ >= 2 && tokenizer_.getType() == QPDFTokenizer::tt_word &&
  ------------------
  |  Branch (310:17): [True: 573k, False: 247k]
  |  Branch (310:36): [True: 517k, False: 55.9k]
  ------------------
  311|   517k|                tokenizer_.getValue() == "R") {
  ------------------
  |  Branch (311:17): [True: 489k, False: 28.0k]
  ------------------
  312|   489k|                if (!context_) {
  ------------------
  |  Branch (312:21): [True: 0, False: 489k]
  ------------------
  313|      0|                    throw std::logic_error(
  314|      0|                        "Parser::parse called without context on an object with indirect "
  315|      0|                        "references");
  316|      0|                }
  317|   489k|                auto id = QIntC::to_int(int_buffer_[(int_count_ - 1) % 2]);
  318|   489k|                auto gen = QIntC::to_int(int_buffer_[(int_count_) % 2]);
  319|   489k|                if (!(id < 1 || gen < 0 || gen >= 65535)) {
  ------------------
  |  Branch (319:23): [True: 2.65k, False: 486k]
  |  Branch (319:33): [True: 264, False: 486k]
  |  Branch (319:44): [True: 525, False: 485k]
  ------------------
  320|   485k|                    add(ParseGuard::getObject(context_, id, gen, parse_pdf_));
  321|   485k|                } else {
  322|  3.44k|                    add_bad_null(
  323|  3.44k|                        "treating bad indirect reference (" + std::to_string(id) + " " +
  324|  3.44k|                        std::to_string(gen) + " R) as null");
  325|  3.44k|                }
  326|   489k|                int_count_ = 0;
  327|   489k|                continue;
  328|       |
  329|   489k|            } else if (int_count_ > 0) {
  ------------------
  |  Branch (329:24): [True: 331k, False: 0]
  ------------------
  330|       |                // Process the buffered integers before processing the current token.
  331|   331k|                if (int_count_ > 1) {
  ------------------
  |  Branch (331:21): [True: 84.0k, False: 247k]
  ------------------
  332|  84.0k|                    add_int(int_count_ - 1);
  333|  84.0k|                }
  334|   331k|                add_int(int_count_);
  335|   331k|                int_count_ = 0;
  336|   331k|            }
  337|  2.62M|        }
  338|       |
  339|  6.27M|        switch (tokenizer_.getType()) {
  340|  7.25k|        case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (340:9): [True: 7.25k, False: 6.26M]
  ------------------
  341|  7.25k|            warn("parse error while reading object");
  342|  7.25k|            if (content_stream) {
  ------------------
  |  Branch (342:17): [True: 218, False: 7.03k]
  ------------------
  343|       |                // In content stream mode, leave object uninitialized to indicate EOF
  344|    218|                return {};
  345|    218|            }
  346|  7.03k|            warn("unexpected EOF");
  347|  7.03k|            return {};
  348|       |
  349|  48.8k|        case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (349:9): [True: 48.8k, False: 6.22M]
  ------------------
  350|  48.8k|            check_too_many_bad_tokens();
  351|  48.8k|            add_null();
  352|  48.8k|            continue;
  353|       |
  354|  2.29k|        case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (354:9): [True: 2.29k, False: 6.26M]
  ------------------
  355|  5.20k|        case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (355:9): [True: 2.90k, False: 6.26M]
  ------------------
  356|  5.20k|            add_bad_null("treating unexpected brace token as null");
  357|  5.20k|            continue;
  358|       |
  359|   154k|        case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (359:9): [True: 154k, False: 6.11M]
  ------------------
  360|   154k|            if (frame_->state == st_array) {
  ------------------
  |  Branch (360:17): [True: 151k, False: 2.94k]
  ------------------
  361|   151k|                auto object = frame_->null_count > 100
  ------------------
  |  Branch (361:31): [True: 370, False: 151k]
  ------------------
  362|   151k|                    ? QPDFObject::create<QPDF_Array>(std::move(frame_->olist), true)
  363|   151k|                    : QPDFObject::create<QPDF_Array>(std::move(frame_->olist));
  364|   151k|                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|   151k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (369:21): [True: 10.5k, False: 141k]
  ------------------
  370|  10.5k|                    return object;
  371|  10.5k|                }
  372|   141k|                stack_.pop_back();
  373|   141k|                frame_ = &stack_.back();
  374|   141k|                add(std::move(object));
  375|   141k|            } else {
  376|  2.94k|                if (sanity_checks_) {
  ------------------
  |  Branch (376:21): [True: 1.99k, False: 943]
  ------------------
  377|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  378|       |                    // unusable.
  379|  1.99k|                    warn("unexpected array close token; giving up on reading object");
  380|  1.99k|                    return {};
  381|  1.99k|                }
  382|    943|                add_bad_null("treating unexpected array close token as null");
  383|    943|            }
  384|   142k|            continue;
  385|       |
  386|   226k|        case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (386:9): [True: 226k, False: 6.04M]
  ------------------
  387|   226k|            if (frame_->state <= st_dictionary_value) {
  ------------------
  |  Branch (387:17): [True: 223k, False: 3.03k]
  ------------------
  388|       |                // Attempt to recover more or less gracefully from invalid dictionaries.
  389|   223k|                auto& dict = frame_->dict;
  390|       |
  391|   223k|                if (frame_->state == st_dictionary_value) {
  ------------------
  |  Branch (391:21): [True: 14.4k, False: 209k]
  ------------------
  392|  14.4k|                    warn(
  393|  14.4k|                        frame_->offset,
  394|  14.4k|                        "dictionary ended prematurely; using null as value for last key");
  395|  14.4k|                    dict[frame_->key] = QPDFObject::create<QPDF_Null>();
  396|  14.4k|                }
  397|   223k|                if (!frame_->olist.empty()) {
  ------------------
  |  Branch (397:21): [True: 75.4k, False: 147k]
  ------------------
  398|  75.4k|                    if (sanity_checks_) {
  ------------------
  |  Branch (398:25): [True: 71.6k, False: 3.81k]
  ------------------
  399|  71.6k|                        warn(
  400|  71.6k|                            frame_->offset,
  401|  71.6k|                            "expected dictionary keys but found non-name objects; ignoring");
  402|  71.6k|                    } else {
  403|  3.81k|                        fix_missing_keys();
  404|  3.81k|                    }
  405|  75.4k|                }
  406|       |
  407|   223k|                if (!frame_->contents_string.empty() && dict.contains("/Type") &&
  ------------------
  |  Branch (407:21): [True: 115, False: 223k]
  |  Branch (407:21): [True: 10, False: 223k]
  |  Branch (407:57): [True: 74, False: 41]
  ------------------
  408|     74|                    dict["/Type"].isNameAndEquals("/Sig") && dict.contains("/ByteRange") &&
  ------------------
  |  Branch (408:21): [True: 20, False: 54]
  |  Branch (408:62): [True: 10, False: 10]
  ------------------
  409|     10|                    dict.contains("/Contents") && dict["/Contents"].isString()) {
  ------------------
  |  Branch (409:21): [True: 10, False: 0]
  |  Branch (409:51): [True: 10, False: 0]
  ------------------
  410|     10|                    dict["/Contents"] = QPDFObjectHandle::newString(frame_->contents_string);
  411|     10|                    dict["/Contents"].setParsedOffset(frame_->contents_offset);
  412|     10|                }
  413|   223k|                auto object = QPDFObject::create<QPDF_Dictionary>(std::move(dict));
  414|   223k|                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|   223k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (419:21): [True: 134k, False: 89.3k]
  ------------------
  420|   134k|                    return object;
  421|   134k|                }
  422|  89.3k|                stack_.pop_back();
  423|  89.3k|                frame_ = &stack_.back();
  424|  89.3k|                add(std::move(object));
  425|  89.3k|            } else {
  426|  3.03k|                if (sanity_checks_) {
  ------------------
  |  Branch (426:21): [True: 2.46k, False: 564]
  ------------------
  427|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  428|       |                    // unusable.
  429|  2.46k|                    warn("unexpected dictionary close token; giving up on reading object");
  430|  2.46k|                    return {};
  431|  2.46k|                }
  432|    564|                add_bad_null("unexpected dictionary close token");
  433|    564|            }
  434|  89.9k|            continue;
  435|       |
  436|   227k|        case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (436:9): [True: 227k, False: 6.04M]
  ------------------
  437|   347k|        case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (437:9): [True: 120k, False: 6.15M]
  ------------------
  438|   347k|            if (stack_.size() > max_nesting) {
  ------------------
  |  Branch (438:17): [True: 93, False: 347k]
  ------------------
  439|     93|                limits_error(
  440|     93|                    "parser-max-nesting", "ignoring excessively deeply nested data structure");
  441|     93|            }
  442|   347k|            b_contents = false;
  443|   347k|            stack_.emplace_back(
  444|   347k|                input_,
  445|   347k|                (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array
  ------------------
  |  Branch (445:17): [True: 227k, False: 120k]
  ------------------
  446|   347k|                                                                       : st_dictionary_key);
  447|   347k|            frame_ = &stack_.back();
  448|   347k|            continue;
  449|       |
  450|  22.8k|        case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (450:9): [True: 22.8k, False: 6.24M]
  ------------------
  451|  22.8k|            add_scalar<QPDF_Bool>(tokenizer_.getValue() == "true");
  452|  22.8k|            continue;
  453|       |
  454|  56.0k|        case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (454:9): [True: 56.0k, False: 6.21M]
  ------------------
  455|  56.0k|            add_null();
  456|  56.0k|            continue;
  457|       |
  458|  1.05M|        case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (458:9): [True: 1.05M, False: 5.21M]
  ------------------
  459|  1.05M|            if (!content_stream) {
  ------------------
  |  Branch (459:17): [True: 821k, False: 233k]
  ------------------
  460|       |                // Buffer token in case it is part of an indirect reference.
  461|   821k|                last_offset_buffer_[1] = input_.getLastOffset();
  462|   821k|                int_buffer_[1] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  463|   821k|                int_count_ = 1;
  464|   821k|            } else {
  465|   233k|                add_scalar<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  466|   233k|            }
  467|  1.05M|            continue;
  468|       |
  469|   176k|        case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (469:9): [True: 176k, False: 6.09M]
  ------------------
  470|   176k|            add_scalar<QPDF_Real>(tokenizer_.getValue());
  471|   176k|            continue;
  472|       |
  473|  2.83M|        case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (473:9): [True: 2.83M, False: 3.43M]
  ------------------
  474|  2.83M|            if (frame_->state == st_dictionary_key) {
  ------------------
  |  Branch (474:17): [True: 943k, False: 1.89M]
  ------------------
  475|   943k|                frame_->key = tokenizer_.getValue();
  476|   943k|                frame_->state = st_dictionary_value;
  477|   943k|                b_contents = decrypter_ && frame_->key == "/Contents";
  ------------------
  |  Branch (477:30): [True: 40.1k, False: 903k]
  |  Branch (477:44): [True: 577, False: 39.5k]
  ------------------
  478|   943k|                continue;
  479|  1.89M|            } else {
  480|  1.89M|                add_scalar<QPDF_Name>(tokenizer_.getValue());
  481|  1.89M|            }
  482|  1.89M|            continue;
  483|       |
  484|  1.89M|        case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (484:9): [True: 907k, False: 5.36M]
  ------------------
  485|   907k|            if (content_stream) {
  ------------------
  |  Branch (485:17): [True: 598k, False: 308k]
  ------------------
  486|   598k|                add_scalar<QPDF_Operator>(tokenizer_.getValue());
  487|   598k|                continue;
  488|   598k|            }
  489|       |
  490|   308k|            if (sanity_checks_) {
  ------------------
  |  Branch (490:17): [True: 299k, False: 8.85k]
  ------------------
  491|   299k|                if (tokenizer_.getValue() == "endobj" || tokenizer_.getValue() == "endstream") {
  ------------------
  |  Branch (491:21): [True: 2.66k, False: 297k]
  |  Branch (491:58): [True: 1.10k, False: 296k]
  ------------------
  492|       |                    // During sanity checks, assume an unexpected endobj or endstream indicates that
  493|       |                    // we are parsing past the end of the object.
  494|  3.76k|                    warn(
  495|  3.76k|                        "unexpected 'endobj' or 'endstream' while reading object; giving up on "
  496|  3.76k|                        "reading object");
  497|  3.76k|                    return {};
  498|  3.76k|                }
  499|       |
  500|   296k|                add_bad_null("unknown token while reading object; treating as null");
  501|   296k|                continue;
  502|   299k|            }
  503|       |
  504|  8.85k|            warn("unknown token while reading object; treating as string");
  505|  8.85k|            check_too_many_bad_tokens();
  506|  8.85k|            add_scalar<QPDF_String>(tokenizer_.getValue());
  507|       |
  508|  8.85k|            continue;
  509|       |
  510|   426k|        case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (510:9): [True: 426k, False: 5.84M]
  ------------------
  511|   426k|            {
  512|   426k|                auto const& val = tokenizer_.getValue();
  513|   426k|                if (decrypter_) {
  ------------------
  |  Branch (513:21): [True: 11.1k, False: 414k]
  ------------------
  514|  11.1k|                    if (b_contents) {
  ------------------
  |  Branch (514:25): [True: 309, False: 10.8k]
  ------------------
  515|    309|                        frame_->contents_string = val;
  516|    309|                        frame_->contents_offset = input_.getLastOffset();
  517|    309|                        b_contents = false;
  518|    309|                    }
  519|  11.1k|                    std::string s{val};
  520|  11.1k|                    decrypter_->decryptString(s);
  521|  11.1k|                    add_scalar<QPDF_String>(s);
  522|   414k|                } else {
  523|   414k|                    add_scalar<QPDF_String>(val);
  524|   414k|                }
  525|   426k|            }
  526|   426k|            continue;
  527|       |
  528|      0|        default:
  ------------------
  |  Branch (528:9): [True: 0, False: 6.27M]
  ------------------
  529|      0|            add_bad_null("treating unknown token type as null while reading object");
  530|  6.27M|        }
  531|  6.27M|    }
  532|   173k|}
_ZN4qpdf4impl6Parser3addEONSt3__110shared_ptrI10QPDFObjectEE:
  536|  5.72M|{
  537|  5.72M|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (537:9): [True: 4.85M, False: 867k]
  ------------------
  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|  4.85M|        frame_->olist.emplace_back(std::move(obj));
  541|  4.85M|    } else {
  542|   867k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, std::move(obj)); !res.second) {
  ------------------
  |  Branch (542:84): [True: 9.35k, False: 857k]
  ------------------
  543|  9.35k|            warn_duplicate_key();
  544|  9.35k|        }
  545|   867k|        frame_->state = st_dictionary_key;
  546|   867k|    }
  547|  5.72M|}
_ZN4qpdf4impl6Parser8add_nullEv:
  551|   400k|{
  552|   400k|    const static ObjectPtr null_obj = QPDFObject::create<QPDF_Null>();
  553|       |
  554|   400k|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (554:9): [True: 349k, False: 50.7k]
  ------------------
  555|       |        // If state is st_dictionary_key then there is a missing key. Push onto olist for
  556|       |        // processing once the tt_dict_close token has been found.
  557|   349k|        frame_->olist.emplace_back(null_obj);
  558|   349k|    } else {
  559|  50.7k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, null_obj); !res.second) {
  ------------------
  |  Branch (559:78): [True: 2.22k, False: 48.4k]
  ------------------
  560|  2.22k|            warn_duplicate_key();
  561|  2.22k|        }
  562|  50.7k|        frame_->state = st_dictionary_key;
  563|  50.7k|    }
  564|   400k|    ++frame_->null_count;
  565|   400k|}
_ZN4qpdf4impl6Parser12add_bad_nullERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  569|   305k|{
  570|   305k|    warn(msg);
  571|   305k|    check_too_many_bad_tokens();
  572|   305k|    add_null();
  573|   305k|}
_ZN4qpdf4impl6Parser7add_intEi:
  577|  1.65M|{
  578|  1.65M|    auto obj = QPDFObject::create<QPDF_Integer>(int_buffer_[count % 2]);
  579|  1.65M|    obj->setDescription(context_, description_, last_offset_buffer_[count % 2]);
  580|  1.65M|    add(std::move(obj));
  581|  1.65M|}
_ZN4qpdf4impl6Parser15set_descriptionERNSt3__110shared_ptrI10QPDFObjectEEx:
  610|   375k|{
  611|   375k|    if (obj) {
  ------------------
  |  Branch (611:9): [True: 375k, False: 0]
  ------------------
  612|   375k|        obj->setDescription(context_, description_, parsed_offset);
  613|   375k|    }
  614|   375k|}
_ZN4qpdf4impl6Parser16fix_missing_keysEv:
  618|  3.81k|{
  619|  3.81k|    std::set<std::string> names;
  620|  11.0k|    for (auto& obj: frame_->olist) {
  ------------------
  |  Branch (620:19): [True: 11.0k, False: 3.81k]
  ------------------
  621|  11.0k|        if (obj.raw_type_code() == ::ot_name) {
  ------------------
  |  Branch (621:13): [True: 217, False: 10.8k]
  ------------------
  622|    217|            names.insert(obj.getName());
  623|    217|        }
  624|  11.0k|    }
  625|  3.81k|    int next_fake_key = 1;
  626|  11.0k|    for (auto const& item: frame_->olist) {
  ------------------
  |  Branch (626:26): [True: 11.0k, False: 3.81k]
  ------------------
  627|  11.0k|        while (true) {
  ------------------
  |  Branch (627:16): [True: 11.0k, Folded]
  ------------------
  628|  11.0k|            const std::string key = "/QPDFFake" + std::to_string(next_fake_key++);
  629|  11.0k|            const bool found_fake = !frame_->dict.contains(key) && !names.contains(key);
  ------------------
  |  Branch (629:37): [True: 11.0k, False: 38]
  |  Branch (629:68): [True: 11.0k, False: 3]
  ------------------
  630|  11.0k|            QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1));
  ------------------
  |  Branch (630:55): [True: 11.0k, False: 41]
  ------------------
  631|  11.0k|            if (found_fake) {
  ------------------
  |  Branch (631:17): [True: 11.0k, False: 41]
  ------------------
  632|  11.0k|                warn(
  633|  11.0k|                    frame_->offset,
  634|  11.0k|                    "expected dictionary key but found non-name object; inserting key " + key);
  635|  11.0k|                frame_->dict[key] = item;
  636|  11.0k|                break;
  637|  11.0k|            }
  638|  11.0k|        }
  639|  11.0k|    }
  640|  3.81k|}
_ZN4qpdf4impl6Parser25check_too_many_bad_tokensEv:
  644|   373k|{
  645|   373k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (645:52): [True: 285k, False: 88.0k]
  |  Branch (645:66): [True: 85.1k, False: 2.91k]
  ------------------
  646|   373k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (646:9): [True: 392, False: 372k]
  |  Branch (646:42): [True: 0, False: 372k]
  ------------------
  647|    392|        if (bad_count_) {
  ------------------
  |  Branch (647:13): [True: 242, False: 150]
  ------------------
  648|    242|            limits_error(
  649|    242|                "parser-max-container-size-damaged",
  650|    242|                "encountered errors while parsing an array or dictionary with more than " +
  651|    242|                    std::to_string(limit) + " elements; giving up on reading object");
  652|    242|        }
  653|    392|        limits_error(
  654|    392|            "parser-max-container-size",
  655|    392|            "encountered an array or dictionary with more than " + std::to_string(limit) +
  656|    392|                " elements during xref recovery; giving up on reading object");
  657|    392|    }
  658|   373k|    if (max_bad_count_ && --max_bad_count_ == 0) {
  ------------------
  |  Branch (658:9): [True: 372k, False: 392]
  |  Branch (658:27): [True: 1.93k, False: 370k]
  ------------------
  659|  1.93k|        limits_error(
  660|  1.93k|            "parser-max-errors", "too many errors during parsing; treating object as null");
  661|  1.93k|    }
  662|   373k|    if (good_count_ > 4) {
  ------------------
  |  Branch (662:9): [True: 144k, False: 228k]
  ------------------
  663|   144k|        good_count_ = 0;
  664|   144k|        bad_count_ = 1;
  665|   144k|        return;
  666|   144k|    }
  667|   228k|    if (++bad_count_ > 5 ||
  ------------------
  |  Branch (667:9): [True: 7.40k, False: 221k]
  ------------------
  668|   221k|        (frame_->state != st_array && std::cmp_less(max_bad_count_, frame_->olist.size()))) {
  ------------------
  |  Branch (668:10): [True: 134k, False: 86.7k]
  |  Branch (668:39): [True: 2.71k, False: 132k]
  ------------------
  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|  7.79k|        warn("too many errors; giving up on reading object");
  672|  7.79k|        throw Error();
  673|  7.79k|    }
  674|   221k|    good_count_ = 0;
  675|   221k|}
_ZN4qpdf4impl6Parser12limits_errorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  679|  2.42k|{
  680|  2.42k|    Limits::error();
  681|  2.42k|    warn("limits error("s + limit + "): " + msg);
  682|  2.42k|    throw Error();
  683|  2.42k|}
_ZNK4qpdf4impl6Parser4warnERK7QPDFExc:
  687|   528k|{
  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|   528k|    if (context_) {
  ------------------
  |  Branch (691:9): [True: 528k, False: 0]
  ------------------
  692|   528k|        context_->warn(e);
  693|   528k|    } else {
  694|      0|        throw e;
  695|      0|    }
  696|   528k|}
_ZN4qpdf4impl6Parser18warn_duplicate_keyEv:
  700|  11.5k|{
  701|  11.5k|    warn(
  702|  11.5k|        frame_->offset,
  703|  11.5k|        "dictionary has duplicated key " + frame_->key +
  704|  11.5k|            "; last occurrence overrides earlier ones");
  705|  11.5k|    check_too_many_bad_tokens();
  706|  11.5k|}
_ZNK4qpdf4impl6Parser4warnExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  710|   528k|{
  711|   528k|    if (stream_id_) {
  ------------------
  |  Branch (711:9): [True: 15.5k, False: 513k]
  ------------------
  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|   513k|    } else {
  716|   513k|        warn(QPDFExc(qpdf_e_damaged_pdf, input_.getName(), object_description_, offset, msg));
  717|   513k|    }
  718|   528k|}
_ZNK4qpdf4impl6Parser4warnERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  722|   420k|{
  723|   420k|    warn(input_.getLastOffset(), msg);
  724|   420k|}
_ZN4QPDF3Doc10ParseGuardC2EPS_:
   26|  21.8M|        objects(qpdf ? &qpdf->m->objects : nullptr)
  ------------------
  |  Branch (26:17): [True: 21.8M, False: 0]
  ------------------
   27|  21.8M|    {
   28|  21.8M|        if (objects) {
  ------------------
  |  Branch (28:13): [True: 21.8M, False: 0]
  ------------------
   29|  21.8M|            objects->inParse(true);
   30|  21.8M|        }
   31|  21.8M|    }
_ZN4QPDF3Doc10ParseGuardD2Ev:
   40|  21.8M|    {
   41|  21.8M|        if (objects) {
  ------------------
  |  Branch (41:13): [True: 21.8M, False: 0]
  ------------------
   42|  21.8M|            objects->inParse(false);
   43|  21.8M|        }
   44|  21.8M|    }
_ZN4QPDF3Doc10ParseGuard9getObjectEPS_iib:
   35|   485k|    {
   36|   485k|        return qpdf->m->objects.getObjectForParser(id, gen, parse_pdf);
   37|   485k|    }
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_BoolJbEEE16QPDFObjectHandleDpOT0_:
  602|  2.29k|{
  603|  2.29k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  2.29k|    obj->setDescription(context_, description_, start_);
  605|  2.29k|    return {obj};
  606|  2.29k|}
_ZN4qpdf4impl6Parser16with_descriptionI12QPDF_IntegerJxEEE16QPDFObjectHandleDpOT0_:
  602|   101k|{
  603|   101k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|   101k|    obj->setDescription(context_, description_, start_);
  605|   101k|    return {obj};
  606|   101k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  43.4k|{
  603|  43.4k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  43.4k|    obj->setDescription(context_, description_, start_);
  605|  43.4k|    return {obj};
  606|  43.4k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  61.8k|{
  603|  61.8k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  61.8k|    obj->setDescription(context_, description_, start_);
  605|  61.8k|    return {obj};
  606|  61.8k|}
_ZN4qpdf4impl6Parser16with_descriptionI13QPDF_OperatorJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  21.4M|{
  603|  21.4M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  21.4M|    obj->setDescription(context_, description_, start_);
  605|  21.4M|    return {obj};
  606|  21.4M|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  8.99k|{
  603|  8.99k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  8.99k|    obj->setDescription(context_, description_, start_);
  605|  8.99k|    return {obj};
  606|  8.99k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|    132|{
  603|    132|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    132|    obj->setDescription(context_, description_, start_);
  605|    132|    return {obj};
  606|    132|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_BoolJbEEEvDpOT0_:
  586|  22.8k|{
  587|  22.8k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 10.1k, False: 12.6k]
  |  Branch (587:66): [True: 11.0k, False: 1.53k]
  ------------------
  588|  22.8k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 45, False: 22.7k]
  |  Branch (588:42): [True: 0, False: 22.7k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     45|        max_bad_count_ = 1;
  592|     45|        check_too_many_bad_tokens(); // always throws Error()
  593|     45|    }
  594|  22.8k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  22.8k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  22.8k|    add(std::move(obj));
  597|  22.8k|}
_ZN4qpdf4impl6Parser10add_scalarI12QPDF_IntegerJxEEEvDpOT0_:
  586|   233k|{
  587|   233k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 9.85k, False: 223k]
  |  Branch (587:66): [True: 223k, False: 581]
  ------------------
  588|   233k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 18, False: 233k]
  |  Branch (588:42): [True: 0, False: 233k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     18|        max_bad_count_ = 1;
  592|     18|        check_too_many_bad_tokens(); // always throws Error()
  593|     18|    }
  594|   233k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   233k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   233k|    add(std::move(obj));
  597|   233k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   176k|{
  587|   176k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 47.1k, False: 129k]
  |  Branch (587:66): [True: 122k, False: 7.54k]
  ------------------
  588|   176k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 73, False: 176k]
  |  Branch (588:42): [True: 0, False: 176k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     73|        max_bad_count_ = 1;
  592|     73|        check_too_many_bad_tokens(); // always throws Error()
  593|     73|    }
  594|   176k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   176k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   176k|    add(std::move(obj));
  597|   176k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  1.89M|{
  587|  1.89M|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 1.19M, False: 701k]
  |  Branch (587:66): [True: 680k, False: 20.8k]
  ------------------
  588|  1.89M|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 113, False: 1.89M]
  |  Branch (588:42): [True: 0, False: 1.89M]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|    113|        max_bad_count_ = 1;
  592|    113|        check_too_many_bad_tokens(); // always throws Error()
  593|    113|    }
  594|  1.89M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  1.89M|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  1.89M|    add(std::move(obj));
  597|  1.89M|}
_ZN4qpdf4impl6Parser10add_scalarI13QPDF_OperatorJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   598k|{
  587|   598k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 198k, False: 399k]
  |  Branch (587:66): [True: 399k, False: 318]
  ------------------
  588|   598k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 70, False: 598k]
  |  Branch (588:42): [True: 0, False: 598k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     70|        max_bad_count_ = 1;
  592|     70|        check_too_many_bad_tokens(); // always throws Error()
  593|     70|    }
  594|   598k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   598k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   598k|    add(std::move(obj));
  597|   598k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   423k|{
  587|   423k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 197k, False: 225k]
  |  Branch (587:66): [True: 200k, False: 25.8k]
  ------------------
  588|   423k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 61, False: 423k]
  |  Branch (588:42): [True: 0, False: 423k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     61|        max_bad_count_ = 1;
  592|     61|        check_too_many_bad_tokens(); // always throws Error()
  593|     61|    }
  594|   423k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   423k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   423k|    add(std::move(obj));
  597|   423k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  11.1k|{
  587|  11.1k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 7.34k, False: 3.82k]
  |  Branch (587:66): [True: 3.79k, False: 34]
  ------------------
  588|  11.1k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 10, False: 11.1k]
  |  Branch (588:42): [True: 0, False: 11.1k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     10|        max_bad_count_ = 1;
  592|     10|        check_too_many_bad_tokens(); // always throws Error()
  593|     10|    }
  594|  11.1k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  11.1k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  11.1k|    add(std::move(obj));
  597|  11.1k|}

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

_ZN4qpdf9Tokenizer5resetEv:
   85|  61.1M|{
   86|  61.1M|    state = st_before_token;
   87|  61.1M|    type = tt::tt_bad;
   88|  61.1M|    val.clear();
   89|  61.1M|    raw_val.clear();
   90|  61.1M|    error_message = "";
   91|  61.1M|    before_token = true;
   92|  61.1M|    in_token = false;
   93|  61.1M|    char_to_unread = '\0';
   94|  61.1M|    inline_image_bytes = 0;
   95|  61.1M|    string_depth = 0;
   96|  61.1M|    bad = false;
   97|  61.1M|}
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  100|    911|    type(type),
  101|    911|    value(value),
  102|    911|    raw_value(value)
  103|    911|{
  104|    911|    if (type == tt_string) {
  ------------------
  |  Branch (104:9): [True: 0, False: 911]
  ------------------
  105|      0|        raw_value = QPDFObjectHandle::newString(value).unparse();
  106|    911|    } else if (type == tt_name) {
  ------------------
  |  Branch (106:16): [True: 0, False: 911]
  ------------------
  107|      0|        raw_value = QPDFObjectHandle::newName(value).unparse();
  108|      0|    }
  109|    911|}
_ZN13QPDFTokenizerC2Ev:
  112|  17.3k|    m(std::make_unique<qpdf::Tokenizer>())
  113|  17.3k|{
  114|  17.3k|}
_ZN13QPDFTokenizerD2Ev:
  116|  17.3k|QPDFTokenizer::~QPDFTokenizer() = default;
_ZN4qpdf9TokenizerC2Ev:
  119|   107k|{
  120|   107k|    reset();
  121|   107k|}
_ZN13QPDFTokenizer8allowEOFEv:
  125|  17.3k|{
  126|  17.3k|    m->allowEOF();
  127|  17.3k|}
_ZN4qpdf9Tokenizer8allowEOFEv:
  131|  58.8k|{
  132|  58.8k|    allow_eof = true;
  133|  58.8k|}
_ZN13QPDFTokenizer16includeIgnorableEv:
  137|  17.3k|{
  138|  17.3k|    m->includeIgnorable();
  139|  17.3k|}
_ZN4qpdf9Tokenizer16includeIgnorableEv:
  143|  17.3k|{
  144|  17.3k|    include_ignorable = true;
  145|  17.3k|}
_ZN4qpdf9Tokenizer7isSpaceEc:
  149|   113M|{
  150|   113M|    return (ch == '\0' || util::is_space(ch));
  ------------------
  |  Branch (150:13): [True: 47.5M, False: 66.3M]
  |  Branch (150:27): [True: 9.67M, False: 56.6M]
  ------------------
  151|   113M|}
_ZN4qpdf9Tokenizer11isDelimiterEc:
  155|   430M|{
  156|   430M|    return is_delimiter(ch);
  157|   430M|}
_ZN4qpdf9Tokenizer16presentCharacterEc:
  167|  24.0k|{
  168|  24.0k|    handleCharacter(ch);
  169|       |
  170|  24.0k|    if (in_token) {
  ------------------
  |  Branch (170:9): [True: 0, False: 24.0k]
  ------------------
  171|      0|        raw_val += ch;
  172|      0|    }
  173|  24.0k|}
_ZN4qpdf9Tokenizer15handleCharacterEc:
  177|   933M|{
  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|   933M|    switch (state) {
  182|      0|    case st_top:
  ------------------
  |  Branch (182:5): [True: 0, False: 933M]
  ------------------
  183|      0|        inTop(ch);
  184|      0|        return;
  185|       |
  186|   738k|    case st_in_space:
  ------------------
  |  Branch (186:5): [True: 738k, False: 932M]
  ------------------
  187|   738k|        inSpace(ch);
  188|   738k|        return;
  189|       |
  190|  3.85M|    case st_in_comment:
  ------------------
  |  Branch (190:5): [True: 3.85M, False: 929M]
  ------------------
  191|  3.85M|        inComment(ch);
  192|  3.85M|        return;
  193|       |
  194|   599k|    case st_lt:
  ------------------
  |  Branch (194:5): [True: 599k, False: 933M]
  ------------------
  195|   599k|        inLt(ch);
  196|   599k|        return;
  197|       |
  198|   346k|    case st_gt:
  ------------------
  |  Branch (198:5): [True: 346k, False: 933M]
  ------------------
  199|   346k|        inGt(ch);
  200|   346k|        return;
  201|       |
  202|   182M|    case st_in_string:
  ------------------
  |  Branch (202:5): [True: 182M, False: 751M]
  ------------------
  203|   182M|        inString(ch);
  204|   182M|        return;
  205|       |
  206|   103M|    case st_name:
  ------------------
  |  Branch (206:5): [True: 103M, False: 830M]
  ------------------
  207|   103M|        inName(ch);
  208|   103M|        return;
  209|       |
  210|  10.0M|    case st_number:
  ------------------
  |  Branch (210:5): [True: 10.0M, False: 923M]
  ------------------
  211|  10.0M|        inNumber(ch);
  212|  10.0M|        return;
  213|       |
  214|   981k|    case st_real:
  ------------------
  |  Branch (214:5): [True: 981k, False: 932M]
  ------------------
  215|   981k|        inReal(ch);
  216|   981k|        return;
  217|       |
  218|   322k|    case st_string_after_cr:
  ------------------
  |  Branch (218:5): [True: 322k, False: 933M]
  ------------------
  219|   322k|        inStringAfterCR(ch);
  220|   322k|        return;
  221|       |
  222|   487k|    case st_string_escape:
  ------------------
  |  Branch (222:5): [True: 487k, False: 933M]
  ------------------
  223|   487k|        inStringEscape(ch);
  224|   487k|        return;
  225|       |
  226|  43.1k|    case st_char_code:
  ------------------
  |  Branch (226:5): [True: 43.1k, False: 933M]
  ------------------
  227|  43.1k|        inCharCode(ch);
  228|  43.1k|        return;
  229|       |
  230|   317M|    case st_literal:
  ------------------
  |  Branch (230:5): [True: 317M, False: 616M]
  ------------------
  231|   317M|        inLiteral(ch);
  232|   317M|        return;
  233|       |
  234|   174M|    case st_inline_image:
  ------------------
  |  Branch (234:5): [True: 174M, False: 758M]
  ------------------
  235|   174M|        inInlineImage(ch);
  236|   174M|        return;
  237|       |
  238|  9.65M|    case st_in_hexstring:
  ------------------
  |  Branch (238:5): [True: 9.65M, False: 923M]
  ------------------
  239|  9.65M|        inHexstring(ch);
  240|  9.65M|        return;
  241|       |
  242|  9.63M|    case st_in_hexstring_2nd:
  ------------------
  |  Branch (242:5): [True: 9.63M, False: 923M]
  ------------------
  243|  9.63M|        inHexstring2nd(ch);
  244|  9.63M|        return;
  245|       |
  246|  5.07M|    case st_name_hex1:
  ------------------
  |  Branch (246:5): [True: 5.07M, False: 928M]
  ------------------
  247|  5.07M|        inNameHex1(ch);
  248|  5.07M|        return;
  249|       |
  250|  12.8k|    case st_name_hex2:
  ------------------
  |  Branch (250:5): [True: 12.8k, False: 933M]
  ------------------
  251|  12.8k|        inNameHex2(ch);
  252|  12.8k|        return;
  253|       |
  254|   143k|    case st_sign:
  ------------------
  |  Branch (254:5): [True: 143k, False: 933M]
  ------------------
  255|   143k|        inSign(ch);
  256|   143k|        return;
  257|       |
  258|  19.6k|    case st_decimal:
  ------------------
  |  Branch (258:5): [True: 19.6k, False: 933M]
  ------------------
  259|  19.6k|        inDecimal(ch);
  260|  19.6k|        return;
  261|       |
  262|   113M|    case (st_before_token):
  ------------------
  |  Branch (262:5): [True: 113M, False: 820M]
  ------------------
  263|   113M|        inBeforeToken(ch);
  264|   113M|        return;
  265|       |
  266|      0|    case (st_token_ready):
  ------------------
  |  Branch (266:5): [True: 0, False: 933M]
  ------------------
  267|      0|        inTokenReady(ch);
  268|      0|        return;
  269|       |
  270|      0|    default:
  ------------------
  |  Branch (270:5): [True: 0, False: 933M]
  ------------------
  271|      0|        throw std::logic_error("INTERNAL ERROR: invalid state while reading token");
  272|   933M|    }
  273|   933M|}
_ZN4qpdf9Tokenizer13inBeforeTokenEc:
  284|   113M|{
  285|       |    // Note: we specifically do not use ctype here.  It is locale-dependent.
  286|   113M|    if (isSpace(ch)) {
  ------------------
  |  Branch (286:9): [True: 56.7M, False: 56.2M]
  ------------------
  287|  56.7M|        before_token = !include_ignorable;
  288|  56.7M|        in_token = include_ignorable;
  289|  56.7M|        if (include_ignorable) {
  ------------------
  |  Branch (289:13): [True: 399k, False: 56.3M]
  ------------------
  290|   399k|            state = st_in_space;
  291|   399k|        }
  292|  56.7M|    } else if (ch == '%') {
  ------------------
  |  Branch (292:16): [True: 45.7k, False: 56.1M]
  ------------------
  293|  45.7k|        before_token = !include_ignorable;
  294|  45.7k|        in_token = include_ignorable;
  295|  45.7k|        state = st_in_comment;
  296|  56.1M|    } else {
  297|  56.1M|        before_token = false;
  298|  56.1M|        in_token = true;
  299|  56.1M|        inTop(ch);
  300|  56.1M|    }
  301|   113M|}
_ZN4qpdf9Tokenizer5inTopEc:
  305|  56.1M|{
  306|  56.1M|    switch (ch) {
  307|   338k|    case '(':
  ------------------
  |  Branch (307:5): [True: 338k, False: 55.8M]
  ------------------
  308|   338k|        string_depth = 1;
  309|   338k|        state = st_in_string;
  310|   338k|        return;
  311|       |
  312|   601k|    case '<':
  ------------------
  |  Branch (312:5): [True: 601k, False: 55.5M]
  ------------------
  313|   601k|        state = st_lt;
  314|   601k|        return;
  315|       |
  316|   347k|    case '>':
  ------------------
  |  Branch (316:5): [True: 347k, False: 55.8M]
  ------------------
  317|   347k|        state = st_gt;
  318|   347k|        return;
  319|       |
  320|  24.5k|    case (')'):
  ------------------
  |  Branch (320:5): [True: 24.5k, False: 56.1M]
  ------------------
  321|  24.5k|        type = tt::tt_bad;
  322|  24.5k|        QTC::TC("qpdf", "QPDFTokenizer bad )");
  323|  24.5k|        error_message = "unexpected )";
  324|  24.5k|        state = st_token_ready;
  325|  24.5k|        return;
  326|       |
  327|   291k|    case '[':
  ------------------
  |  Branch (327:5): [True: 291k, False: 55.8M]
  ------------------
  328|   291k|        type = tt::tt_array_open;
  329|   291k|        state = st_token_ready;
  330|   291k|        return;
  331|       |
  332|   210k|    case ']':
  ------------------
  |  Branch (332:5): [True: 210k, False: 55.9M]
  ------------------
  333|   210k|        type = tt::tt_array_close;
  334|   210k|        state = st_token_ready;
  335|   210k|        return;
  336|       |
  337|  63.1k|    case '{':
  ------------------
  |  Branch (337:5): [True: 63.1k, False: 56.1M]
  ------------------
  338|  63.1k|        type = tt::tt_brace_open;
  339|  63.1k|        state = st_token_ready;
  340|  63.1k|        return;
  341|       |
  342|  7.08k|    case '}':
  ------------------
  |  Branch (342:5): [True: 7.08k, False: 56.1M]
  ------------------
  343|  7.08k|        type = tt::tt_brace_close;
  344|  7.08k|        state = st_token_ready;
  345|  7.08k|        return;
  346|       |
  347|  3.31M|    case '/':
  ------------------
  |  Branch (347:5): [True: 3.31M, False: 52.8M]
  ------------------
  348|  3.31M|        state = st_name;
  349|  3.31M|        val += ch;
  350|  3.31M|        return;
  351|       |
  352|  1.43M|    case '0':
  ------------------
  |  Branch (352:5): [True: 1.43M, False: 54.7M]
  ------------------
  353|  2.54M|    case '1':
  ------------------
  |  Branch (353:5): [True: 1.11M, False: 55.0M]
  ------------------
  354|  3.04M|    case '2':
  ------------------
  |  Branch (354:5): [True: 504k, False: 55.6M]
  ------------------
  355|  3.26M|    case '3':
  ------------------
  |  Branch (355:5): [True: 210k, False: 55.9M]
  ------------------
  356|  3.69M|    case '4':
  ------------------
  |  Branch (356:5): [True: 434k, False: 55.7M]
  ------------------
  357|  4.11M|    case '5':
  ------------------
  |  Branch (357:5): [True: 416k, False: 55.7M]
  ------------------
  358|  4.29M|    case '6':
  ------------------
  |  Branch (358:5): [True: 183k, False: 56.0M]
  ------------------
  359|  4.41M|    case '7':
  ------------------
  |  Branch (359:5): [True: 116k, False: 56.0M]
  ------------------
  360|  4.61M|    case '8':
  ------------------
  |  Branch (360:5): [True: 208k, False: 55.9M]
  ------------------
  361|  4.67M|    case '9':
  ------------------
  |  Branch (361:5): [True: 59.7k, False: 56.1M]
  ------------------
  362|  4.67M|        state = st_number;
  363|  4.67M|        return;
  364|       |
  365|  6.90k|    case '+':
  ------------------
  |  Branch (365:5): [True: 6.90k, False: 56.1M]
  ------------------
  366|   152k|    case '-':
  ------------------
  |  Branch (366:5): [True: 145k, False: 56.0M]
  ------------------
  367|   152k|        state = st_sign;
  368|   152k|        return;
  369|       |
  370|  21.9k|    case '.':
  ------------------
  |  Branch (370:5): [True: 21.9k, False: 56.1M]
  ------------------
  371|  21.9k|        state = st_decimal;
  372|  21.9k|        return;
  373|       |
  374|  46.1M|    default:
  ------------------
  |  Branch (374:5): [True: 46.1M, False: 10.0M]
  ------------------
  375|  46.1M|        state = st_literal;
  376|  46.1M|        return;
  377|  56.1M|    }
  378|  56.1M|}
_ZN4qpdf9Tokenizer7inSpaceEc:
  382|   738k|{
  383|       |    // We only enter this state if include_ignorable is true.
  384|   738k|    if (!isSpace(ch)) {
  ------------------
  |  Branch (384:9): [True: 393k, False: 344k]
  ------------------
  385|   393k|        type = tt::tt_space;
  386|   393k|        in_token = false;
  387|   393k|        char_to_unread = ch;
  388|   393k|        state = st_token_ready;
  389|   393k|    }
  390|   738k|}
_ZN4qpdf9Tokenizer9inCommentEc:
  394|  3.85M|{
  395|  3.85M|    if ((ch == '\r') || (ch == '\n')) {
  ------------------
  |  Branch (395:9): [True: 10.2k, False: 3.84M]
  |  Branch (395:25): [True: 34.3k, False: 3.81M]
  ------------------
  396|  44.5k|        if (include_ignorable) {
  ------------------
  |  Branch (396:13): [True: 966, False: 43.5k]
  ------------------
  397|    966|            type = tt::tt_comment;
  398|    966|            in_token = false;
  399|    966|            char_to_unread = ch;
  400|    966|            state = st_token_ready;
  401|  43.5k|        } else {
  402|  43.5k|            state = st_before_token;
  403|  43.5k|        }
  404|  44.5k|    }
  405|  3.85M|}
_ZN4qpdf9Tokenizer8inStringEc:
  409|   182M|{
  410|   182M|    switch (ch) {
  411|   487k|    case '\\':
  ------------------
  |  Branch (411:5): [True: 487k, False: 182M]
  ------------------
  412|   487k|        state = st_string_escape;
  413|   487k|        return;
  414|       |
  415|   353k|    case '(':
  ------------------
  |  Branch (415:5): [True: 353k, False: 182M]
  ------------------
  416|   353k|        val += ch;
  417|   353k|        ++string_depth;
  418|   353k|        return;
  419|       |
  420|   482k|    case ')':
  ------------------
  |  Branch (420:5): [True: 482k, False: 182M]
  ------------------
  421|   482k|        if (--string_depth == 0) {
  ------------------
  |  Branch (421:13): [True: 328k, False: 153k]
  ------------------
  422|   328k|            type = tt::tt_string;
  423|   328k|            state = st_token_ready;
  424|   328k|            return;
  425|   328k|        }
  426|       |
  427|   153k|        val += ch;
  428|   153k|        return;
  429|       |
  430|   321k|    case '\r':
  ------------------
  |  Branch (430:5): [True: 321k, False: 182M]
  ------------------
  431|       |        // CR by itself is converted to LF
  432|   321k|        val += '\n';
  433|   321k|        state = st_string_after_cr;
  434|   321k|        return;
  435|       |
  436|  1.03M|    case '\n':
  ------------------
  |  Branch (436:5): [True: 1.03M, False: 181M]
  ------------------
  437|  1.03M|        val += ch;
  438|  1.03M|        return;
  439|       |
  440|   180M|    default:
  ------------------
  |  Branch (440:5): [True: 180M, False: 2.67M]
  ------------------
  441|   180M|        val += ch;
  442|   180M|        return;
  443|   182M|    }
  444|   182M|}
_ZN4qpdf9Tokenizer6inNameEc:
  448|   108M|{
  449|   108M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (449:9): [True: 3.21M, False: 105M]
  ------------------
  450|       |        // A C-locale whitespace character or delimiter terminates token.  It is important to unread
  451|       |        // the whitespace character even though it is ignored since it may be the newline after a
  452|       |        // stream keyword.  Removing it here could make the stream-reading code break on some files,
  453|       |        // though not on any files in the test suite as of this
  454|       |        // writing.
  455|       |
  456|  3.21M|        type = bad ? tt::tt_bad : tt::tt_name;
  ------------------
  |  Branch (456:16): [True: 203, False: 3.21M]
  ------------------
  457|  3.21M|        in_token = false;
  458|  3.21M|        char_to_unread = ch;
  459|  3.21M|        state = st_token_ready;
  460|   105M|    } else if (ch == '#') {
  ------------------
  |  Branch (460:16): [True: 5.07M, False: 100M]
  ------------------
  461|  5.07M|        char_code = 0;
  462|  5.07M|        state = st_name_hex1;
  463|   100M|    } else {
  464|   100M|        val += ch;
  465|   100M|    }
  466|   108M|}
_ZN4qpdf9Tokenizer10inNameHex1Ec:
  470|  5.07M|{
  471|  5.07M|    hex_char = ch;
  472|       |
  473|  5.07M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (473:48): [True: 12.8k, False: 5.06M]
  ------------------
  474|  12.8k|        char_code = int(hval) << 4;
  475|  12.8k|        state = st_name_hex2;
  476|  5.06M|    } else {
  477|  5.06M|        QTC::TC("qpdf", "QPDFTokenizer bad name 1");
  478|  5.06M|        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|  5.06M|        val += '\0';
  481|  5.06M|        state = st_name;
  482|  5.06M|        inName(ch);
  483|  5.06M|    }
  484|  5.07M|}
_ZN4qpdf9Tokenizer10inNameHex2Ec:
  488|  12.8k|{
  489|  12.8k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (489:48): [True: 3.68k, False: 9.13k]
  ------------------
  490|  3.68k|        char_code |= int(hval);
  491|  9.13k|    } else {
  492|  9.13k|        QTC::TC("qpdf", "QPDFTokenizer bad name 2");
  493|  9.13k|        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|  9.13k|        val += '\0';
  496|  9.13k|        val += hex_char;
  497|  9.13k|        state = st_name;
  498|  9.13k|        inName(ch);
  499|  9.13k|        return;
  500|  9.13k|    }
  501|  3.68k|    if (char_code == 0) {
  ------------------
  |  Branch (501:9): [True: 840, False: 2.84k]
  ------------------
  502|    840|        QTC::TC("qpdf", "QPDFTokenizer null in name");
  503|    840|        error_message = "null character not allowed in name token";
  504|    840|        val += "#00";
  505|    840|        state = st_name;
  506|    840|        bad = true;
  507|  2.84k|    } else {
  508|  2.84k|        val += char(char_code);
  509|  2.84k|        state = st_name;
  510|  2.84k|    }
  511|  3.68k|}
_ZN4qpdf9Tokenizer6inSignEc:
  515|   143k|{
  516|   143k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (516:9): [True: 134k, False: 8.73k]
  ------------------
  517|   134k|        state = st_number;
  518|   134k|    } else if (ch == '.') {
  ------------------
  |  Branch (518:16): [True: 465, False: 8.27k]
  ------------------
  519|    465|        state = st_decimal;
  520|  8.27k|    } else {
  521|  8.27k|        state = st_literal;
  522|  8.27k|        inLiteral(ch);
  523|  8.27k|    }
  524|   143k|}
_ZN4qpdf9Tokenizer9inDecimalEc:
  528|  19.6k|{
  529|  19.6k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (529:9): [True: 8.02k, False: 11.6k]
  ------------------
  530|  8.02k|        state = st_real;
  531|  11.6k|    } else {
  532|  11.6k|        state = st_literal;
  533|  11.6k|        inLiteral(ch);
  534|  11.6k|    }
  535|  19.6k|}
_ZN4qpdf9Tokenizer8inNumberEc:
  539|  10.0M|{
  540|  10.0M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (540:9): [True: 5.42M, False: 4.63M]
  ------------------
  541|  5.42M|    } else if (ch == '.') {
  ------------------
  |  Branch (541:16): [True: 282k, False: 4.35M]
  ------------------
  542|   282k|        state = st_real;
  543|  4.35M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (543:16): [True: 4.24M, False: 107k]
  ------------------
  544|  4.24M|        type = tt::tt_integer;
  545|  4.24M|        state = st_token_ready;
  546|  4.24M|        in_token = false;
  547|  4.24M|        char_to_unread = ch;
  548|  4.24M|    } else {
  549|   107k|        state = st_literal;
  550|   107k|    }
  551|  10.0M|}
_ZN4qpdf9Tokenizer6inRealEc:
  555|   981k|{
  556|   981k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (556:9): [True: 691k, False: 290k]
  ------------------
  557|   691k|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (557:16): [True: 276k, False: 13.6k]
  ------------------
  558|   276k|        type = tt::tt_real;
  559|   276k|        state = st_token_ready;
  560|   276k|        in_token = false;
  561|   276k|        char_to_unread = ch;
  562|   276k|    } else {
  563|  13.6k|        state = st_literal;
  564|  13.6k|    }
  565|   981k|}
_ZN4qpdf9Tokenizer14inStringEscapeEc:
  568|   487k|{
  569|   487k|    state = st_in_string;
  570|   487k|    switch (ch) {
  571|  9.72k|    case '0':
  ------------------
  |  Branch (571:5): [True: 9.72k, False: 477k]
  ------------------
  572|  11.2k|    case '1':
  ------------------
  |  Branch (572:5): [True: 1.50k, False: 485k]
  ------------------
  573|  15.6k|    case '2':
  ------------------
  |  Branch (573:5): [True: 4.41k, False: 482k]
  ------------------
  574|  20.5k|    case '3':
  ------------------
  |  Branch (574:5): [True: 4.90k, False: 482k]
  ------------------
  575|  22.2k|    case '4':
  ------------------
  |  Branch (575:5): [True: 1.67k, False: 485k]
  ------------------
  576|  22.9k|    case '5':
  ------------------
  |  Branch (576:5): [True: 709, False: 486k]
  ------------------
  577|  23.6k|    case '6':
  ------------------
  |  Branch (577:5): [True: 742, False: 486k]
  ------------------
  578|  24.7k|    case '7':
  ------------------
  |  Branch (578:5): [True: 1.03k, False: 486k]
  ------------------
  579|  24.7k|        state = st_char_code;
  580|  24.7k|        char_code = 0;
  581|  24.7k|        digit_count = 0;
  582|  24.7k|        inCharCode(ch);
  583|  24.7k|        return;
  584|       |
  585|  12.9k|    case 'n':
  ------------------
  |  Branch (585:5): [True: 12.9k, False: 474k]
  ------------------
  586|  12.9k|        val += '\n';
  587|  12.9k|        return;
  588|       |
  589|  24.1k|    case 'r':
  ------------------
  |  Branch (589:5): [True: 24.1k, False: 463k]
  ------------------
  590|  24.1k|        val += '\r';
  591|  24.1k|        return;
  592|       |
  593|   185k|    case 't':
  ------------------
  |  Branch (593:5): [True: 185k, False: 301k]
  ------------------
  594|   185k|        val += '\t';
  595|   185k|        return;
  596|       |
  597|  1.28k|    case 'b':
  ------------------
  |  Branch (597:5): [True: 1.28k, False: 485k]
  ------------------
  598|  1.28k|        val += '\b';
  599|  1.28k|        return;
  600|       |
  601|   131k|    case 'f':
  ------------------
  |  Branch (601:5): [True: 131k, False: 355k]
  ------------------
  602|   131k|        val += '\f';
  603|   131k|        return;
  604|       |
  605|    796|    case '\n':
  ------------------
  |  Branch (605:5): [True: 796, False: 486k]
  ------------------
  606|    796|        return;
  607|       |
  608|    890|    case '\r':
  ------------------
  |  Branch (608:5): [True: 890, False: 486k]
  ------------------
  609|    890|        state = st_string_after_cr;
  610|    890|        return;
  611|       |
  612|   105k|    default:
  ------------------
  |  Branch (612:5): [True: 105k, False: 381k]
  ------------------
  613|       |        // PDF spec says backslash is ignored before anything else
  614|   105k|        val += ch;
  615|   105k|        return;
  616|   487k|    }
  617|   487k|}
_ZN4qpdf9Tokenizer15inStringAfterCREc:
  621|   322k|{
  622|   322k|    state = st_in_string;
  623|   322k|    if (ch != '\n') {
  ------------------
  |  Branch (623:9): [True: 208k, False: 114k]
  ------------------
  624|   208k|        inString(ch);
  625|   208k|    }
  626|   322k|}
_ZN4qpdf9Tokenizer4inLtEc:
  630|   599k|{
  631|   599k|    if (ch == '<') {
  ------------------
  |  Branch (631:9): [True: 435k, False: 164k]
  ------------------
  632|   435k|        type = tt::tt_dict_open;
  633|   435k|        state = st_token_ready;
  634|   435k|        return;
  635|   435k|    }
  636|       |
  637|   164k|    state = st_in_hexstring;
  638|   164k|    inHexstring(ch);
  639|   164k|}
_ZN4qpdf9Tokenizer4inGtEc:
  643|   346k|{
  644|   346k|    if (ch == '>') {
  ------------------
  |  Branch (644:9): [True: 310k, False: 36.4k]
  ------------------
  645|   310k|        type = tt::tt_dict_close;
  646|   310k|        state = st_token_ready;
  647|   310k|    } else {
  648|  36.4k|        type = tt::tt_bad;
  649|  36.4k|        QTC::TC("qpdf", "QPDFTokenizer bad >");
  650|  36.4k|        error_message = "unexpected >";
  651|  36.4k|        in_token = false;
  652|  36.4k|        char_to_unread = ch;
  653|  36.4k|        state = st_token_ready;
  654|  36.4k|    }
  655|   346k|}
_ZN4qpdf9Tokenizer9inLiteralEc:
  659|   317M|{
  660|   317M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (660:9): [True: 24.6M, False: 292M]
  ------------------
  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|  24.6M|        in_token = false;
  667|  24.6M|        char_to_unread = ch;
  668|  24.6M|        state = st_token_ready;
  669|  24.6M|        type = (raw_val == "true") || (raw_val == "false")
  ------------------
  |  Branch (669:16): [True: 23.6k, False: 24.6M]
  |  Branch (669:39): [True: 2.70k, False: 24.6M]
  ------------------
  670|  24.6M|            ? tt::tt_bool
  671|  24.6M|            : (raw_val == "null" ? tt::tt_null : tt::tt_word);
  ------------------
  |  Branch (671:16): [True: 60.0k, False: 24.5M]
  ------------------
  672|  24.6M|    }
  673|   317M|}
_ZN4qpdf9Tokenizer11inHexstringEc:
  677|  9.81M|{
  678|  9.81M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (678:48): [True: 9.62M, False: 185k]
  ------------------
  679|  9.62M|        char_code = int(hval) << 4;
  680|  9.62M|        state = st_in_hexstring_2nd;
  681|       |
  682|  9.62M|    } else if (ch == '>') {
  ------------------
  |  Branch (682:16): [True: 124k, False: 61.1k]
  ------------------
  683|   124k|        type = tt::tt_string;
  684|   124k|        state = st_token_ready;
  685|       |
  686|   124k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (686:16): [True: 42.0k, False: 19.1k]
  ------------------
  687|       |        // ignore
  688|       |
  689|  42.0k|    } else {
  690|  19.1k|        type = tt::tt_bad;
  691|  19.1k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
  692|  19.1k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  693|  19.1k|        state = st_token_ready;
  694|  19.1k|    }
  695|  9.81M|}
_ZN4qpdf9Tokenizer14inHexstring2ndEc:
  699|  9.63M|{
  700|  9.63M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (700:48): [True: 9.60M, False: 27.4k]
  ------------------
  701|  9.60M|        val += char(char_code) | hval;
  702|  9.60M|        state = st_in_hexstring;
  703|       |
  704|  9.60M|    } else if (ch == '>') {
  ------------------
  |  Branch (704:16): [True: 10.2k, False: 17.1k]
  ------------------
  705|       |        // PDF spec says odd hexstrings have implicit trailing 0.
  706|  10.2k|        val += char(char_code);
  707|  10.2k|        type = tt::tt_string;
  708|  10.2k|        state = st_token_ready;
  709|       |
  710|  17.1k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (710:16): [True: 10.5k, False: 6.59k]
  ------------------
  711|       |        // ignore
  712|       |
  713|  10.5k|    } else {
  714|  6.59k|        type = tt::tt_bad;
  715|  6.59k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
  716|  6.59k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  717|  6.59k|        state = st_token_ready;
  718|  6.59k|    }
  719|  9.63M|}
_ZN4qpdf9Tokenizer10inCharCodeEc:
  723|  67.8k|{
  724|  67.8k|    bool handled = false;
  725|  67.8k|    if (('0' <= ch) && (ch <= '7')) {
  ------------------
  |  Branch (725:9): [True: 63.8k, False: 4.00k]
  |  Branch (725:24): [True: 59.9k, False: 3.98k]
  ------------------
  726|  59.9k|        char_code = 8 * char_code + (int(ch) - int('0'));
  727|  59.9k|        if (++(digit_count) < 3) {
  ------------------
  |  Branch (727:13): [True: 43.4k, False: 16.4k]
  ------------------
  728|  43.4k|            return;
  729|  43.4k|        }
  730|  16.4k|        handled = true;
  731|  16.4k|    }
  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|  24.4k|    val += char(char_code % 256);
  735|  24.4k|    state = st_in_string;
  736|  24.4k|    if (!handled) {
  ------------------
  |  Branch (736:9): [True: 7.98k, False: 16.4k]
  ------------------
  737|  7.98k|        inString(ch);
  738|  7.98k|    }
  739|  24.4k|}
_ZN4qpdf9Tokenizer13inInlineImageEc:
  743|   174M|{
  744|   174M|    if ((raw_val.length() + 1) == inline_image_bytes) {
  ------------------
  |  Branch (744:9): [True: 1.94k, False: 174M]
  ------------------
  745|  1.94k|        QTC::TC("qpdf", "QPDFTokenizer found EI by byte count");
  746|  1.94k|        type = tt::tt_inline_image;
  747|  1.94k|        inline_image_bytes = 0;
  748|  1.94k|        state = st_token_ready;
  749|  1.94k|    }
  750|   174M|}
_ZN4qpdf9Tokenizer10presentEOFEv:
  760|  76.2k|{
  761|  76.2k|    switch (state) {
  762|  2.02k|    case st_name:
  ------------------
  |  Branch (762:5): [True: 2.02k, False: 74.2k]
  ------------------
  763|  2.19k|    case st_name_hex1:
  ------------------
  |  Branch (763:5): [True: 169, False: 76.0k]
  ------------------
  764|  2.33k|    case st_name_hex2:
  ------------------
  |  Branch (764:5): [True: 137, False: 76.1k]
  ------------------
  765|  8.58k|    case st_number:
  ------------------
  |  Branch (765:5): [True: 6.25k, False: 70.0k]
  ------------------
  766|  8.86k|    case st_real:
  ------------------
  |  Branch (766:5): [True: 275, False: 75.9k]
  ------------------
  767|  9.02k|    case st_sign:
  ------------------
  |  Branch (767:5): [True: 158, False: 76.1k]
  ------------------
  768|  9.10k|    case st_decimal:
  ------------------
  |  Branch (768:5): [True: 80, False: 76.1k]
  ------------------
  769|  24.0k|    case st_literal:
  ------------------
  |  Branch (769:5): [True: 14.9k, False: 61.2k]
  ------------------
  770|  24.0k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
  771|       |        // Push any delimiter to the state machine to finish off the final token.
  772|  24.0k|        presentCharacter('\f');
  773|  24.0k|        in_token = true;
  774|  24.0k|        break;
  775|       |
  776|      0|    case st_top:
  ------------------
  |  Branch (776:5): [True: 0, False: 76.2k]
  ------------------
  777|  40.6k|    case st_before_token:
  ------------------
  |  Branch (777:5): [True: 40.6k, False: 35.6k]
  ------------------
  778|  40.6k|        type = tt::tt_eof;
  779|  40.6k|        break;
  780|       |
  781|  5.76k|    case st_in_space:
  ------------------
  |  Branch (781:5): [True: 5.76k, False: 70.5k]
  ------------------
  782|  5.76k|        type = include_ignorable ? tt::tt_space : tt::tt_eof;
  ------------------
  |  Branch (782:16): [True: 5.76k, False: 0]
  ------------------
  783|  5.76k|        break;
  784|       |
  785|  1.24k|    case st_in_comment:
  ------------------
  |  Branch (785:5): [True: 1.24k, False: 75.0k]
  ------------------
  786|  1.24k|        type = include_ignorable ? tt::tt_comment : tt::tt_bad;
  ------------------
  |  Branch (786:16): [True: 72, False: 1.17k]
  ------------------
  787|  1.24k|        break;
  788|       |
  789|      0|    case st_token_ready:
  ------------------
  |  Branch (789:5): [True: 0, False: 76.2k]
  ------------------
  790|      0|        break;
  791|       |
  792|  4.52k|    default:
  ------------------
  |  Branch (792:5): [True: 4.52k, False: 71.7k]
  ------------------
  793|  4.52k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
  794|  4.52k|        type = tt::tt_bad;
  795|  4.52k|        error_message = "EOF while reading token";
  796|  76.2k|    }
  797|  76.2k|    state = st_token_ready;
  798|  76.2k|}
_ZN13QPDFTokenizer17expectInlineImageER11InputSource:
  808|    911|{
  809|    911|    m->expectInlineImage(input);
  810|    911|}
_ZN4qpdf9Tokenizer17expectInlineImageER11InputSource:
  814|  2.11k|{
  815|  2.11k|    if (state == st_token_ready) {
  ------------------
  |  Branch (815:9): [True: 1.19k, False: 911]
  ------------------
  816|  1.19k|        reset();
  817|  1.19k|    } else if (state != st_before_token) {
  ------------------
  |  Branch (817:16): [True: 0, False: 911]
  ------------------
  818|      0|        throw std::logic_error(
  819|      0|            "QPDFTokenizer::expectInlineImage called when tokenizer is in improper state");
  820|      0|    }
  821|  2.11k|    findEI(input);
  822|  2.11k|    before_token = false;
  823|  2.11k|    in_token = true;
  824|  2.11k|    state = st_inline_image;
  825|  2.11k|}
_ZN4qpdf9Tokenizer6findEIER11InputSource:
  829|  2.11k|{
  830|  2.11k|    qpdf_offset_t last_offset = input.getLastOffset();
  831|  2.11k|    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.11k|    bool okay = false;
  841|  2.11k|    bool first_try = true;
  842|  14.3k|    while (!okay) {
  ------------------
  |  Branch (842:12): [True: 12.8k, False: 1.57k]
  ------------------
  843|  12.8k|        QPDFWordTokenFinder f(input, "EI");
  844|  12.8k|        if (!input.findFirst("EI", input.tell(), 0, f)) {
  ------------------
  |  Branch (844:13): [True: 539, False: 12.2k]
  ------------------
  845|    539|            break;
  846|    539|        }
  847|  12.2k|        inline_image_bytes = QIntC::to_size(input.tell() - pos - 2);
  848|       |
  849|  12.2k|        Tokenizer check;
  850|  12.2k|        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|  37.5k|        for (int i = 0; i < 10; ++i) {
  ------------------
  |  Branch (856:25): [True: 35.9k, False: 1.57k]
  ------------------
  857|  35.9k|            check.nextToken(input, "checker");
  858|  35.9k|            auto typ = check.getType();
  859|  35.9k|            if (typ == tt::tt_eof) {
  ------------------
  |  Branch (859:17): [True: 0, False: 35.9k]
  ------------------
  860|      0|                okay = true;
  861|  35.9k|            } else if (typ == tt::tt_bad) {
  ------------------
  |  Branch (861:24): [True: 1.41k, False: 34.5k]
  ------------------
  862|  1.41k|                found_bad = true;
  863|  34.5k|            } else if (typ == tt::tt_word) {
  ------------------
  |  Branch (863:24): [True: 20.0k, False: 14.4k]
  ------------------
  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|  20.0k|                bool found_alpha = false;
  870|  20.0k|                bool found_non_printable = false;
  871|  20.0k|                bool found_other = false;
  872|  94.6k|                for (char ch: check.getValue()) {
  ------------------
  |  Branch (872:29): [True: 94.6k, False: 12.9k]
  ------------------
  873|  94.6k|                    if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '*')) {
  ------------------
  |  Branch (873:26): [True: 18.5k, False: 76.0k]
  |  Branch (873:39): [True: 16.6k, False: 1.95k]
  |  Branch (873:54): [True: 23.6k, False: 54.3k]
  |  Branch (873:67): [True: 21.6k, False: 2.00k]
  |  Branch (873:81): [True: 421, False: 55.9k]
  ------------------
  874|       |                        // Treat '*' as alpha since there are valid PDF operators that contain *
  875|       |                        // along with alphabetic characters.
  876|  38.6k|                        found_alpha = true;
  877|  55.9k|                    } else if (static_cast<signed char>(ch) < 32 && !isSpace(ch)) {
  ------------------
  |  Branch (877:32): [True: 7.11k, False: 48.8k]
  |  Branch (877:69): [True: 7.11k, False: 0]
  ------------------
  878|       |                        // Compare ch as a signed char so characters outside of 7-bit will be < 0.
  879|  7.11k|                        found_non_printable = true;
  880|  7.11k|                        break;
  881|  48.8k|                    } else {
  882|  48.8k|                        found_other = true;
  883|  48.8k|                    }
  884|  94.6k|                }
  885|  20.0k|                if (found_non_printable || (found_alpha && found_other)) {
  ------------------
  |  Branch (885:21): [True: 7.11k, False: 12.9k]
  |  Branch (885:45): [True: 12.0k, False: 841]
  |  Branch (885:60): [True: 2.18k, False: 9.90k]
  ------------------
  886|  9.30k|                    found_bad = true;
  887|  9.30k|                }
  888|  20.0k|            }
  889|  35.9k|            if (okay || found_bad) {
  ------------------
  |  Branch (889:17): [True: 0, False: 35.9k]
  |  Branch (889:25): [True: 10.7k, False: 25.2k]
  ------------------
  890|  10.7k|                break;
  891|  10.7k|            }
  892|  35.9k|        }
  893|  12.2k|        if (!found_bad) {
  ------------------
  |  Branch (893:13): [True: 1.57k, False: 10.7k]
  ------------------
  894|  1.57k|            okay = true;
  895|  1.57k|        }
  896|  12.2k|        if (!okay) {
  ------------------
  |  Branch (896:13): [True: 10.7k, False: 1.57k]
  ------------------
  897|  10.7k|            first_try = false;
  898|  10.7k|        }
  899|  12.2k|    }
  900|  2.11k|    if (okay && (!first_try)) {
  ------------------
  |  Branch (900:9): [True: 1.57k, False: 539]
  |  Branch (900:17): [True: 66, False: 1.50k]
  ------------------
  901|     66|        QTC::TC("qpdf", "QPDFTokenizer found EI after more than one try");
  902|     66|    }
  903|       |
  904|       |    input.seek(pos, SEEK_SET);
  905|  2.11k|    input.setLastOffset(last_offset);
  906|  2.11k|}
_ZN4qpdf9Tokenizer8getTokenERN13QPDFTokenizer5TokenERbRc:
  916|  4.42M|{
  917|  4.42M|    bool ready = (state == st_token_ready);
  918|  4.42M|    unread_char = !in_token && !before_token;
  ------------------
  |  Branch (918:19): [True: 3.73M, False: 692k]
  |  Branch (918:32): [True: 3.71M, False: 24.9k]
  ------------------
  919|  4.42M|    ch = char_to_unread;
  920|  4.42M|    if (ready) {
  ------------------
  |  Branch (920:9): [True: 4.42M, False: 0]
  ------------------
  921|  4.42M|        token = (!(type == tt::tt_name || type == tt::tt_string))
  ------------------
  |  Branch (921:20): [True: 313k, False: 4.11M]
  |  Branch (921:43): [True: 34.2k, False: 4.08M]
  ------------------
  922|  4.42M|            ? Token(type, raw_val, raw_val, error_message)
  923|  4.42M|            : Token(type, val, raw_val, error_message);
  924|       |
  925|  4.42M|        reset();
  926|  4.42M|    }
  927|  4.42M|    return ready;
  928|  4.42M|}
_ZN13QPDFTokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbm:
  945|   942k|{
  946|   942k|    return m->readToken(input, context, allow_bad, max_len);
  947|   942k|}
_ZN4qpdf9Tokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbm:
  958|  4.42M|{
  959|  4.42M|    nextToken(input, context, max_len);
  960|       |
  961|  4.42M|    Token token;
  962|  4.42M|    bool unread_char;
  963|  4.42M|    char char_to_unread;
  964|  4.42M|    getToken(token, unread_char, char_to_unread);
  965|       |
  966|  4.42M|    if (token.getType() == tt::tt_bad) {
  ------------------
  |  Branch (966:9): [True: 261k, False: 4.16M]
  ------------------
  967|   261k|        if (allow_bad) {
  ------------------
  |  Branch (967:13): [True: 261k, False: 0]
  ------------------
  968|   261k|            QTC::TC("qpdf", "QPDFTokenizer allowing bad token");
  969|   261k|        } 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|   261k|    }
  978|  4.42M|    return token;
  979|  4.42M|}
_ZN4qpdf9Tokenizer9nextTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
  983|  56.6M|{
  984|  56.6M|    if (state != st_inline_image) {
  ------------------
  |  Branch (984:9): [True: 56.6M, False: 2.11k]
  ------------------
  985|  56.6M|        reset();
  986|  56.6M|    }
  987|  56.6M|    qpdf_offset_t offset = input.fastTell();
  988|       |
  989|   990M|    while (state != st_token_ready) {
  ------------------
  |  Branch (989:12): [True: 933M, False: 56.6M]
  ------------------
  990|   933M|        char ch;
  991|   933M|        if (!input.fastRead(ch)) {
  ------------------
  |  Branch (991:13): [True: 76.2k, False: 933M]
  ------------------
  992|  76.2k|            presentEOF();
  993|       |
  994|  76.2k|            if ((type == tt::tt_eof) && (!allow_eof)) {
  ------------------
  |  Branch (994:17): [True: 40.6k, False: 35.6k]
  |  Branch (994:41): [True: 130, False: 40.5k]
  ------------------
  995|       |                // Nothing in the qpdf library calls readToken without allowEOF anymore, so this
  996|       |                // case is not exercised.
  997|    130|                type = tt::tt_bad;
  998|    130|                error_message = "unexpected EOF";
  999|    130|                offset = input.getLastOffset();
 1000|    130|            }
 1001|   933M|        } else {
 1002|   933M|            handleCharacter(ch);
 1003|   933M|            if (before_token) {
  ------------------
  |  Branch (1003:17): [True: 59.9M, False: 873M]
  ------------------
 1004|  59.9M|                ++offset;
 1005|  59.9M|            }
 1006|   933M|            if (in_token) {
  ------------------
  |  Branch (1006:17): [True: 840M, False: 92.7M]
  ------------------
 1007|   840M|                raw_val += ch;
 1008|   840M|            }
 1009|   933M|            if (max_len && (raw_val.length() >= max_len) && (state != st_token_ready)) {
  ------------------
  |  Branch (1009:17): [True: 79.6M, False: 853M]
  |  Branch (1009:28): [True: 21.9M, False: 57.7M]
  |  Branch (1009:61): [True: 21.9M, False: 12.2k]
  ------------------
 1010|       |                // terminate this token now
 1011|  21.9M|                QTC::TC("qpdf", "QPDFTokenizer block long token");
 1012|  21.9M|                type = tt::tt_bad;
 1013|  21.9M|                state = st_token_ready;
 1014|  21.9M|                error_message = "exceeded allowable length while reading token";
 1015|  21.9M|            }
 1016|   933M|        }
 1017|   933M|    }
 1018|       |
 1019|  56.6M|    input.fastUnread(!in_token && !before_token);
  ------------------
  |  Branch (1019:22): [True: 32.8M, False: 23.7M]
  |  Branch (1019:35): [True: 32.8M, False: 41.8k]
  ------------------
 1020|       |
 1021|  56.6M|    if (type != tt::tt_eof) {
  ------------------
  |  Branch (1021:9): [True: 56.5M, False: 40.5k]
  ------------------
 1022|  56.5M|        input.setLastOffset(offset);
 1023|  56.5M|    }
 1024|       |
 1025|  56.6M|    return error_message.empty();
 1026|  56.6M|}
QPDFTokenizer.cc:_ZL12is_delimiterc:
   25|   430M|{
   26|   430M|    return (
   27|   430M|        ch == ' ' || ch == '\n' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (27:9): [True: 5.39M, False: 425M]
  |  Branch (27:22): [True: 1.08M, False: 424M]
  |  Branch (27:36): [True: 2.24M, False: 422M]
  |  Branch (27:49): [True: 263k, False: 421M]
  |  Branch (27:62): [True: 42.5k, False: 421M]
  |  Branch (27:75): [True: 22.0k, False: 421M]
  |  Branch (27:88): [True: 12.1k, False: 421M]
  ------------------
   28|   421M|        ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch == '\t' || ch == '\r' ||
  ------------------
  |  Branch (28:9): [True: 231k, False: 421M]
  |  Branch (28:22): [True: 162k, False: 421M]
  |  Branch (28:35): [True: 172k, False: 421M]
  |  Branch (28:48): [True: 112k, False: 421M]
  |  Branch (28:61): [True: 19.4k, False: 421M]
  |  Branch (28:74): [True: 17.7k, False: 420M]
  |  Branch (28:88): [True: 380k, False: 420M]
  ------------------
   29|   420M|        ch == '\v' || ch == '\f' || ch == 0);
  ------------------
  |  Branch (29:9): [True: 26.9k, False: 420M]
  |  Branch (29:23): [True: 91.0k, False: 420M]
  |  Branch (29:37): [True: 22.1M, False: 398M]
  ------------------
   30|   430M|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderC2ER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   38|  12.8k|            is(is),
   39|  12.8k|            str(str)
   40|  12.8k|        {
   41|  12.8k|        }
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinder5checkEv:
   53|  36.2k|{
   54|       |    // Find a word token matching the given string, preceded by a delimiter, and followed by a
   55|       |    // delimiter or EOF.
   56|  36.2k|    Tokenizer tokenizer;
   57|  36.2k|    tokenizer.nextToken(is, "finder", str.size() + 2);
   58|  36.2k|    qpdf_offset_t pos = is.tell();
   59|  36.2k|    if (tokenizer.getType() != tt::tt_word || tokenizer.getValue() != str) {
  ------------------
  |  Branch (59:9): [True: 23.5k, False: 12.7k]
  |  Branch (59:47): [True: 414, False: 12.2k]
  ------------------
   60|  23.9k|        QTC::TC("qpdf", "QPDFTokenizer finder found wrong word");
   61|  23.9k|        return false;
   62|  23.9k|    }
   63|  12.2k|    qpdf_offset_t token_start = is.getLastOffset();
   64|  12.2k|    char next;
   65|  12.2k|    bool next_okay = false;
   66|  12.2k|    if (is.read(&next, 1) == 0) {
  ------------------
  |  Branch (66:9): [True: 31, False: 12.2k]
  ------------------
   67|     31|        QTC::TC("qpdf", "QPDFTokenizer inline image at EOF");
   68|     31|        next_okay = true;
   69|  12.2k|    } else {
   70|  12.2k|        next_okay = is_delimiter(next);
   71|  12.2k|    }
   72|  12.2k|    is.seek(pos, SEEK_SET);
   73|  12.2k|    if (!next_okay) {
  ------------------
  |  Branch (73:9): [True: 0, False: 12.2k]
  ------------------
   74|      0|        return false;
   75|      0|    }
   76|  12.2k|    if (token_start == 0) {
  ------------------
  |  Branch (76:9): [True: 0, False: 12.2k]
  ------------------
   77|       |        // Can't actually happen...we never start the search at the beginning of the input.
   78|      0|        return false;
   79|      0|    }
   80|  12.2k|    return true;
   81|  12.2k|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderD2Ev:
   42|  12.8k|        ~QPDFWordTokenFinder() override = default;

_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEEb:
   39|  16.4k|{
   40|  16.4k|    if (sparse) {
  ------------------
  |  Branch (40:9): [True: 370, False: 16.0k]
  ------------------
   41|    370|        sp = std::make_unique<Sparse>();
   42|  72.0k|        for (auto& item: v) {
  ------------------
  |  Branch (42:24): [True: 72.0k, False: 370]
  ------------------
   43|  72.0k|            if (item.raw_type_code() != ::ot_null || item.indirect()) {
  ------------------
  |  Branch (43:17): [True: 21.0k, False: 50.9k]
  |  Branch (43:54): [True: 73, False: 50.8k]
  ------------------
   44|  21.1k|                sp->elements[sp->size] = std::move(item);
   45|  21.1k|            }
   46|  72.0k|            ++sp->size;
   47|  72.0k|        }
   48|  16.0k|    } else {
   49|  16.0k|        elements = std::move(v);
   50|  16.0k|    }
   51|  16.4k|}
_ZNK4qpdf5Array5arrayEv:
   55|  48.1k|{
   56|  48.1k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (56:14): [True: 48.1k, False: 0]
  ------------------
   57|  48.1k|        return a;
   58|  48.1k|    }
   59|       |
   60|      0|    throw std::runtime_error("Expected an array but found a non-array object");
   61|      0|    return nullptr; // unreachable
   62|  48.1k|}
_ZN4qpdf5ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   65|  6.12k|    BaseHandle(QPDFObject::create<QPDF_Array>(items))
   66|  6.12k|{
   67|  6.12k|}
_ZN4qpdf5ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   70|  7.25k|    BaseHandle(QPDFObject::create<QPDF_Array>(std::move(items)))
   71|  7.25k|{
   72|  7.25k|}
_ZN4qpdf5Array5emptyEv:
   76|    879|{
   77|    879|    return Array(std::vector<QPDFObjectHandle>());
   78|    879|}
_ZN4qpdf5Array5beginEv:
   82|   184k|{
   83|   184k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (83:14): [True: 107k, False: 76.8k]
  ------------------
   84|   107k|        if (!a->sp) {
  ------------------
  |  Branch (84:13): [True: 106k, False: 394]
  ------------------
   85|   106k|            return a->elements.begin();
   86|   106k|        }
   87|    394|        if (!sp_elements) {
  ------------------
  |  Branch (87:13): [True: 394, False: 0]
  ------------------
   88|    394|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
   89|    394|        }
   90|    394|        return sp_elements->begin();
   91|   107k|    }
   92|  76.8k|    return {};
   93|   184k|}
_ZN4qpdf5Array3endEv:
   97|   184k|{
   98|   184k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (98:14): [True: 107k, False: 76.8k]
  ------------------
   99|   107k|        if (!a->sp) {
  ------------------
  |  Branch (99:13): [True: 106k, False: 394]
  ------------------
  100|   106k|            return a->elements.end();
  101|   106k|        }
  102|    394|        if (!sp_elements) {
  ------------------
  |  Branch (102:13): [True: 0, False: 394]
  ------------------
  103|      0|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
  104|      0|        }
  105|    394|        return sp_elements->end();
  106|   107k|    }
  107|  76.8k|    return {};
  108|   184k|}
_ZNK4qpdf5Array4sizeEv:
  178|   261k|{
  179|   261k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (179:14): [True: 208k, False: 52.9k]
  ------------------
  180|   208k|        return a->sp ? a->sp->size : a->elements.size();
  ------------------
  |  Branch (180:16): [True: 23.4k, False: 184k]
  ------------------
  181|   208k|    }
  182|  52.9k|    return 0;
  183|   261k|}
_ZNK4qpdf5ArrayixEm:
  187|   970k|{
  188|   970k|    static const QPDFObjectHandle null_obj;
  189|   970k|    auto a = as<QPDF_Array>();
  190|   970k|    if (!a) {
  ------------------
  |  Branch (190:9): [True: 1.63k, False: 969k]
  ------------------
  191|  1.63k|        return null_obj;
  192|  1.63k|    }
  193|   969k|    if (a->sp) {
  ------------------
  |  Branch (193:9): [True: 31.6k, False: 937k]
  ------------------
  194|  31.6k|        auto const& iter = a->sp->elements.find(n);
  195|  31.6k|        return iter == a->sp->elements.end() ? null_obj : iter->second;
  ------------------
  |  Branch (195:16): [True: 22.3k, False: 9.34k]
  ------------------
  196|  31.6k|    }
  197|   937k|    return n >= a->elements.size() ? null_obj : a->elements[n];
  ------------------
  |  Branch (197:12): [True: 1.35k, False: 936k]
  ------------------
  198|   969k|}
_ZNK4qpdf5ArrayixEi:
  202|   860k|{
  203|   860k|    static const QPDFObjectHandle null_obj;
  204|   860k|    if (n < 0) {
  ------------------
  |  Branch (204:9): [True: 2.43k, False: 857k]
  ------------------
  205|  2.43k|        return null_obj;
  206|  2.43k|    }
  207|   857k|    return (*this)[static_cast<size_t>(n)];
  208|   860k|}
_ZNK4qpdf5Array3getEm:
  212|    332|{
  213|    332|    if (n >= size()) {
  ------------------
  |  Branch (213:9): [True: 0, False: 332]
  ------------------
  214|      0|        return {};
  215|      0|    }
  216|    332|    auto a = array();
  217|    332|    if (!a->sp) {
  ------------------
  |  Branch (217:9): [True: 332, False: 0]
  ------------------
  218|    332|        return a->elements[n];
  219|    332|    }
  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|    332|}
_ZNK4qpdf5Array3getEi:
  226|    332|{
  227|    332|    if (n < 0) {
  ------------------
  |  Branch (227:9): [True: 0, False: 332]
  ------------------
  228|      0|        return {};
  229|      0|    }
  230|    332|    return get(to_s(n));
  231|    332|}
_ZNK4qpdf5Array11getAsVectorEv:
  235|  9.09k|{
  236|  9.09k|    auto a = array();
  237|  9.09k|    if (a->sp) {
  ------------------
  |  Branch (237:9): [True: 398, False: 8.69k]
  ------------------
  238|    398|        std::vector<QPDFObjectHandle> v;
  239|    398|        v.reserve(size());
  240|  10.3k|        for (auto const& item: a->sp->elements) {
  ------------------
  |  Branch (240:30): [True: 10.3k, False: 398]
  ------------------
  241|  10.3k|            v.resize(item.first, null_oh);
  242|  10.3k|            v.emplace_back(item.second);
  243|  10.3k|        }
  244|    398|        v.resize(size(), null_oh);
  245|    398|        return v;
  246|  8.69k|    } else {
  247|  8.69k|        return a->elements;
  248|  8.69k|    }
  249|  9.09k|}
_ZN4qpdf5Array3setEmRK16QPDFObjectHandle:
  253|     26|{
  254|     26|    if (at >= size()) {
  ------------------
  |  Branch (254:9): [True: 0, False: 26]
  ------------------
  255|      0|        return false;
  256|      0|    }
  257|     26|    auto a = array();
  258|     26|    checkOwnership(oh);
  259|     26|    if (a->sp) {
  ------------------
  |  Branch (259:9): [True: 6, False: 20]
  ------------------
  260|      6|        a->sp->elements[at] = oh;
  261|     20|    } else {
  262|     20|        a->elements[at] = oh;
  263|     20|    }
  264|     26|    return true;
  265|     26|}
_ZN4qpdf5Array3setEiRK16QPDFObjectHandle:
  269|     26|{
  270|     26|    if (at < 0) {
  ------------------
  |  Branch (270:9): [True: 0, False: 26]
  ------------------
  271|      0|        return false;
  272|      0|    }
  273|     26|    return set(to_s(at), oh);
  274|     26|}
_ZN4qpdf5Array6insertEmRK16QPDFObjectHandle:
  290|  9.73k|{
  291|  9.73k|    auto a = array();
  292|  9.73k|    size_t sz = size();
  293|  9.73k|    if (at > sz) {
  ------------------
  |  Branch (293:9): [True: 0, False: 9.73k]
  ------------------
  294|      0|        return false;
  295|      0|    }
  296|  9.73k|    checkOwnership(item);
  297|  9.73k|    if (at == sz) {
  ------------------
  |  Branch (297:9): [True: 9.73k, False: 0]
  ------------------
  298|       |        // As special case, also allow insert beyond the end
  299|  9.73k|        push_back(item);
  300|  9.73k|        return true;
  301|  9.73k|    }
  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|  9.73k|{
  325|  9.73k|    if (at_i < 0) {
  ------------------
  |  Branch (325:9): [True: 0, False: 9.73k]
  ------------------
  326|      0|        return false;
  327|      0|    }
  328|  9.73k|    return insert(to_s(at_i), item);
  329|  9.73k|}
_ZN4qpdf5Array9push_backERK16QPDFObjectHandle:
  333|  23.6k|{
  334|  23.6k|    auto a = array();
  335|  23.6k|    checkOwnership(item);
  336|  23.6k|    if (a->sp) {
  ------------------
  |  Branch (336:9): [True: 270, False: 23.3k]
  ------------------
  337|    270|        a->sp->elements[(a->sp->size)++] = item;
  338|  23.3k|    } else {
  339|  23.3k|        a->elements.emplace_back(item);
  340|  23.3k|    }
  341|  23.6k|}
_ZN4qpdf5Array5eraseEm:
  345|  5.27k|{
  346|  5.27k|    auto a = array();
  347|  5.27k|    if (at >= size()) {
  ------------------
  |  Branch (347:9): [True: 0, False: 5.27k]
  ------------------
  348|      0|        return false;
  349|      0|    }
  350|  5.27k|    if (!a->sp) {
  ------------------
  |  Branch (350:9): [True: 5.27k, False: 0]
  ------------------
  351|  5.27k|        a->elements.erase(a->elements.cbegin() + to_i(at));
  352|  5.27k|        return true;
  353|  5.27k|    }
  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|  5.27k|}
_ZN4qpdf5Array5eraseEi:
  373|  5.27k|{
  374|  5.27k|    if (at_i < 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 5.27k]
  ------------------
  375|      0|        return false;
  376|      0|    }
  377|  5.27k|    return erase(to_s(at_i));
  378|  5.27k|}
_ZNK16QPDFObjectHandle14getArrayNItemsEv:
  382|   514k|{
  383|   514k|    auto s = size();
  384|   514k|    if (s > 1 || isArray()) {
  ------------------
  |  Branch (384:9): [True: 510k, False: 4.61k]
  |  Branch (384:18): [True: 4.61k, False: 0]
  ------------------
  385|   514k|        return to_i(s);
  386|   514k|    }
  387|      0|    typeWarning("array", "treating as empty");
  388|      0|    return 0;
  389|   514k|}
_ZNK16QPDFObjectHandle12getArrayItemEi:
  393|   521k|{
  394|   521k|    if (auto array = Array(*this)) {
  ------------------
  |  Branch (394:14): [True: 521k, False: 0]
  ------------------
  395|   521k|        if (auto result = array[n]) {
  ------------------
  |  Branch (395:18): [True: 499k, False: 22.0k]
  ------------------
  396|   499k|            return result;
  397|   499k|        }
  398|  22.0k|        if (n >= 0 && std::cmp_less(n, array.size())) {
  ------------------
  |  Branch (398:13): [True: 22.0k, False: 0]
  |  Branch (398:23): [True: 22.0k, False: 0]
  ------------------
  399|       |            // sparse array null
  400|  22.0k|            return newNull();
  401|  22.0k|        }
  402|      0|        objectWarning("returning null for out of bounds array access");
  403|      0|    } else {
  404|      0|        typeWarning("array", "returning null");
  405|      0|    }
  406|      0|    static auto constexpr msg = " -> null returned from invalid array access"sv;
  407|      0|    return QPDF_Null::create(obj, msg, "");
  408|   521k|}
_ZNK16QPDFObjectHandle11isRectangleEv:
  412|  65.0k|{
  413|  65.0k|    Array array(*this);
  414|   156k|    for (auto const& oh: array) {
  ------------------
  |  Branch (414:24): [True: 156k, False: 63.7k]
  ------------------
  415|   156k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (415:13): [True: 1.23k, False: 155k]
  ------------------
  416|  1.23k|            return false;
  417|  1.23k|        }
  418|   156k|    }
  419|  63.7k|    return array.size() == 4;
  420|  65.0k|}
_ZNK16QPDFObjectHandle8isMatrixEv:
  424|  7.50k|{
  425|  7.50k|    Array array(*this);
  426|  7.50k|    for (auto const& oh: array) {
  ------------------
  |  Branch (426:24): [True: 2.72k, False: 7.43k]
  ------------------
  427|  2.72k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (427:13): [True: 76, False: 2.65k]
  ------------------
  428|     76|            return false;
  429|     76|        }
  430|  2.72k|    }
  431|  7.43k|    return array.size() == 6;
  432|  7.50k|}
_ZNK16QPDFObjectHandle19getArrayAsRectangleEv:
  436|  27.7k|{
  437|  27.7k|    Array array(*this);
  438|  27.7k|    if (array.size() != 4) {
  ------------------
  |  Branch (438:9): [True: 1.25k, False: 26.4k]
  ------------------
  439|  1.25k|        return {};
  440|  1.25k|    }
  441|  26.4k|    std::array<double, 4> items;
  442|   131k|    for (size_t i = 0; i < 4; ++i) {
  ------------------
  |  Branch (442:24): [True: 105k, False: 26.3k]
  ------------------
  443|   105k|        if (!array[i].getValueAsNumber(items[i])) {
  ------------------
  |  Branch (443:13): [True: 157, False: 105k]
  ------------------
  444|    157|            return {};
  445|    157|        }
  446|   105k|    }
  447|  26.3k|    return {
  448|  26.3k|        std::min(items[0], items[2]),
  449|  26.3k|        std::min(items[1], items[3]),
  450|  26.3k|        std::max(items[0], items[2]),
  451|  26.3k|        std::max(items[1], items[3])};
  452|  26.4k|}
_ZNK16QPDFObjectHandle16getArrayAsMatrixEv:
  456|    375|{
  457|    375|    Array array(*this);
  458|    375|    if (array.size() != 6) {
  ------------------
  |  Branch (458:9): [True: 0, False: 375]
  ------------------
  459|      0|        return {};
  460|      0|    }
  461|    375|    std::array<double, 6> items;
  462|  2.62k|    for (size_t i = 0; i < 6; ++i) {
  ------------------
  |  Branch (462:24): [True: 2.25k, False: 375]
  ------------------
  463|  2.25k|        if (!array[i].getValueAsNumber(items[i])) {
  ------------------
  |  Branch (463:13): [True: 0, False: 2.25k]
  ------------------
  464|      0|            return {};
  465|      0|        }
  466|  2.25k|    }
  467|    375|    return {items[0], items[1], items[2], items[3], items[4], items[5]};
  468|    375|}
_ZNK16QPDFObjectHandle16getArrayAsVectorEv:
  472|  8.70k|{
  473|  8.70k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (473:14): [True: 8.70k, False: 0]
  ------------------
  474|  8.70k|        return array.getAsVector();
  475|  8.70k|    }
  476|      0|    typeWarning("array", "treating as empty");
  477|      0|    QTC::TC("qpdf", "QPDFObjectHandle array treating as empty vector");
  478|      0|    return {};
  479|  8.70k|}
_ZN16QPDFObjectHandle10appendItemERKS_:
  526|  8.61k|{
  527|  8.61k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (527:14): [True: 8.61k, False: 0]
  ------------------
  528|  8.61k|        array.push_back(item);
  529|  8.61k|    } else {
  530|      0|        typeWarning("array", "ignoring attempt to append item");
  531|      0|        QTC::TC("qpdf", "QPDFObjectHandle array ignoring append item");
  532|      0|    }
  533|  8.61k|}
_ZNK4qpdf10BaseHandle4sizeEv:
  566|   563k|{
  567|   563k|    switch (resolved_type_code()) {
  568|   531k|    case ::ot_array:
  ------------------
  |  Branch (568:5): [True: 531k, False: 31.6k]
  ------------------
  569|   531k|        return as<QPDF_Array>()->size();
  570|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (570:5): [True: 0, False: 563k]
  ------------------
  571|      0|    case ::ot_reserved:
  ------------------
  |  Branch (571:5): [True: 0, False: 563k]
  ------------------
  572|  9.89k|    case ::ot_null:
  ------------------
  |  Branch (572:5): [True: 9.89k, False: 553k]
  ------------------
  573|  9.89k|    case ::ot_destroyed:
  ------------------
  |  Branch (573:5): [True: 0, False: 563k]
  ------------------
  574|  9.89k|    case ::ot_unresolved:
  ------------------
  |  Branch (574:5): [True: 0, False: 563k]
  ------------------
  575|  9.89k|    case ::ot_reference:
  ------------------
  |  Branch (575:5): [True: 0, False: 563k]
  ------------------
  576|  9.89k|        return 0;
  577|     90|    case ::ot_boolean:
  ------------------
  |  Branch (577:5): [True: 90, False: 563k]
  ------------------
  578|  1.50k|    case ::ot_integer:
  ------------------
  |  Branch (578:5): [True: 1.41k, False: 561k]
  ------------------
  579|  1.95k|    case ::ot_real:
  ------------------
  |  Branch (579:5): [True: 444, False: 562k]
  ------------------
  580|  1.97k|    case ::ot_string:
  ------------------
  |  Branch (580:5): [True: 25, False: 563k]
  ------------------
  581|  21.0k|    case ::ot_name:
  ------------------
  |  Branch (581:5): [True: 19.0k, False: 544k]
  ------------------
  582|  21.5k|    case ::ot_dictionary:
  ------------------
  |  Branch (582:5): [True: 503, False: 562k]
  ------------------
  583|  21.8k|    case ::ot_stream:
  ------------------
  |  Branch (583:5): [True: 270, False: 563k]
  ------------------
  584|  21.8k|    case ::ot_inlineimage:
  ------------------
  |  Branch (584:5): [True: 0, False: 563k]
  ------------------
  585|  21.8k|    case ::ot_operator:
  ------------------
  |  Branch (585:5): [True: 0, False: 563k]
  ------------------
  586|  21.8k|        return 1;
  587|      0|    default:
  ------------------
  |  Branch (587:5): [True: 0, False: 563k]
  ------------------
  588|      0|        throw std::logic_error("Unexpected type code in size"); // unreachable
  589|      0|        return 0;                                               // unreachable
  590|   563k|    }
  591|   563k|}
_ZNK4qpdf10BaseHandleixEm:
  595|  2.39k|{
  596|  2.39k|    if (resolved_type_code() == ::ot_array) {
  ------------------
  |  Branch (596:9): [True: 2.39k, False: 0]
  ------------------
  597|  2.39k|        return Array(obj)[n];
  598|  2.39k|    }
  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.39k|{
  608|  2.39k|    if (n < 0) {
  ------------------
  |  Branch (608:9): [True: 0, False: 2.39k]
  ------------------
  609|      0|        return {};
  610|      0|    }
  611|  2.39k|    return (*this)[static_cast<size_t>(n)];
  612|  2.39k|}
QPDF_Array.cc:_ZL4to_si:
   15|  15.3k|{
   16|  15.3k|    return static_cast<size_t>(n);
   17|  15.3k|}
_ZNK4qpdf5Array14checkOwnershipERK16QPDFObjectHandle:
   27|  33.4k|{
   28|  33.4k|    if (!item) {
  ------------------
  |  Branch (28:9): [True: 0, False: 33.4k]
  ------------------
   29|      0|        throw std::logic_error("Attempting to add an uninitialized object to a QPDF_Array.");
   30|      0|    }
   31|  33.4k|    if (qpdf() && item.qpdf() && qpdf() != item.qpdf()) {
  ------------------
  |  Branch (31:9): [True: 1.23k, False: 32.1k]
  |  Branch (31:19): [True: 1.13k, False: 105]
  |  Branch (31:34): [True: 0, False: 1.13k]
  ------------------
   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|  33.4k|}
QPDF_Array.cc:_ZL4to_im:
   21|   520k|{
   22|   520k|    return static_cast<int>(n);
   23|   520k|}

_ZNK4qpdf14BaseDictionary4dictEv:
   12|  13.7k|{
   13|  13.7k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (13:14): [True: 13.7k, False: 0]
  ------------------
   14|  13.7k|        return d;
   15|  13.7k|    }
   16|      0|    throw std::runtime_error("Expected a dictionary but found a non-dictionary object");
   17|      0|    return nullptr; // unreachable
   18|  13.7k|}
_ZNK4qpdf10BaseHandleixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   22|  2.16M|{
   23|  2.16M|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (23:14): [True: 2.11M, False: 56.3k]
  ------------------
   24|  2.11M|        auto it = d->items.find(key);
   25|  2.11M|        if (it != d->items.end()) {
  ------------------
  |  Branch (25:13): [True: 1.40M, False: 706k]
  ------------------
   26|  1.40M|            return it->second;
   27|  1.40M|        }
   28|  2.11M|    }
   29|   763k|    static const QPDFObjectHandle null_obj;
   30|   763k|    return null_obj;
   31|  2.16M|}
_ZNK4qpdf10BaseHandle8containsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   63|   194k|{
   64|   194k|    return !(*this)[key].null();
   65|   194k|}
_ZN4qpdf14BaseDictionary7getKeysEv:
   99|  13.7k|{
  100|  13.7k|    std::set<std::string> result;
  101|  46.1k|    for (auto& iter: dict()->items) {
  ------------------
  |  Branch (101:20): [True: 46.1k, False: 13.7k]
  ------------------
  102|  46.1k|        if (!iter.second.null()) {
  ------------------
  |  Branch (102:13): [True: 42.6k, False: 3.46k]
  ------------------
  103|  42.6k|            result.insert(iter.first);
  104|  42.6k|        }
  105|  46.1k|    }
  106|  13.7k|    return result;
  107|  13.7k|}
_ZN4qpdf10BaseHandle5eraseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  117|  25.2k|{
  118|       |    // no-op if key does not exist
  119|  25.2k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (119:14): [True: 25.2k, False: 0]
  ------------------
  120|  25.2k|        return d->items.erase(key);
  121|  25.2k|    }
  122|      0|    return 0;
  123|  25.2k|}
_ZN4qpdf10BaseHandle7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  140|   216k|{
  141|   216k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (141:14): [True: 216k, False: 223]
  ------------------
  142|   216k|        if (value.null() && !value.indirect()) {
  ------------------
  |  Branch (142:13): [True: 46.6k, False: 169k]
  |  Branch (142:29): [True: 44.0k, False: 2.54k]
  ------------------
  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|  44.0k|            d->items.erase(key);
  147|   172k|        } else {
  148|       |            // add or replace value
  149|   172k|            d->items[key] = value;
  150|   172k|        }
  151|   216k|        return true;
  152|   216k|    }
  153|    223|    return false;
  154|   216k|}
_ZN4qpdf14BaseDictionary7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  172|   209k|{
  173|   209k|    if (!BaseHandle::replace(key, value)) {
  ------------------
  |  Branch (173:9): [True: 0, False: 209k]
  ------------------
  174|      0|        (void)dict();
  175|      0|    }
  176|   209k|}
_ZN4qpdf10DictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  179|  50.7k|    BaseDictionary(std::move(dict))
  180|  50.7k|{
  181|  50.7k|}
_ZN4qpdf10DictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  184|   278k|    BaseDictionary(obj)
  185|   278k|{
  186|   278k|}
_ZN4qpdf10Dictionary5emptyEv:
  190|  20.8k|{
  191|  20.8k|    return Dictionary(std::map<std::string, QPDFObjectHandle>());
  192|  20.8k|}
_ZNK16QPDFObjectHandle14checkOwnershipERKS_:
  196|   176k|{
  197|   176k|    auto qpdf = getOwningQPDF();
  198|   176k|    auto item_qpdf = item.getOwningQPDF();
  199|   176k|    if (qpdf && item_qpdf && qpdf != item_qpdf) {
  ------------------
  |  Branch (199:9): [True: 131k, False: 44.3k]
  |  Branch (199:17): [True: 32.8k, False: 99.1k]
  |  Branch (199:30): [True: 0, False: 32.8k]
  ------------------
  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|   176k|}
_ZNK16QPDFObjectHandle6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  208|   134k|{
  209|   134k|    if (Dictionary dict = *this) {
  ------------------
  |  Branch (209:20): [True: 134k, False: 206]
  ------------------
  210|   134k|        return dict.contains(key);
  211|   134k|    } else {
  212|    206|        typeWarning("dictionary", "returning false for a key containment request");
  213|    206|        QTC::TC("qpdf", "QPDFObjectHandle dictionary false for hasKey");
  214|    206|        return false;
  215|    206|    }
  216|   134k|}
_ZNK16QPDFObjectHandle6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  220|   796k|{
  221|   796k|    if (auto result = get(key)) {
  ------------------
  |  Branch (221:14): [True: 512k, False: 284k]
  ------------------
  222|   512k|        return result;
  223|   512k|    }
  224|   284k|    if (isDictionary()) {
  ------------------
  |  Branch (224:9): [True: 283k, False: 254]
  ------------------
  225|   283k|        static auto constexpr msg = " -> dictionary key $VD"sv;
  226|   283k|        return QPDF_Null::create(obj, msg, key);
  227|   283k|    }
  228|    254|    typeWarning("dictionary", "returning null for attempted key retrieval");
  229|    254|    static auto constexpr msg = " -> null returned from getting key $VD from non-Dictionary"sv;
  230|    254|    return QPDF_Null::create(obj, msg, "");
  231|   284k|}
_ZNK16QPDFObjectHandle12getKeyIfDictERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  235|  17.8k|{
  236|  17.8k|    return isNull() ? newNull() : getKey(key);
  ------------------
  |  Branch (236:12): [True: 209, False: 17.6k]
  ------------------
  237|  17.8k|}
_ZNK16QPDFObjectHandle7getKeysEv:
  241|  14.0k|{
  242|  14.0k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (242:14): [True: 13.7k, False: 275]
  ------------------
  243|  13.7k|        return dict.getKeys();
  244|  13.7k|    }
  245|    275|    typeWarning("dictionary", "treating as empty");
  246|    275|    QTC::TC("qpdf", "QPDFObjectHandle dictionary empty set for getKeys");
  247|    275|    return {};
  248|  14.0k|}
_ZN16QPDFObjectHandle10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  263|   185k|{
  264|   185k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (264:14): [True: 176k, False: 9.50k]
  ------------------
  265|   176k|        checkOwnership(value);
  266|   176k|        dict.replace(key, value);
  267|   176k|        return;
  268|   176k|    }
  269|  9.50k|    typeWarning("dictionary", "ignoring key replacement request");
  270|  9.50k|}
_ZN16QPDFObjectHandle19replaceKeyAndGetNewERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  274|  7.36k|{
  275|  7.36k|    replaceKey(key, value);
  276|  7.36k|    return value;
  277|  7.36k|}
_ZN16QPDFObjectHandle9removeKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  289|  20.2k|{
  290|  20.2k|    if (erase(key) || isDictionary()) {
  ------------------
  |  Branch (290:9): [True: 9.48k, False: 10.7k]
  |  Branch (290:23): [True: 10.7k, False: 0]
  ------------------
  291|  20.2k|        return;
  292|  20.2k|    }
  293|      0|    typeWarning("dictionary", "ignoring key removal request");
  294|      0|}

_ZN4QPDF3Doc7Objects7StreamsC2ERNS0_6CommonE:
  126|  24.5k|    Common(common),
  127|  24.5k|    copier_(std::make_shared<Copier>(*this))
  128|  24.5k|{
  129|  24.5k|}
_ZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  225|  45.6k|{
  226|  45.6k|    if (filter_factories_registered) [[unlikely]] {
  ------------------
  |  Branch (226:9): [True: 0, False: 45.6k]
  ------------------
  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|  45.6k|    if (name == "/FlateDecode") {
  ------------------
  |  Branch (235:9): [True: 6.36k, False: 39.3k]
  ------------------
  236|  6.36k|        return SF_FlateLzwDecode::flate_factory;
  237|  6.36k|    }
  238|  39.3k|    if (name == "/Crypt") {
  ------------------
  |  Branch (238:9): [True: 4.29k, False: 35.0k]
  ------------------
  239|  4.29k|        return []() { return std::make_shared<SF_Crypt>(); };
  240|  4.29k|    }
  241|  35.0k|    if (name == "/LZWDecode") {
  ------------------
  |  Branch (241:9): [True: 140, False: 34.8k]
  ------------------
  242|    140|        return SF_FlateLzwDecode::lzw_factory;
  243|    140|    }
  244|  34.8k|    if (name == "/RunLengthDecode") {
  ------------------
  |  Branch (244:9): [True: 37, False: 34.8k]
  ------------------
  245|     37|        return SF_RunLengthDecode::factory;
  246|     37|    }
  247|  34.8k|    if (name == "/DCTDecode") {
  ------------------
  |  Branch (247:9): [True: 2.55k, False: 32.2k]
  ------------------
  248|  2.55k|        return SF_DCTDecode::factory;
  249|  2.55k|    }
  250|  32.2k|    if (name == "/ASCII85Decode") {
  ------------------
  |  Branch (250:9): [True: 3.06k, False: 29.2k]
  ------------------
  251|  3.06k|        return SF_ASCII85Decode::factory;
  252|  3.06k|    }
  253|  29.2k|    if (name == "/ASCIIHexDecode") {
  ------------------
  |  Branch (253:9): [True: 89, False: 29.1k]
  ------------------
  254|     89|        return SF_ASCIIHexDecode::factory;
  255|     89|    }
  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|  29.1k|    if (name == "/Fl") {
  ------------------
  |  Branch (260:9): [True: 12.5k, False: 16.5k]
  ------------------
  261|  12.5k|        return SF_FlateLzwDecode::flate_factory;
  262|  12.5k|    }
  263|  16.5k|    if (name == "/AHx") {
  ------------------
  |  Branch (263:9): [True: 1.31k, False: 15.2k]
  ------------------
  264|  1.31k|        return SF_ASCIIHexDecode::factory;
  265|  1.31k|    }
  266|  15.2k|    if (name == "/A85") {
  ------------------
  |  Branch (266:9): [True: 110, False: 15.1k]
  ------------------
  267|    110|        return SF_ASCII85Decode::factory;
  268|    110|    }
  269|  15.1k|    if (name == "/LZW") {
  ------------------
  |  Branch (269:9): [True: 5.71k, False: 9.39k]
  ------------------
  270|  5.71k|        return SF_FlateLzwDecode::lzw_factory;
  271|  5.71k|    }
  272|  9.39k|    if (name == "/RL") {
  ------------------
  |  Branch (272:9): [True: 8.94k, False: 444]
  ------------------
  273|  8.94k|        return SF_RunLengthDecode::factory;
  274|  8.94k|    }
  275|    444|    if (name == "/DCT") {
  ------------------
  |  Branch (275:9): [True: 96, False: 348]
  ------------------
  276|     96|        return SF_DCTDecode::factory;
  277|     96|    }
  278|    348|    return nullptr;
  279|    444|}
_ZN4qpdf6StreamC2ER4QPDF10QPDFObjGen16QPDFObjectHandlexm:
  283|  48.0k|    BaseHandle(QPDFObject::create<QPDF_Stream>(&qpdf, og, std::move(stream_dict), length))
  284|  48.0k|{
  285|  48.0k|    auto descr = std::make_shared<QPDFObject::Description>(
  286|  48.0k|        qpdf.getFilename() + ", stream object " + og.unparse(' '));
  287|  48.0k|    obj->setDescription(&qpdf, descr, offset);
  288|  48.0k|    setDictDescription();
  289|  48.0k|}
_ZN4qpdf6Stream4copyEv:
  293|  1.14k|{
  294|  1.14k|    Stream result = qpdf()->newStream();
  295|  1.14k|    result.stream()->stream_dict = getDict().copy();
  296|  1.14k|    copy_data_to(result);
  297|  1.14k|    return result;
  298|  1.14k|}
_ZN4qpdf6Stream12copy_data_toERS0_:
  302|  1.14k|{
  303|  1.14k|    qpdf_expect(dest);
  ------------------
  |  |   13|  1.14k|#define qpdf_expect assert
  ------------------
  |  Branch (303:5): [True: 1.14k, False: 0]
  ------------------
  304|  1.14k|    auto s = stream();
  305|  1.14k|    auto& d_streams = dest.qpdf()->doc().objects().streams();
  306|       |
  307|  1.14k|    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.14k|    if (qpdf()->doc().config().immediate_copy_from() && !s->stream_data) {
  ------------------
  |  Branch (311:9): [True: 0, False: 1.14k]
  |  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.14k|    if (s->stream_data) {
  ------------------
  |  Branch (318:9): [True: 11, False: 1.13k]
  ------------------
  319|     11|        dest.replaceStreamData(s->stream_data, dict["/Filter"], dict["/DecodeParms"]);
  320|  1.13k|    } else {
  321|  1.13k|        d_streams.copier()->register_copy(dest, *this, s->stream_provider.get());
  322|  1.13k|        dest.replaceStreamData(d_streams.copier(), dict["/Filter"], dict["/DecodeParms"]);
  323|  1.13k|    }
  324|  1.14k|}
_ZN4qpdf6Stream18setDictDescriptionEv:
  451|  52.0k|{
  452|  52.0k|    auto s = stream();
  453|  52.0k|    if (!s->stream_dict.hasObjectDescription()) {
  ------------------
  |  Branch (453:9): [True: 20.9k, False: 31.1k]
  ------------------
  454|  20.9k|        s->stream_dict.setObjectDescription(
  455|  20.9k|            obj->getQPDF(), obj->getDescription() + " -> stream dictionary");
  456|  20.9k|    }
  457|  52.0k|}
_ZN4qpdf6Stream13getStreamDataE26qpdf_stream_decode_level_e:
  461|  19.1k|{
  462|  19.1k|    std::string result;
  463|  19.1k|    pl::String buf(result);
  464|  19.1k|    bool filtered;
  465|  19.1k|    pipeStreamData(&buf, &filtered, 0, decode_level, false, false);
  466|  19.1k|    if (!filtered) {
  ------------------
  |  Branch (466:9): [True: 3.32k, False: 15.8k]
  ------------------
  467|  3.32k|        throw QPDFExc(
  468|  3.32k|            qpdf_e_unsupported,
  469|  3.32k|            qpdf()->getFilename(),
  470|  3.32k|            "",
  471|  3.32k|            offset(),
  472|  3.32k|            "getStreamData called on unfilterable stream");
  473|  3.32k|    }
  474|  15.8k|    return result;
  475|  19.1k|}
_ZNK4qpdf6Stream14isRootMetadataEv:
  495|  32.6k|{
  496|  32.6k|    if (!stream()->stream_dict.isDictionaryOfType("/Metadata", "/XML")) {
  ------------------
  |  Branch (496:9): [True: 32.5k, False: 81]
  ------------------
  497|  32.5k|        return false;
  498|  32.5k|    }
  499|     81|    return qpdf()->getRoot()["/Metadata"].isSameObjectAs(obj);
  500|  32.6k|}
_ZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEE:
  506|  50.1k|{
  507|  50.1k|    auto s = stream();
  508|       |    // Check filters
  509|       |
  510|  50.1k|    auto const& filter_obj = s->stream_dict["/Filter"];
  511|       |
  512|  50.1k|    if (filter_obj.null()) {
  ------------------
  |  Branch (512:9): [True: 26.4k, False: 23.7k]
  ------------------
  513|       |        // No filters
  514|  26.4k|        return true;
  515|  26.4k|    }
  516|  23.7k|    if (filter_obj.size() > global::Limits::max_stream_filters()) {
  ------------------
  |  Branch (516:9): [True: 31, False: 23.6k]
  ------------------
  517|     31|        global::Limits::error();
  518|     31|        warn(
  519|     31|            "limits error(max-stream-filters): too many filters for stream; treating stream as "
  520|     31|            "not filterable");
  521|     31|        return false;
  522|     31|    }
  523|  23.6k|    if (filter_obj.isName()) {
  ------------------
  |  Branch (523:9): [True: 17.3k, False: 6.33k]
  ------------------
  524|       |        // One filter
  525|  17.3k|        auto ff = s->filter_factory(filter_obj.getName());
  526|  17.3k|        if (!ff) {
  ------------------
  |  Branch (526:13): [True: 150, False: 17.1k]
  ------------------
  527|    150|            return false;
  528|    150|        }
  529|  17.1k|        filters.emplace_back(ff());
  530|  17.1k|    } else if (Array array = filter_obj) {
  ------------------
  |  Branch (530:22): [True: 6.31k, False: 22]
  ------------------
  531|       |        // Potentially multiple filters
  532|  28.3k|        for (Name item: array) {
  ------------------
  |  Branch (532:23): [True: 28.3k, False: 6.09k]
  ------------------
  533|  28.3k|            if (!item) {
  ------------------
  |  Branch (533:17): [True: 24, False: 28.3k]
  ------------------
  534|     24|                warn("stream filter type is not name or array");
  535|     24|                return false;
  536|     24|            }
  537|  28.3k|            auto ff = s->filter_factory(item);
  538|  28.3k|            if (!ff) {
  ------------------
  |  Branch (538:17): [True: 198, False: 28.1k]
  ------------------
  539|    198|                filters.clear();
  540|    198|                return false;
  541|    198|            }
  542|  28.1k|            filters.emplace_back(ff());
  543|  28.1k|        }
  544|  6.31k|    } else {
  545|     22|        warn("stream filter type is not name or array");
  546|     22|        return false;
  547|     22|    }
  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|  23.2k|    auto decode_obj = s->stream_dict.getKey("/DecodeParms");
  553|       |
  554|  23.2k|    auto can_filter = // linebreak
  555|  23.2k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  23.2k|        if (!filter.setDecodeParms(d_obj) ||
  557|  23.2k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  558|  23.2k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  559|  23.2k|            return false;
  560|  23.2k|        }
  561|  23.2k|        return true;
  562|  23.2k|    };
  563|       |
  564|  23.2k|    auto decode_array = decode_obj.as_array(strict);
  565|  23.2k|    if (!decode_array || decode_array.size() == 0) {
  ------------------
  |  Branch (565:9): [True: 22.8k, False: 396]
  |  Branch (565:26): [True: 70, False: 326]
  ------------------
  566|  22.9k|        if (decode_array) {
  ------------------
  |  Branch (566:13): [True: 70, False: 22.8k]
  ------------------
  567|     70|            decode_obj = QPDFObjectHandle::newNull();
  568|     70|        }
  569|       |
  570|  43.9k|        for (auto& filter: filters) {
  ------------------
  |  Branch (570:26): [True: 43.9k, False: 22.7k]
  ------------------
  571|  43.9k|            if (!can_filter(decode_level, *filter, decode_obj)) {
  ------------------
  |  Branch (571:17): [True: 249, False: 43.6k]
  ------------------
  572|    249|                return false;
  573|    249|            }
  574|  43.9k|        }
  575|  22.9k|    } 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|    326|        if (!filters.empty() && QIntC::to_size(decode_array.size()) != filters.size()) {
  ------------------
  |  Branch (578:13): [True: 316, False: 10]
  |  Branch (578:13): [True: 21, False: 305]
  |  Branch (578:33): [True: 21, False: 295]
  ------------------
  579|     21|            warn("stream /DecodeParms length is inconsistent with filters");
  580|     21|            return false;
  581|     21|        }
  582|       |
  583|    305|        int i = -1;
  584|    332|        for (auto& filter: filters) {
  ------------------
  |  Branch (584:26): [True: 332, False: 294]
  ------------------
  585|    332|            auto d_obj = decode_array.get(++i);
  586|    332|            if (!can_filter(decode_level, *filter, d_obj)) {
  ------------------
  |  Branch (586:17): [True: 11, False: 321]
  ------------------
  587|     11|                return false;
  588|     11|            }
  589|    332|        }
  590|    305|    }
  591|       |
  592|  23.0k|    return true;
  593|  23.2k|}
_ZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebb:
  603|  50.1k|{
  604|  50.1k|    auto s = stream();
  605|  50.1k|    std::vector<std::shared_ptr<QPDFStreamFilter>> filters;
  606|  50.1k|    bool ignored;
  607|  50.1k|    if (!filterp) {
  ------------------
  |  Branch (607:9): [True: 0, False: 50.1k]
  ------------------
  608|      0|        filterp = &ignored;
  609|      0|    }
  610|  50.1k|    bool& filter = *filterp;
  611|       |
  612|  50.1k|    const bool empty_stream = !s->stream_provider && !s->stream_data && s->length == 0;
  ------------------
  |  Branch (612:31): [True: 45.6k, False: 4.51k]
  |  Branch (612:54): [True: 31.5k, False: 14.0k]
  |  Branch (612:73): [True: 5.70k, False: 25.8k]
  ------------------
  613|  50.1k|    const bool empty_stream_data = s->stream_data && s->stream_data->getSize() == 0;
  ------------------
  |  Branch (613:36): [True: 14.0k, False: 36.0k]
  |  Branch (613:54): [True: 318, False: 13.7k]
  ------------------
  614|  50.1k|    const bool empty = empty_stream || empty_stream_data;
  ------------------
  |  Branch (614:24): [True: 5.70k, False: 44.4k]
  |  Branch (614:40): [True: 318, False: 44.1k]
  ------------------
  615|       |
  616|  50.1k|    if (empty_stream || empty_stream_data) {
  ------------------
  |  Branch (616:9): [True: 5.70k, False: 44.4k]
  |  Branch (616:25): [True: 318, False: 44.1k]
  ------------------
  617|  6.02k|        filter = true;
  618|  6.02k|    }
  619|       |
  620|  50.1k|    filter = empty || encode_flags || decode_level != qpdf_dl_none;
  ------------------
  |  Branch (620:14): [True: 6.02k, False: 44.1k]
  |  Branch (620:23): [True: 0, False: 44.1k]
  |  Branch (620:39): [True: 44.1k, False: 0]
  ------------------
  621|  50.1k|    if (filter) {
  ------------------
  |  Branch (621:9): [True: 50.1k, False: 0]
  ------------------
  622|  50.1k|        filter = filterable(decode_level, filters);
  623|  50.1k|    }
  624|       |
  625|  50.1k|    if (!pipeline) {
  ------------------
  |  Branch (625:9): [True: 0, False: 50.1k]
  ------------------
  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|  50.1k|    std::vector<std::unique_ptr<Pipeline>> to_delete;
  635|       |
  636|  50.1k|    ContentNormalizer normalizer;
  637|  50.1k|    if (filter) {
  ------------------
  |  Branch (637:9): [True: 49.4k, False: 709]
  ------------------
  638|  49.4k|        if (encode_flags & qpdf_ef_compress) {
  ------------------
  |  Branch (638:13): [True: 0, False: 49.4k]
  ------------------
  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|  49.4k|        if (encode_flags & qpdf_ef_normalize) {
  ------------------
  |  Branch (645:13): [True: 0, False: 49.4k]
  ------------------
  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|  49.4k|        for (auto iter = s->token_filters.rbegin(); iter != s->token_filters.rend(); ++iter) {
  ------------------
  |  Branch (652:53): [True: 0, False: 49.4k]
  ------------------
  653|      0|            auto new_pipeline =
  654|      0|                std::make_unique<Pl_QPDFTokenizer>("token filter", (*iter).get(), pipeline);
  655|      0|            pipeline = new_pipeline.get();
  656|      0|            to_delete.push_back(std::move(new_pipeline));
  657|      0|        }
  658|       |
  659|  93.4k|        for (auto f_iter = filters.rbegin(); f_iter != filters.rend(); ++f_iter) {
  ------------------
  |  Branch (659:46): [True: 43.9k, False: 49.4k]
  ------------------
  660|  43.9k|            if (auto decode_pipeline = (*f_iter)->getDecodePipeline(pipeline)) {
  ------------------
  |  Branch (660:22): [True: 39.7k, False: 4.25k]
  ------------------
  661|  39.7k|                pipeline = decode_pipeline;
  662|  39.7k|            }
  663|  43.9k|            auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
  664|  43.9k|            if (flate) {
  ------------------
  |  Branch (664:17): [True: 18.8k, False: 25.1k]
  ------------------
  665|  18.8k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });
  666|  18.8k|            }
  667|  43.9k|        }
  668|  49.4k|    }
  669|       |
  670|  50.1k|    if (s->stream_data.get()) {
  ------------------
  |  Branch (670:9): [True: 14.0k, False: 36.0k]
  ------------------
  671|  14.0k|        QTC::TC("qpdf", "QPDF_Stream pipe replaced stream data");
  672|  14.0k|        pipeline->write(s->stream_data->getBuffer(), s->stream_data->getSize());
  673|  14.0k|        pipeline->finish();
  674|  36.0k|    } else if (s->stream_provider.get()) {
  ------------------
  |  Branch (674:16): [True: 4.51k, False: 31.5k]
  ------------------
  675|  4.51k|        Pl_Count count("stream provider count", pipeline);
  676|  4.51k|        if (s->stream_provider->supportsRetry()) {
  ------------------
  |  Branch (676:13): [True: 0, False: 4.51k]
  ------------------
  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.51k|        } else {
  683|  4.51k|            s->stream_provider->provideStreamData(obj->getObjGen(), &count);
  684|  4.51k|        }
  685|  4.51k|        qpdf_offset_t actual_length = count.getCount();
  686|  4.51k|        if (auto desired_length = Length()) {
  ------------------
  |  Branch (686:18): [True: 0, False: 4.51k]
  ------------------
  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.51k|        } else {
  696|  4.51k|            Length(actual_length);
  697|  4.51k|        }
  698|  31.5k|    } else {
  699|  31.5k|        if (offset() == 0) {
  ------------------
  |  Branch (699:13): [True: 0, False: 31.5k]
  ------------------
  700|      0|            throw std::logic_error("pipeStreamData called for stream with no data");
  701|      0|        }
  702|  31.5k|        if (!Streams::pipeStreamData(
  ------------------
  |  Branch (702:13): [True: 3.34k, False: 28.2k]
  ------------------
  703|  31.5k|                qpdf(),
  704|  31.5k|                id_gen(),
  705|  31.5k|                offset(),
  706|  31.5k|                s->length,
  707|  31.5k|                s->stream_dict,
  708|  31.5k|                isRootMetadata(),
  709|  31.5k|                pipeline,
  710|  31.5k|                suppress_warnings,
  711|  31.5k|                will_retry)) {
  712|  3.34k|            filter = false;
  713|  3.34k|            return false;
  714|  3.34k|        }
  715|  31.5k|    }
  716|       |
  717|  46.7k|    if (filter && !suppress_warnings && normalizer.anyBadTokens()) {
  ------------------
  |  Branch (717:9): [True: 45.7k, False: 1.09k]
  |  Branch (717:19): [True: 45.7k, False: 0]
  |  Branch (717:41): [True: 0, False: 45.7k]
  ------------------
  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|  46.7k|    return true;
  733|  50.1k|}
_ZN4qpdf6Stream17replaceStreamDataEONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERK16QPDFObjectHandleSB_:
  738|  21.0k|{
  739|  21.0k|    auto s = stream();
  740|  21.0k|    s->stream_data = std::make_shared<Buffer>(std::move(data));
  741|  21.0k|    s->stream_provider = nullptr;
  742|  21.0k|    replaceFilterData(filter, decode_parms, s->stream_data->getSize());
  743|  21.0k|}
_ZN4qpdf6Stream17replaceStreamDataENSt3__110shared_ptrI6BufferEERK16QPDFObjectHandleS7_:
  750|     11|{
  751|     11|    auto s = stream();
  752|     11|    s->stream_data = data;
  753|     11|    s->stream_provider = nullptr;
  754|     11|    replaceFilterData(filter, decode_parms, data->size());
  755|     11|}
_ZN4qpdf6Stream17replaceStreamDataENSt3__110shared_ptrIN16QPDFObjectHandle18StreamDataProviderEEERKS3_S7_:
  762|  5.64k|{
  763|  5.64k|    auto s = stream();
  764|  5.64k|    s->stream_provider = provider;
  765|  5.64k|    s->stream_data = nullptr;
  766|  5.64k|    replaceFilterData(filter, decode_parms, 0);
  767|  5.64k|}
_ZN4qpdf6Stream17replaceFilterDataERK16QPDFObjectHandleS3_m:
  772|  26.7k|{
  773|  26.7k|    auto s = stream();
  774|  26.7k|    if (filter) {
  ------------------
  |  Branch (774:9): [True: 15.3k, False: 11.3k]
  ------------------
  775|  15.3k|        s->stream_dict.replaceKey("/Filter", filter);
  776|  15.3k|    }
  777|  26.7k|    if (decode_parms) {
  ------------------
  |  Branch (777:9): [True: 14.2k, False: 12.4k]
  ------------------
  778|  14.2k|        s->stream_dict.replaceKey("/DecodeParms", decode_parms);
  779|  14.2k|    }
  780|  26.7k|    if (length == 0) {
  ------------------
  |  Branch (780:9): [True: 6.02k, False: 20.6k]
  ------------------
  781|  6.02k|        s->stream_dict.removeKey("/Length");
  782|  20.6k|    } else {
  783|  20.6k|        Length(length);
  784|  20.6k|    }
  785|  26.7k|}
_ZN4qpdf6Stream4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  789|  6.56k|{
  790|  6.56k|    qpdf()->warn(qpdf_e_damaged_pdf, "", offset(), message);
  791|  6.56k|}
_ZNK16QPDFObjectHandle7getDictEv:
  795|  42.7k|{
  796|  42.7k|    return as_stream(error).getDict();
  797|  42.7k|}
_ZN16QPDFObjectHandle13getStreamDataE26qpdf_stream_decode_level_e:
  831|  6.54k|{
  832|  6.54k|    return std::make_shared<Buffer>(as_stream(error).getStreamData(level));
  833|  6.54k|}
_ZN16QPDFObjectHandle14pipeStreamDataEP8Pipelinei26qpdf_stream_decode_level_ebb:
  861|  30.9k|{
  862|  30.9k|    bool filtering_attempted;
  863|  30.9k|    as_stream(error).pipeStreamData(
  864|  30.9k|        p, &filtering_attempted, encode_flags, decode_level, suppress_warnings, will_retry);
  865|  30.9k|    return filtering_attempted;
  866|  30.9k|}
_ZN16QPDFObjectHandle17replaceStreamDataERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_SA_:
  897|  11.2k|{
  898|  11.2k|    std::string s(data);
  899|  11.2k|    as_stream(error).replaceStreamData(std::move(s), filter, decode_parms);
  900|  11.2k|}
_ZN16QPDFObjectHandle17replaceStreamDataENSt3__110shared_ptrINS_18StreamDataProviderEEERKS_S5_:
  907|  4.51k|{
  908|  4.51k|    as_stream(error).replaceStreamData(provider, filter, decode_parms);
  909|  4.51k|}
_ZN4QPDF3Doc7Objects7Streams6Copier13register_copyERN4qpdf6StreamES6_b:
  109|  1.13k|    {
  110|  1.13k|        qpdf_expect(source);
  ------------------
  |  |   13|  1.13k|#define qpdf_expect assert
  ------------------
  |  Branch (110:9): [True: 1.13k, False: 0]
  ------------------
  111|  1.13k|        qpdf_expect(dest);
  ------------------
  |  |   13|  1.13k|#define qpdf_expect assert
  ------------------
  |  Branch (111:9): [True: 1.13k, False: 0]
  ------------------
  112|  1.13k|        if (provider) {
  ------------------
  |  Branch (112:13): [True: 0, False: 1.13k]
  ------------------
  113|      0|            copied_streams.insert_or_assign(dest, source);
  114|  1.13k|        } else {
  115|  1.13k|            copied_data.insert_or_assign(dest, Data(source, dest.getDict()));
  116|  1.13k|        }
  117|  1.13k|    }
_ZN4QPDF3Doc7Objects7Streams6Copier4DataC2ERN4qpdf6StreamERKNS5_10DictionaryE:
   38|  1.13k|            encp(source.qpdf()->m->encp),
   39|  1.13k|            file(source.qpdf()->m->file),
   40|  1.13k|            source_og(source.id_gen()),
   41|  1.13k|            offset(source.offset()),
   42|  1.13k|            length(source.getLength()),
   43|  1.13k|            dest_dict(dest_dict),
   44|  1.13k|            is_root_metadata(source.isRootMetadata())
   45|  1.13k|        {
   46|  1.13k|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEEENK3$_0clIS1_S5_16QPDFObjectHandleEEbT_RT0_RT1_:
  555|  44.2k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  44.2k|        if (!filter.setDecodeParms(d_obj) ||
  ------------------
  |  Branch (556:13): [True: 249, False: 44.0k]
  |  Branch (556:13): [True: 260, False: 44.0k]
  ------------------
  557|  44.0k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  ------------------
  |  Branch (557:14): [True: 39.7k, False: 4.29k]
  |  Branch (557:39): [True: 14, False: 39.7k]
  ------------------
  558|  44.0k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  ------------------
  |  Branch (558:14): [True: 0, False: 44.0k]
  |  Branch (558:47): [True: 0, False: 0]
  ------------------
  559|    260|            return false;
  560|    260|        }
  561|  44.0k|        return true;
  562|  44.2k|    };
_ZN4QPDF3Doc7Objects7Streams6CopierC2ERS2_:
   67|  24.5k|        QPDFObjectHandle::StreamDataProvider(true),
   68|  24.5k|        streams(streams)
   69|  24.5k|    {
   70|  24.5k|    }
_ZN4QPDF3Doc7Objects7Streams6CopierD2Ev:
   64|  24.5k|    ~Copier() final = default;
QPDF_Stream.cc:_ZZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clEv:
  239|  4.29k|        return []() { return std::make_shared<SF_Crypt>(); };
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_CryptC2Ev:
  136|  4.29k|        SF_Crypt() = default;
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt14setDecodeParmsE16QPDFObjectHandle:
  141|  4.28k|        {
  142|       |            // we only validate here - processing happens in decryptStream
  143|  4.28k|            if (Dictionary dict = decode_parms) {
  ------------------
  |  Branch (143:28): [True: 3.01k, False: 1.26k]
  ------------------
  144|  11.2k|                for (auto const& [key, value]: dict) {
  ------------------
  |  Branch (144:46): [True: 11.2k, False: 2.94k]
  ------------------
  145|  11.2k|                    if (key == "/Type" &&
  ------------------
  |  Branch (145:25): [True: 2.47k, False: 8.82k]
  |  Branch (145:25): [True: 2.43k, False: 8.86k]
  ------------------
  146|  2.47k|                        (value.null() || Name(value) == "/CryptFilterDecodeParms")) {
  ------------------
  |  Branch (146:26): [True: 276, False: 2.19k]
  |  Branch (146:42): [True: 2.15k, False: 39]
  ------------------
  147|  2.43k|                        continue;
  148|  2.43k|                    }
  149|  8.86k|                    if (key == "/Name") {
  ------------------
  |  Branch (149:25): [True: 2.39k, False: 6.46k]
  ------------------
  150|  2.39k|                        continue;
  151|  2.39k|                    }
  152|  6.46k|                    if (!value.null()) {
  ------------------
  |  Branch (152:25): [True: 71, False: 6.39k]
  ------------------
  153|     71|                        return false;
  154|     71|                    }
  155|  6.46k|                }
  156|  2.94k|                return true;
  157|  3.01k|            }
  158|  1.26k|            return decode_parms.null();
  159|  4.28k|        }
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt17getDecodePipelineEP8Pipeline:
  163|  4.20k|        {
  164|       |            // Not used -- handled by pipeStreamData
  165|  4.20k|            return nullptr;
  166|  4.20k|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebbENK3$_0clEPKci:
  665|  6.47k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });

_ZN11QPDF_String9writeJSONEiRN4JSON6WriterE:
   18|  79.4k|{
   19|  79.4k|    if (json_version == 1) {
  ------------------
  |  Branch (19:9): [True: 0, False: 79.4k]
  ------------------
   20|      0|        if (util::is_utf16(val)) {
  ------------------
  |  Branch (20:13): [True: 0, False: 0]
  ------------------
   21|      0|            p << "\"" << JSON::Writer::encode_string(QUtil::utf16_to_utf8(val)) << "\"";
   22|      0|            return;
   23|      0|        }
   24|      0|        if (util::is_explicit_utf8(val)) {
  ------------------
  |  Branch (24:13): [True: 0, False: 0]
  ------------------
   25|       |            // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte
   26|       |            // representation of U+FEFF.
   27|      0|            p << "\"" << JSON::Writer::encode_string(val.substr(3)) << "\"";
   28|      0|            return;
   29|      0|        }
   30|      0|        p << "\"" << JSON::Writer::encode_string(QUtil::pdf_doc_to_utf8(val)) << "\"";
   31|      0|        return;
   32|      0|    }
   33|       |    // See if we can unambiguously represent as Unicode.
   34|  79.4k|    if (util::is_utf16(val)) {
  ------------------
  |  Branch (34:9): [True: 2.96k, False: 76.4k]
  ------------------
   35|  2.96k|        p << "\"u:" << JSON::Writer::encode_string(QUtil::utf16_to_utf8(val)) << "\"";
   36|  2.96k|        return;
   37|  2.96k|    }
   38|       |    // See if we can unambiguously represent as Unicode.
   39|  76.4k|    if (util::is_explicit_utf8(val)) {
  ------------------
  |  Branch (39:9): [True: 2.28k, False: 74.1k]
  ------------------
   40|  2.28k|        p << "\"u:" << JSON::Writer::encode_string(val.substr(3)) << "\"";
   41|  2.28k|        return;
   42|  2.28k|    }
   43|  74.1k|    if (!useHexString()) {
  ------------------
  |  Branch (43:9): [True: 47.6k, False: 26.4k]
  ------------------
   44|  47.6k|        auto candidate = QUtil::pdf_doc_to_utf8(val);
   45|  47.6k|        std::string test;
   46|  47.6k|        if (QUtil::utf8_to_pdf_doc(candidate, test, '?') && test == val) {
  ------------------
  |  Branch (46:13): [True: 47.6k, False: 0]
  |  Branch (46:61): [True: 46.9k, False: 756]
  ------------------
   47|       |            // This is a PDF-doc string that can be losslessly encoded as Unicode.
   48|  46.9k|            p << "\"u:" << JSON::Writer::encode_string(candidate) << "\"";
   49|  46.9k|            return;
   50|  46.9k|        }
   51|  47.6k|    }
   52|  27.2k|    p << "\"b:" << QUtil::hex_encode(val) << "\"";
   53|  27.2k|}
_ZNK11QPDF_String12useHexStringEv:
   57|   276k|{
   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|   276k|    unsigned int non_ascii = 0;
   62|  39.2M|    for (auto const ch: val) {
  ------------------
  |  Branch (62:23): [True: 39.2M, False: 200k]
  ------------------
   63|  39.2M|        if (ch > 126) {
  ------------------
  |  Branch (63:13): [True: 11.1k, False: 39.2M]
  ------------------
   64|  11.1k|            ++non_ascii;
   65|  39.2M|        } else if (ch >= 32) {
  ------------------
  |  Branch (65:20): [True: 23.1M, False: 16.1M]
  ------------------
   66|  23.1M|            continue;
   67|  23.1M|        } else if (ch < 0 || ch >= 24) {
  ------------------
  |  Branch (67:20): [True: 3.95M, False: 12.1M]
  |  Branch (67:30): [True: 173k, False: 11.9M]
  ------------------
   68|  4.13M|            ++non_ascii;
   69|  11.9M|        } else if (!(ch == '\n' || ch == '\r' || ch == '\t' || ch == '\b' || ch == '\f')) {
  ------------------
  |  Branch (69:22): [True: 564k, False: 11.4M]
  |  Branch (69:36): [True: 27.9k, False: 11.3M]
  |  Branch (69:50): [True: 1.32M, False: 10.0M]
  |  Branch (69:64): [True: 9.79M, False: 265k]
  |  Branch (69:78): [True: 189k, False: 75.6k]
  ------------------
   70|  75.6k|            return true;
   71|  75.6k|        }
   72|  39.2M|    }
   73|   200k|    return 5 * non_ascii > val.length();
   74|   276k|}
_ZN11QPDF_String7unparseEb:
   78|   201k|{
   79|   201k|    bool use_hexstring = force_binary || useHexString();
  ------------------
  |  Branch (79:26): [True: 0, False: 201k]
  |  Branch (79:42): [True: 69.4k, False: 132k]
  ------------------
   80|   201k|    std::string result;
   81|   201k|    if (use_hexstring) {
  ------------------
  |  Branch (81:9): [True: 69.4k, False: 132k]
  ------------------
   82|  69.4k|        static auto constexpr hexchars = "0123456789abcdef";
   83|  69.4k|        result.reserve(2 * val.length() + 2);
   84|  69.4k|        result += '<';
   85|  46.7M|        for (const char c: val) {
  ------------------
  |  Branch (85:26): [True: 46.7M, False: 69.4k]
  ------------------
   86|  46.7M|            result += hexchars[static_cast<unsigned char>(c) >> 4];
   87|  46.7M|            result += hexchars[c & 0x0f];
   88|  46.7M|        }
   89|  69.4k|        result += '>';
   90|   132k|    } else {
   91|   132k|        result += "(";
   92|  23.1M|        for (unsigned int i = 0; i < val.length(); ++i) {
  ------------------
  |  Branch (92:34): [True: 23.0M, False: 132k]
  ------------------
   93|  23.0M|            char ch = val.at(i);
   94|  23.0M|            switch (ch) {
   95|   377k|            case '\n':
  ------------------
  |  Branch (95:13): [True: 377k, False: 22.6M]
  ------------------
   96|   377k|                result += "\\n";
   97|   377k|                break;
   98|       |
   99|  22.1k|            case '\r':
  ------------------
  |  Branch (99:13): [True: 22.1k, False: 23.0M]
  ------------------
  100|  22.1k|                result += "\\r";
  101|  22.1k|                break;
  102|       |
  103|   716k|            case '\t':
  ------------------
  |  Branch (103:13): [True: 716k, False: 22.3M]
  ------------------
  104|   716k|                result += "\\t";
  105|   716k|                break;
  106|       |
  107|  4.91M|            case '\b':
  ------------------
  |  Branch (107:13): [True: 4.91M, False: 18.1M]
  ------------------
  108|  4.91M|                result += "\\b";
  109|  4.91M|                break;
  110|       |
  111|   129k|            case '\f':
  ------------------
  |  Branch (111:13): [True: 129k, False: 22.9M]
  ------------------
  112|   129k|                result += "\\f";
  113|   129k|                break;
  114|       |
  115|  14.2k|            case '(':
  ------------------
  |  Branch (115:13): [True: 14.2k, False: 23.0M]
  ------------------
  116|  14.2k|                result += "\\(";
  117|  14.2k|                break;
  118|       |
  119|  14.1k|            case ')':
  ------------------
  |  Branch (119:13): [True: 14.1k, False: 23.0M]
  ------------------
  120|  14.1k|                result += "\\)";
  121|  14.1k|                break;
  122|       |
  123|  3.99k|            case '\\':
  ------------------
  |  Branch (123:13): [True: 3.99k, False: 23.0M]
  ------------------
  124|  3.99k|                result += "\\\\";
  125|  3.99k|                break;
  126|       |
  127|  16.8M|            default:
  ------------------
  |  Branch (127:13): [True: 16.8M, False: 6.18M]
  ------------------
  128|  16.8M|                if (is_iso_latin1_printable(ch)) {
  ------------------
  |  Branch (128:21): [True: 16.3M, False: 467k]
  ------------------
  129|  16.3M|                    result += val.at(i);
  130|  16.3M|                } else {
  131|   467k|                    result += "\\" +
  132|   467k|                        QUtil::int_to_string_base(
  133|   467k|                                  static_cast<int>(static_cast<unsigned char>(ch)), 8, 3);
  134|   467k|                }
  135|  16.8M|                break;
  136|  23.0M|            }
  137|  23.0M|        }
  138|   132k|        result += ")";
  139|   132k|    }
  140|       |
  141|   201k|    return result;
  142|   201k|}
QPDF_String.cc:_ZL23is_iso_latin1_printablec:
   12|  16.8M|{
   13|  16.8M|    return (ch >= 32 && ch <= 126) || static_cast<unsigned char>(ch) >= 160;
  ------------------
  |  Branch (13:13): [True: 16.1M, False: 706k]
  |  Branch (13:25): [True: 16.1M, False: 6.16k]
  |  Branch (13:39): [True: 244k, False: 467k]
  ------------------
   14|  16.8M|}

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

_ZN13QPDFXRefEntryC2Ev:
   30|   426k|QPDFXRefEntry::QPDFXRefEntry() = default;
_ZNK13QPDFXRefEntry7getTypeEv:
   42|   847k|{
   43|   847k|    return type;
   44|   847k|}
_ZNK13QPDFXRefEntry9getOffsetEv:
   48|   502k|{
   49|   502k|    util::assertion(type == 1, "getOffset called for xref entry of type != 1");
   50|   502k|    return this->field1;
   51|   502k|}
_ZNK13QPDFXRefEntry18getObjStreamNumberEv:
   55|   104k|{
   56|   104k|    util::assertion(type == 2, "getObjStreamNumber called for xref entry of type != 2");
   57|   104k|    return QIntC::to_int(field1);
   58|   104k|}
_ZN4QPDF3Doc7Objects18validatePDFVersionERPKcRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  165|  4.74k|{
  166|  4.74k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (166:9): [True: 1.34k, False: 3.39k]
  ------------------
  167|  1.34k|        return false;
  168|  1.34k|    }
  169|  8.97k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (169:12): [True: 5.58k, False: 3.39k]
  ------------------
  170|  5.58k|        version.append(1, *p++);
  171|  5.58k|    }
  172|  3.39k|    if (!(*p == '.' && util::is_digit(*(p + 1)))) {
  ------------------
  |  Branch (172:11): [True: 1.95k, False: 1.44k]
  |  Branch (172:24): [True: 1.40k, False: 542]
  ------------------
  173|  1.98k|        return false;
  174|  1.98k|    }
  175|  1.40k|    version.append(1, *p++);
  176|  3.33k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (176:12): [True: 1.92k, False: 1.40k]
  ------------------
  177|  1.92k|        version.append(1, *p++);
  178|  1.92k|    }
  179|  1.40k|    return true;
  180|  3.39k|}
_ZN4QPDF3Doc7Objects10findHeaderEv:
  184|  4.74k|{
  185|  4.74k|    qpdf_offset_t global_offset = m->file->tell();
  186|  4.74k|    std::string line = m->file->readLine(1024);
  187|  4.74k|    char const* p = line.data();
  188|  4.74k|    util::assertion(strncmp(p, "%PDF-", 5) == 0, "findHeader is not looking at %PDF-");
  189|  4.74k|    p += 5;
  190|  4.74k|    std::string version;
  191|       |    // Note: The string returned by line.data() is always null-terminated. The code below never
  192|       |    // overruns the buffer because a null character always short-circuits further advancement.
  193|  4.74k|    if (!validatePDFVersion(p, version)) {
  ------------------
  |  Branch (193:9): [True: 3.33k, False: 1.40k]
  ------------------
  194|  3.33k|        return false;
  195|  3.33k|    }
  196|  1.40k|    m->pdf_version = version;
  197|  1.40k|    if (global_offset != 0) {
  ------------------
  |  Branch (197:9): [True: 979, False: 430]
  ------------------
  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|    979|        m->file = std::make_shared<OffsetInputSource>(m->file, global_offset);
  202|    979|    }
  203|  1.40k|    return true;
  204|  4.74k|}
_ZN4QPDF3Doc7Objects13findStartxrefEv:
  208|  7.34k|{
  209|  7.34k|    if (readToken(*m->file).isWord("startxref") && readToken(*m->file).isInteger()) {
  ------------------
  |  Branch (209:9): [True: 6.98k, False: 367]
  |  Branch (209:9): [True: 5.54k, False: 1.80k]
  |  Branch (209:52): [True: 5.54k, False: 1.43k]
  ------------------
  210|       |        // Position in front of offset token
  211|  5.54k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
  212|  5.54k|        return true;
  213|  5.54k|    }
  214|  1.80k|    return false;
  215|  7.34k|}
_ZN4QPDF3Doc7Objects5parseEPKc:
  219|  24.5k|{
  220|  24.5k|    if (password) {
  ------------------
  |  Branch (220:9): [True: 0, False: 24.5k]
  ------------------
  221|      0|        m->encp->provided_password = password;
  222|      0|    }
  223|       |
  224|       |    // Find the header anywhere in the first 1024 bytes of the file.
  225|  24.5k|    PatternFinder hf(*this, &Objects::findHeader);
  226|  24.5k|    if (!m->file->findFirst("%PDF-", 0, 1024, hf)) {
  ------------------
  |  Branch (226:9): [True: 23.1k, False: 1.40k]
  ------------------
  227|  23.1k|        warn(damagedPDF("", -1, "can't find PDF header"));
  228|       |        // QPDFWriter writes files that usually require at least version 1.2 for /FlateDecode
  229|  23.1k|        m->pdf_version = "1.2";
  230|  23.1k|    }
  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|  24.5k|    m->file->seek(0, SEEK_END);
  235|  24.5k|    qpdf_offset_t end_offset = m->file->tell();
  236|  24.5k|    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|  24.5k|    if (m->xref_table_max_id > m->xref_table_max_offset / 3) {
  ------------------
  |  Branch (239:9): [True: 24.5k, False: 0]
  ------------------
  240|  24.5k|        m->xref_table_max_id = static_cast<int>(m->xref_table_max_offset / 3);
  241|  24.5k|    }
  242|  24.5k|    qpdf_offset_t start_offset = (end_offset > 1054 ? end_offset - 1054 : 0);
  ------------------
  |  Branch (242:35): [True: 6.70k, False: 17.8k]
  ------------------
  243|  24.5k|    PatternFinder sf(*this, &Objects::findStartxref);
  244|  24.5k|    qpdf_offset_t xref_offset = 0;
  245|  24.5k|    if (m->file->findLast("startxref", start_offset, 0, sf)) {
  ------------------
  |  Branch (245:9): [True: 5.02k, False: 19.5k]
  ------------------
  246|  5.02k|        xref_offset = QUtil::string_to_ll(readToken(*m->file).getValue().c_str());
  247|  5.02k|    }
  248|       |
  249|  24.5k|    try {
  250|  24.5k|        if (xref_offset == 0) {
  ------------------
  |  Branch (250:13): [True: 19.5k, False: 4.99k]
  ------------------
  251|  19.5k|            throw damagedPDF("", -1, "can't find startxref");
  252|  19.5k|        }
  253|  4.99k|        try {
  254|  4.99k|            read_xref(xref_offset);
  255|  4.99k|        } catch (QPDFExc&) {
  256|  3.50k|            throw;
  257|  3.50k|        } catch (std::exception& e) {
  258|    446|            throw damagedPDF("", -1, std::string("error reading xref: ") + e.what());
  259|    446|        }
  260|  23.5k|    } catch (QPDFExc& e) {
  261|  23.5k|        if (global::Options::inspection_mode()) {
  ------------------
  |  Branch (261:13): [True: 0, False: 23.5k]
  ------------------
  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|  23.5k|        if (cf.surpress_recovery()) {
  ------------------
  |  Branch (272:13): [True: 0, False: 23.5k]
  ------------------
  273|      0|            throw;
  274|      0|        }
  275|  23.5k|        reconstruct_xref(e, xref_offset > 0);
  276|  23.5k|    }
  277|       |
  278|  11.3k|    m->encp->initialize(qpdf);
  279|  11.3k|    m->parsed = true;
  280|  11.3k|    if (!m->xref_table.empty() && !qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (280:9): [True: 10.6k, False: 721]
  |  Branch (280:9): [True: 9, False: 11.3k]
  |  Branch (280:35): [True: 9, False: 10.6k]
  ------------------
  281|       |        // QPDFs created from JSON have an empty xref table and no root object yet.
  282|      9|        throw damagedPDF("", -1, "unable to find page tree");
  283|      9|    }
  284|  11.3k|    if (m->cf.max_warnings()) {
  ------------------
  |  Branch (284:9): [True: 10.6k, False: 731]
  ------------------
  285|  10.6k|        if (m->pages.empty()) {
  ------------------
  |  Branch (285:13): [True: 8, False: 10.6k]
  ------------------
  286|      8|            throw damagedPDF("", -1, "no pages found");
  287|      8|        }
  288|  10.6k|        (void)m->cf.max_warnings(0);
  289|  10.6k|    }
  290|  11.3k|}
_ZN4QPDF3Doc7Objects7inParseEb:
  294|  43.7M|{
  295|  43.7M|    util::internal_error_if(
  296|  43.7M|        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|  43.7M|    );
  300|  43.7M|    m->in_parse = v;
  301|  43.7M|}
_ZN4QPDF3Doc7Objects10setTrailerE16QPDFObjectHandle:
  305|  7.07k|{
  306|  7.07k|    if (m->trailer) {
  ------------------
  |  Branch (306:9): [True: 219, False: 6.85k]
  ------------------
  307|    219|        return;
  308|    219|    }
  309|  6.85k|    m->trailer = obj;
  310|  6.85k|}
_ZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcb:
  314|  25.1k|{
  315|  25.1k|    if (m->reconstructed_xref) {
  ------------------
  |  Branch (315:9): [True: 1.44k, False: 23.7k]
  ------------------
  316|       |        // Avoid xref reconstruction infinite loops. This is getting very hard to reproduce because
  317|       |        // qpdf is throwing many fewer exceptions while parsing. Most situations are warnings now.
  318|  1.44k|        throw e;
  319|  1.44k|    }
  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|  23.7k|    const auto max_warnings = m->warnings.size() + 1000U;
  324|  23.7k|    auto check_warnings = [this, max_warnings]() {
  325|  23.7k|        if (m->warnings.size() > max_warnings) {
  326|  23.7k|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|  23.7k|        }
  328|  23.7k|    };
  329|       |
  330|  23.7k|    m->reconstructed_xref = true;
  331|       |    // We may find more objects, which may contain dangling references.
  332|  23.7k|    m->fixed_dangling_refs = false;
  333|       |
  334|  23.7k|    warn(damagedPDF("", -1, "file is damaged"));
  335|  23.7k|    warn(e);
  336|  23.7k|    warn(damagedPDF("", -1, "Attempting to reconstruct cross-reference table"));
  337|       |
  338|       |    // Delete all references to type 1 (uncompressed) objects
  339|  23.7k|    std::vector<QPDFObjGen> to_delete;
  340|  62.9k|    for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (340:26): [True: 62.9k, False: 23.7k]
  ------------------
  341|  62.9k|        if (iter.second.getType() == 1) {
  ------------------
  |  Branch (341:13): [True: 51.1k, False: 11.7k]
  ------------------
  342|  51.1k|            to_delete.emplace_back(iter.first);
  343|  51.1k|        }
  344|  62.9k|    }
  345|  51.1k|    for (auto const& iter: to_delete) {
  ------------------
  |  Branch (345:26): [True: 51.1k, False: 23.7k]
  ------------------
  346|  51.1k|        m->xref_table.erase(iter);
  347|  51.1k|    }
  348|       |
  349|  23.7k|    std::vector<std::tuple<int, int, qpdf_offset_t>> found_objects;
  350|  23.7k|    std::vector<qpdf_offset_t> trailers;
  351|  23.7k|    std::vector<qpdf_offset_t> startxrefs;
  352|       |
  353|  23.7k|    m->file->seek(0, SEEK_END);
  354|  23.7k|    qpdf_offset_t eof = m->file->tell();
  355|  23.7k|    m->file->seek(0, SEEK_SET);
  356|       |    // Don't allow very long tokens here during recovery. All the interesting tokens are covered.
  357|  23.7k|    static size_t const MAX_LEN = 10;
  358|  2.00M|    while (m->file->tell() < eof) {
  ------------------
  |  Branch (358:12): [True: 1.98M, False: 23.7k]
  ------------------
  359|  1.98M|        QPDFTokenizer::Token t1 = m->objects.readToken(*m->file, MAX_LEN);
  360|  1.98M|        qpdf_offset_t token_start = m->file->tell() - toO(t1.getValue().length());
  361|  1.98M|        if (t1.isInteger()) {
  ------------------
  |  Branch (361:13): [True: 406k, False: 1.57M]
  ------------------
  362|   406k|            auto pos = m->file->tell();
  363|   406k|            auto t2 = m->objects.readToken(*m->file, MAX_LEN);
  364|   406k|            if (t2.isInteger() && m->objects.readToken(*m->file, MAX_LEN).isWord("obj")) {
  ------------------
  |  Branch (364:17): [True: 335k, False: 70.1k]
  |  Branch (364:17): [True: 171k, False: 234k]
  |  Branch (364:35): [True: 171k, False: 164k]
  ------------------
  365|   171k|                int obj = QUtil::string_to_int(t1.getValue().c_str());
  366|   171k|                if (obj > 0) {
  ------------------
  |  Branch (366:21): [True: 170k, False: 1.03k]
  ------------------
  367|   170k|                    int gen = QUtil::string_to_int(t2.getValue().c_str());
  368|   170k|                    if (0 <= gen && gen < 65535) {
  ------------------
  |  Branch (368:25): [True: 168k, False: 2.18k]
  |  Branch (368:37): [True: 167k, False: 252]
  ------------------
  369|   167k|                        if (obj <= m->xref_table_max_id) {
  ------------------
  |  Branch (369:29): [True: 167k, False: 847]
  ------------------
  370|   167k|                            found_objects.emplace_back(obj, gen, token_start);
  371|   167k|                        } else {
  372|    847|                            warn(damagedPDF(
  373|    847|                                "",
  374|    847|                                -1,
  375|    847|                                "ignoring object with impossibly large id " + std::to_string(obj)));
  376|    847|                        }
  377|   167k|                    }
  378|   170k|                }
  379|   171k|            }
  380|   406k|            m->file->seek(pos, SEEK_SET);
  381|  1.57M|        } else if (!m->trailer && t1.isWord("trailer")) {
  ------------------
  |  Branch (381:20): [True: 1.47M, False: 97.0k]
  |  Branch (381:20): [True: 166k, False: 1.40M]
  |  Branch (381:35): [True: 166k, False: 1.31M]
  ------------------
  382|   166k|            trailers.emplace_back(m->file->tell());
  383|  1.40M|        } else if (!found_startxref && t1.isWord("startxref")) {
  ------------------
  |  Branch (383:20): [True: 1.18M, False: 226k]
  |  Branch (383:20): [True: 17.7k, False: 1.39M]
  |  Branch (383:40): [True: 17.7k, False: 1.16M]
  ------------------
  384|  17.7k|            startxrefs.emplace_back(m->file->tell());
  385|  17.7k|        }
  386|  1.98M|        check_warnings();
  387|  1.98M|        m->file->findAndSkipNextEOL();
  388|  1.98M|    }
  389|       |
  390|  23.7k|    if (!found_startxref && !startxrefs.empty() && !found_objects.empty() &&
  ------------------
  |  Branch (390:9): [True: 19.7k, False: 3.95k]
  |  Branch (390:29): [True: 526, False: 19.2k]
  |  Branch (390:52): [True: 390, False: 136]
  ------------------
  391|    390|        startxrefs.back() > std::get<2>(found_objects.back())) {
  ------------------
  |  Branch (391:9): [True: 202, False: 188]
  ------------------
  392|    202|        auto xref_backup{m->xref_table};
  393|    202|        try {
  394|    202|            m->file->seek(startxrefs.back(), SEEK_SET);
  395|    202|            if (auto offset = QUtil::string_to_ll(readToken(*m->file).getValue().data())) {
  ------------------
  |  Branch (395:22): [True: 148, False: 54]
  ------------------
  396|    148|                read_xref(offset);
  397|       |
  398|    148|                if (qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (398:21): [True: 2, False: 146]
  ------------------
  399|      2|                    warn(damagedPDF(
  400|      2|                        "", -1, "startxref was more than 1024 bytes before end of file"));
  401|      2|                    m->encp->initialize(qpdf);
  402|      2|                    m->parsed = true;
  403|      2|                    m->reconstructed_xref = false;
  404|      2|                    return;
  405|      2|                }
  406|    148|            }
  407|    202|        } catch (...) {
  408|       |            // ok, bad luck. Do recovery.
  409|    146|        }
  410|    200|        m->xref_table = std::move(xref_backup);
  411|    200|    }
  412|       |
  413|  23.7k|    auto rend = found_objects.rend();
  414|   190k|    for (auto it = found_objects.rbegin(); it != rend; it++) {
  ------------------
  |  Branch (414:44): [True: 167k, False: 23.7k]
  ------------------
  415|   167k|        auto [obj, gen, token_start] = *it;
  416|   167k|        insertXrefEntry(obj, 1, token_start, gen);
  417|   167k|        check_warnings();
  418|   167k|    }
  419|  23.7k|    m->deleted_objects.clear();
  420|       |
  421|       |    // Search at most the last 100 trailer candidates. If none of them are valid, odds are this file
  422|       |    // is deliberately broken.
  423|  23.7k|    int end_index = trailers.size() > 100 ? static_cast<int>(trailers.size()) - 100 : 0;
  ------------------
  |  Branch (423:21): [True: 12, False: 23.6k]
  ------------------
  424|  40.4k|    for (auto it = trailers.rbegin(); it != std::prev(trailers.rend(), end_index); it++) {
  ------------------
  |  Branch (424:39): [True: 19.2k, False: 21.1k]
  ------------------
  425|  19.2k|        m->file->seek(*it, SEEK_SET);
  426|  19.2k|        auto t = readTrailer();
  427|  19.2k|        if (!t.isDictionary()) {
  ------------------
  |  Branch (427:13): [True: 15.8k, False: 3.44k]
  ------------------
  428|       |            // Oh well.  It was worth a try.
  429|  15.8k|        } else {
  430|  3.44k|            if (t.hasKey("/Root")) {
  ------------------
  |  Branch (430:17): [True: 2.54k, False: 900]
  ------------------
  431|  2.54k|                m->trailer = t;
  432|  2.54k|                break;
  433|  2.54k|            }
  434|    900|            warn(damagedPDF("trailer", *it, "recovered trailer has no /Root entry"));
  435|    900|        }
  436|  16.7k|        check_warnings();
  437|  16.7k|    }
  438|       |
  439|  23.7k|    if (!m->trailer) {
  ------------------
  |  Branch (439:9): [True: 20.4k, False: 3.26k]
  ------------------
  440|  20.4k|        qpdf_offset_t max_offset{0};
  441|  20.4k|        size_t max_size{0};
  442|       |        // If there are any xref streams, take the last one to appear.
  443|   105k|        for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (443:30): [True: 105k, False: 20.4k]
  ------------------
  444|   105k|            auto entry = iter.second;
  445|   105k|            if (entry.getType() != 1) {
  ------------------
  |  Branch (445:17): [True: 1.08k, False: 104k]
  ------------------
  446|  1.08k|                continue;
  447|  1.08k|            }
  448|   104k|            auto oh = qpdf.getObject(iter.first);
  449|   104k|            try {
  450|   104k|                if (!oh.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (450:21): [True: 95.8k, False: 8.60k]
  ------------------
  451|  95.8k|                    continue;
  452|  95.8k|                }
  453|   104k|            } catch (std::exception&) {
  454|  3.03k|                continue;
  455|  3.03k|            }
  456|  5.57k|            auto offset = entry.getOffset();
  457|  5.57k|            auto size = oh.getDict().getKey("/Size").getUIntValueAsUInt();
  458|  5.57k|            if (size > max_size || (size == max_size && offset > max_offset)) {
  ------------------
  |  Branch (458:17): [True: 3.87k, False: 1.69k]
  |  Branch (458:37): [True: 1.69k, False: 0]
  |  Branch (458:57): [True: 1.65k, False: 43]
  ------------------
  459|  5.52k|                max_offset = offset;
  460|  5.52k|                setTrailer(oh.getDict());
  461|  5.52k|            }
  462|  5.57k|            check_warnings();
  463|  5.57k|        }
  464|  20.4k|        if (max_offset > 0) {
  ------------------
  |  Branch (464:13): [True: 5.30k, False: 15.1k]
  ------------------
  465|  5.30k|            try {
  466|  5.30k|                read_xref(max_offset, true);
  467|  5.30k|            } catch (std::exception&) {
  468|  3.26k|                warn(damagedPDF(
  469|  3.26k|                    "", -1, "error decoding candidate xref stream while recovering damaged file"));
  470|  3.26k|            }
  471|  5.30k|            QTC::TC("qpdf", "QPDF recover xref stream");
  472|  5.27k|        }
  473|  20.4k|    }
  474|       |
  475|  23.6k|    if (!m->trailer || (!m->parsed && !m->trailer.getKey("/Root").isDictionary())) {
  ------------------
  |  Branch (475:9): [True: 15.1k, False: 8.50k]
  |  Branch (475:9): [True: 20.7k, False: 2.90k]
  |  Branch (475:25): [True: 8.33k, False: 170]
  |  Branch (475:39): [True: 5.64k, False: 2.68k]
  ------------------
  476|       |        // Try to find a Root dictionary. As a quick fix try the one with the highest object id.
  477|  20.7k|        QPDFObjectHandle root;
  478|   270k|        for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (478:30): [True: 270k, False: 20.7k]
  ------------------
  479|   270k|            try {
  480|   270k|                if (QPDFObjectHandle(iter.second.object).isDictionaryOfType("/Catalog")) {
  ------------------
  |  Branch (480:21): [True: 8.91k, False: 261k]
  ------------------
  481|  8.91k|                    root = iter.second.object;
  482|  8.91k|                }
  483|   270k|            } catch (std::exception&) {
  484|  4.98k|                continue;
  485|  4.98k|            }
  486|   270k|        }
  487|  20.7k|        if (root) {
  ------------------
  |  Branch (487:13): [True: 8.73k, False: 12.0k]
  ------------------
  488|  8.73k|            if (!m->trailer) {
  ------------------
  |  Branch (488:17): [True: 8.02k, False: 713]
  ------------------
  489|  8.02k|                warn(damagedPDF(
  490|  8.02k|                    "", -1, "unable to find trailer dictionary while recovering damaged file"));
  491|  8.02k|                m->trailer = QPDFObjectHandle::newDictionary();
  492|  8.02k|            }
  493|  8.73k|            m->trailer.replaceKey("/Root", root);
  494|  8.73k|        }
  495|  20.7k|    }
  496|       |
  497|  23.6k|    if (!m->trailer) {
  ------------------
  |  Branch (497:9): [True: 7.10k, False: 16.5k]
  ------------------
  498|       |        // We could check the last encountered object to see if it was an xref stream.  If so, we
  499|       |        // could try to get the trailer from there.  This may make it possible to recover files with
  500|       |        // bad startxref pointers even when they have object streams.
  501|       |
  502|  7.10k|        throw damagedPDF("", -1, "unable to find trailer dictionary while recovering damaged file");
  503|  7.10k|    }
  504|  16.5k|    if (m->xref_table.empty()) {
  ------------------
  |  Branch (504:9): [True: 347, False: 16.2k]
  ------------------
  505|       |        // We cannot check for an empty xref table in parse because empty tables are valid when
  506|       |        // creating QPDF objects from JSON.
  507|    347|        throw damagedPDF("", -1, "unable to find objects while recovering damaged file");
  508|    347|    }
  509|  16.2k|    check_warnings();
  510|  16.2k|    if (!m->parsed) {
  ------------------
  |  Branch (510:9): [True: 16.0k, False: 189]
  ------------------
  511|  16.0k|        m->parsed = !m->pages.empty();
  512|  16.0k|        if (!m->parsed) {
  ------------------
  |  Branch (512:13): [True: 627, False: 15.4k]
  ------------------
  513|    627|            throw damagedPDF("", -1, "unable to find any pages while recovering damaged file");
  514|    627|        }
  515|  15.4k|        check_warnings();
  516|  15.4k|    }
  517|       |
  518|       |    // We could iterate through the objects looking for streams and try to find objects inside of
  519|       |    // them, but it's probably not worth the trouble.  Acrobat can't recover files with any errors
  520|       |    // in an xref stream, and this would be a real long shot anyway.  If we wanted to do anything
  521|       |    // that involved looking at stream contents, we'd also have to call initializeEncryption() here.
  522|       |    // It's safe to call it more than once.
  523|  16.2k|}
_ZN4QPDF3Doc7Objects9read_xrefExb:
  527|  10.4k|{
  528|  10.4k|    std::map<int, int> free_table;
  529|  10.4k|    std::set<qpdf_offset_t> visited;
  530|  21.5k|    while (xref_offset) {
  ------------------
  |  Branch (530:12): [True: 11.3k, False: 10.2k]
  ------------------
  531|  11.3k|        visited.insert(xref_offset);
  532|  11.3k|        char buf[7];
  533|  11.3k|        memset(buf, 0, sizeof(buf));
  534|  11.3k|        m->file->seek(xref_offset, SEEK_SET);
  535|       |        // Some files miss the mark a little with startxref. We could do a better job of searching
  536|       |        // in the neighborhood for something that looks like either an xref table or stream, but the
  537|       |        // simple heuristic of skipping whitespace can help with the xref table case and is harmless
  538|       |        // with the stream case.
  539|  11.3k|        bool done = false;
  540|  11.3k|        bool skipped_space = false;
  541|  27.5k|        while (!done) {
  ------------------
  |  Branch (541:16): [True: 16.1k, False: 11.3k]
  ------------------
  542|  16.1k|            char ch;
  543|  16.1k|            if (1 == m->file->read(&ch, 1)) {
  ------------------
  |  Branch (543:17): [True: 15.6k, False: 517]
  ------------------
  544|  15.6k|                if (util::is_space(ch)) {
  ------------------
  |  Branch (544:21): [True: 5.12k, False: 10.5k]
  ------------------
  545|  5.12k|                    skipped_space = true;
  546|  10.5k|                } else {
  547|  10.5k|                    m->file->unreadCh(ch);
  548|  10.5k|                    done = true;
  549|  10.5k|                }
  550|  15.6k|            } else {
  551|    517|                QTC::TC("qpdf", "QPDF eof skipping spaces before xref", skipped_space ? 0 : 1);
  ------------------
  |  Branch (551:73): [True: 1, False: 516]
  ------------------
  552|    517|                done = true;
  553|    517|            }
  554|  16.1k|        }
  555|       |
  556|  11.3k|        m->file->read(buf, sizeof(buf) - 1);
  557|       |        // The PDF spec says xref must be followed by a line terminator, but files exist in the wild
  558|       |        // where it is terminated by arbitrary whitespace.
  559|  11.3k|        if ((strncmp(buf, "xref", 4) == 0) && util::is_space(buf[4])) {
  ------------------
  |  Branch (559:13): [True: 1.92k, False: 9.43k]
  |  Branch (559:47): [True: 1.90k, False: 17]
  ------------------
  560|  1.90k|            if (skipped_space) {
  ------------------
  |  Branch (560:17): [True: 81, False: 1.82k]
  ------------------
  561|     81|                warn(damagedPDF("", -1, "extraneous whitespace seen before xref"));
  562|     81|            }
  563|  1.90k|            QTC::TC(
  564|  1.90k|                "qpdf",
  565|  1.90k|                "QPDF xref space",
  566|  1.90k|                ((buf[4] == '\n')       ? 0
  ------------------
  |  Branch (566:18): [True: 111, False: 1.79k]
  ------------------
  567|  1.90k|                     : (buf[4] == '\r') ? 1
  ------------------
  |  Branch (567:24): [True: 1.18k, False: 604]
  ------------------
  568|  1.79k|                     : (buf[4] == ' ')  ? 2
  ------------------
  |  Branch (568:24): [True: 227, False: 377]
  ------------------
  569|    604|                                        : 9999));
  570|  1.90k|            int skip = 4;
  571|       |            // buf is null-terminated, and util::is_space('\0') is false, so this won't overrun.
  572|  3.98k|            while (util::is_space(buf[skip])) {
  ------------------
  |  Branch (572:20): [True: 2.07k, False: 1.90k]
  ------------------
  573|  2.07k|                ++skip;
  574|  2.07k|            }
  575|  1.90k|            xref_offset = read_xrefTable(xref_offset + skip);
  576|  9.45k|        } else {
  577|  9.45k|            xref_offset = read_xrefStream(xref_offset, in_stream_recovery);
  578|  9.45k|        }
  579|  11.3k|        if (visited.contains(xref_offset)) {
  ------------------
  |  Branch (579:13): [True: 236, False: 11.1k]
  ------------------
  580|    236|            throw damagedPDF("", -1, "loop detected following xref tables");
  581|    236|        }
  582|  11.3k|    }
  583|       |
  584|  10.2k|    if (!m->trailer) {
  ------------------
  |  Branch (584:9): [True: 0, False: 10.2k]
  ------------------
  585|      0|        throw damagedPDF("", -1, "unable to find trailer while reading xref");
  586|      0|    }
  587|  10.2k|    int size = m->trailer.getKey("/Size").getIntValueAsInt();
  588|  10.2k|    int max_obj = 0;
  589|  10.2k|    if (!m->xref_table.empty()) {
  ------------------
  |  Branch (589:9): [True: 2.87k, False: 7.33k]
  ------------------
  590|  2.87k|        max_obj = m->xref_table.rbegin()->first.getObj();
  591|  2.87k|    }
  592|  10.2k|    if (!m->deleted_objects.empty()) {
  ------------------
  |  Branch (592:9): [True: 687, False: 9.52k]
  ------------------
  593|    687|        max_obj = std::max(max_obj, *(m->deleted_objects.rbegin()));
  594|    687|    }
  595|  10.2k|    if (size < 1 || (size - 1) != max_obj) {
  ------------------
  |  Branch (595:9): [True: 7.61k, False: 2.59k]
  |  Branch (595:21): [True: 1.73k, False: 867]
  ------------------
  596|  2.22k|        if (size == (max_obj + 2) && qpdf.getObject(max_obj + 1, 0).isStreamOfType("/XRef")) {
  ------------------
  |  Branch (596:13): [True: 106, False: 2.11k]
  |  Branch (596:13): [True: 2, False: 2.22k]
  |  Branch (596:38): [True: 2, False: 104]
  ------------------
  597|      2|            warn(damagedPDF(
  598|      2|                "",
  599|      2|                -1,
  600|      2|                "xref entry for the xref stream itself is missing - a common error handled "
  601|      2|                "correctly by qpdf and most other applications"));
  602|  2.22k|        } else {
  603|  2.22k|            warn(damagedPDF(
  604|  2.22k|                "",
  605|  2.22k|                -1,
  606|  2.22k|                ("reported number of objects (" + std::to_string(size) +
  607|  2.22k|                 ") is not one plus the highest object number (" + std::to_string(max_obj) + ")")));
  608|  2.22k|        }
  609|  2.22k|    }
  610|       |
  611|       |    // We no longer need the deleted_objects table, so go ahead and clear it out to make sure we
  612|       |    // never depend on its being set.
  613|  10.2k|    m->deleted_objects.clear();
  614|       |
  615|       |    // Make sure we keep only the highest generation for any object.
  616|  10.2k|    QPDFObjGen last_og{-1, 0};
  617|   242k|    for (auto const& item: m->xref_table) {
  ------------------
  |  Branch (617:26): [True: 242k, False: 10.2k]
  ------------------
  618|   242k|        auto id = item.first.getObj();
  619|   242k|        if (id == last_og.getObj() && id > 0) {
  ------------------
  |  Branch (619:13): [True: 13.8k, False: 228k]
  |  Branch (619:39): [True: 13.8k, False: 0]
  ------------------
  620|  13.8k|            qpdf.removeObject(last_og);
  621|  13.8k|        }
  622|   242k|        last_og = item.first;
  623|   242k|    }
  624|  10.2k|}
_ZN4QPDF3Doc7Objects15parse_xrefFirstERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERiSB_SB_:
  628|  7.64k|{
  629|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  630|       |    // buffer.
  631|  7.64k|    char const* p = line.c_str();
  632|  7.64k|    char const* start = line.c_str();
  633|       |
  634|       |    // Skip zero or more spaces
  635|  8.96k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (635:12): [True: 1.32k, False: 7.64k]
  ------------------
  636|  1.32k|        ++p;
  637|  1.32k|    }
  638|       |    // Require digit
  639|  7.64k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (639:9): [True: 240, False: 7.40k]
  ------------------
  640|    240|        return false;
  641|    240|    }
  642|       |    // Gather digits
  643|  7.40k|    std::string obj_str;
  644|  23.3k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (644:12): [True: 15.9k, False: 7.40k]
  ------------------
  645|  15.9k|        obj_str.append(1, *p++);
  646|  15.9k|    }
  647|       |    // Require space
  648|  7.40k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (648:9): [True: 106, False: 7.29k]
  ------------------
  649|    106|        return false;
  650|    106|    }
  651|       |    // Skip spaces
  652|  17.0k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (652:12): [True: 9.78k, False: 7.29k]
  ------------------
  653|  9.78k|        ++p;
  654|  9.78k|    }
  655|       |    // Require digit
  656|  7.29k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (656:9): [True: 94, False: 7.20k]
  ------------------
  657|     94|        return false;
  658|     94|    }
  659|       |    // Gather digits
  660|  7.20k|    std::string num_str;
  661|  19.1k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (661:12): [True: 11.9k, False: 7.20k]
  ------------------
  662|  11.9k|        num_str.append(1, *p++);
  663|  11.9k|    }
  664|       |    // Skip any space including line terminators
  665|  19.1k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (665:12): [True: 11.9k, False: 7.20k]
  ------------------
  666|  11.9k|        ++p;
  667|  11.9k|    }
  668|  7.20k|    bytes = toI(p - start);
  669|  7.20k|    obj = QUtil::string_to_int(obj_str.c_str());
  670|  7.20k|    num = QUtil::string_to_int(num_str.c_str());
  671|  7.20k|    return true;
  672|  7.29k|}
_ZN4QPDF3Doc7Objects18read_bad_xrefEntryERxRiRc:
  676|  8.18k|{
  677|       |    // Reposition after initial read attempt and reread.
  678|  8.18k|    m->file->seek(m->file->getLastOffset(), SEEK_SET);
  679|  8.18k|    auto line = m->file->readLine(30);
  680|       |
  681|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  682|       |    // buffer.
  683|  8.18k|    char const* p = line.data();
  684|       |
  685|       |    // Skip zero or more spaces. There aren't supposed to be any.
  686|  8.18k|    bool invalid = false;
  687|  9.23k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (687:12): [True: 1.05k, False: 8.18k]
  ------------------
  688|  1.05k|        ++p;
  689|  1.05k|        invalid = true;
  690|  1.05k|    }
  691|       |    // Require digit
  692|  8.18k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (692:9): [True: 38, False: 8.15k]
  ------------------
  693|     38|        return false;
  694|     38|    }
  695|       |    // Gather digits
  696|  8.15k|    std::string f1_str;
  697|  31.8k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (697:12): [True: 23.6k, False: 8.15k]
  ------------------
  698|  23.6k|        f1_str.append(1, *p++);
  699|  23.6k|    }
  700|       |    // Require space
  701|  8.15k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (701:9): [True: 46, False: 8.10k]
  ------------------
  702|     46|        return false;
  703|     46|    }
  704|  8.10k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (704:9): [True: 1.07k, False: 7.03k]
  ------------------
  705|  1.07k|        invalid = true;
  706|  1.07k|    }
  707|       |    // Skip spaces
  708|  17.8k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (708:12): [True: 9.71k, False: 8.10k]
  ------------------
  709|  9.71k|        ++p;
  710|  9.71k|    }
  711|       |    // Require digit
  712|  8.10k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (712:9): [True: 97, False: 8.00k]
  ------------------
  713|     97|        return false;
  714|     97|    }
  715|       |    // Gather digits
  716|  8.00k|    std::string f2_str;
  717|  29.7k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (717:12): [True: 21.7k, False: 8.00k]
  ------------------
  718|  21.7k|        f2_str.append(1, *p++);
  719|  21.7k|    }
  720|       |    // Require space
  721|  8.00k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (721:9): [True: 51, False: 7.95k]
  ------------------
  722|     51|        return false;
  723|     51|    }
  724|  7.95k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (724:9): [True: 2.27k, False: 5.68k]
  ------------------
  725|  2.27k|        invalid = true;
  726|  2.27k|    }
  727|       |    // Skip spaces
  728|  21.2k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (728:12): [True: 13.2k, False: 7.95k]
  ------------------
  729|  13.2k|        ++p;
  730|  13.2k|    }
  731|  7.95k|    if ((*p == 'f') || (*p == 'n')) {
  ------------------
  |  Branch (731:9): [True: 1.77k, False: 6.18k]
  |  Branch (731:24): [True: 6.07k, False: 114]
  ------------------
  732|  7.84k|        type = *p;
  733|  7.84k|    } else {
  734|    114|        return false;
  735|    114|    }
  736|  7.84k|    if ((f1_str.length() != 10) || (f2_str.length() != 5)) {
  ------------------
  |  Branch (736:9): [True: 6.89k, False: 943]
  |  Branch (736:36): [True: 497, False: 446]
  ------------------
  737|  7.39k|        invalid = true;
  738|  7.39k|    }
  739|       |
  740|  7.84k|    if (invalid) {
  ------------------
  |  Branch (740:9): [True: 7.40k, False: 441]
  ------------------
  741|  7.40k|        warn(damagedPDF("xref table", "accepting invalid xref table entry"));
  742|  7.40k|    }
  743|       |
  744|  7.84k|    f1 = QUtil::string_to_ll(f1_str.c_str());
  745|  7.84k|    f2 = QUtil::string_to_int(f2_str.c_str());
  746|       |
  747|  7.84k|    return true;
  748|  7.95k|}
_ZN4QPDF3Doc7Objects14read_xrefEntryERxRiRc:
  754|  18.9k|{
  755|  18.9k|    std::array<char, 21> line;
  756|  18.9k|    if (m->file->read(line.data(), 20) != 20) {
  ------------------
  |  Branch (756:9): [True: 243, False: 18.6k]
  ------------------
  757|       |        // C++20: [[unlikely]]
  758|    243|        return false;
  759|    243|    }
  760|  18.6k|    line[20] = '\0';
  761|  18.6k|    char const* p = line.data();
  762|       |
  763|  18.6k|    int f1_len = 0;
  764|  18.6k|    int f2_len = 0;
  765|       |
  766|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  767|       |    // buffer.
  768|       |
  769|       |    // Gather f1 digits. NB No risk of overflow as 9'999'999'999 < max long long.
  770|  89.4k|    while (*p == '0') {
  ------------------
  |  Branch (770:12): [True: 70.7k, False: 18.6k]
  ------------------
  771|  70.7k|        ++f1_len;
  772|  70.7k|        ++p;
  773|  70.7k|    }
  774|  74.4k|    while (util::is_digit(*p) && f1_len++ < 10) {
  ------------------
  |  Branch (774:12): [True: 55.7k, False: 18.6k]
  |  Branch (774:34): [True: 55.7k, False: 4]
  ------------------
  775|  55.7k|        f1 *= 10;
  776|  55.7k|        f1 += *p++ - '0';
  777|  55.7k|    }
  778|       |    // Require space
  779|  18.6k|    if (!util::is_space(*p++)) {
  ------------------
  |  Branch (779:9): [True: 86, False: 18.5k]
  ------------------
  780|       |        // Entry doesn't start with space or digit.
  781|       |        // C++20: [[unlikely]]
  782|     86|        return false;
  783|     86|    }
  784|       |    // Gather digits. NB No risk of overflow as 99'999 < max int.
  785|  67.5k|    while (*p == '0') {
  ------------------
  |  Branch (785:12): [True: 48.9k, False: 18.5k]
  ------------------
  786|  48.9k|        ++f2_len;
  787|  48.9k|        ++p;
  788|  48.9k|    }
  789|  39.9k|    while (util::is_digit(*p) && f2_len++ < 5) {
  ------------------
  |  Branch (789:12): [True: 21.7k, False: 18.1k]
  |  Branch (789:34): [True: 21.4k, False: 386]
  ------------------
  790|  21.4k|        f2 *= 10;
  791|  21.4k|        f2 += static_cast<int>(*p++ - '0');
  792|  21.4k|    }
  793|  18.5k|    if (util::is_space(*p++) && (*p == 'f' || *p == 'n')) {
  ------------------
  |  Branch (793:9): [True: 17.8k, False: 715]
  |  Branch (793:34): [True: 3.21k, False: 14.6k]
  |  Branch (793:47): [True: 12.2k, False: 2.37k]
  ------------------
  794|       |        // C++20: [[likely]]
  795|  15.4k|        type = *p;
  796|       |        // No test for valid line[19].
  797|  15.4k|        if (*(++p) && *(++p) && (*p == '\n' || *p == '\r') && f1_len == 10 && f2_len == 5) {
  ------------------
  |  Branch (797:13): [True: 15.1k, False: 397]
  |  Branch (797:23): [True: 14.2k, False: 860]
  |  Branch (797:34): [True: 12.0k, False: 2.22k]
  |  Branch (797:48): [True: 448, False: 1.77k]
  |  Branch (797:63): [True: 10.5k, False: 1.89k]
  |  Branch (797:79): [True: 10.3k, False: 168]
  ------------------
  798|       |            // C++20: [[likely]]
  799|  10.3k|            return true;
  800|  10.3k|        }
  801|  15.4k|    }
  802|  8.18k|    return read_bad_xrefEntry(f1, f2, type);
  803|  18.5k|}
_ZN4QPDF3Doc7Objects14read_xrefTableEx:
  808|  1.90k|{
  809|  1.90k|    m->file->seek(xref_offset, SEEK_SET);
  810|  1.90k|    std::string line;
  811|  7.67k|    while (true) {
  ------------------
  |  Branch (811:12): [True: 7.64k, Folded]
  ------------------
  812|  7.64k|        line.assign(50, '\0');
  813|  7.64k|        m->file->read(line.data(), line.size());
  814|  7.64k|        int obj = 0;
  815|  7.64k|        int num = 0;
  816|  7.64k|        int bytes = 0;
  817|  7.64k|        if (!parse_xrefFirst(line, obj, num, bytes)) {
  ------------------
  |  Branch (817:13): [True: 440, False: 7.20k]
  ------------------
  818|    440|            throw damagedPDF("xref table", "xref syntax invalid");
  819|    440|        }
  820|  7.20k|        m->file->seek(m->file->getLastOffset() + bytes, SEEK_SET);
  821|  25.4k|        for (qpdf_offset_t i = obj; i - num < obj; ++i) {
  ------------------
  |  Branch (821:37): [True: 18.9k, False: 6.52k]
  ------------------
  822|  18.9k|            if (i == 0) {
  ------------------
  |  Branch (822:17): [True: 492, False: 18.4k]
  ------------------
  823|       |                // This is needed by checkLinearization()
  824|    492|                first_xref_item_offset_ = m->file->tell();
  825|    492|            }
  826|       |            // For xref_table, these will always be small enough to be ints
  827|  18.9k|            qpdf_offset_t f1 = 0;
  828|  18.9k|            int f2 = 0;
  829|  18.9k|            char type = '\0';
  830|  18.9k|            if (!read_xrefEntry(f1, f2, type)) {
  ------------------
  |  Branch (830:17): [True: 675, False: 18.2k]
  ------------------
  831|    675|                throw damagedPDF(
  832|    675|                    "xref table", "invalid xref entry (obj=" + std::to_string(i) + ")");
  833|    675|            }
  834|  18.2k|            if (type == 'f') {
  ------------------
  |  Branch (834:17): [True: 4.52k, False: 13.7k]
  ------------------
  835|  4.52k|                insertFreeXrefEntry(QPDFObjGen(toI(i), f2));
  836|  13.7k|            } else {
  837|  13.7k|                insertXrefEntry(toI(i), 1, f1, f2);
  838|  13.7k|            }
  839|  18.2k|        }
  840|  6.52k|        qpdf_offset_t pos = m->file->tell();
  841|  6.52k|        if (readToken(*m->file).isWord("trailer")) {
  ------------------
  |  Branch (841:13): [True: 758, False: 5.77k]
  ------------------
  842|    758|            break;
  843|  5.77k|        } else {
  844|  5.77k|            m->file->seek(pos, SEEK_SET);
  845|  5.77k|        }
  846|  6.52k|    }
  847|       |
  848|       |    // Set offset to previous xref table if any
  849|    788|    QPDFObjectHandle cur_trailer = m->objects.readTrailer();
  850|    788|    if (!cur_trailer.isDictionary()) {
  ------------------
  |  Branch (850:9): [True: 69, False: 719]
  ------------------
  851|     69|        throw damagedPDF("", "expected trailer dictionary");
  852|     69|    }
  853|       |
  854|    719|    if (!m->trailer) {
  ------------------
  |  Branch (854:9): [True: 635, False: 84]
  ------------------
  855|    635|        setTrailer(cur_trailer);
  856|       |
  857|    635|        if (!m->trailer.hasKey("/Size")) {
  ------------------
  |  Branch (857:13): [True: 122, False: 513]
  ------------------
  858|    122|            throw damagedPDF("trailer", "trailer dictionary lacks /Size key");
  859|    122|        }
  860|    513|        if (!m->trailer.getKey("/Size").isInteger()) {
  ------------------
  |  Branch (860:13): [True: 7, False: 506]
  ------------------
  861|      7|            throw damagedPDF("trailer", "/Size key in trailer dictionary is not an integer");
  862|      7|        }
  863|    513|    }
  864|       |
  865|    590|    if (cur_trailer.hasKey("/XRefStm")) {
  ------------------
  |  Branch (865:9): [True: 25, False: 565]
  ------------------
  866|     25|        if (cf.ignore_xref_streams()) {
  ------------------
  |  Branch (866:13): [True: 0, False: 25]
  ------------------
  867|      0|            QTC::TC("qpdf", "QPDF ignoring XRefStm in trailer");
  868|     25|        } else {
  869|     25|            if (cur_trailer.getKey("/XRefStm").isInteger()) {
  ------------------
  |  Branch (869:17): [True: 24, False: 1]
  ------------------
  870|       |                // Read the xref stream but disregard any return value -- we'll use our trailer's
  871|       |                // /Prev key instead of the xref stream's.
  872|     24|                (void)read_xrefStream(cur_trailer.getKey("/XRefStm").getIntValue());
  873|     24|            } else {
  874|      1|                throw damagedPDF("xref stream", xref_offset, "invalid /XRefStm");
  875|      1|            }
  876|     25|        }
  877|     25|    }
  878|       |
  879|    589|    if (cur_trailer.hasKey("/Prev")) {
  ------------------
  |  Branch (879:9): [True: 154, False: 435]
  ------------------
  880|    154|        if (!cur_trailer.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (880:13): [True: 1, False: 153]
  ------------------
  881|      1|            throw damagedPDF("trailer", "/Prev key in trailer dictionary is not an integer");
  882|      1|        }
  883|    153|        return cur_trailer.getKey("/Prev").getIntValue();
  884|    154|    }
  885|       |
  886|    435|    return 0;
  887|    589|}
_ZN4QPDF3Doc7Objects15read_xrefStreamExb:
  892|  9.14k|{
  893|  9.14k|    if (!cf.ignore_xref_streams()) {
  ------------------
  |  Branch (893:9): [True: 9.14k, False: 0]
  ------------------
  894|  9.14k|        QPDFObjectHandle xref_obj;
  895|  9.14k|        try {
  896|  9.14k|            m->in_read_xref_stream = true;
  897|  9.14k|            xref_obj = readObjectAtOffset(xref_offset, "xref stream", true);
  898|  9.14k|        } catch (QPDFExc&) {
  899|       |            // ignore -- report error below
  900|  1.46k|        }
  901|  9.14k|        m->in_read_xref_stream = false;
  902|  9.08k|        if (xref_obj.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (902:13): [True: 7.38k, False: 1.70k]
  ------------------
  903|  7.38k|            return processXRefStream(xref_offset, xref_obj, in_stream_recovery);
  904|  7.38k|        }
  905|  9.08k|    }
  906|       |
  907|  1.70k|    throw damagedPDF("", xref_offset, "xref not found");
  908|      0|    return 0; // unreachable
  909|  9.14k|}
_ZN4QPDF3Doc7Objects12processXRefWER16QPDFObjectHandleNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  914|  7.38k|{
  915|  7.38k|    auto W_obj = dict.getKey("/W");
  916|  7.38k|    if (!(W_obj.size() >= 3 && W_obj.getArrayItem(0).isInteger() &&
  ------------------
  |  Branch (916:9): [True: 330, False: 7.05k]
  |  Branch (916:11): [True: 7.08k, False: 294]
  |  Branch (916:32): [True: 7.07k, False: 16]
  ------------------
  917|  7.07k|          W_obj.getArrayItem(1).isInteger() && W_obj.getArrayItem(2).isInteger())) {
  ------------------
  |  Branch (917:11): [True: 7.05k, False: 14]
  |  Branch (917:48): [True: 7.05k, False: 6]
  ------------------
  918|    330|        throw damaged("Cross-reference stream does not have a proper /W key");
  919|    330|    }
  920|       |
  921|  7.05k|    std::array<int, 3> W;
  922|  7.05k|    int entry_size = 0;
  923|  7.05k|    auto w_vector = W_obj.getArrayAsVector();
  924|  7.05k|    int max_bytes = sizeof(qpdf_offset_t);
  925|  28.0k|    for (size_t i = 0; i < 3; ++i) {
  ------------------
  |  Branch (925:24): [True: 21.0k, False: 6.98k]
  ------------------
  926|  21.0k|        W[i] = w_vector[i].getIntValueAsInt();
  927|  21.0k|        if (W[i] > max_bytes) {
  ------------------
  |  Branch (927:13): [True: 20, False: 21.0k]
  ------------------
  928|     20|            throw damaged("Cross-reference stream's /W contains impossibly large values");
  929|     20|        }
  930|  21.0k|        if (W[i] < 0) {
  ------------------
  |  Branch (930:13): [True: 52, False: 20.9k]
  ------------------
  931|     52|            throw damaged("Cross-reference stream's /W contains negative values");
  932|     52|        }
  933|  20.9k|        entry_size += W[i];
  934|  20.9k|    }
  935|  6.98k|    if (entry_size == 0) {
  ------------------
  |  Branch (935:9): [True: 4, False: 6.97k]
  ------------------
  936|      4|        throw damaged("Cross-reference stream's /W indicates entry size of 0");
  937|      4|    }
  938|  6.97k|    return {entry_size, W};
  939|  6.98k|}
_ZN4QPDF3Doc7Objects15processXRefSizeER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  945|  6.97k|{
  946|       |    // Number of entries is limited by the highest possible object id and stream size.
  947|  6.97k|    auto max_num_entries = std::numeric_limits<int>::max();
  948|  6.97k|    if (max_num_entries > (std::numeric_limits<qpdf_offset_t>::max() / entry_size)) {
  ------------------
  |  Branch (948:9): [True: 0, False: 6.97k]
  ------------------
  949|      0|        max_num_entries = toI(std::numeric_limits<qpdf_offset_t>::max() / entry_size);
  950|      0|    }
  951|       |
  952|  6.97k|    auto Size_obj = dict.getKey("/Size");
  953|  6.97k|    long long size;
  954|  6.97k|    if (!dict.getKey("/Size").getValueAsInt(size)) {
  ------------------
  |  Branch (954:9): [True: 51, False: 6.92k]
  ------------------
  955|     51|        throw damaged("Cross-reference stream does not have a proper /Size key");
  956|  6.92k|    } else if (size < 0) {
  ------------------
  |  Branch (956:16): [True: 70, False: 6.85k]
  ------------------
  957|     70|        throw damaged("Cross-reference stream has a negative /Size key");
  958|  6.85k|    } else if (size >= max_num_entries) {
  ------------------
  |  Branch (958:16): [True: 82, False: 6.77k]
  ------------------
  959|     82|        throw damaged("Cross-reference stream has an impossibly large /Size key");
  960|     82|    }
  961|       |    // We are not validating that Size <= (Size key of parent xref / trailer).
  962|  6.77k|    return max_num_entries;
  963|  6.97k|}
_ZN4QPDF3Doc7Objects16processXRefIndexER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  969|  6.77k|{
  970|  6.77k|    auto size = dict.getKey("/Size").getIntValueAsInt();
  971|  6.77k|    auto Index_obj = dict.getKey("/Index");
  972|       |
  973|  6.77k|    if (Index_obj.isArray()) {
  ------------------
  |  Branch (973:9): [True: 538, False: 6.23k]
  ------------------
  974|    538|        std::vector<std::pair<int, int>> indx;
  975|    538|        int num_entries = 0;
  976|    538|        auto index_vec = Index_obj.getArrayAsVector();
  977|    538|        if ((index_vec.size() % 2) || index_vec.size() < 2) {
  ------------------
  |  Branch (977:13): [True: 5, False: 533]
  |  Branch (977:39): [True: 3, False: 530]
  ------------------
  978|      8|            throw damaged("Cross-reference stream's /Index has an invalid number of values");
  979|      8|        }
  980|       |
  981|    530|        int i = 0;
  982|    530|        long long first = 0;
  983|  11.1k|        for (auto& val: index_vec) {
  ------------------
  |  Branch (983:23): [True: 11.1k, False: 309]
  ------------------
  984|  11.1k|            if (val.isInteger()) {
  ------------------
  |  Branch (984:17): [True: 11.1k, False: 26]
  ------------------
  985|  11.1k|                if (i % 2) {
  ------------------
  |  Branch (985:21): [True: 5.54k, False: 5.62k]
  ------------------
  986|  5.54k|                    auto count = val.getIntValue();
  987|  5.54k|                    if (count <= 0) {
  ------------------
  |  Branch (987:25): [True: 50, False: 5.49k]
  ------------------
  988|     50|                        throw damaged(
  989|     50|                            "Cross-reference stream section claims to contain " +
  990|     50|                            std::to_string(count) + " entries");
  991|     50|                    }
  992|       |                    // We are guarding against the possibility of num_entries * entry_size
  993|       |                    // overflowing. We are not checking that entries are in ascending order as
  994|       |                    // required by the spec, which probably should generate a warning. We are also
  995|       |                    // not checking that for each subsection first object number + number of entries
  996|       |                    // <= /Size. The spec requires us to ignore object number > /Size.
  997|  5.49k|                    if (first > (max_num_entries - count) ||
  ------------------
  |  Branch (997:25): [True: 66, False: 5.42k]
  ------------------
  998|  5.42k|                        count > (max_num_entries - num_entries)) {
  ------------------
  |  Branch (998:25): [True: 4, False: 5.42k]
  ------------------
  999|     70|                        throw damaged(
 1000|     70|                            "Cross-reference stream claims to contain too many entries: " +
 1001|     70|                            std::to_string(first) + " " + std::to_string(max_num_entries) + " " +
 1002|     70|                            std::to_string(num_entries));
 1003|     70|                    }
 1004|  5.42k|                    indx.emplace_back(static_cast<int>(first), static_cast<int>(count));
 1005|  5.42k|                    num_entries += static_cast<int>(count);
 1006|  5.62k|                } else {
 1007|  5.62k|                    first = val.getIntValue();
 1008|  5.62k|                    if (first < 0) {
  ------------------
  |  Branch (1008:25): [True: 7, False: 5.62k]
  ------------------
 1009|      7|                        throw damaged(
 1010|      7|                            "Cross-reference stream's /Index contains a negative object id");
 1011|  5.62k|                    } else if (first > max_num_entries) {
  ------------------
  |  Branch (1011:32): [True: 68, False: 5.55k]
  ------------------
 1012|     68|                        throw damaged(
 1013|     68|                            "Cross-reference stream's /Index contains an impossibly "
 1014|     68|                            "large object id");
 1015|     68|                    }
 1016|  5.62k|                }
 1017|  11.1k|            } else {
 1018|     26|                throw damaged(
 1019|     26|                    "Cross-reference stream's /Index's item " + std::to_string(i) +
 1020|     26|                    " is not an integer");
 1021|     26|            }
 1022|  10.9k|            i++;
 1023|  10.9k|        }
 1024|    309|        QTC::TC("qpdf", "QPDF xref /Index is array", index_vec.size() == 2 ? 0 : 1);
  ------------------
  |  Branch (1024:54): [True: 194, False: 115]
  ------------------
 1025|    309|        return {num_entries, indx};
 1026|  6.23k|    } else if (Index_obj.null()) {
  ------------------
  |  Branch (1026:16): [True: 6.23k, False: 4]
  ------------------
 1027|  6.23k|        return {size, {{0, size}}};
 1028|  6.23k|    } else {
 1029|      4|        throw damaged("Cross-reference stream does not have a proper /Index key");
 1030|      4|    }
 1031|  6.77k|}
_ZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandleb:
 1036|  7.38k|{
 1037|  7.38k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1038|  7.38k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1039|  7.38k|    };
 1040|       |
 1041|  7.38k|    auto dict = xref_obj.getDict();
 1042|       |
 1043|  7.38k|    auto [entry_size, W] = processXRefW(dict, damaged);
 1044|  7.38k|    int max_num_entries = processXRefSize(dict, entry_size, damaged);
 1045|  7.38k|    auto [num_entries, indx] = processXRefIndex(dict, max_num_entries, damaged);
 1046|       |
 1047|  7.38k|    std::shared_ptr<Buffer> bp = xref_obj.getStreamData(qpdf_dl_specialized);
 1048|  7.38k|    size_t actual_size = bp->getSize();
 1049|  7.38k|    auto expected_size = toS(entry_size) * toS(num_entries);
 1050|       |
 1051|  7.38k|    if (expected_size != actual_size) {
  ------------------
  |  Branch (1051:9): [True: 3.98k, False: 3.40k]
  ------------------
 1052|  3.98k|        QPDFExc x = damaged(
 1053|  3.98k|            "Cross-reference stream data has the wrong size; expected = " +
 1054|  3.98k|            std::to_string(expected_size) + "; actual = " + std::to_string(actual_size));
 1055|  3.98k|        if (expected_size > actual_size) {
  ------------------
  |  Branch (1055:13): [True: 690, False: 3.29k]
  ------------------
 1056|    690|            throw x;
 1057|  3.29k|        } else {
 1058|  3.29k|            warn(x);
 1059|  3.29k|        }
 1060|  3.98k|    }
 1061|       |
 1062|  6.69k|    bool saw_first_compressed_object = false;
 1063|       |
 1064|       |    // Actual size vs. expected size check above ensures that we will not overflow any buffers here.
 1065|       |    // We know that entry_size * num_entries is less or equal to the size of the buffer.
 1066|  6.69k|    auto p = bp->getBuffer();
 1067|  6.69k|    for (auto [obj, sec_entries]: indx) {
  ------------------
  |  Branch (1067:33): [True: 4.79k, False: 6.69k]
  ------------------
 1068|       |        // Process a subsection.
 1069|  1.79M|        for (int i = 0; i < sec_entries; ++i) {
  ------------------
  |  Branch (1069:25): [True: 1.79M, False: 4.79k]
  ------------------
 1070|       |            // Read this entry
 1071|  1.79M|            std::array<qpdf_offset_t, 3> fields{};
 1072|  1.79M|            if (W[0] == 0) {
  ------------------
  |  Branch (1072:17): [True: 169k, False: 1.62M]
  ------------------
 1073|   169k|                fields[0] = 1;
 1074|   169k|            }
 1075|  7.17M|            for (size_t j = 0; j < 3; ++j) {
  ------------------
  |  Branch (1075:32): [True: 5.37M, False: 1.79M]
  ------------------
 1076|  12.7M|                for (int k = 0; k < W[j]; ++k) {
  ------------------
  |  Branch (1076:33): [True: 7.38M, False: 5.37M]
  ------------------
 1077|  7.38M|                    fields[j] <<= 8;
 1078|  7.38M|                    fields[j] |= *p++;
 1079|  7.38M|                }
 1080|  5.37M|            }
 1081|       |
 1082|       |            // Get the generation number.  The generation number is 0 unless this is an uncompressed
 1083|       |            // object record, in which case the generation number appears as the third field.
 1084|  1.79M|            if (saw_first_compressed_object) {
  ------------------
  |  Branch (1084:17): [True: 1.41M, False: 375k]
  ------------------
 1085|  1.41M|                if (fields[0] != 2) {
  ------------------
  |  Branch (1085:21): [True: 1.13M, False: 283k]
  ------------------
 1086|  1.13M|                    uncompressed_after_compressed_ = true;
 1087|  1.13M|                }
 1088|  1.41M|            } else if (fields[0] == 2) {
  ------------------
  |  Branch (1088:24): [True: 1.84k, False: 373k]
  ------------------
 1089|  1.84k|                saw_first_compressed_object = true;
 1090|  1.84k|            }
 1091|  1.79M|            if (obj == 0) {
  ------------------
  |  Branch (1091:17): [True: 3.37k, False: 1.78M]
  ------------------
 1092|       |                // This is needed by checkLinearization()
 1093|  3.37k|                first_xref_item_offset_ = xref_offset;
 1094|  1.78M|            } else if (fields[0] == 0) {
  ------------------
  |  Branch (1094:24): [True: 546k, False: 1.24M]
  ------------------
 1095|       |                // Ignore fields[2], which we don't care about in this case. This works around the
 1096|       |                // issue of some PDF files that put invalid values, like -1, here for deleted
 1097|       |                // objects.
 1098|   546k|                insertFreeXrefEntry(QPDFObjGen(obj, 0));
 1099|  1.24M|            } else {
 1100|  1.24M|                auto typ = toI(fields[0]);
 1101|  1.24M|                if (!in_stream_recovery || typ == 2) {
  ------------------
  |  Branch (1101:21): [True: 434k, False: 808k]
  |  Branch (1101:44): [True: 252k, False: 556k]
  ------------------
 1102|       |                    // If we are in xref stream recovery all actual uncompressed objects have
 1103|       |                    // already been inserted into the xref table. Avoid adding junk data into the
 1104|       |                    // xref table.
 1105|   686k|                    insertXrefEntry(obj, toI(fields[0]), fields[1], toI(fields[2]));
 1106|   686k|                }
 1107|  1.24M|            }
 1108|  1.79M|            ++obj;
 1109|  1.79M|        }
 1110|  4.79k|    }
 1111|       |
 1112|  6.69k|    if (!m->trailer) {
  ------------------
  |  Branch (1112:9): [True: 911, False: 5.78k]
  ------------------
 1113|    911|        setTrailer(dict);
 1114|    911|    }
 1115|       |
 1116|  6.69k|    if (dict.hasKey("/Prev")) {
  ------------------
  |  Branch (1116:9): [True: 1.09k, False: 5.60k]
  ------------------
 1117|  1.09k|        if (!dict.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (1117:13): [True: 93, False: 999]
  ------------------
 1118|     93|            throw damagedPDF(
 1119|     93|                "xref stream", "/Prev key in xref stream dictionary is not an integer");
 1120|     93|        }
 1121|    999|        return dict.getKey("/Prev").getIntValue();
 1122|  5.60k|    } else {
 1123|  5.60k|        return 0;
 1124|  5.60k|    }
 1125|  6.69k|}
_ZN4QPDF3Doc7Objects15insertXrefEntryEiixi:
 1129|   866k|{
 1130|       |    // Populate the xref table in such a way that the first reference to an object that we see,
 1131|       |    // which is the one in the latest xref table in which it appears, is the one that gets stored.
 1132|       |    // This works because we are reading more recent appends before older ones.
 1133|       |
 1134|       |    // If there is already an entry for this object and generation in the table, it means that a
 1135|       |    // later xref table has registered this object.  Disregard this one.
 1136|   866k|    int new_gen = f0 == 2 ? 0 : f2;
  ------------------
  |  Branch (1136:19): [True: 284k, False: 582k]
  ------------------
 1137|       |
 1138|   866k|    if (!(f0 == 1 || f0 == 2)) {
  ------------------
  |  Branch (1138:11): [True: 495k, False: 370k]
  |  Branch (1138:22): [True: 284k, False: 86.0k]
  ------------------
 1139|  86.0k|        return;
 1140|  86.0k|    }
 1141|       |
 1142|   780k|    if (!(obj > 0 && obj <= m->xref_table_max_id && 0 <= f2 && new_gen < 65535)) {
  ------------------
  |  Branch (1142:11): [True: 780k, False: 296]
  |  Branch (1142:22): [True: 480k, False: 300k]
  |  Branch (1142:53): [True: 480k, False: 50]
  |  Branch (1142:64): [True: 479k, False: 1.11k]
  ------------------
 1143|       |        // We are ignoring invalid objgens. Most will arrive here from xref reconstruction. There
 1144|       |        // is probably no point having another warning but we could count invalid items in order to
 1145|       |        // decide when to give up.
 1146|       |        // ignore impossibly large object ids or object ids > Size.
 1147|   301k|        return;
 1148|   301k|    }
 1149|       |
 1150|   479k|    if (m->deleted_objects.contains(obj)) {
  ------------------
  |  Branch (1150:9): [True: 1.95k, False: 477k]
  ------------------
 1151|  1.95k|        return;
 1152|  1.95k|    }
 1153|       |
 1154|   477k|    if (f0 == 2) {
  ------------------
  |  Branch (1154:9): [True: 198k, False: 279k]
  ------------------
 1155|   198k|        if (f1 == obj) {
  ------------------
  |  Branch (1155:13): [True: 792, False: 197k]
  ------------------
 1156|    792|            warn(
 1157|    792|                damagedPDF("xref stream", "self-referential object stream " + std::to_string(obj)));
 1158|    792|            return;
 1159|    792|        }
 1160|   197k|        if (f1 > m->xref_table_max_id) {
  ------------------
  |  Branch (1160:13): [True: 6.95k, False: 190k]
  ------------------
 1161|       |            // ignore impossibly large object stream ids
 1162|  6.95k|            warn(damagedPDF(
 1163|  6.95k|                "xref stream",
 1164|  6.95k|                "object stream id " + std::to_string(f1) + " for object " + std::to_string(obj) +
 1165|  6.95k|                    " is impossibly large"));
 1166|  6.95k|            return;
 1167|  6.95k|        }
 1168|   197k|    }
 1169|       |
 1170|   469k|    auto [iter, created] = m->xref_table.try_emplace(QPDFObjGen(obj, (f0 == 2 ? 0 : f2)));
  ------------------
  |  Branch (1170:71): [True: 190k, False: 279k]
  ------------------
 1171|   469k|    if (!created) {
  ------------------
  |  Branch (1171:9): [True: 42.8k, False: 426k]
  ------------------
 1172|  42.8k|        return;
 1173|  42.8k|    }
 1174|       |
 1175|   426k|    switch (f0) {
 1176|   239k|    case 1:
  ------------------
  |  Branch (1176:5): [True: 239k, False: 187k]
  ------------------
 1177|       |        // f2 is generation
 1178|   239k|        QTC::TC("qpdf", "QPDF xref gen > 0", ((f2 > 0) ? 1 : 0));
  ------------------
  |  Branch (1178:47): [True: 84.9k, False: 154k]
  ------------------
 1179|   239k|        iter->second = QPDFXRefEntry(f1);
 1180|   239k|        break;
 1181|       |
 1182|   187k|    case 2:
  ------------------
  |  Branch (1182:5): [True: 187k, False: 239k]
  ------------------
 1183|   187k|        iter->second = QPDFXRefEntry(toI(f1), f2);
 1184|   187k|        break;
 1185|       |
 1186|      0|    default:
  ------------------
  |  Branch (1186:5): [True: 0, False: 426k]
  ------------------
 1187|      0|        throw damagedPDF("xref stream", "unknown xref stream entry type " + std::to_string(f0));
 1188|      0|        break;
 1189|   426k|    }
 1190|   426k|}
_ZN4QPDF3Doc7Objects19insertFreeXrefEntryE10QPDFObjGen:
 1194|   550k|{
 1195|   550k|    if (!m->xref_table.contains(og) && og.getObj() <= m->xref_table_max_id) {
  ------------------
  |  Branch (1195:9): [True: 549k, False: 1.09k]
  |  Branch (1195:40): [True: 224k, False: 325k]
  ------------------
 1196|   224k|        m->deleted_objects.insert(og.getObj());
 1197|   224k|    }
 1198|   550k|}
_ZN4QPDF3Doc7Objects16resolveXRefTableEv:
 1230|  5.18k|{
 1231|  5.18k|    bool may_change = !m->reconstructed_xref;
 1232|   128k|    for (auto& iter: m->xref_table) {
  ------------------
  |  Branch (1232:20): [True: 128k, False: 5.13k]
  ------------------
 1233|   128k|        if (isUnresolved(iter.first)) {
  ------------------
  |  Branch (1233:13): [True: 64.1k, False: 64.4k]
  ------------------
 1234|  64.1k|            resolve(iter.first);
 1235|  64.1k|            if (may_change && m->reconstructed_xref) {
  ------------------
  |  Branch (1235:17): [True: 565, False: 63.5k]
  |  Branch (1235:31): [True: 50, False: 515]
  ------------------
 1236|     50|                return false;
 1237|     50|            }
 1238|  64.1k|        }
 1239|   128k|    }
 1240|  5.13k|    return true;
 1241|  5.18k|}
_ZN4QPDF21fixDanglingReferencesEb:
 1247|  40.0k|{
 1248|  40.0k|    if (m->fixed_dangling_refs) {
  ------------------
  |  Branch (1248:9): [True: 34.9k, False: 5.13k]
  ------------------
 1249|  34.9k|        return;
 1250|  34.9k|    }
 1251|  5.13k|    if (!m->objects.resolveXRefTable()) {
  ------------------
  |  Branch (1251:9): [True: 50, False: 5.08k]
  ------------------
 1252|     50|        m->objects.resolveXRefTable();
 1253|     50|    }
 1254|  5.13k|    m->fixed_dangling_refs = true;
 1255|  5.13k|}
_ZN4QPDF14getObjectCountEv:
 1259|  40.0k|{
 1260|       |    // This method returns the next available indirect object number. makeIndirectObject uses it for
 1261|       |    // this purpose. After fixDanglingReferences is called, all objects in the xref table will also
 1262|       |    // be in obj_cache.
 1263|  40.0k|    fixDanglingReferences();
 1264|  40.0k|    QPDFObjGen og;
 1265|  40.0k|    if (!m->obj_cache.empty()) {
  ------------------
  |  Branch (1265:9): [True: 40.0k, False: 19]
  ------------------
 1266|  40.0k|        og = (*(m->obj_cache.rbegin())).first;
 1267|  40.0k|    }
 1268|  40.0k|    return QIntC::to_size(og.getObj());
 1269|  40.0k|}
_ZN4QPDF3Doc7Objects24setLastObjectDescriptionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1285|   283k|{
 1286|   283k|    m->last_object_description.clear();
 1287|   283k|    if (!description.empty()) {
  ------------------
  |  Branch (1287:9): [True: 7.70k, False: 275k]
  ------------------
 1288|  7.70k|        m->last_object_description += description;
 1289|  7.70k|        if (og.isIndirect()) {
  ------------------
  |  Branch (1289:13): [True: 7.70k, False: 0]
  ------------------
 1290|  7.70k|            m->last_object_description += ": ";
 1291|  7.70k|        }
 1292|  7.70k|    }
 1293|   283k|    if (og.isIndirect()) {
  ------------------
  |  Branch (1293:9): [True: 283k, False: 0]
  ------------------
 1294|   283k|        m->last_object_description += "object " + og.unparse(' ');
 1295|   283k|    }
 1296|   283k|}
_ZN4QPDF3Doc7Objects11readTrailerEv:
 1300|  20.0k|{
 1301|  20.0k|    qpdf_offset_t offset = m->file->tell();
 1302|  20.0k|    auto object =
 1303|  20.0k|        Parser::parse(*m->file, "trailer", m->tokenizer, nullptr, qpdf, m->reconstructed_xref);
 1304|  20.0k|    if (object.isDictionary() && m->objects.readToken(*m->file).isWord("stream")) {
  ------------------
  |  Branch (1304:9): [True: 4.10k, False: 15.9k]
  |  Branch (1304:9): [True: 135, False: 19.9k]
  |  Branch (1304:34): [True: 135, False: 3.96k]
  ------------------
 1305|    135|        warn(damagedPDF("trailer", m->file->tell(), "stream keyword found in trailer"));
 1306|    135|    }
 1307|       |    // Override last_offset so that it points to the beginning of the object we just read
 1308|  20.0k|    m->file->setLastOffset(offset);
 1309|  20.0k|    return object;
 1310|  20.0k|}
_ZN4QPDF3Doc7Objects10readObjectERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1314|   144k|{
 1315|   144k|    setLastObjectDescription(description, og);
 1316|   144k|    qpdf_offset_t offset = m->file->tell();
 1317|       |
 1318|   144k|    StringDecrypter decrypter{&qpdf, og};
 1319|   144k|    StringDecrypter* decrypter_ptr = m->encp->encrypted ? &decrypter : nullptr;
  ------------------
  |  Branch (1319:38): [True: 5.98k, False: 138k]
  ------------------
 1320|   144k|    auto object = Parser::parse(
 1321|   144k|        *m->file,
 1322|   144k|        m->last_object_description,
 1323|   144k|        m->tokenizer,
 1324|   144k|        decrypter_ptr,
 1325|   144k|        qpdf,
 1326|   144k|        m->reconstructed_xref || m->in_read_xref_stream);
  ------------------
  |  Branch (1326:9): [True: 139k, False: 4.43k]
  |  Branch (1326:34): [True: 2.21k, False: 2.21k]
  ------------------
 1327|   144k|    if (!object) {
  ------------------
  |  Branch (1327:9): [True: 13.2k, False: 131k]
  ------------------
 1328|  13.2k|        return {};
 1329|  13.2k|    }
 1330|   131k|    auto token = readToken(*m->file);
 1331|   131k|    if (object.isDictionary() && token.isWord("stream")) {
  ------------------
  |  Branch (1331:9): [True: 119k, False: 11.6k]
  |  Branch (1331:9): [True: 38.4k, False: 92.7k]
  |  Branch (1331:34): [True: 38.4k, False: 81.0k]
  ------------------
 1332|  38.4k|        readStream(object, og, offset);
 1333|  38.4k|        token = readToken(*m->file);
 1334|  38.4k|    }
 1335|   131k|    if (!token.isWord("endobj")) {
  ------------------
  |  Branch (1335:9): [True: 47.7k, False: 83.4k]
  ------------------
 1336|  47.7k|        warn(damagedPDF("expected endobj"));
 1337|  47.7k|    }
 1338|   131k|    return object;
 1339|   144k|}
_ZN4QPDF3Doc7Objects10readStreamER16QPDFObjectHandle10QPDFObjGenx:
 1344|  38.4k|{
 1345|  38.4k|    validateStreamLineEnd(object, og, offset);
 1346|       |
 1347|       |    // Must get offset before accessing any additional objects since resolving a previously
 1348|       |    // unresolved indirect object will change file position.
 1349|  38.4k|    qpdf_offset_t stream_offset = m->file->tell();
 1350|  38.4k|    size_t length = 0;
 1351|       |
 1352|  38.4k|    try {
 1353|  38.4k|        auto length_obj = object.getKey("/Length");
 1354|       |
 1355|  38.4k|        if (!length_obj.isInteger()) {
  ------------------
  |  Branch (1355:13): [True: 18.1k, False: 20.2k]
  ------------------
 1356|  18.1k|            if (length_obj.null()) {
  ------------------
  |  Branch (1356:17): [True: 17.9k, False: 203]
  ------------------
 1357|  17.9k|                throw damagedPDF(offset, "stream dictionary lacks /Length key");
 1358|  17.9k|            }
 1359|    203|            throw damagedPDF(offset, "/Length key in stream dictionary is not an integer");
 1360|  18.1k|        }
 1361|       |
 1362|  20.2k|        length = toS(length_obj.getUIntValue());
 1363|       |        // Seek in two steps to avoid potential integer overflow
 1364|  20.2k|        m->file->seek(stream_offset, SEEK_SET);
 1365|  20.2k|        m->file->seek(toO(length), SEEK_CUR);
 1366|  20.2k|        if (!readToken(*m->file).isWord("endstream")) {
  ------------------
  |  Branch (1366:13): [True: 3.33k, False: 16.9k]
  ------------------
 1367|  3.33k|            throw damagedPDF("expected endstream");
 1368|  3.33k|        }
 1369|  27.9k|    } catch (QPDFExc& e) {
 1370|  27.9k|        if (!cf.surpress_recovery()) {
  ------------------
  |  Branch (1370:13): [True: 27.9k, False: 0]
  ------------------
 1371|  27.9k|            warn(e);
 1372|  27.9k|            length = recoverStreamLength(m->file, og, stream_offset);
 1373|  27.9k|        } else {
 1374|      0|            throw;
 1375|      0|        }
 1376|  27.9k|    }
 1377|  31.1k|    object = QPDFObjectHandle(qpdf::Stream(qpdf, og, object, stream_offset, length));
 1378|  31.1k|}
_ZN4QPDF3Doc7Objects21validateStreamLineEndER16QPDFObjectHandle10QPDFObjGenx:
 1382|  38.4k|{
 1383|       |    // The PDF specification states that the word "stream" should be followed by either a carriage
 1384|       |    // return and a newline or by a newline alone.  It specifically disallowed following it by a
 1385|       |    // carriage return alone since, in that case, there would be no way to tell whether the NL in a
 1386|       |    // CR NL sequence was part of the stream data.  However, some readers, including Adobe reader,
 1387|       |    // accept a carriage return by itself when followed by a non-newline character, so that's what
 1388|       |    // we do here. We have also seen files that have extraneous whitespace between the stream
 1389|       |    // keyword and the newline.
 1390|  49.1k|    while (true) {
  ------------------
  |  Branch (1390:12): [True: 49.0k, Folded]
  ------------------
 1391|  49.0k|        char ch;
 1392|  49.0k|        if (m->file->read(&ch, 1) == 0) {
  ------------------
  |  Branch (1392:13): [True: 205, False: 48.8k]
  ------------------
 1393|       |            // A premature EOF here will result in some other problem that will get reported at
 1394|       |            // another time.
 1395|    205|            return;
 1396|    205|        }
 1397|  48.8k|        if (ch == '\n') {
  ------------------
  |  Branch (1397:13): [True: 15.2k, False: 33.5k]
  ------------------
 1398|       |            // ready to read stream data
 1399|  15.2k|            return;
 1400|  15.2k|        }
 1401|  33.5k|        if (ch == '\r') {
  ------------------
  |  Branch (1401:13): [True: 18.3k, False: 15.2k]
  ------------------
 1402|       |            // Read another character
 1403|  18.3k|            if (m->file->read(&ch, 1) != 0) {
  ------------------
  |  Branch (1403:17): [True: 18.3k, False: 24]
  ------------------
 1404|  18.3k|                if (ch == '\n') {
  ------------------
  |  Branch (1404:21): [True: 16.1k, False: 2.13k]
  ------------------
 1405|       |                    // Ready to read stream data
 1406|  16.1k|                    QTC::TC("qpdf", "QPDF stream with CRNL");
 1407|  16.1k|                } else {
 1408|       |                    // Treat the \r by itself as the whitespace after endstream and start reading
 1409|       |                    // stream data in spite of not having seen a newline.
 1410|  2.13k|                    m->file->unreadCh(ch);
 1411|  2.13k|                    warn(damagedPDF(
 1412|  2.13k|                        m->file->tell(), "stream keyword followed by carriage return only"));
 1413|  2.13k|                }
 1414|  18.3k|            }
 1415|  18.3k|            return;
 1416|  18.3k|        }
 1417|  15.2k|        if (!util::is_space(ch)) {
  ------------------
  |  Branch (1417:13): [True: 4.55k, False: 10.7k]
  ------------------
 1418|  4.55k|            m->file->unreadCh(ch);
 1419|  4.55k|            warn(damagedPDF(
 1420|  4.55k|                m->file->tell(), "stream keyword not followed by proper line terminator"));
 1421|  4.55k|            return;
 1422|  4.55k|        }
 1423|  10.7k|        warn(damagedPDF(m->file->tell(), "stream keyword followed by extraneous whitespace"));
 1424|  10.7k|    }
 1425|  38.4k|}
_ZN4QPDF3Doc7Objects13findEndstreamEv:
 1429|  23.2k|{
 1430|       |    // Find endstream or endobj. Position the input at that token.
 1431|  23.2k|    auto t = readToken(*m->file, 20);
 1432|  23.2k|    if (t.isWord("endobj") || t.isWord("endstream")) {
  ------------------
  |  Branch (1432:9): [True: 14.6k, False: 8.63k]
  |  Branch (1432:9): [True: 20.1k, False: 3.11k]
  |  Branch (1432:31): [True: 5.51k, False: 3.11k]
  ------------------
 1433|  20.1k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1434|  20.1k|        return true;
 1435|  20.1k|    }
 1436|  3.11k|    return false;
 1437|  23.2k|}
_ZN4QPDF3Doc7Objects19recoverStreamLengthENSt3__110shared_ptrI11InputSourceEE10QPDFObjGenx:
 1442|  20.8k|{
 1443|       |    // Try to reconstruct stream length by looking for endstream or endobj
 1444|  20.8k|    warn(damagedPDF(*input, stream_offset, "attempting to recover stream length"));
 1445|       |
 1446|  20.8k|    PatternFinder ef(*this, &Objects::findEndstream);
 1447|  20.8k|    size_t length = 0;
 1448|  20.8k|    if (m->file->findFirst("end", stream_offset, 0, ef)) {
  ------------------
  |  Branch (1448:9): [True: 20.1k, False: 676]
  ------------------
 1449|  20.1k|        length = toS(m->file->tell() - stream_offset);
 1450|       |        // Reread endstream but, if it was endobj, don't skip that.
 1451|  20.1k|        QPDFTokenizer::Token t = readToken(*m->file);
 1452|  20.1k|        if (t.getValue() == "endobj") {
  ------------------
  |  Branch (1452:13): [True: 14.6k, False: 5.51k]
  ------------------
 1453|  14.6k|            m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1454|  14.6k|        }
 1455|  20.1k|    }
 1456|       |
 1457|  20.8k|    if (length) {
  ------------------
  |  Branch (1457:9): [True: 19.5k, False: 1.28k]
  ------------------
 1458|  19.5k|        auto end = stream_offset + toO(length);
 1459|  19.5k|        qpdf_offset_t found_offset = 0;
 1460|  19.5k|        QPDFObjGen found_og;
 1461|       |
 1462|       |        // Make sure this is inside this object
 1463|   434k|        for (auto const& [current_og, entry]: m->xref_table) {
  ------------------
  |  Branch (1463:45): [True: 434k, False: 19.5k]
  ------------------
 1464|   434k|            if (entry.getType() == 1) {
  ------------------
  |  Branch (1464:17): [True: 357k, False: 76.8k]
  ------------------
 1465|   357k|                qpdf_offset_t obj_offset = entry.getOffset();
 1466|   357k|                if (found_offset < obj_offset && obj_offset < end) {
  ------------------
  |  Branch (1466:21): [True: 260k, False: 97.6k]
  |  Branch (1466:50): [True: 68.5k, False: 191k]
  ------------------
 1467|  68.5k|                    found_offset = obj_offset;
 1468|  68.5k|                    found_og = current_og;
 1469|  68.5k|                }
 1470|   357k|            }
 1471|   434k|        }
 1472|  19.5k|        if (!found_offset || found_og == og) {
  ------------------
  |  Branch (1472:13): [True: 1.90k, False: 17.6k]
  |  Branch (1472:30): [True: 16.0k, False: 1.65k]
  ------------------
 1473|       |            // If we are trying to recover an XRef stream the xref table will not contain and
 1474|       |            // won't contain any entries, therefore we cannot check the found length. Otherwise we
 1475|       |            // found endstream\nendobj within the space allowed for this object, so we're probably
 1476|       |            // in good shape.
 1477|  17.9k|        } else {
 1478|  1.65k|            length = 0;
 1479|  1.65k|        }
 1480|  19.5k|    }
 1481|       |
 1482|  20.8k|    if (length == 0) {
  ------------------
  |  Branch (1482:9): [True: 2.94k, False: 17.9k]
  ------------------
 1483|  2.94k|        warn(damagedPDF(
 1484|  2.94k|            *input, stream_offset, "unable to recover stream data; treating stream as empty"));
 1485|  17.9k|    } else {
 1486|  17.9k|        warn(damagedPDF(
 1487|  17.9k|            *input, stream_offset, "recovered stream length: " + std::to_string(length)));
 1488|  17.9k|    }
 1489|       |
 1490|  20.8k|    return length;
 1491|  20.8k|}
_ZN4QPDF3Doc7Objects9readTokenER11InputSourcem:
 1495|  3.48M|{
 1496|  3.48M|    return m->tokenizer.readToken(input, m->last_object_description, true, max_len);
 1497|  3.48M|}
_ZN4QPDF3Doc7Objects17read_object_startEx:
 1501|   147k|{
 1502|   147k|    m->file->seek(offset, SEEK_SET);
 1503|   147k|    QPDFTokenizer::Token tobjid = readToken(*m->file);
 1504|   147k|    bool objidok = tobjid.isInteger();
 1505|   147k|    if (!objidok) {
  ------------------
  |  Branch (1505:9): [True: 1.70k, False: 146k]
  ------------------
 1506|  1.70k|        throw damagedPDF(offset, "expected n n obj");
 1507|  1.70k|    }
 1508|   146k|    QPDFTokenizer::Token tgen = readToken(*m->file);
 1509|   146k|    bool genok = tgen.isInteger();
 1510|   146k|    if (!genok) {
  ------------------
  |  Branch (1510:9): [True: 258, False: 145k]
  ------------------
 1511|    258|        throw damagedPDF(offset, "expected n n obj");
 1512|    258|    }
 1513|   145k|    QPDFTokenizer::Token tobj = readToken(*m->file);
 1514|       |
 1515|   145k|    bool objok = tobj.isWord("obj");
 1516|       |
 1517|   145k|    if (!objok) {
  ------------------
  |  Branch (1517:9): [True: 502, False: 145k]
  ------------------
 1518|    502|        throw damagedPDF(offset, "expected n n obj");
 1519|    502|    }
 1520|   145k|    int objid = QUtil::string_to_int(tobjid.getValue().c_str());
 1521|   145k|    int generation = QUtil::string_to_int(tgen.getValue().c_str());
 1522|   145k|    if (objid <= 0 || objid >= m->xref_table_max_id || generation < 0 || generation >= 65535) {
  ------------------
  |  Branch (1522:9): [True: 467, False: 144k]
  |  Branch (1522:23): [True: 174, False: 144k]
  |  Branch (1522:56): [True: 42, False: 144k]
  |  Branch (1522:74): [True: 78, False: 144k]
  ------------------
 1523|    408|        throw damagedPDF(
 1524|    408|            offset,
 1525|    408|            "object " + std::to_string(objid) + " " + std::to_string(generation) +
 1526|    408|                " has an invalid or impossibly large ID or generation");
 1527|    408|    }
 1528|   144k|    return {objid, generation};
 1529|   145k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetEbxRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1534|   138k|{
 1535|   138k|    QPDFObjGen og;
 1536|   138k|    setLastObjectDescription(description, exp_og);
 1537|       |
 1538|   138k|    if (cf.surpress_recovery()) {
  ------------------
  |  Branch (1538:9): [True: 0, False: 138k]
  ------------------
 1539|      0|        try_recovery = false;
 1540|      0|    }
 1541|       |
 1542|       |    // Special case: if offset is 0, just return null.  Some PDF writers, in particular
 1543|       |    // "Mac OS X 10.7.5 Quartz PDFContext", may store deleted objects in the xref table as
 1544|       |    // "0000000000 00000 n", which is not correct, but it won't hurt anything for us to ignore
 1545|       |    // these.
 1546|   138k|    if (offset == 0) {
  ------------------
  |  Branch (1546:9): [True: 324, False: 138k]
  ------------------
 1547|    324|        warn(damagedPDF(
 1548|    324|            -1,
 1549|    324|            "object has offset 0 - a common error handled correctly by qpdf and most other "
 1550|    324|            "applications"));
 1551|    324|        return;
 1552|    324|    }
 1553|       |
 1554|   138k|    try {
 1555|   138k|        og = read_object_start(offset);
 1556|   138k|        if (exp_og != og) {
  ------------------
  |  Branch (1556:13): [True: 132, False: 138k]
  ------------------
 1557|    132|            QPDFExc e = damagedPDF(offset, "expected " + exp_og.unparse(' ') + " obj");
 1558|    132|            if (try_recovery) {
  ------------------
  |  Branch (1558:17): [True: 132, False: 0]
  ------------------
 1559|       |                // Will be retried below
 1560|    132|                throw e;
 1561|    132|            } else {
 1562|       |                // We can try reading the object anyway even if the ID doesn't match.
 1563|      0|                warn(e);
 1564|      0|            }
 1565|    132|        }
 1566|   138k|    } catch (QPDFExc& e) {
 1567|  1.62k|        if (!try_recovery) {
  ------------------
  |  Branch (1567:13): [True: 0, False: 1.62k]
  ------------------
 1568|      0|            throw;
 1569|      0|        }
 1570|       |        // Try again after reconstructing xref table
 1571|  1.62k|        reconstruct_xref(e);
 1572|  1.62k|        if (m->xref_table.contains(exp_og) && m->xref_table[exp_og].getType() == 1) {
  ------------------
  |  Branch (1572:13): [True: 46, False: 1.57k]
  |  Branch (1572:47): [True: 46, False: 0]
  ------------------
 1573|     46|            qpdf_offset_t new_offset = m->xref_table[exp_og].getOffset();
 1574|     46|            readObjectAtOffset(false, new_offset, description, exp_og);
 1575|     46|            return;
 1576|     46|        }
 1577|  1.57k|        warn(damagedPDF(
 1578|  1.57k|            "",
 1579|  1.57k|            -1,
 1580|  1.57k|            ("object " + exp_og.unparse(' ') +
 1581|  1.57k|             " not found in file after regenerating cross reference table")));
 1582|  1.57k|        return;
 1583|  1.62k|    }
 1584|       |
 1585|   136k|    if (auto oh = readObject(description, og)) {
  ------------------
  |  Branch (1585:14): [True: 111k, False: 25.3k]
  ------------------
 1586|       |        // Determine the end offset of this object before and after white space.  We use these
 1587|       |        // numbers to validate linearization hint tables.  Offsets and lengths of objects may imply
 1588|       |        // the end of an object to be anywhere between these values.
 1589|   111k|        qpdf_offset_t end_before_space = m->file->tell();
 1590|       |
 1591|       |        // skip over spaces
 1592|   252k|        while (true) {
  ------------------
  |  Branch (1592:16): [True: 252k, Folded]
  ------------------
 1593|   252k|            char ch;
 1594|   252k|            if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1594:17): [True: 799, False: 251k]
  ------------------
 1595|    799|                throw damagedPDF(m->file->tell(), "EOF after endobj");
 1596|    799|            }
 1597|   251k|            if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1597:17): [True: 110k, False: 141k]
  ------------------
 1598|   110k|                m->file->seek(-1, SEEK_CUR);
 1599|   110k|                break;
 1600|   110k|            }
 1601|   251k|        }
 1602|   110k|        m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1603|   110k|    }
 1604|   136k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
 1609|  9.14k|{
 1610|  9.14k|    auto og = read_object_start(offset);
 1611|  9.14k|    auto oh = readObject(description, og);
 1612|       |
 1613|  9.14k|    if (!oh || !m->objects.isUnresolved(og)) {
  ------------------
  |  Branch (1613:9): [True: 1.50k, False: 7.63k]
  |  Branch (1613:16): [True: 5.58k, False: 2.05k]
  ------------------
 1614|  5.64k|        return oh;
 1615|  5.64k|    }
 1616|       |
 1617|  3.50k|    if (skip_cache_if_in_xref && m->xref_table.contains(og)) {
  ------------------
  |  Branch (1617:9): [True: 2.05k, False: 1.45k]
  |  Branch (1617:34): [True: 14, False: 2.03k]
  ------------------
 1618|       |        // In the special case of the xref stream and linearization hint tables, the offset comes
 1619|       |        // from another source. For the specific case of xref streams, the xref stream is read and
 1620|       |        // loaded into the object cache very early in parsing. Ordinarily, when a file is updated by
 1621|       |        // appending, items inserted into the xref table in later updates take precedence over
 1622|       |        // earlier items. In the special case of reusing the object number previously used as the
 1623|       |        // xref stream, we have the following order of events:
 1624|       |        //
 1625|       |        // * reused object gets loaded into the xref table
 1626|       |        // * old object is read here while reading xref streams
 1627|       |        // * original xref entry is ignored (since already in xref table)
 1628|       |        //
 1629|       |        // It is the second step that causes a problem. Even though the xref table is correct in
 1630|       |        // this case, the old object is already in the cache and so effectively prevails over the
 1631|       |        // reused object. To work around this issue, we have a special case for the xref stream (via
 1632|       |        // the skip_cache_if_in_xref): if the object is already in the xref stream, don't cache what
 1633|       |        // we read here.
 1634|       |        //
 1635|       |        // It is likely that the same bug may exist for linearization hint tables, but the existing
 1636|       |        // code uses end_before_space and end_after_space from the cache, so fixing that would
 1637|       |        // require more significant rework. The chances of a linearization hint stream being reused
 1638|       |        // seems smaller because the xref stream is probably the highest object in the file and the
 1639|       |        // linearization hint stream would be some random place in the middle, so I'm leaving that
 1640|       |        // bug unfixed for now. If the bug were to be fixed, we could use !check_og in place of
 1641|       |        // skip_cache_if_in_xref.
 1642|     14|        QTC::TC("qpdf", "QPDF skipping cache for known unchecked object");
 1643|     14|        return oh;
 1644|     14|    }
 1645|       |
 1646|       |    // Determine the end offset of this object before and after white space.  We use these
 1647|       |    // numbers to validate linearization hint tables.  Offsets and lengths of objects may imply
 1648|       |    // the end of an object to be anywhere between these values.
 1649|  3.49k|    qpdf_offset_t end_before_space = m->file->tell();
 1650|       |
 1651|       |    // skip over spaces
 1652|  5.98k|    while (true) {
  ------------------
  |  Branch (1652:12): [True: 4.53k, Folded]
  ------------------
 1653|  4.53k|        char ch;
 1654|  4.53k|        if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1654:13): [True: 66, False: 4.46k]
  ------------------
 1655|     66|            throw damagedPDF(m->file->tell(), "EOF after endobj");
 1656|     66|        }
 1657|  4.46k|        if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1657:13): [True: 1.97k, False: 2.49k]
  ------------------
 1658|  1.97k|            m->file->seek(-1, SEEK_CUR);
 1659|  1.97k|            break;
 1660|  1.97k|        }
 1661|  4.46k|    }
 1662|  3.42k|    m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1663|       |
 1664|  3.42k|    return oh;
 1665|  3.49k|}
_ZN4QPDF3Doc7Objects7resolveE10QPDFObjGen:
 1669|   379k|{
 1670|   379k|    if (!isUnresolved(og)) {
  ------------------
  |  Branch (1670:9): [True: 0, False: 379k]
  ------------------
 1671|      0|        return m->obj_cache[og].object;
 1672|      0|    }
 1673|       |
 1674|   379k|    if (m->resolving.contains(og)) {
  ------------------
  |  Branch (1674:9): [True: 533, False: 378k]
  ------------------
 1675|       |        // This can happen if an object references itself directly or indirectly in some key that
 1676|       |        // has to be resolved during object parsing, such as stream length.
 1677|    533|        warn(damagedPDF("", "loop detected resolving object " + og.unparse(' ')));
 1678|    533|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1679|    533|        return m->obj_cache[og].object;
 1680|    533|    }
 1681|   378k|    ResolveRecorder rr(qpdf, og);
 1682|       |
 1683|   378k|    if (m->xref_table.contains(og)) {
  ------------------
  |  Branch (1683:9): [True: 222k, False: 156k]
  ------------------
 1684|   222k|        QPDFXRefEntry const& entry = m->xref_table[og];
 1685|   222k|        try {
 1686|   222k|            switch (entry.getType()) {
 1687|   138k|            case 1:
  ------------------
  |  Branch (1687:13): [True: 138k, False: 83.1k]
  ------------------
 1688|       |                // Object stored in cache by readObjectAtOffset
 1689|   138k|                readObjectAtOffset(true, entry.getOffset(), "", og);
 1690|   138k|                break;
 1691|       |
 1692|  83.1k|            case 2:
  ------------------
  |  Branch (1692:13): [True: 83.1k, False: 138k]
  ------------------
 1693|  83.1k|                resolveObjectsInStream(entry.getObjStreamNumber());
 1694|  83.1k|                break;
 1695|       |
 1696|      7|            default:
  ------------------
  |  Branch (1696:13): [True: 7, False: 222k]
  ------------------
 1697|      7|                throw damagedPDF(
 1698|      7|                    "", -1, ("object " + og.unparse('/') + " has unexpected xref entry type"));
 1699|   222k|            }
 1700|   222k|        } catch (QPDFExc& e) {
 1701|  40.7k|            warn(e);
 1702|  40.7k|        } catch (std::exception& e) {
 1703|    427|            warn(damagedPDF(
 1704|    427|                "", -1, ("object " + og.unparse('/') + ": error reading object: " + e.what())));
 1705|    427|        }
 1706|   222k|    }
 1707|       |
 1708|   362k|    if (isUnresolved(og)) {
  ------------------
  |  Branch (1708:9): [True: 251k, False: 111k]
  ------------------
 1709|       |        // PDF spec says unknown objects resolve to the null object.
 1710|   251k|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1711|   251k|    }
 1712|       |
 1713|   362k|    auto& result(m->obj_cache[og].object);
 1714|   362k|    result->setDefaultDescription(&qpdf, og);
 1715|   362k|    return result;
 1716|   378k|}
_ZN4QPDF3Doc7Objects22resolveObjectsInStreamEi:
 1720|  83.1k|{
 1721|  83.1k|    auto damaged =
 1722|  83.1k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1723|  83.1k|        return {
 1724|  83.1k|            qpdf_e_damaged_pdf,
 1725|  83.1k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1726|  83.1k|            +"object " + std::to_string(id) + " 0",
 1727|  83.1k|            offset,
 1728|  83.1k|            msg,
 1729|  83.1k|            true};
 1730|  83.1k|    };
 1731|       |
 1732|  83.1k|    if (m->resolved_object_streams.contains(obj_stream_number)) {
  ------------------
  |  Branch (1732:9): [True: 56.1k, False: 27.0k]
  ------------------
 1733|  56.1k|        return;
 1734|  56.1k|    }
 1735|  27.0k|    m->resolved_object_streams.insert(obj_stream_number);
 1736|       |    // Force resolution of object stream
 1737|  27.0k|    Stream obj_stream = qpdf.getObject(obj_stream_number, 0);
 1738|  27.0k|    if (!obj_stream) {
  ------------------
  |  Branch (1738:9): [True: 23.3k, False: 3.64k]
  ------------------
 1739|  23.3k|        throw damagedPDF(
 1740|  23.3k|            "object " + std::to_string(obj_stream_number) + " 0",
 1741|  23.3k|            "supposed object stream " + std::to_string(obj_stream_number) + " is not a stream");
 1742|  23.3k|    }
 1743|       |
 1744|       |    // For linearization data in the object, use the data from the object stream for the objects in
 1745|       |    // the stream.
 1746|  3.64k|    QPDFObjGen stream_og(obj_stream_number, 0);
 1747|  3.64k|    qpdf_offset_t end_before_space = m->obj_cache[stream_og].end_before_space;
 1748|  3.64k|    qpdf_offset_t end_after_space = m->obj_cache[stream_og].end_after_space;
 1749|       |
 1750|  3.64k|    QPDFObjectHandle dict = obj_stream.getDict();
 1751|  3.64k|    if (!dict.isDictionaryOfType("/ObjStm")) {
  ------------------
  |  Branch (1751:9): [True: 741, False: 2.90k]
  ------------------
 1752|    741|        warn(damagedPDF(
 1753|    741|            "object " + std::to_string(obj_stream_number) + " 0",
 1754|    741|            "supposed object stream " + std::to_string(obj_stream_number) + " has wrong type"));
 1755|    741|    }
 1756|       |
 1757|  3.64k|    unsigned int n{0};
 1758|  3.64k|    int first{0};
 1759|  3.64k|    if (!(dict.getKey("/N").getValueAsUInt(n) && dict.getKey("/First").getValueAsInt(first))) {
  ------------------
  |  Branch (1759:9): [True: 166, False: 3.47k]
  |  Branch (1759:11): [True: 1.20k, False: 2.44k]
  |  Branch (1759:50): [True: 1.15k, False: 46]
  ------------------
 1760|    166|        throw damagedPDF(
 1761|    166|            "object " + std::to_string(obj_stream_number) + " 0",
 1762|    166|            "object stream " + std::to_string(obj_stream_number) + " has incorrect keys");
 1763|    166|    }
 1764|       |
 1765|       |    // id, offset, size
 1766|  3.47k|    std::vector<std::tuple<int, qpdf_offset_t, size_t>> offsets;
 1767|       |
 1768|  3.47k|    auto stream_data = obj_stream.getStreamData(qpdf_dl_specialized);
 1769|       |
 1770|  3.47k|    is::OffsetBuffer input("", stream_data);
 1771|       |
 1772|  3.47k|    const auto b_size = stream_data.size();
 1773|  3.47k|    const auto end_offset = static_cast<qpdf_offset_t>(b_size);
 1774|  3.47k|    auto b_start = stream_data.data();
 1775|       |
 1776|  3.47k|    if (first >= end_offset) {
  ------------------
  |  Branch (1776:9): [True: 45, False: 3.43k]
  ------------------
 1777|     45|        throw damagedPDF(
 1778|     45|            "object " + std::to_string(obj_stream_number) + " 0",
 1779|     45|            "object stream " + std::to_string(obj_stream_number) + " has invalid /First entry");
 1780|     45|    }
 1781|       |
 1782|  3.43k|    int id = 0;
 1783|  3.43k|    long long last_offset = -1;
 1784|  3.43k|    bool is_first = true;
 1785|  41.9k|    for (unsigned int i = 0; i < n; ++i) {
  ------------------
  |  Branch (1785:30): [True: 38.6k, False: 3.28k]
  ------------------
 1786|  38.6k|        auto tnum = readToken(input);
 1787|  38.6k|        auto id_offset = input.getLastOffset();
 1788|  38.6k|        auto toffset = readToken(input);
 1789|  38.6k|        if (!(tnum.isInteger() && toffset.isInteger())) {
  ------------------
  |  Branch (1789:15): [True: 38.5k, False: 97]
  |  Branch (1789:35): [True: 38.4k, False: 51]
  ------------------
 1790|    148|            throw damaged(0, input.getLastOffset(), "expected integer in object stream header");
 1791|    148|        }
 1792|       |
 1793|  38.4k|        int num = QUtil::string_to_int(tnum.getValue().c_str());
 1794|  38.4k|        long long offset = QUtil::string_to_int(toffset.getValue().c_str());
 1795|       |
 1796|  38.4k|        if (num == obj_stream_number) {
  ------------------
  |  Branch (1796:13): [True: 371, False: 38.0k]
  ------------------
 1797|    371|            warn(damaged(num, id_offset, "object stream claims to contain itself"));
 1798|    371|            continue;
 1799|    371|        }
 1800|       |
 1801|  38.0k|        if (num < 1) {
  ------------------
  |  Branch (1801:13): [True: 600, False: 37.4k]
  ------------------
 1802|    600|            warn(damaged(num, id_offset, "object id is invalid"s));
 1803|    600|            continue;
 1804|    600|        }
 1805|       |
 1806|  37.4k|        if (offset <= last_offset) {
  ------------------
  |  Branch (1806:13): [True: 3.67k, False: 33.8k]
  ------------------
 1807|  3.67k|            warn(damaged(
 1808|  3.67k|                num,
 1809|  3.67k|                input.getLastOffset(),
 1810|  3.67k|                "offset " + std::to_string(offset) +
 1811|  3.67k|                    " is invalid (must be larger than previous offset " +
 1812|  3.67k|                    std::to_string(last_offset) + ")"));
 1813|  3.67k|            continue;
 1814|  3.67k|        }
 1815|       |
 1816|  33.8k|        if (num > m->xref_table_max_id) {
  ------------------
  |  Branch (1816:13): [True: 902, False: 32.9k]
  ------------------
 1817|    902|            continue;
 1818|    902|        }
 1819|       |
 1820|  32.9k|        if (first + offset >= end_offset) {
  ------------------
  |  Branch (1820:13): [True: 6.58k, False: 26.3k]
  ------------------
 1821|  6.58k|            warn(damaged(
 1822|  6.58k|                num, input.getLastOffset(), "offset " + std::to_string(offset) + " is too large"));
 1823|  6.58k|            continue;
 1824|  6.58k|        }
 1825|       |
 1826|  26.3k|        if (is_first) {
  ------------------
  |  Branch (1826:13): [True: 781, False: 25.5k]
  ------------------
 1827|    781|            is_first = false;
 1828|  25.5k|        } else {
 1829|  25.5k|            offsets.emplace_back(
 1830|  25.5k|                id, last_offset + first, static_cast<size_t>(offset - last_offset));
 1831|  25.5k|        }
 1832|       |
 1833|  26.3k|        last_offset = offset;
 1834|  26.3k|        id = num;
 1835|  26.3k|    }
 1836|       |
 1837|  3.28k|    if (!is_first) {
  ------------------
  |  Branch (1837:9): [True: 674, False: 2.61k]
  ------------------
 1838|       |        // We found at least one valid entry.
 1839|    674|        offsets.emplace_back(
 1840|    674|            id, last_offset + first, b_size - static_cast<size_t>(last_offset + first));
 1841|    674|    }
 1842|       |
 1843|       |    // To avoid having to read the object stream multiple times, store all objects that would be
 1844|       |    // found here in the cache.  Remember that some objects stored here might have been overridden
 1845|       |    // by new objects appended to the file, so it is necessary to recheck the xref table and only
 1846|       |    // cache what would actually be resolved here.
 1847|  23.1k|    for (auto const& [obj_id, obj_offset, obj_size]: offsets) {
  ------------------
  |  Branch (1847:52): [True: 23.1k, False: 3.28k]
  ------------------
 1848|  23.1k|        QPDFObjGen og(obj_id, 0);
 1849|  23.1k|        auto entry = m->xref_table.find(og);
 1850|  23.1k|        if (entry != m->xref_table.end() && entry->second.getType() == 2 &&
  ------------------
  |  Branch (1850:13): [True: 21.8k, False: 1.35k]
  |  Branch (1850:13): [True: 21.1k, False: 2.08k]
  |  Branch (1850:45): [True: 21.4k, False: 394]
  ------------------
 1851|  21.4k|            entry->second.getObjStreamNumber() == obj_stream_number) {
  ------------------
  |  Branch (1851:13): [True: 21.1k, False: 334]
  ------------------
 1852|  21.1k|            is::OffsetBuffer in("", {b_start + obj_offset, obj_size}, obj_offset);
 1853|  21.1k|            if (auto oh = Parser::parse(in, obj_stream_number, obj_id, m->tokenizer, qpdf)) {
  ------------------
  |  Branch (1853:22): [True: 18.6k, False: 2.49k]
  ------------------
 1854|  18.6k|                updateCache(og, oh.obj_sp(), end_before_space, end_after_space);
 1855|  18.6k|            }
 1856|  21.1k|        } else {
 1857|  2.08k|            QTC::TC("qpdf", "QPDF not caching overridden objstm object");
 1858|  2.08k|        }
 1859|  23.1k|    }
 1860|  3.28k|}
_ZN4QPDF3Doc7Objects11newIndirectE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEE:
 1864|  23.0k|{
 1865|  23.0k|    obj->setDefaultDescription(&qpdf, og);
 1866|  23.0k|    return {obj};
 1867|  23.0k|}
_ZN4QPDF3Doc7Objects11updateCacheE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEExxb:
 1876|   382k|{
 1877|   382k|    object->setObjGen(&qpdf, og);
 1878|   382k|    if (isCached(og)) {
  ------------------
  |  Branch (1878:9): [True: 311k, False: 71.1k]
  ------------------
 1879|   311k|        auto& cache = m->obj_cache[og];
 1880|   311k|        object->move_to(cache.object, destroy);
 1881|   311k|        cache.end_before_space = end_before_space;
 1882|   311k|        cache.end_after_space = end_after_space;
 1883|   311k|    } else {
 1884|  71.1k|        m->obj_cache[og] = ObjCache(object, end_before_space, end_after_space);
 1885|  71.1k|    }
 1886|   382k|}
_ZN4QPDF3Doc7Objects8isCachedE10QPDFObjGen:
 1890|  1.26M|{
 1891|  1.26M|    return m->obj_cache.contains(og);
 1892|  1.26M|}
_ZN4QPDF3Doc7Objects12isUnresolvedE10QPDFObjGen:
 1896|   878k|{
 1897|   878k|    return !isCached(og) || m->obj_cache[og].object->isUnresolved();
  ------------------
  |  Branch (1897:12): [True: 178k, False: 700k]
  |  Branch (1897:29): [True: 518k, False: 181k]
  ------------------
 1898|   878k|}
_ZN4QPDF3Doc7Objects10nextObjGenEv:
 1902|  40.0k|{
 1903|  40.0k|    int max_objid = toI(qpdf.getObjectCount());
 1904|  40.0k|    if (max_objid == std::numeric_limits<int>::max()) {
  ------------------
  |  Branch (1904:9): [True: 0, False: 40.0k]
  ------------------
 1905|      0|        throw std::range_error("max object id is too high to create new objects");
 1906|      0|    }
 1907|  40.0k|    return {max_objid + 1, 0};
 1908|  40.0k|}
_ZN4QPDF3Doc7Objects26makeIndirectFromQPDFObjectERKNSt3__110shared_ptrI10QPDFObjectEE:
 1912|  23.1k|{
 1913|  23.1k|    QPDFObjGen next{nextObjGen()};
 1914|  23.1k|    m->obj_cache[next] = ObjCache(obj, -1, -1);
 1915|  23.1k|    return newIndirect(next, m->obj_cache[next].object);
 1916|  23.1k|}
_ZN4QPDF18makeIndirectObjectE16QPDFObjectHandle:
 1920|  23.1k|{
 1921|  23.1k|    if (!oh) {
  ------------------
  |  Branch (1921:9): [True: 0, False: 23.1k]
  ------------------
 1922|      0|        throw std::logic_error("attempted to make an uninitialized QPDFObjectHandle indirect");
 1923|      0|    }
 1924|  23.1k|    return m->objects.makeIndirectFromQPDFObject(oh.obj_sp());
 1925|  23.1k|}
_ZN4QPDF3Doc7Objects18getObjectForParserEiib:
 1929|   485k|{
 1930|       |    // This method is called by the parser and therefore must not resolve any objects.
 1931|   485k|    auto og = QPDFObjGen(id, gen);
 1932|   485k|    if (auto iter = m->obj_cache.find(og); iter != m->obj_cache.end()) {
  ------------------
  |  Branch (1932:44): [True: 216k, False: 269k]
  ------------------
 1933|   216k|        return iter->second.object;
 1934|   216k|    }
 1935|   269k|    if (m->xref_table.contains(og) || (!m->parsed && og.getObj() < m->xref_table_max_id)) {
  ------------------
  |  Branch (1935:9): [True: 87.0k, False: 182k]
  |  Branch (1935:40): [True: 171k, False: 11.6k]
  |  Branch (1935:54): [True: 163k, False: 7.86k]
  ------------------
 1936|   250k|        return m->obj_cache.insert({og, QPDFObject::create<QPDF_Unresolved>(&qpdf, og)})
 1937|   250k|            .first->second.object;
 1938|   250k|    }
 1939|  19.5k|    if (parse_pdf) {
  ------------------
  |  Branch (1939:9): [True: 19.5k, False: 0]
  ------------------
 1940|  19.5k|        return QPDFObject::create<QPDF_Null>();
 1941|  19.5k|    }
 1942|      0|    return m->obj_cache.insert({og, QPDFObject::create<QPDF_Null>(&qpdf, og)}).first->second.object;
 1943|  19.5k|}
_ZN4QPDF9getObjectE10QPDFObjGen:
 1961|   131k|{
 1962|   131k|    if (auto it = m->obj_cache.find(og); it != m->obj_cache.end()) {
  ------------------
  |  Branch (1962:42): [True: 55.7k, False: 75.8k]
  ------------------
 1963|  55.7k|        return {it->second.object};
 1964|  75.8k|    } else if (m->parsed && !m->xref_table.contains(og)) {
  ------------------
  |  Branch (1964:16): [True: 5.15k, False: 70.7k]
  |  Branch (1964:29): [True: 3.08k, False: 2.06k]
  ------------------
 1965|  3.08k|        return QPDFObject::create<QPDF_Null>();
 1966|  72.7k|    } else {
 1967|  72.7k|        auto result =
 1968|  72.7k|            m->obj_cache.try_emplace(og, QPDFObject::create<QPDF_Unresolved>(this, og), -1, -1);
 1969|  72.7k|        return {result.first->second.object};
 1970|  72.7k|    }
 1971|   131k|}
_ZN4QPDF13replaceObjectE10QPDFObjGen16QPDFObjectHandle:
 1981|     71|{
 1982|     71|    if (!oh || (oh.isIndirect() && !(oh.isStream() && oh.getObjGen() == og))) {
  ------------------
  |  Branch (1982:9): [True: 0, False: 71]
  |  Branch (1982:9): [True: 0, False: 71]
  |  Branch (1982:17): [True: 0, False: 71]
  |  Branch (1982:38): [True: 0, False: 0]
  |  Branch (1982:55): [True: 0, False: 0]
  ------------------
 1983|      0|        throw std::logic_error("QPDF::replaceObject called with indirect object handle");
 1984|      0|    }
 1985|     71|    m->objects.updateCache(og, oh.obj_sp(), -1, -1, false);
 1986|     71|}
_ZN4QPDF12removeObjectE10QPDFObjGen:
 1990|  13.8k|{
 1991|  13.8k|    m->xref_table.erase(og);
 1992|  13.8k|    if (auto cached = m->obj_cache.find(og); cached != m->obj_cache.end()) {
  ------------------
  |  Branch (1992:46): [True: 717, False: 13.1k]
  ------------------
 1993|       |        // Take care of any object handles that may be floating around.
 1994|    717|        cached->second.object->assign_null();
 1995|    717|        cached->second.object->setObjGen(nullptr, QPDFObjGen());
 1996|    717|        m->obj_cache.erase(cached);
 1997|    717|    }
 1998|  13.8k|}
_ZN4QPDF3Doc7Objects13PatternFinderC2ERS1_MS1_FbvE:
  147|  69.9k|        o(o),
  148|  69.9k|        checker(checker)
  149|  69.9k|    {
  150|  69.9k|    }
_ZN4QPDF3Doc7Objects13PatternFinder5checkEv:
  154|  35.3k|    {
  155|  35.3k|        return (this->o.*checker)();
  156|  35.3k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcbENK3$_0clEv:
  324|  2.19M|    auto check_warnings = [this, max_warnings]() {
  325|  2.19M|        if (m->warnings.size() > max_warnings) {
  ------------------
  |  Branch (325:13): [True: 0, False: 2.19M]
  ------------------
  326|      0|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|      0|        }
  328|  2.19M|    };
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandlebENK3$_0clENSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
 1037|  4.82k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1038|  4.82k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1039|  4.82k|    };
_ZN4QPDF15ResolveRecorderC2ERS_RK10QPDFObjGen:
  129|   378k|        qpdf(qpdf),
  130|   378k|        iter(qpdf.m->resolving.insert(og).first)
  131|   378k|    {
  132|   378k|    }
_ZN4QPDF15ResolveRecorderD2Ev:
  134|   378k|    {
  135|   378k|        qpdf.m->resolving.erase(iter);
  136|   378k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects22resolveObjectsInStreamEiENK3$_0clEixRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 1722|  11.3k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1723|  11.3k|        return {
 1724|  11.3k|            qpdf_e_damaged_pdf,
 1725|  11.3k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1726|  11.3k|            +"object " + std::to_string(id) + " 0",
 1727|  11.3k|            offset,
 1728|  11.3k|            msg,
 1729|  11.3k|            true};
 1730|  11.3k|    };

_ZN4QPDF3Doc5Pages5cacheEv:
   53|  22.9k|{
   54|       |    // Note that pushInheritedAttributesToPage may also be used to initialize m->all_pages.
   55|  22.9k|    if (all_pages.empty() && !invalid_page_found) {
  ------------------
  |  Branch (55:9): [True: 17.4k, False: 5.53k]
  |  Branch (55:30): [True: 16.6k, False: 775]
  ------------------
   56|  16.6k|        ever_called_get_all_pages_ = true;
   57|  16.6k|        auto root = qpdf.getRoot();
   58|  16.6k|        QPDFObjGen::set visited;
   59|  16.6k|        QPDFObjGen::set seen;
   60|  16.6k|        QPDFObjectHandle pages = root.getKey("/Pages");
   61|  16.6k|        bool warned = false;
   62|  16.6k|        bool changed_pages = false;
   63|  21.5k|        while (pages.isDictionary() && pages.hasKey("/Parent")) {
  ------------------
  |  Branch (63:16): [True: 16.6k, False: 4.96k]
  |  Branch (63:16): [True: 5.15k, False: 16.4k]
  |  Branch (63:40): [True: 5.15k, False: 11.4k]
  ------------------
   64|  5.15k|            if (!seen.add(pages)) {
  ------------------
  |  Branch (64:17): [True: 237, False: 4.92k]
  ------------------
   65|       |                // loop -- will be detected again and reported later
   66|    237|                break;
   67|    237|            }
   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|  4.92k|            if (!warned) {
  ------------------
  |  Branch (70:17): [True: 2.54k, False: 2.37k]
  ------------------
   71|  2.54k|                root.warn(
   72|  2.54k|                    "document page tree root (root -> /Pages) doesn't point"
   73|  2.54k|                    " to the root of the page tree; attempting to correct");
   74|  2.54k|                warned = true;
   75|  2.54k|            }
   76|  4.92k|            changed_pages = true;
   77|  4.92k|            pages = pages.getKey("/Parent");
   78|  4.92k|        }
   79|  16.6k|        if (changed_pages) {
  ------------------
  |  Branch (79:13): [True: 2.53k, False: 14.1k]
  ------------------
   80|  2.53k|            root.replaceKey("/Pages", pages);
   81|  2.53k|        }
   82|  16.6k|        seen.clear();
   83|  16.6k|        if (!pages.hasKey("/Kids")) {
  ------------------
  |  Branch (83:13): [True: 126, False: 16.5k]
  ------------------
   84|       |            // Ensure we actually found a /Pages object.
   85|    126|            throw QPDFExc(
   86|    126|                qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array");
   87|    126|        }
   88|  16.5k|        try {
   89|  16.5k|            getAllPagesInternal(pages, 0, visited, seen, false, false);
   90|  16.5k|        } catch (...) {
   91|     79|            all_pages.clear();
   92|     79|            invalid_page_found = false;
   93|     79|            throw;
   94|     79|        }
   95|  11.6k|        if (invalid_page_found) {
  ------------------
  |  Branch (95:13): [True: 6.30k, False: 5.29k]
  ------------------
   96|  6.30k|            flattenPagesTree();
   97|  6.30k|            invalid_page_found = false;
   98|  6.30k|        }
   99|  11.6k|    }
  100|  17.9k|    return all_pages;
  101|  22.9k|}
_ZN4QPDF3Doc5Pages19getAllPagesInternalE16QPDFObjectHandlejRN10QPDFObjGen3setES5_bb:
  111|  14.0k|{
  112|  14.0k|    static uint32_t constexpr max_level = 100;
  113|  14.0k|    if (++level > max_level) {
  ------------------
  |  Branch (113:9): [True: 0, False: 14.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|  14.0k|    if (!visited.add(cur_node)) {
  ------------------
  |  Branch (121:9): [True: 23, False: 14.0k]
  ------------------
  122|     23|        throw QPDFExc(
  123|     23|            qpdf_e_pages,
  124|     23|            m->file->getName(),
  125|     23|            "object " + cur_node.getObjGen().unparse(' '),
  126|     23|            0,
  127|     23|            "Loop detected in /Pages structure (getAllPages)");
  128|     23|    }
  129|  14.0k|    if (!cur_node.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (129:9): [True: 10.3k, False: 3.67k]
  ------------------
  130|       |        // During fuzzing files were encountered where the root object appeared in the pages tree.
  131|       |        // Unconditionally setting the /Type to /Pages could cause problems, but trying to
  132|       |        // accommodate the possibility may be excessive.
  133|  10.3k|        cur_node.warn("/Type key should be /Pages but is not; overriding");
  134|  10.3k|        cur_node.replaceKey("/Type", Name("/Pages"));
  135|  10.3k|    }
  136|  14.0k|    if (!media_box) {
  ------------------
  |  Branch (136:9): [True: 13.7k, False: 326]
  ------------------
  137|  13.7k|        media_box = cur_node.getKey("/MediaBox").isRectangle();
  138|  13.7k|        QTC::TC("qpdf", "QPDF inherit mediabox", media_box ? 0 : 1);
  ------------------
  |  Branch (138:50): [True: 1.33k, False: 12.3k]
  ------------------
  139|  13.7k|    }
  140|  14.0k|    if (!resources) {
  ------------------
  |  Branch (140:9): [True: 13.7k, False: 313]
  ------------------
  141|  13.7k|        resources = cur_node.getKey("/Resources").isDictionary();
  142|  13.7k|    }
  143|  14.0k|    auto kids = cur_node.getKey("/Kids");
  144|  14.0k|    if (!visited.add(kids)) {
  ------------------
  |  Branch (144:9): [True: 22, False: 14.0k]
  ------------------
  145|     22|        throw QPDFExc(
  146|     22|            qpdf_e_pages,
  147|     22|            m->file->getName(),
  148|     22|            "object " + cur_node.getObjGen().unparse(' '),
  149|     22|            0,
  150|     22|            "Loop detected in /Pages structure (getAllPages)");
  151|     22|    }
  152|  14.0k|    int i = -1;
  153|  77.1k|    for (auto& kid: kids.as_array()) {
  ------------------
  |  Branch (153:19): [True: 77.1k, False: 14.0k]
  ------------------
  154|  77.1k|        ++i;
  155|  77.1k|        int errors = 0;
  156|       |
  157|  77.1k|        if (!kid.isDictionary()) {
  ------------------
  |  Branch (157:13): [True: 51.1k, False: 25.9k]
  ------------------
  158|  51.1k|            kid.warn("Pages tree includes non-dictionary object; ignoring");
  159|  51.1k|            invalid_page_found = true;
  160|  51.1k|            continue;
  161|  51.1k|        }
  162|  25.9k|        if (!kid.isIndirect()) {
  ------------------
  |  Branch (162:13): [True: 2.22k, False: 23.7k]
  ------------------
  163|  2.22k|            cur_node.warn(
  164|  2.22k|                "kid " + std::to_string(i) + " (from 0) is direct; converting to indirect");
  165|  2.22k|            kid = qpdf.makeIndirectObject(kid);
  166|  2.22k|            ++errors;
  167|  2.22k|        }
  168|  25.9k|        if (kid.hasKey("/Kids")) {
  ------------------
  |  Branch (168:13): [True: 2.37k, False: 23.5k]
  ------------------
  169|  2.37k|            getAllPagesInternal(kid, level, visited, seen, media_box, resources);
  170|  23.5k|        } else {
  171|  23.5k|            if (!media_box && !kid.getKey("/MediaBox").isRectangle()) {
  ------------------
  |  Branch (171:17): [True: 19.6k, False: 3.94k]
  |  Branch (171:17): [True: 9.45k, False: 14.1k]
  |  Branch (171:31): [True: 9.45k, False: 10.1k]
  ------------------
  172|  9.45k|                kid.warn(
  173|  9.45k|                    "kid " + std::to_string(i) +
  174|  9.45k|                    " (from 0) MediaBox is undefined; setting to letter / ANSI A");
  175|  9.45k|                kid.replaceKey(
  176|  9.45k|                    "/MediaBox",
  177|  9.45k|                    QPDFObjectHandle::newArray(QPDFObjectHandle::Rectangle(0, 0, 612, 792)));
  178|  9.45k|                ++errors;
  179|  9.45k|            }
  180|  23.5k|            if (!resources) {
  ------------------
  |  Branch (180:17): [True: 18.0k, False: 5.52k]
  ------------------
  181|  18.0k|                auto res = kid.getKey("/Resources");
  182|       |
  183|  18.0k|                if (!res.isDictionary()) {
  ------------------
  |  Branch (183:21): [True: 10.3k, False: 7.64k]
  ------------------
  184|  10.3k|                    ++errors;
  185|  10.3k|                    kid.warn(
  186|  10.3k|                        "kid " + std::to_string(i) +
  187|  10.3k|                        " (from 0) Resources is missing or invalid; repairing");
  188|  10.3k|                    kid.replaceKey("/Resources", QPDFObjectHandle::newDictionary());
  189|  10.3k|                }
  190|  18.0k|            }
  191|  23.5k|            auto annots = kid.getKey("/Annots");
  192|  23.5k|            if (!annots.null()) {
  ------------------
  |  Branch (192:17): [True: 7.65k, False: 15.9k]
  ------------------
  193|  7.65k|                if (!annots.isArray()) {
  ------------------
  |  Branch (193:21): [True: 102, False: 7.55k]
  ------------------
  194|    102|                    kid.warn(
  195|    102|                        "kid " + std::to_string(i) + " (from 0) Annots is not an array; removing");
  196|    102|                    kid.removeKey("/Annots");
  197|    102|                    ++errors;
  198|  7.55k|                } else {
  199|  7.55k|                    QPDFObjGen::set seen_annots;
  200|   176k|                    for (auto& annot: annots.as_array()) {
  ------------------
  |  Branch (200:37): [True: 176k, False: 7.55k]
  ------------------
  201|   176k|                        if (!seen_annots.add(annot)) {
  ------------------
  |  Branch (201:29): [True: 3.42k, False: 173k]
  ------------------
  202|  3.42k|                            kid.warn(
  203|  3.42k|                                "kid " + std::to_string(i) +
  204|  3.42k|                                " (from 0) Annots has duplicate entry for annotation " +
  205|  3.42k|                                annot.id_gen().unparse(' '));
  206|  3.42k|                            ++errors;
  207|  3.42k|                        }
  208|   176k|                    }
  209|  7.55k|                }
  210|  7.65k|            }
  211|       |
  212|  23.5k|            if (!seen.add(kid)) {
  ------------------
  |  Branch (212:17): [True: 4.63k, False: 18.9k]
  ------------------
  213|       |                // Make a copy of the page. This does the same as shallowCopyPage in
  214|       |                // QPDFPageObjectHelper.
  215|  4.63k|                if (!m->reconstructed_xref) {
  ------------------
  |  Branch (215:21): [True: 2.74k, False: 1.88k]
  ------------------
  216|  2.74k|                    cur_node.warn(
  217|  2.74k|                        "kid " + std::to_string(i) +
  218|  2.74k|                        " (from 0) appears more than once in the pages tree;"
  219|  2.74k|                        " creating a new page object as a copy");
  220|       |                    // This needs to be fixed. shallowCopy does not necessarily produce a valid
  221|       |                    // page.
  222|  2.74k|                    kid = qpdf.makeIndirectObject(QPDFObjectHandle(kid).shallowCopy());
  223|  2.74k|                    seen.add(kid);
  224|  2.74k|                } else {
  225|  1.88k|                    cur_node.warn(
  226|  1.88k|                        "kid " + std::to_string(i) +
  227|  1.88k|                        " (from 0) appears more than once in the pages tree; ignoring duplicate");
  228|  1.88k|                    invalid_page_found = true;
  229|  1.88k|                    kid = QPDFObjectHandle::newNull();
  230|  1.88k|                    continue;
  231|  1.88k|                }
  232|  2.74k|                if (!kid.getKey("/Parent").isSameObjectAs(cur_node)) {
  ------------------
  |  Branch (232:21): [True: 2.73k, False: 13]
  ------------------
  233|       |                    // Consider fixing and adding an information message.
  234|  2.73k|                    ++errors;
  235|  2.73k|                }
  236|  2.74k|            }
  237|  21.6k|            if (!kid.isDictionaryOfType("/Page")) {
  ------------------
  |  Branch (237:17): [True: 9.37k, False: 12.2k]
  ------------------
  238|  9.37k|                kid.warn("/Type key should be /Page but is not; overriding");
  239|  9.37k|                kid.replaceKey("/Type", Name("/Page"));
  240|  9.37k|                ++errors;
  241|  9.37k|            }
  242|  21.6k|            if (m->reconstructed_xref && errors > 2) {
  ------------------
  |  Branch (242:17): [True: 18.1k, False: 3.55k]
  |  Branch (242:42): [True: 1.12k, False: 16.9k]
  ------------------
  243|  1.12k|                cur_node.warn(
  244|  1.12k|                    "kid " + std::to_string(i) + " (from 0) has too many errors; ignoring page");
  245|  1.12k|                invalid_page_found = true;
  246|  1.12k|                kid = QPDFObjectHandle::newNull();
  247|  1.12k|                continue;
  248|  1.12k|            }
  249|  20.5k|            all_pages.emplace_back(kid);
  250|  20.5k|        }
  251|  25.9k|    }
  252|  14.0k|}
_ZN4QPDF3Doc5Pages16flattenPagesTreeEv:
  274|  6.30k|{
  275|       |    // If not already done, flatten the /Pages structure and initialize pageobj_to_pages_pos.
  276|       |
  277|  6.30k|    if (!pageobj_to_pages_pos.empty()) {
  ------------------
  |  Branch (277:9): [True: 0, False: 6.30k]
  ------------------
  278|      0|        return;
  279|      0|    }
  280|       |
  281|       |    // Push inherited objects down to the /Page level.  As a side effect all_pages will also be
  282|       |    // generated.
  283|  6.30k|    pushInheritedAttributesToPage(true, true);
  284|       |
  285|  6.30k|    QPDFObjectHandle pages = qpdf.getRoot().getKey("/Pages");
  286|       |
  287|  6.30k|    size_t const len = all_pages.size();
  288|  20.2k|    for (size_t pos = 0; pos < len; ++pos) {
  ------------------
  |  Branch (288:26): [True: 13.9k, False: 6.30k]
  ------------------
  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|  13.9k|        insertPageobjToPage(all_pages.at(pos), toI(pos), true);
  293|  13.9k|        all_pages.at(pos).replaceKey("/Parent", pages);
  294|  13.9k|    }
  295|       |
  296|  6.30k|    pages.replaceKey("/Kids", Array(all_pages));
  297|       |    // /Count has not changed
  298|  6.30k|    if (pages.getKey("/Count").getUIntValue() != len) {
  ------------------
  |  Branch (298:9): [True: 5.29k, False: 1.01k]
  ------------------
  299|  5.29k|        if (invalid_page_found && pages.getKey("/Count").getUIntValue() > len) {
  ------------------
  |  Branch (299:13): [True: 5.29k, False: 0]
  |  Branch (299:13): [True: 5.25k, False: 37]
  |  Branch (299:35): [True: 5.25k, False: 37]
  ------------------
  300|  5.25k|            pages.replaceKey("/Count", Integer(len));
  301|  5.25k|        } else {
  302|     37|            throw std::runtime_error("/Count is wrong after flattening pages tree");
  303|     37|        }
  304|  5.29k|    }
  305|  6.30k|}
_ZN4QPDF3Doc5Pages29pushInheritedAttributesToPageEbb:
  316|  6.30k|{
  317|       |    // Traverse pages tree pushing all inherited resources down to the page level.
  318|       |
  319|       |    // The record of whether we've done this is cleared by updateAllPagesCache().  If we're warning
  320|       |    // for skipped keys, re-traverse unconditionally.
  321|  6.30k|    if (pushed_inherited_attributes_to_pages && !warn_skipped_keys) {
  ------------------
  |  Branch (321:9): [True: 0, False: 6.30k]
  |  Branch (321:49): [True: 0, False: 0]
  ------------------
  322|      0|        return;
  323|      0|    }
  324|       |
  325|       |    // Calling cache() resolves any duplicated page objects, repairs broken nodes, and detects
  326|       |    // loops, so we don't have to do those activities here.
  327|  6.30k|    (void)cache();
  328|       |
  329|       |    // key_ancestors is a mapping of page attribute keys to a stack of Pages nodes that contain
  330|       |    // values for them.
  331|  6.30k|    std::map<std::string, std::vector<QPDFObjectHandle>> key_ancestors;
  332|  6.30k|    pushInheritedAttributesToPageInternal(
  333|  6.30k|        m->trailer.getKey("/Root").getKey("/Pages"),
  334|  6.30k|        key_ancestors,
  335|  6.30k|        allow_changes,
  336|  6.30k|        warn_skipped_keys);
  337|  6.30k|    util::assertion(
  338|  6.30k|        key_ancestors.empty(),
  339|  6.30k|        "key_ancestors not empty after pushing inherited attributes to pages");
  340|  6.30k|    pushed_inherited_attributes_to_pages = true;
  341|  6.30k|    ever_pushed_inherited_attributes_to_pages_ = true;
  342|  6.30k|}
_ZN4QPDF3Doc5Pages37pushInheritedAttributesToPageInternalE16QPDFObjectHandleRNSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_6vectorIS2_NS8_IS2_EEEENS3_4lessISA_EENS8_INS3_4pairIKSA_SD_EEEEEEbb:
  350|  8.30k|{
  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.30k|    std::set<std::string> inheritable_keys;
  356|  31.4k|    for (auto const& key: cur_pages.getKeys()) {
  ------------------
  |  Branch (356:25): [True: 31.4k, False: 8.30k]
  ------------------
  357|  31.4k|        if (key == "/MediaBox" || key == "/CropBox" || key == "/Resources" || key == "/Rotate") {
  ------------------
  |  Branch (357:13): [True: 1.19k, False: 30.2k]
  |  Branch (357:35): [True: 63, False: 30.2k]
  |  Branch (357:56): [True: 846, False: 29.3k]
  |  Branch (357:79): [True: 84, False: 29.2k]
  ------------------
  358|  2.18k|            if (!allow_changes) {
  ------------------
  |  Branch (358:17): [True: 0, False: 2.18k]
  ------------------
  359|      0|                throw QPDFExc(
  360|      0|                    qpdf_e_internal,
  361|      0|                    m->file->getName(),
  362|      0|                    "/Pages object " + cur_pages.id_gen().unparse(' '),
  363|      0|                    cur_pages.offset(),
  364|      0|                    "pushInheritedAttributesToPage detected an inheritable attribute when called "
  365|      0|                    "in no-change mode");
  366|      0|            }
  367|       |
  368|       |            // This is an inheritable resource
  369|  2.18k|            inheritable_keys.insert(key);
  370|  2.18k|            auto oh = cur_pages[key];
  371|  2.18k|            QTC::TC("qpdf", "QPDF opt direct pages resource", oh.indirect() ? 0 : 1);
  ------------------
  |  Branch (371:63): [True: 428, False: 1.75k]
  ------------------
  372|  2.18k|            if (!oh.indirect()) {
  ------------------
  |  Branch (372:17): [True: 1.75k, False: 428]
  ------------------
  373|  1.75k|                if (!oh.isScalar()) {
  ------------------
  |  Branch (373:21): [True: 680, False: 1.07k]
  ------------------
  374|       |                    // Replace shared direct object non-scalar resources with indirect objects to
  375|       |                    // avoid copying large structures around.
  376|    680|                    cur_pages.replaceKey(key, qpdf.makeIndirectObject(oh));
  377|    680|                    oh = cur_pages[key];
  378|  1.07k|                } else {
  379|       |                    // It's okay to copy scalars.
  380|  1.07k|                }
  381|  1.75k|            }
  382|  2.18k|            key_ancestors[key].emplace_back(oh);
  383|  2.18k|            if (key_ancestors[key].size() > 1) {
  ------------------
  |  Branch (383:17): [True: 214, False: 1.97k]
  ------------------
  384|    214|            }
  385|       |            // Remove this resource from this node.  It will be reattached at the page level.
  386|  2.18k|            cur_pages.erase(key);
  387|  29.2k|        } else if (!(key == "/Type" || key == "/Parent" || key == "/Kids" || key == "/Count")) {
  ------------------
  |  Branch (387:22): [True: 8.28k, False: 20.9k]
  |  Branch (387:40): [True: 356, False: 20.6k]
  |  Branch (387:60): [True: 8.30k, False: 12.3k]
  |  Branch (387:78): [True: 5.87k, False: 6.45k]
  ------------------
  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|  6.45k|            if (warn_skipped_keys && cur_pages.contains("/Parent")) {
  ------------------
  |  Branch (390:17): [True: 6.45k, False: 0]
  |  Branch (390:17): [True: 591, False: 5.86k]
  |  Branch (390:38): [True: 591, False: 5.86k]
  ------------------
  391|    591|                warn(
  392|    591|                    qpdf_e_pages,
  393|    591|                    "Pages object: object " + cur_pages.id_gen().unparse(' '),
  394|    591|                    cur_pages.offset(),
  395|    591|                    ("Unknown key " + key +
  396|    591|                     " in /Pages object is being discarded as a result of flattening the /Pages "
  397|    591|                     "tree"));
  398|    591|            }
  399|  6.45k|        }
  400|  31.4k|    }
  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|  66.1k|    for (auto& kid: Array(cur_pages["/Kids"])) {
  ------------------
  |  Branch (405:19): [True: 66.1k, False: 8.30k]
  ------------------
  406|  66.1k|        if (kid.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (406:13): [True: 2.00k, False: 64.1k]
  ------------------
  407|  2.00k|            pushInheritedAttributesToPageInternal(
  408|  2.00k|                kid, key_ancestors, allow_changes, warn_skipped_keys);
  409|  64.1k|        } else {
  410|       |            // Add all available inheritable attributes not present in this object to this object.
  411|  64.1k|            for (auto const& [key, values]: key_ancestors) {
  ------------------
  |  Branch (411:43): [True: 15.2k, False: 64.1k]
  ------------------
  412|  15.2k|                if (!kid.contains(key)) {
  ------------------
  |  Branch (412:21): [True: 12.4k, False: 2.79k]
  ------------------
  413|  12.4k|                    kid.replaceKey(key, values.back());
  414|  12.4k|                } else {
  415|  2.79k|                    QTC::TC("qpdf", "QPDF opt page resource hides ancestor");
  416|  2.79k|                }
  417|  15.2k|            }
  418|  64.1k|        }
  419|  66.1k|    }
  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.30k|    if (!inheritable_keys.empty()) {
  ------------------
  |  Branch (425:9): [True: 1.74k, False: 6.55k]
  ------------------
  426|  1.95k|        for (auto const& key: inheritable_keys) {
  ------------------
  |  Branch (426:29): [True: 1.95k, False: 1.74k]
  ------------------
  427|  1.95k|            key_ancestors[key].pop_back();
  428|  1.95k|            if (key_ancestors[key].empty()) {
  ------------------
  |  Branch (428:17): [True: 1.74k, False: 211]
  ------------------
  429|  1.74k|                key_ancestors.erase(key);
  430|  1.74k|            }
  431|  1.95k|        }
  432|  6.55k|    } else {
  433|  6.55k|        QTC::TC("qpdf", "QPDF opt no inheritable keys");
  434|  6.55k|    }
  435|  8.30k|}
_ZN4QPDF3Doc5Pages19insertPageobjToPageERK16QPDFObjectHandleib:
  439|  13.9k|{
  440|  13.9k|    QPDFObjGen og(obj.getObjGen());
  441|  13.9k|    if (check_duplicate) {
  ------------------
  |  Branch (441:9): [True: 13.9k, False: 0]
  ------------------
  442|  13.9k|        if (!pageobj_to_pages_pos.insert(std::make_pair(og, pos)).second) {
  ------------------
  |  Branch (442:13): [True: 0, False: 13.9k]
  ------------------
  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|  13.9k|    } else {
  452|      0|        pageobj_to_pages_pos[og] = pos;
  453|      0|    }
  454|  13.9k|}
_ZN22QPDFPageDocumentHelperC2ER4QPDF:
  584|  14.8k|    QPDFDocumentHelper(qpdf)
  585|  14.8k|{
  586|  14.8k|}
_ZN22QPDFPageDocumentHelper11getAllPagesEv:
  601|  13.0k|{
  602|  13.0k|    auto& pp = qpdf.doc().pages();
  603|  13.0k|    return {pp.begin(), pp.end()};
  604|  13.0k|}
_ZN22QPDFPageDocumentHelper18flattenAnnotationsEii:
  641|  8.66k|{
  642|  8.66k|    qpdf.doc().pages().flatten_annotations(required_flags, forbidden_flags);
  643|  8.66k|}
_ZN4QPDF3Doc5Pages19flatten_annotationsEii:
  647|  8.66k|{
  648|  8.66k|    auto& afdh = qpdf.doc().acroform();
  649|  8.66k|    if (afdh.getNeedAppearances()) {
  ------------------
  |  Branch (649:9): [True: 0, False: 8.66k]
  ------------------
  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|  17.9k|    for (QPDFPageObjectHelper ph: all()) {
  ------------------
  |  Branch (656:33): [True: 17.9k, False: 8.66k]
  ------------------
  657|  17.9k|        QPDFObjectHandle resources = ph.getAttribute("/Resources", true);
  658|  17.9k|        if (!resources.isDictionary()) {
  ------------------
  |  Branch (658:13): [True: 806, False: 17.1k]
  ------------------
  659|       |            // As of #1521, this should be impossible unless a user inserted an invalid page.
  660|    806|            resources = ph.getObjectHandle().replaceKeyAndGetNew("/Resources", Dictionary::empty());
  661|    806|        }
  662|  17.9k|        flatten_annotations_for_page(ph, resources, afdh, required_flags, forbidden_flags);
  663|  17.9k|    }
  664|  8.66k|    if (!afdh.getNeedAppearances()) {
  ------------------
  |  Branch (664:9): [True: 8.61k, False: 46]
  ------------------
  665|  8.61k|        qpdf.getRoot().removeKey("/AcroForm");
  666|  8.61k|    }
  667|  8.66k|}
_ZN4QPDF3Doc5Pages28flatten_annotations_for_pageER20QPDFPageObjectHelperR16QPDFObjectHandleRN4qpdf4impl8AcroFormEii:
  676|  17.9k|{
  677|  17.9k|    bool need_appearances = afdh.getNeedAppearances();
  678|  17.9k|    std::vector<QPDFAnnotationObjectHelper> annots = page.getAnnotations();
  679|  17.9k|    std::vector<QPDFObjectHandle> new_annots;
  680|  17.9k|    std::string new_content;
  681|  17.9k|    int rotate = 0;
  682|  17.9k|    QPDFObjectHandle rotate_obj = page.getObjectHandle().getKey("/Rotate");
  683|  17.9k|    if (rotate_obj.isInteger() && rotate_obj.getIntValue()) {
  ------------------
  |  Branch (683:9): [True: 733, False: 17.1k]
  |  Branch (683:35): [True: 171, False: 562]
  ------------------
  684|    171|        rotate = rotate_obj.getIntValueAsInt();
  685|    171|    }
  686|  17.9k|    int next_fx = 1;
  687|  19.1k|    for (auto& aoh: annots) {
  ------------------
  |  Branch (687:19): [True: 19.1k, False: 17.9k]
  ------------------
  688|  19.1k|        QPDFObjectHandle as = aoh.getAppearanceStream("/N");
  689|  19.1k|        bool is_widget = (aoh.getSubtype() == "/Widget");
  690|  19.1k|        bool process = true;
  691|  19.1k|        if (need_appearances && is_widget) {
  ------------------
  |  Branch (691:13): [True: 0, False: 19.1k]
  |  Branch (691:33): [True: 0, False: 0]
  ------------------
  692|      0|            process = false;
  693|      0|        }
  694|  19.1k|        if (process && as.isStream()) {
  ------------------
  |  Branch (694:13): [True: 19.1k, False: 29]
  |  Branch (694:24): [True: 11.9k, False: 7.18k]
  ------------------
  695|  11.9k|            if (is_widget) {
  ------------------
  |  Branch (695:17): [True: 10.6k, False: 1.27k]
  ------------------
  696|  10.6k|                QPDFFormFieldObjectHelper ff = afdh.getFieldForAnnotation(aoh);
  697|  10.6k|                QPDFObjectHandle as_resources = as.getDict().getKey("/Resources");
  698|  10.6k|                if (as_resources.isIndirect()) {
  ------------------
  |  Branch (698:21): [True: 434, False: 10.2k]
  ------------------
  699|    434|                    ;
  700|    434|                    as.getDict().replaceKey("/Resources", as_resources.shallowCopy());
  701|    434|                    as_resources = as.getDict().getKey("/Resources");
  702|    434|                }
  703|  10.6k|                as_resources.mergeResources(ff.getDefaultResources());
  704|  10.6k|            } else {
  705|  1.27k|                QTC::TC("qpdf", "QPDFPageDocumentHelper non-widget annotation");
  706|  1.27k|            }
  707|  11.9k|            std::string name = resources.getUniqueResourceName("/Fxo", next_fx);
  708|  11.9k|            std::string content =
  709|  11.9k|                aoh.getPageContentForAppearance(name, rotate, required_flags, forbidden_flags);
  710|  11.9k|            if (!content.empty()) {
  ------------------
  |  Branch (710:17): [True: 7.41k, False: 4.52k]
  ------------------
  711|  7.41k|                resources.mergeResources(Dictionary({{"/XObject", Dictionary({{name, as}})}}));
  712|  7.41k|                resources.getKey("/XObject").replaceKey(name, as);
  713|  7.41k|                ++next_fx;
  714|  7.41k|            }
  715|  11.9k|            new_content += content;
  716|  11.9k|        } else if (process && !aoh.getAppearanceDictionary().null()) {
  ------------------
  |  Branch (716:20): [True: 7.18k, False: 29]
  |  Branch (716:20): [True: 1.94k, False: 5.27k]
  |  Branch (716:31): [True: 1.94k, False: 5.24k]
  ------------------
  717|       |            // If an annotation has no selected appearance stream, just drop the annotation when
  718|       |            // flattening. This can happen for unchecked checkboxes and radio buttons, popup windows
  719|       |            // associated with comments that aren't visible, and other types of annotations that
  720|       |            // aren't visible. Annotations that have no appearance streams at all, such as Link,
  721|       |            // Popup, and Projection, should be preserved.
  722|  5.27k|        } else {
  723|  5.27k|            new_annots.push_back(aoh.getObjectHandle());
  724|  5.27k|        }
  725|  19.1k|    }
  726|  17.9k|    if (new_annots.size() != annots.size()) {
  ------------------
  |  Branch (726:9): [True: 3.63k, False: 14.2k]
  ------------------
  727|  3.63k|        QPDFObjectHandle page_oh = page.getObjectHandle();
  728|  3.63k|        if (new_annots.empty()) {
  ------------------
  |  Branch (728:13): [True: 2.73k, False: 904]
  ------------------
  729|  2.73k|            page_oh.removeKey("/Annots");
  730|  2.73k|        } else {
  731|    904|            QPDFObjectHandle old_annots = page_oh.getKey("/Annots");
  732|    904|            QPDFObjectHandle new_annots_oh = QPDFObjectHandle::newArray(new_annots);
  733|    904|            if (old_annots.isIndirect()) {
  ------------------
  |  Branch (733:17): [True: 71, False: 833]
  ------------------
  734|     71|                qpdf.replaceObject(old_annots.getObjGen(), new_annots_oh);
  735|    833|            } else {
  736|    833|                page_oh.replaceKey("/Annots", new_annots_oh);
  737|    833|            }
  738|    904|        }
  739|  3.63k|        page.addPageContents(qpdf.newStream("q\n"), true);
  740|  3.63k|        page.addPageContents(qpdf.newStream("\nQ\n" + new_content), false);
  741|  3.63k|    }
  742|  17.9k|}

_ZN5QUtil18int_to_string_baseExii:
  343|   467k|{
  344|   467k|    return int_to_string_base_internal(num, base, length);
  345|   467k|}
_ZN5QUtil16double_to_stringEdib:
  355|   143k|{
  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|   143k|    if (decimal_places <= 0) {
  ------------------
  |  Branch (359:9): [True: 99.3k, False: 44.4k]
  ------------------
  360|  99.3k|        decimal_places = 6;
  361|  99.3k|    }
  362|   143k|    std::ostringstream buf;
  363|   143k|    buf.imbue(std::locale::classic());
  364|   143k|    buf << std::setprecision(decimal_places) << std::fixed << num;
  365|   143k|    std::string result = buf.str();
  366|   143k|    if (trim_trailing_zeroes) {
  ------------------
  |  Branch (366:9): [True: 143k, False: 0]
  ------------------
  367|   867k|        while ((result.length() > 1) && (result.back() == '0')) {
  ------------------
  |  Branch (367:16): [True: 867k, False: 0]
  |  Branch (367:41): [True: 723k, False: 143k]
  ------------------
  368|   723k|            result.pop_back();
  369|   723k|        }
  370|   143k|        if ((result.length() > 1) && (result.back() == '.')) {
  ------------------
  |  Branch (370:13): [True: 143k, False: 0]
  |  Branch (370:38): [True: 103k, False: 40.2k]
  ------------------
  371|   103k|            result.pop_back();
  372|   103k|        }
  373|   143k|    }
  374|   143k|    return result;
  375|   143k|}
_ZN5QUtil12string_to_llEPKc:
  379|  3.70M|{
  380|  3.70M|    errno = 0;
  381|       |#ifdef _MSC_VER
  382|       |    long long result = _strtoi64(str, 0, 10);
  383|       |#else
  384|  3.70M|    long long result = strtoll(str, nullptr, 10);
  385|  3.70M|#endif
  386|  3.70M|    if (errno == ERANGE) {
  ------------------
  |  Branch (386:9): [True: 1.05k, False: 3.70M]
  ------------------
  387|  1.05k|        throw std::range_error(
  388|  1.05k|            std::string("overflow/underflow converting ") + str + " to 64-bit integer");
  389|  1.05k|    }
  390|  3.70M|    return result;
  391|  3.70M|}
_ZN5QUtil13string_to_intEPKc:
  395|   731k|{
  396|       |    // QIntC::to_int does range checking
  397|   731k|    return QIntC::to_int(string_to_ll(str));
  398|   731k|}
_ZN5QUtil21unsigned_char_pointerERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  447|   144k|{
  448|   144k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str.c_str()));
  449|   144k|}
_ZN5QUtil21unsigned_char_pointerEPKc:
  453|  5.65k|{
  454|  5.65k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str));
  455|  5.65k|}
_ZN5QUtil16make_unique_cstrERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  717|  5.65k|{
  718|  5.65k|    auto result = std::make_unique<char[]>(str.length() + 1);
  719|       |    // Use memcpy in case string contains nulls
  720|  5.65k|    result.get()[str.length()] = '\0';
  721|  5.65k|    memcpy(result.get(), str.c_str(), str.length());
  722|  5.65k|    return result;
  723|  5.65k|}
_ZN5QUtil10hex_encodeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  727|  27.2k|{
  728|  27.2k|    static auto constexpr hexchars = "0123456789abcdef";
  729|  27.2k|    std::string result;
  730|  27.2k|    result.reserve(2 * input.length());
  731|  11.2M|    for (const char c: input) {
  ------------------
  |  Branch (731:22): [True: 11.2M, False: 27.2k]
  ------------------
  732|  11.2M|        result += hexchars[static_cast<unsigned char>(c) >> 4];
  733|  11.2M|        result += hexchars[c & 0x0f];
  734|  11.2M|    }
  735|  27.2k|    return result;
  736|  27.2k|}
_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|   379M|{
 1005|   379M|    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|   379M|    if (uval > 0x7fffffff) {
  ------------------
  |  Branch (1014:9): [True: 0, False: 379M]
  ------------------
 1015|      0|        throw std::runtime_error("bounds error in QUtil::toUTF8");
 1016|   379M|    } else if (uval < 128) {
  ------------------
  |  Branch (1016:16): [True: 143M, False: 235M]
  ------------------
 1017|   143M|        result += static_cast<char>(uval);
 1018|   235M|    } else {
 1019|   235M|        unsigned char bytes[7];
 1020|   235M|        bytes[6] = '\0';
 1021|   235M|        unsigned char* cur_byte = &bytes[5];
 1022|       |
 1023|       |        // maximum value that will fit in the current number of bytes
 1024|   235M|        unsigned char maxval = 0x3f; // six bits
 1025|       |
 1026|   660M|        while (uval > QIntC::to_ulong(maxval)) {
  ------------------
  |  Branch (1026:16): [True: 424M, False: 235M]
  ------------------
 1027|       |            // Assign low six bits plus 10000000 to lowest unused byte position, then shift
 1028|   424M|            *cur_byte = static_cast<unsigned char>(0x80 + (uval & 0x3f));
 1029|   424M|            uval >>= 6;
 1030|       |            // Maximum that will fit in high byte now shrinks by one bit
 1031|   424M|            maxval = static_cast<unsigned char>(maxval >> 1);
 1032|       |            // Slide to the left one byte
 1033|   424M|            if (cur_byte <= bytes) {
  ------------------
  |  Branch (1033:17): [True: 0, False: 424M]
  ------------------
 1034|      0|                throw std::logic_error("QUtil::toUTF8: overflow error");
 1035|      0|            }
 1036|   424M|            --cur_byte;
 1037|   424M|        }
 1038|       |        // If maxval is k bits long, the high (7 - k) bits of the resulting byte must be high.
 1039|   235M|        *cur_byte = static_cast<unsigned char>(QIntC::to_ulong(0xff - (1 + (maxval << 1))) + uval);
 1040|       |
 1041|   235M|        result += reinterpret_cast<char*>(cur_byte);
 1042|   235M|    }
 1043|       |
 1044|   379M|    return result;
 1045|   379M|}
_ZN5QUtil7toUTF16Em:
 1049|  1.12M|{
 1050|  1.12M|    std::string result;
 1051|  1.12M|    if ((uval >= 0xd800) && (uval <= 0xdfff)) {
  ------------------
  |  Branch (1051:9): [True: 13.7k, False: 1.10M]
  |  Branch (1051:29): [True: 351, False: 13.3k]
  ------------------
 1052|    351|        result = "\xff\xfd";
 1053|  1.11M|    } else if (uval <= 0xffff) {
  ------------------
  |  Branch (1053:16): [True: 1.11M, False: 1.51k]
  ------------------
 1054|  1.11M|        char out[2];
 1055|  1.11M|        out[0] = static_cast<char>((uval & 0xff00) >> 8);
 1056|  1.11M|        out[1] = static_cast<char>(uval & 0xff);
 1057|  1.11M|        result = std::string(out, 2);
 1058|  1.11M|    } else if (uval <= 0x10ffff) {
  ------------------
  |  Branch (1058:16): [True: 524, False: 987]
  ------------------
 1059|    524|        char out[4];
 1060|    524|        uval -= 0x10000;
 1061|    524|        unsigned short high = static_cast<unsigned short>(((uval & 0xffc00) >> 10) + 0xd800);
 1062|    524|        unsigned short low = static_cast<unsigned short>((uval & 0x3ff) + 0xdc00);
 1063|    524|        out[0] = static_cast<char>((high & 0xff00) >> 8);
 1064|    524|        out[1] = static_cast<char>(high & 0xff);
 1065|    524|        out[2] = static_cast<char>((low & 0xff00) >> 8);
 1066|    524|        out[3] = static_cast<char>(low & 0xff);
 1067|    524|        result = std::string(out, 4);
 1068|    987|    } else {
 1069|    987|        result = "\xff\xfd";
 1070|    987|    }
 1071|       |
 1072|  1.12M|    return result;
 1073|  1.12M|}
_ZN5QUtil21getRandomDataProviderEv:
 1126|    387|{
 1127|    387|    return getRandomDataProviderProvider()->getProvider();
 1128|    387|}
_ZN5QUtil25initializeWithRandomBytesEPhm:
 1132|    387|{
 1133|    387|    getRandomDataProvider()->provideRandomData(data, len);
 1134|    387|}
_ZN5QUtil23get_next_utf8_codepointERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERmRb:
 1479|  61.6M|{
 1480|  61.6M|    auto o_pos = pos;
 1481|  61.6M|    size_t len = utf8_val.length();
 1482|  61.6M|    unsigned char ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1483|  61.6M|    error = false;
 1484|  61.6M|    if (ch < 128) {
  ------------------
  |  Branch (1484:9): [True: 22.1M, False: 39.4M]
  ------------------
 1485|  22.1M|        return static_cast<unsigned long>(ch);
 1486|  22.1M|    }
 1487|       |
 1488|  39.4M|    size_t bytes_needed = 0;
 1489|  39.4M|    unsigned bit_check = 0x40;
 1490|  39.4M|    unsigned char to_clear = 0x80;
 1491|  96.3M|    while (ch & bit_check) {
  ------------------
  |  Branch (1491:12): [True: 56.9M, False: 39.4M]
  ------------------
 1492|  56.9M|        ++bytes_needed;
 1493|  56.9M|        to_clear = static_cast<unsigned char>(to_clear | bit_check);
 1494|  56.9M|        bit_check >>= 1;
 1495|  56.9M|    }
 1496|  39.4M|    if (((bytes_needed > 5) || (bytes_needed < 1)) || ((pos + bytes_needed) > len)) {
  ------------------
  |  Branch (1496:10): [True: 133k, False: 39.3M]
  |  Branch (1496:32): [True: 6.60M, False: 32.7M]
  |  Branch (1496:55): [True: 102, False: 32.7M]
  ------------------
 1497|  6.74M|        error = true;
 1498|  6.74M|        return 0xfffd;
 1499|  6.74M|    }
 1500|       |
 1501|  32.7M|    auto codepoint = static_cast<unsigned long>(ch & ~to_clear);
 1502|  76.4M|    while (bytes_needed > 0) {
  ------------------
  |  Branch (1502:12): [True: 52.2M, False: 24.2M]
  ------------------
 1503|  52.2M|        --bytes_needed;
 1504|  52.2M|        ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1505|  52.2M|        if ((ch & 0xc0) != 0x80) {
  ------------------
  |  Branch (1505:13): [True: 8.48M, False: 43.7M]
  ------------------
 1506|  8.48M|            --pos;
 1507|  8.48M|            error = true;
 1508|  8.48M|            return 0xfffd;
 1509|  8.48M|        }
 1510|  43.7M|        codepoint <<= 6;
 1511|  43.7M|        codepoint += (ch & 0x3f);
 1512|  43.7M|    }
 1513|  24.2M|    unsigned long lower_bound = 0;
 1514|  24.2M|    switch (pos - o_pos) {
 1515|  4.67M|    case 2:
  ------------------
  |  Branch (1515:5): [True: 4.67M, False: 19.5M]
  ------------------
 1516|  4.67M|        lower_bound = 1 << 7;
 1517|  4.67M|        break;
 1518|  19.5M|    case 3:
  ------------------
  |  Branch (1518:5): [True: 19.5M, False: 4.68M]
  ------------------
 1519|  19.5M|        lower_bound = 1 << 11;
 1520|  19.5M|        break;
 1521|  1.17k|    case 4:
  ------------------
  |  Branch (1521:5): [True: 1.17k, False: 24.2M]
  ------------------
 1522|  1.17k|        lower_bound = 1 << 16;
 1523|  1.17k|        break;
 1524|  1.48k|    case 5:
  ------------------
  |  Branch (1524:5): [True: 1.48k, False: 24.2M]
  ------------------
 1525|  1.48k|        lower_bound = 1 << 12;
 1526|  1.48k|        break;
 1527|    393|    case 6:
  ------------------
  |  Branch (1527:5): [True: 393, False: 24.2M]
  ------------------
 1528|    393|        lower_bound = 1 << 26;
 1529|    393|        break;
 1530|      0|    default:
  ------------------
  |  Branch (1530:5): [True: 0, False: 24.2M]
  ------------------
 1531|      0|        lower_bound = 0;
 1532|  24.2M|    }
 1533|       |
 1534|  24.2M|    if (lower_bound > 0 && codepoint < lower_bound) {
  ------------------
  |  Branch (1534:9): [True: 24.2M, False: 0]
  |  Branch (1534:28): [True: 560, False: 24.2M]
  ------------------
 1535|       |        // Too many bytes were used, but return whatever character was encoded.
 1536|    560|        error = true;
 1537|    560|    }
 1538|  24.2M|    return codepoint;
 1539|  24.2M|}
_ZN5QUtil13utf8_to_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1637|    572|{
 1638|    572|    return transcode_utf8(utf8, e_utf16, 0);
 1639|    572|}
_ZN5QUtil13utf8_to_asciiERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1643|   129k|{
 1644|   129k|    return transcode_utf8(utf8, e_ascii, unknown_char);
 1645|   129k|}
_ZN5QUtil16utf8_to_win_ansiERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1649|    439|{
 1650|    439|    return transcode_utf8(utf8, e_winansi, unknown_char);
 1651|    439|}
_ZN5QUtil17utf8_to_mac_romanERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1655|     50|{
 1656|     50|    return transcode_utf8(utf8, e_macroman, unknown_char);
 1657|     50|}
_ZN5QUtil15utf8_to_pdf_docERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_c:
 1685|  48.9k|{
 1686|  48.9k|    return transcode_utf8(utf8, pdfdoc, e_pdfdoc, unknown_char);
 1687|  48.9k|}
_ZN5QUtil8is_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1691|  42.2k|{
 1692|  42.2k|    return util::is_utf16(val);
 1693|  42.2k|}
_ZN5QUtil13utf16_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1703|  42.2k|{
 1704|  42.2k|    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|  42.2k|    unsigned long codepoint = 0L;
 1709|  42.2k|    size_t len = val.length();
 1710|  42.2k|    size_t start = 0;
 1711|  42.2k|    bool is_le = false;
 1712|  42.2k|    if (is_utf16(val)) {
  ------------------
  |  Branch (1712:9): [True: 42.2k, False: 0]
  ------------------
 1713|  42.2k|        if (static_cast<unsigned char>(val.at(0)) == 0xff) {
  ------------------
  |  Branch (1713:13): [True: 1.46k, False: 40.7k]
  ------------------
 1714|  1.46k|            is_le = true;
 1715|  1.46k|        }
 1716|  42.2k|        start += 2;
 1717|  42.2k|    }
 1718|       |    // If the string has an odd number of bytes, the last byte is ignored.
 1719|  31.0M|    for (size_t i = start; i + 1 < len; i += 2) {
  ------------------
  |  Branch (1719:28): [True: 30.9M, False: 42.2k]
  ------------------
 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|  30.9M|        auto msb = is_le ? i + 1 : i;
  ------------------
  |  Branch (1724:20): [True: 326k, False: 30.6M]
  ------------------
 1725|  30.9M|        auto lsb = is_le ? i : i + 1;
  ------------------
  |  Branch (1725:20): [True: 326k, False: 30.6M]
  ------------------
 1726|  30.9M|        unsigned short bits = QIntC::to_ushort(
 1727|  30.9M|            (static_cast<unsigned char>(val.at(msb)) << 8) +
 1728|  30.9M|            static_cast<unsigned char>(val.at(lsb)));
 1729|  30.9M|        if ((bits & 0xFC00) == 0xD800) {
  ------------------
  |  Branch (1729:13): [True: 2.44k, False: 30.9M]
  ------------------
 1730|  2.44k|            codepoint = 0x10000U + ((bits & 0x3FFU) << 10U);
 1731|  2.44k|            continue;
 1732|  30.9M|        } else if ((bits & 0xFC00) == 0xDC00) {
  ------------------
  |  Branch (1732:20): [True: 6.58k, False: 30.9M]
  ------------------
 1733|  6.58k|            if (codepoint != 0) {
  ------------------
  |  Branch (1733:17): [True: 509, False: 6.07k]
  ------------------
 1734|    509|                QTC::TC("qpdf", "QUtil non-trivial UTF-16");
 1735|    509|            }
 1736|  6.58k|            codepoint += bits & 0x3FF;
 1737|  30.9M|        } else {
 1738|  30.9M|            codepoint = bits;
 1739|  30.9M|        }
 1740|       |
 1741|  30.9M|        result += QUtil::toUTF8(codepoint);
 1742|  30.9M|        codepoint = 0;
 1743|  30.9M|    }
 1744|  42.2k|    return result;
 1745|  42.2k|}
_ZN5QUtil15pdf_doc_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1781|   464k|{
 1782|   464k|    std::string result;
 1783|   464k|    size_t len = val.length();
 1784|   316M|    for (unsigned int i = 0; i < len; ++i) {
  ------------------
  |  Branch (1784:30): [True: 315M, False: 464k]
  ------------------
 1785|   315M|        unsigned char ch = static_cast<unsigned char>(val.at(i));
 1786|   315M|        unsigned short ch_short = ch;
 1787|   315M|        if ((ch >= 127) && (ch <= 160)) {
  ------------------
  |  Branch (1787:13): [True: 205M, False: 110M]
  |  Branch (1787:28): [True: 159M, False: 45.5M]
  ------------------
 1788|   159M|            ch_short = pdf_doc_to_unicode[ch - 127];
 1789|   159M|        } else if ((ch >= 24) && (ch <= 31)) {
  ------------------
  |  Branch (1789:20): [True: 129M, False: 26.6M]
  |  Branch (1789:34): [True: 595k, False: 128M]
  ------------------
 1790|   595k|            ch_short = pdf_doc_low_to_unicode[ch - 24];
 1791|   155M|        } else if (ch == 173) {
  ------------------
  |  Branch (1791:20): [True: 92.3k, False: 155M]
  ------------------
 1792|  92.3k|            ch_short = 0xfffd;
 1793|  92.3k|        }
 1794|   315M|        result += QUtil::toUTF8(ch_short);
 1795|   315M|    }
 1796|   464k|    return result;
 1797|   464k|}
QUtil.cc:_ZL29getRandomDataProviderProviderv:
 1112|    387|{
 1113|       |    // Thread-safe static initializer
 1114|    387|    static RandomDataProviderProvider rdpp;
 1115|    387|    return &rdpp;
 1116|    387|}
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|    387|{
 1101|    387|    return this->current_provider;
 1102|    387|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE10encoding_ec:
 1629|   130k|{
 1630|   130k|    std::string result;
 1631|   130k|    transcode_utf8(utf8_val, result, encoding, unknown);
 1632|   130k|    return result;
 1633|   130k|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERS5_10encoding_ec:
 1543|   179k|{
 1544|   179k|    bool okay = true;
 1545|   179k|    result.clear();
 1546|   179k|    size_t len = utf8_val.length();
 1547|   179k|    switch (encoding) {
 1548|    572|    case e_utf16:
  ------------------
  |  Branch (1548:5): [True: 572, False: 179k]
  ------------------
 1549|    572|        result += "\xfe\xff";
 1550|    572|        break;
 1551|  48.9k|    case e_pdfdoc:
  ------------------
  |  Branch (1551:5): [True: 48.9k, False: 130k]
  ------------------
 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|  48.9k|        if ((len >= 4) && (utf8_val[0] == '\xc3')) {
  ------------------
  |  Branch (1558:13): [True: 32.7k, False: 16.2k]
  |  Branch (1558:27): [True: 3.39k, False: 29.3k]
  ------------------
 1559|  3.39k|            static std::string fe_ff("\xbe\xc3\xbf");
 1560|  3.39k|            static std::string ff_fe("\xbf\xc3\xbe");
 1561|  3.39k|            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|  3.39k|            if ((utf8_val.compare(1, 3, fe_ff) == 0) || (utf8_val.compare(1, 3, ff_fe) == 0) ||
  ------------------
  |  Branch (1564:17): [True: 0, False: 3.39k]
  |  Branch (1564:57): [True: 0, False: 3.39k]
  ------------------
 1565|  3.39k|                (utf8_val.compare(1, 5, ef_bb_bf) == 0)) {
  ------------------
  |  Branch (1565:17): [True: 0, False: 3.39k]
  ------------------
 1566|      0|                result += unknown;
 1567|      0|                okay = false;
 1568|      0|            }
 1569|  3.39k|        }
 1570|  48.9k|        break;
 1571|   130k|    default:
  ------------------
  |  Branch (1571:5): [True: 130k, False: 49.5k]
  ------------------
 1572|   130k|        break;
 1573|   179k|    }
 1574|   179k|    size_t pos = 0;
 1575|  61.8M|    while (pos < len) {
  ------------------
  |  Branch (1575:12): [True: 61.6M, False: 179k]
  ------------------
 1576|  61.6M|        bool error = false;
 1577|  61.6M|        unsigned long codepoint = QUtil::get_next_utf8_codepoint(utf8_val, pos, error);
 1578|  61.6M|        if (error) {
  ------------------
  |  Branch (1578:13): [True: 15.2M, False: 46.4M]
  ------------------
 1579|  15.2M|            okay = false;
 1580|  15.2M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1580:17): [True: 7.60M, False: 7.61M]
  ------------------
 1581|  7.60M|                result += "\xff\xfd";
 1582|  7.61M|            } else {
 1583|  7.61M|                result.append(1, unknown);
 1584|  7.61M|            }
 1585|  46.4M|        } else if (codepoint < 128) {
  ------------------
  |  Branch (1585:20): [True: 22.1M, False: 24.2M]
  ------------------
 1586|  22.1M|            char ch = static_cast<char>(codepoint);
 1587|  22.1M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1587:17): [True: 815k, False: 21.3M]
  ------------------
 1588|   815k|                result += QUtil::toUTF16(QIntC::to_ulong(ch));
 1589|  21.3M|            } else if ((encoding == e_pdfdoc) && (((ch >= 0x18) && (ch <= 0x1f)) || (ch == 127))) {
  ------------------
  |  Branch (1589:24): [True: 11.4M, False: 9.96M]
  |  Branch (1589:52): [True: 6.07M, False: 5.34M]
  |  Branch (1589:68): [True: 15.1k, False: 6.05M]
  |  Branch (1589:85): [True: 43.1k, False: 11.3M]
  ------------------
 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|  58.3k|                okay = false;
 1594|  58.3k|                result.append(1, unknown);
 1595|  21.3M|            } else {
 1596|  21.3M|                result.append(1, ch);
 1597|  21.3M|            }
 1598|  24.2M|        } else if (encoding == e_utf16) {
  ------------------
  |  Branch (1598:20): [True: 305k, False: 23.9M]
  ------------------
 1599|   305k|            result += QUtil::toUTF16(codepoint);
 1600|  23.9M|        } else if ((codepoint == 0xad) && (encoding == e_pdfdoc)) {
  ------------------
  |  Branch (1600:20): [True: 437, False: 23.9M]
  |  Branch (1600:43): [True: 198, False: 239]
  ------------------
 1601|       |            // PDFDocEncoding omits 0x00ad (soft hyphen).
 1602|    198|            okay = false;
 1603|    198|            result.append(1, unknown);
 1604|  23.9M|        } else if (
 1605|  23.9M|            (codepoint > 160) && (codepoint < 256) &&
  ------------------
  |  Branch (1605:13): [True: 23.9M, False: 248]
  |  Branch (1605:34): [True: 4.36M, False: 19.5M]
  ------------------
 1606|  4.36M|            ((encoding == e_winansi) || (encoding == e_pdfdoc))) {
  ------------------
  |  Branch (1606:14): [True: 435, False: 4.36M]
  |  Branch (1606:41): [True: 194k, False: 4.16M]
  ------------------
 1607|   195k|            result.append(1, static_cast<char>(codepoint & 0xff));
 1608|  23.7M|        } else {
 1609|  23.7M|            unsigned char ch = '\0';
 1610|  23.7M|            if (encoding == e_winansi) {
  ------------------
  |  Branch (1610:17): [True: 1.30k, False: 23.7M]
  ------------------
 1611|  1.30k|                ch = encode_winansi(codepoint);
 1612|  23.7M|            } else if (encoding == e_macroman) {
  ------------------
  |  Branch (1612:24): [True: 809, False: 23.7M]
  ------------------
 1613|    809|                ch = encode_macroman(codepoint);
 1614|  23.7M|            } else if (encoding == e_pdfdoc) {
  ------------------
  |  Branch (1614:24): [True: 7.92M, False: 15.7M]
  ------------------
 1615|  7.92M|                ch = encode_pdfdoc(codepoint);
 1616|  7.92M|            }
 1617|  23.7M|            if (ch == '\0') {
  ------------------
  |  Branch (1617:17): [True: 16.0M, False: 7.63M]
  ------------------
 1618|  16.0M|                okay = false;
 1619|  16.0M|                ch = static_cast<unsigned char>(unknown);
 1620|  16.0M|            }
 1621|  23.7M|            result.append(1, static_cast<char>(ch));
 1622|  23.7M|        }
 1623|  61.6M|    }
 1624|   179k|    return okay;
 1625|   179k|}
QUtil.cc:_ZL14encode_winansim:
 1449|  1.30k|{
 1450|  1.30k|    auto i = unicode_to_win_ansi.find(codepoint);
 1451|  1.30k|    if (i != unicode_to_win_ansi.end()) {
  ------------------
  |  Branch (1451:9): [True: 304, False: 1.00k]
  ------------------
 1452|    304|        return i->second;
 1453|    304|    }
 1454|  1.00k|    return '\0';
 1455|  1.30k|}
QUtil.cc:_ZL15encode_macromanm:
 1459|    809|{
 1460|    809|    auto i = unicode_to_mac_roman.find(codepoint);
 1461|    809|    if (i != unicode_to_mac_roman.end()) {
  ------------------
  |  Branch (1461:9): [True: 308, False: 501]
  ------------------
 1462|    308|        return i->second;
 1463|    308|    }
 1464|    501|    return '\0';
 1465|    809|}
QUtil.cc:_ZL13encode_pdfdocm:
 1469|  7.92M|{
 1470|  7.92M|    auto i = unicode_to_pdf_doc.find(codepoint);
 1471|  7.92M|    if (i != unicode_to_pdf_doc.end()) {
  ------------------
  |  Branch (1471:9): [True: 7.63M, False: 292k]
  ------------------
 1472|  7.63M|        return i->second;
 1473|  7.63M|    }
 1474|   292k|    return '\0';
 1475|  7.92M|}
QUtil.cc:_ZL27int_to_string_base_internalIxENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEET_ii:
  300|   467k|{
  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|   467k|    if (!((base == 8) || (base == 10) || (base == 16))) {
  ------------------
  |  Branch (304:11): [True: 467k, 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|   467k|    std::string cvt;
  308|   467k|    if (base == 10) {
  ------------------
  |  Branch (308:9): [True: 0, False: 467k]
  ------------------
  309|       |        // Use the more efficient std::to_string when possible
  310|      0|        cvt = std::to_string(num);
  311|   467k|    } else {
  312|   467k|        std::ostringstream buf;
  313|   467k|        buf.imbue(std::locale::classic());
  314|   467k|        buf << std::setbase(base) << std::nouppercase << num;
  315|   467k|        cvt = buf.str();
  316|   467k|    }
  317|   467k|    std::string result;
  318|   467k|    int str_length = QIntC::to_int(cvt.length());
  319|   467k|    if ((length > 0) && (str_length < length)) {
  ------------------
  |  Branch (319:9): [True: 467k, False: 0]
  |  Branch (319:25): [True: 120k, False: 346k]
  ------------------
  320|   120k|        result.append(QIntC::to_size(length - str_length), '0');
  321|   120k|    }
  322|   467k|    result += cvt;
  323|   467k|    if ((length < 0) && (str_length < -length)) {
  ------------------
  |  Branch (323:9): [True: 0, False: 467k]
  |  Branch (323:25): [True: 0, False: 0]
  ------------------
  324|      0|        result.append(QIntC::to_size(-length - str_length), ' ');
  325|      0|    }
  326|   467k|    return result;
  327|   467k|}

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

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

_ZN17SF_FlateLzwDecode14setDecodeParmsE16QPDFObjectHandle:
   13|  24.4k|{
   14|  24.4k|    if (decode_parms.null()) {
  ------------------
  |  Branch (14:9): [True: 18.7k, False: 5.74k]
  ------------------
   15|  18.7k|        return true;
   16|  18.7k|    }
   17|       |
   18|  5.74k|    auto memory_limit = Pl_Flate::memory_limit();
   19|       |
   20|  5.74k|    std::set<std::string> keys = decode_parms.getKeys();
   21|  11.1k|    for (auto const& key: keys) {
  ------------------
  |  Branch (21:25): [True: 11.1k, False: 5.59k]
  ------------------
   22|  11.1k|        QPDFObjectHandle value = decode_parms.getKey(key);
   23|  11.1k|        if (key == "/Predictor") {
  ------------------
  |  Branch (23:13): [True: 3.30k, False: 7.82k]
  ------------------
   24|  3.30k|            if (value.isInteger()) {
  ------------------
  |  Branch (24:17): [True: 3.29k, False: 13]
  ------------------
   25|  3.29k|                predictor = value.getIntValueAsInt();
   26|  3.29k|                if (!(predictor == 1 || predictor == 2 || (predictor >= 10 && predictor <= 15))) {
  ------------------
  |  Branch (26:23): [True: 199, False: 3.09k]
  |  Branch (26:41): [True: 1.06k, False: 2.02k]
  |  Branch (26:60): [True: 1.97k, False: 46]
  |  Branch (26:79): [True: 1.95k, False: 25]
  ------------------
   27|     71|                    return false;
   28|     71|                }
   29|  3.29k|            } else {
   30|     13|                return false;
   31|     13|            }
   32|  7.82k|        } else if (key == "/Columns" || key == "/Colors" || key == "/BitsPerComponent") {
  ------------------
  |  Branch (32:20): [True: 1.69k, False: 6.13k]
  |  Branch (32:41): [True: 363, False: 5.76k]
  |  Branch (32:61): [True: 537, False: 5.23k]
  ------------------
   33|  2.59k|            if (value.isInteger()) {
  ------------------
  |  Branch (33:17): [True: 2.58k, False: 10]
  ------------------
   34|  2.58k|                int val = value.getIntValueAsInt();
   35|  2.58k|                if (memory_limit && static_cast<unsigned int>(val) > memory_limit) {
  ------------------
  |  Branch (35:21): [True: 2.58k, False: 1]
  |  Branch (35:37): [True: 19, False: 2.56k]
  ------------------
   36|     19|                    QPDFLogger::defaultLogger()->warn(
   37|     19|                        "SF_FlateLzwDecode parameter exceeds PL_Flate memory limit\n");
   38|     19|                    return false;
   39|     19|                }
   40|  2.56k|                if (key == "/Columns") {
  ------------------
  |  Branch (40:21): [True: 1.66k, False: 899]
  ------------------
   41|  1.66k|                    columns = val;
   42|  1.66k|                } else if (key == "/Colors") {
  ------------------
  |  Branch (42:28): [True: 362, False: 537]
  ------------------
   43|    362|                    colors = val;
   44|    537|                } else if (key == "/BitsPerComponent") {
  ------------------
  |  Branch (44:28): [True: 536, False: 1]
  ------------------
   45|    536|                    bits_per_component = val;
   46|    536|                }
   47|  2.56k|            } else {
   48|     10|                return false;
   49|     10|            }
   50|  5.23k|        } else if (lzw && (key == "/EarlyChange")) {
  ------------------
  |  Branch (50:20): [True: 3.76k, False: 1.46k]
  |  Branch (50:27): [True: 177, False: 3.58k]
  ------------------
   51|    177|            if (value.isInteger()) {
  ------------------
  |  Branch (51:17): [True: 174, False: 3]
  ------------------
   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: 70, False: 38]
  ------------------
   55|     38|                    return false;
   56|     38|                }
   57|    174|            } else {
   58|      3|                return false;
   59|      3|            }
   60|    177|        }
   61|  11.1k|    }
   62|       |
   63|  5.59k|    if (predictor > 1 && columns == 0) {
  ------------------
  |  Branch (63:9): [True: 3.02k, False: 2.57k]
  |  Branch (63:26): [True: 6, False: 3.01k]
  ------------------
   64|      6|        return false;
   65|      6|    }
   66|       |
   67|  5.58k|    return true;
   68|  5.59k|}
_ZN17SF_FlateLzwDecode17getDecodePipelineEP8Pipeline:
   72|  24.2k|{
   73|  24.2k|    std::unique_ptr<Pipeline> pipeline;
   74|  24.2k|    if (predictor >= 10 && predictor <= 15) {
  ------------------
  |  Branch (74:9): [True: 1.94k, False: 22.3k]
  |  Branch (74:28): [True: 1.94k, False: 0]
  ------------------
   75|  1.94k|        QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter");
   76|  1.94k|        pipeline = std::make_unique<Pl_PNGFilter>(
   77|  1.94k|            "png decode",
   78|  1.94k|            next,
   79|  1.94k|            Pl_PNGFilter::a_decode,
   80|  1.94k|            QIntC::to_uint(columns),
   81|  1.94k|            QIntC::to_uint(colors),
   82|  1.94k|            QIntC::to_uint(bits_per_component));
   83|  1.94k|        next = pipeline.get();
   84|  1.94k|        pipelines.push_back(std::move(pipeline));
   85|  22.3k|    } else if (predictor == 2) {
  ------------------
  |  Branch (85:16): [True: 1.06k, False: 21.2k]
  ------------------
   86|  1.06k|        QTC::TC("qpdf", "SF_FlateLzwDecode TIFF predictor");
   87|  1.06k|        pipeline = std::make_unique<Pl_TIFFPredictor>(
   88|  1.06k|            "tiff decode",
   89|  1.06k|            next,
   90|  1.06k|            Pl_TIFFPredictor::a_decode,
   91|  1.06k|            QIntC::to_uint(columns),
   92|  1.06k|            QIntC::to_uint(colors),
   93|  1.06k|            QIntC::to_uint(bits_per_component));
   94|  1.06k|        next = pipeline.get();
   95|  1.06k|        pipelines.push_back(std::move(pipeline));
   96|  1.06k|    }
   97|       |
   98|  24.2k|    if (lzw) {
  ------------------
  |  Branch (98:9): [True: 5.46k, False: 18.8k]
  ------------------
   99|  5.46k|        pipeline = std::make_unique<Pl_LZWDecoder>("lzw decode", next, early_code_change);
  100|  18.8k|    } else {
  101|  18.8k|        pipeline = std::make_unique<Pl_Flate>("stream inflate", next, Pl_Flate::a_inflate);
  102|  18.8k|    }
  103|  24.2k|    next = pipeline.get();
  104|  24.2k|    pipelines.push_back(std::move(pipeline));
  105|  24.2k|    return next;
  106|  24.2k|}

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

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

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

_ZN4qpdf4impl8AcroFormC2ERN4QPDF3DocE:
   38|  19.0k|            Common(doc)
   39|  19.0k|        {
   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|  19.0k|            validate();
   44|  19.0k|        }
_ZN4qpdf4impl8FormNodeC2ERK16QPDFObjectHandle:
  352|   179k|            BaseDictionary(oh)
  353|   179k|        {
  354|   179k|        }
_ZNK4qpdf4impl8FormNode2APEv:
  372|  26.4k|        {
  373|  26.4k|            return {get("/AP")};
  374|  26.4k|        }
_ZN4qpdf4impl8FormNode6ParentEv:
  386|  90.2k|        {
  387|  90.2k|            return {get("/Parent")};
  388|  90.2k|        }
_ZNK4qpdf4impl8FormNode4KidsEv:
  400|  33.1k|        {
  401|  33.1k|            return {get("/Kids")};
  402|  33.1k|        }
_ZNK4qpdf4impl8FormNode2FTEb:
  470|  43.8k|        {
  471|  43.8k|            return inheritable_value<Name>("/FT");
  472|  43.8k|        }
_ZNK4qpdf4impl8FormNode1TEv:
  480|  61.4k|        {
  481|  61.4k|            return {get("/T")};
  482|  61.4k|        }
_ZNK4qpdf4impl8FormNode5fieldEv:
  660|  13.7k|        {
  661|  13.7k|            return T() || Kids() || FT();
  ------------------
  |  Branch (661:20): [True: 8.42k, False: 5.37k]
  |  Branch (661:27): [True: 1.11k, False: 4.26k]
  |  Branch (661:37): [True: 1.15k, False: 3.11k]
  ------------------
  662|  13.7k|        }
_ZNK4qpdf4impl8FormNode6widgetEv:
  680|  13.7k|        {
  681|  13.7k|            return !Kids() && (contains("/Subtype") || contains("/Rect") || contains("/AP"));
  ------------------
  |  Branch (681:20): [True: 10.4k, False: 3.35k]
  |  Branch (681:32): [True: 6.43k, False: 4.01k]
  |  Branch (681:56): [True: 219, False: 3.79k]
  |  Branch (681:77): [True: 221, False: 3.57k]
  ------------------
  682|  13.7k|        }
_ZNK4qpdf4impl8FormNode13from_AcroFormERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  767|  17.8k|        {
  768|  17.8k|            return {qpdf() ? qpdf()->getRoot()["/AcroForm"][name] : null_oh};
  ------------------
  |  Branch (768:21): [True: 16.8k, False: 1.00k]
  ------------------
  769|  17.8k|        }
_ZN26QPDFAcroFormDocumentHelper7MembersC2ER4QPDF:
  790|  19.0k|        AcroForm(qpdf.doc())
  791|  19.0k|    {
  792|  19.0k|    }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_4NameEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  43.8k|        {
  449|  43.8k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 37.0k, False: 6.86k]
  ------------------
  450|  37.0k|                return {v};
  451|  37.0k|            }
  452|  6.86k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 6.86k, False: 0]
  ------------------
  453|  43.8k|        }
_ZN4qpdf4impl8AcroFormD2Ev:
   35|  19.0k|        ~AcroForm() = default;
_ZN4qpdf4impl8FormNodeC2ERKS1_:
  345|  28.1k|        FormNode(FormNode const&) = default;
_ZN4qpdf4impl8FormNodeaSEOS1_:
  348|  54.5k|        FormNode& operator=(FormNode&&) = default;
_ZNK4qpdf4impl8FormNode17inheritable_valueI16QPDFObjectHandleEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  4.77k|        {
  449|  4.77k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 1.38k, False: 3.38k]
  ------------------
  450|  1.38k|                return {v};
  451|  1.38k|            }
  452|  3.38k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 3.38k, False: 0]
  ------------------
  453|  4.77k|        }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_6StringEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  17.3k|        {
  449|  17.3k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 8.00k, False: 9.39k]
  ------------------
  450|  8.00k|                return {v};
  451|  8.00k|            }
  452|  9.39k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 9.39k, False: 0]
  ------------------
  453|  17.3k|        }
_ZNK4qpdf4impl8FormNode1VI16QPDFObjectHandleEET_b:
  564|    550|        {
  565|    550|            return inheritable_value<T>("/V", inherit);
  566|    550|        }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_5ArrayEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  2.11k|        {
  449|  2.11k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 1.09k, False: 1.02k]
  ------------------
  450|  1.09k|                return {v};
  451|  1.09k|            }
  452|  1.02k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 1.02k, False: 0]
  ------------------
  453|  2.11k|        }

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

_ZNK4qpdf2is12OffsetBuffer7getNameEv:
   48|  1.11M|        {
   49|  1.11M|            return description;
   50|  1.11M|        }
_ZN4qpdf2is12OffsetBuffer4tellEv:
   54|   135M|        {
   55|   135M|            return pos + global_offset;
   56|   135M|        }
_ZN4qpdf2is12OffsetBuffer8unreadChEc:
   70|  17.1k|        {
   71|  17.1k|            if (pos > 0) {
  ------------------
  |  Branch (71:17): [True: 17.1k, False: 0]
  ------------------
   72|  17.1k|                --pos;
   73|  17.1k|            }
   74|  17.1k|        }
_ZN4qpdf2is12OffsetBufferD2Ev:
   42|  96.7k|        ~OffsetBuffer() final = default;
_ZN4qpdf2is12OffsetBufferC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_17basic_string_viewIcS5_EEx:
   21|  96.7k|            description(description),
   22|  96.7k|            view_(view),
   23|  96.7k|            global_offset(global_offset)
   24|  96.7k|        {
   25|  96.7k|            if (global_offset < 0) {
  ------------------
  |  Branch (25:17): [True: 41, False: 96.7k]
  ------------------
   26|     41|                throw std::logic_error("is::OffsetBuffer constructed with negative offset");
   27|     41|            }
   28|  96.7k|            last_offset = global_offset;
   29|  96.7k|        }
_ZN11InputSource4readERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   87|  44.4k|{
   88|  44.4k|    if (at >= 0) {
  ------------------
  |  Branch (88:9): [True: 31.4k, False: 12.9k]
  ------------------
   89|       |        seek(at, SEEK_SET);
   90|  31.4k|    }
   91|  44.4k|    str.resize(count);
   92|  44.4k|    str.resize(read(str.data(), count));
   93|  44.4k|    return str.size();
   94|  44.4k|}
_ZN11InputSource4readEmx:
   98|  31.4k|{
   99|  31.4k|    std::string result(count, '\0');
  100|  31.4k|    (void)read(result, count, at);
  101|  31.4k|    return result;
  102|  31.4k|}
_ZN11InputSource10loadBufferEv:
  106|  7.32M|{
  107|  7.32M|    buf_idx = 0;
  108|  7.32M|    buf_len = qpdf_offset_t(read(buffer, buf_size));
  109|       |    // NB read sets last_offset
  110|  7.32M|    buf_start = last_offset;
  111|  7.32M|}
_ZN11InputSource8fastTellEv:
  115|  63.4M|{
  116|  63.4M|    if (buf_len == 0) {
  ------------------
  |  Branch (116:9): [True: 115k, False: 63.3M]
  ------------------
  117|   115k|        loadBuffer();
  118|  63.3M|    } else {
  119|  63.3M|        auto curr = tell();
  120|  63.3M|        if (curr < buf_start || curr >= (buf_start + buf_len)) {
  ------------------
  |  Branch (120:13): [True: 70.4k, False: 63.2M]
  |  Branch (120:33): [True: 7.13M, False: 56.1M]
  ------------------
  121|  7.20M|            loadBuffer();
  122|  56.1M|        } else {
  123|  56.1M|            last_offset = curr;
  124|  56.1M|            buf_idx = curr - buf_start;
  125|  56.1M|        }
  126|  63.3M|    }
  127|  63.4M|    return last_offset;
  128|  63.4M|}
_ZN11InputSource8fastReadERc:
  132|   940M|{
  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|   940M|    if (buf_idx < buf_len) {
  ------------------
  |  Branch (135:9): [True: 933M, False: 6.88M]
  ------------------
  136|   933M|        ch = buffer[buf_idx];
  137|   933M|        ++(buf_idx);
  138|   933M|        ++(last_offset);
  139|   933M|        return true;
  140|       |
  141|   933M|    } else if (buf_len == 0) {
  ------------------
  |  Branch (141:16): [True: 76.2k, False: 6.80M]
  ------------------
  142|  76.2k|        return false;
  143|  6.80M|    } else {
  144|       |        seek(buf_start + buf_len, SEEK_SET);
  145|  6.80M|        fastTell();
  146|  6.80M|        return fastRead(ch);
  147|  6.80M|    }
  148|   940M|}
_ZN11InputSource10fastUnreadEb:
  152|  56.6M|{
  153|  56.6M|    last_offset -= back ? 1 : 0;
  ------------------
  |  Branch (153:20): [True: 32.8M, False: 23.8M]
  ------------------
  154|       |    seek(last_offset, SEEK_SET);
  155|  56.6M|}

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

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

_ZNK10NNTreeImpl8itemsKeyEv:
  185|   164k|    {
  186|   164k|        return items_key;
  187|   164k|    }
_ZNK14NNTreeIterator5validEv:
   29|  51.2k|    {
   30|  51.2k|        return item_number >= 0;
   31|  51.2k|    }
_ZN14NNTreeIterator13setItemNumberERK16QPDFObjectHandlei:
  102|  17.6k|    {
  103|  17.6k|        node = a_node;
  104|  17.6k|        item_number = n;
  105|  17.6k|        updateIValue();
  106|  17.6k|    }
_ZNK10NNTreeImpl8keyValidE16QPDFObjectHandle:
  190|   174k|    {
  191|   174k|        return o.resolved_type_code() == key_type;
  192|   174k|    }
_ZN14NNTreeIteratorD2Ev:
   24|  35.2k|    ~NNTreeIterator() = default;
_ZN14NNTreeIterator14addPathElementERK16QPDFObjectHandlei:
  109|  9.20k|    {
  110|  9.20k|        path.emplace_back(a_node, kid_number);
  111|  9.20k|    }
_ZN14NNTreeIterator11PathElementC2ERKN4qpdf10DictionaryEi:
   85|  9.25k|            node(node),
   86|  9.25k|            kid_number(kid_number)
   87|  9.25k|        {
   88|  9.25k|        }
_ZN14NNTreeIteratorC2ER10NNTreeImpl:
   95|  23.2k|        impl(impl)
   96|  23.2k|    {
   97|  23.2k|    }
_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: 884, False: 1.02k]
  ------------------
  143|  1.90k|        value_valid(value_validator),
  144|  1.90k|        auto_repair(auto_repair)
  145|  1.90k|    {
  146|  1.90k|    }
_ZN10NNTreeImpl3endEv:
  150|  5.71k|    {
  151|  5.71k|        return {*this};
  152|  5.71k|    }
_ZNK14NNTreeIteratorneERKS_:
   73|  20.3k|    {
   74|  20.3k|        return !operator==(other);
   75|  20.3k|    }
_ZN14NNTreeIteratordeEv:
   60|  19.1k|    {
   61|  19.1k|        updateIValue(false);
   62|  19.1k|        return ivalue;
   63|  19.1k|    }
_ZN14NNTreeIteratorppEv:
   34|  18.6k|    {
   35|  18.6k|        increment(false);
   36|  18.6k|        return *this;
   37|  18.6k|    }
_ZN14NNTreeIteratorptEv:
   66|  30.3k|    {
   67|  30.3k|        updateIValue(false);
   68|  30.3k|        return &ivalue;
   69|  30.3k|    }

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

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

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

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

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

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

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

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

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

_ZNK4qpdf10BaseHandle13raw_type_codeEv:
  933|  95.4M|    {
  934|  95.4M|        return obj ? static_cast<qpdf_object_type_e>(obj->value.index()) : ::ot_uninitialized;
  ------------------
  |  Branch (934:16): [True: 95.4M, False: 0]
  ------------------
  935|  95.4M|    }
_ZNK4qpdf10BaseHandle4qpdfEv:
  927|   844k|    {
  928|   844k|        return obj ? obj->qpdf : nullptr;
  ------------------
  |  Branch (928:16): [True: 843k, False: 1.00k]
  ------------------
  929|   844k|    }
_ZNK4qpdf10BaseHandle6offsetEv:
  921|  74.6k|    {
  922|  74.6k|        return obj ? obj->parsed_offset : -1;
  ------------------
  |  Branch (922:16): [True: 74.6k, False: 0]
  ------------------
  923|  74.6k|    }
_ZNK4qpdf10BaseHandle9type_codeEv:
  951|  28.9M|    {
  952|  28.9M|        if (!obj) {
  ------------------
  |  Branch (952:13): [True: 214k, False: 28.7M]
  ------------------
  953|   214k|            return ::ot_uninitialized;
  954|   214k|        }
  955|  28.7M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (955:13): [True: 313k, False: 28.4M]
  ------------------
  956|   313k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  957|   313k|        }
  958|  28.4M|        if (raw_type_code() == ::ot_reference) {
  ------------------
  |  Branch (958:13): [True: 0, False: 28.4M]
  ------------------
  959|      0|            return std::get<QPDF_Reference>(obj->value).obj->getTypeCode();
  960|      0|        }
  961|  28.4M|        return raw_type_code();
  962|  28.4M|    }
_ZNK4qpdf10BaseHandle8indirectEv:
  860|  3.15M|    {
  861|  3.15M|        return obj ? obj->og.isIndirect() : false;
  ------------------
  |  Branch (861:16): [True: 3.14M, False: 3.14k]
  ------------------
  862|  3.15M|    }
_ZNK4qpdf10BaseHandle4nullEv:
  907|  1.14M|    {
  908|  1.14M|        return !obj || type_code() == ::ot_null;
  ------------------
  |  Branch (908:16): [True: 148k, False: 998k]
  |  Branch (908:24): [True: 240k, False: 758k]
  ------------------
  909|  1.14M|    }
_ZN4qpdf5ArrayC2ERK16QPDFObjectHandle:
   57|   841k|            BaseHandle(oh.resolved_type_code() == ::ot_array ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (57:24): [True: 758k, False: 82.8k]
  ------------------
   58|   841k|        {
   59|   841k|        }
_ZNK4qpdf10BaseHandle18resolved_type_codeEv:
  939|  3.53M|    {
  940|  3.53M|        if (!obj) {
  ------------------
  |  Branch (940:13): [True: 134k, False: 3.39M]
  ------------------
  941|   134k|            return ::ot_uninitialized;
  942|   134k|        }
  943|  3.39M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (943:13): [True: 1.24k, False: 3.39M]
  ------------------
  944|  1.24k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  945|  1.24k|        }
  946|  3.39M|        return raw_type_code();
  947|  3.39M|    }
_ZN4qpdf10BaseHandleC2ERK16QPDFObjectHandle:
  788|  2.41M|        obj(oh.obj)
  789|  2.41M|    {
  790|  2.41M|    }
_ZN4qpdf10DictionaryC2ERK16QPDFObjectHandle:
  268|   488k|            BaseDictionary(oh)
  269|   488k|        {
  270|   488k|        }
_ZN4qpdf14BaseDictionaryC2ERK16QPDFObjectHandle:
  238|   668k|            BaseHandle(oh.resolved_type_code() == ::ot_dictionary ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (238:24): [True: 554k, False: 114k]
  ------------------
  239|   668k|        {
  240|   668k|        }
_ZN4qpdf14BaseDictionary5beginEv:
  141|  82.1k|        {
  142|  82.1k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (142:22): [True: 58.3k, False: 23.8k]
  ------------------
  143|  58.3k|                return d->items.begin();
  144|  58.3k|            }
  145|  23.8k|            return {};
  146|  82.1k|        }
_ZNK4qpdf10BaseHandle2asI15QPDF_DictionaryEEPT_v:
  770|  2.58M|    {
  771|  2.58M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 59.8k, False: 2.52M]
  ------------------
  772|  59.8k|            return nullptr;
  773|  59.8k|        }
  774|  2.52M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 2.48M, False: 44.4k]
  ------------------
  775|  2.48M|            return &std::get<T>(obj->value);
  776|  2.48M|        }
  777|  44.4k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 134, False: 44.2k]
  ------------------
  778|    134|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|    134|        }
  780|  44.2k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 44.2k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  44.2k|        return nullptr;
  785|  44.2k|    }
_ZN4qpdf14BaseDictionary3endEv:
  150|  82.1k|        {
  151|  82.1k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (151:22): [True: 58.3k, False: 23.8k]
  ------------------
  152|  58.3k|                return d->items.end();
  153|  58.3k|            }
  154|  23.8k|            return {};
  155|  82.1k|        }
_ZNK4qpdf10BaseHandle6id_genEv:
  854|   466k|    {
  855|   466k|        return obj ? obj->og : QPDFObjGen();
  ------------------
  |  Branch (855:16): [True: 466k, False: 0]
  ------------------
  856|   466k|    }
_ZNK4qpdf6Stream7getDictEv:
  554|   128k|        {
  555|   128k|            return {stream()->stream_dict};
  556|   128k|        }
_ZNK4qpdf6Stream6streamEv:
  697|   374k|        {
  698|   374k|            if (auto s = as<QPDF_Stream>()) {
  ------------------
  |  Branch (698:22): [True: 374k, False: 0]
  ------------------
  699|   374k|                if (auto ptr = s->m.get()) {
  ------------------
  |  Branch (699:26): [True: 374k, False: 4]
  ------------------
  700|   374k|                    return ptr;
  701|   374k|                }
  702|      4|                throw std::logic_error("QPDF_Stream: unexpected nullptr");
  703|   374k|            }
  704|      0|            throw std::runtime_error("operation for stream attempted on non-stream object");
  705|      0|            return nullptr; // unreachable
  706|   374k|        }
_ZNK4qpdf10BaseHandle2asI11QPDF_StreamEEPT_v:
  770|   374k|    {
  771|   374k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 374k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   374k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 374k, False: 0]
  ------------------
  775|   374k|            return &std::get<T>(obj->value);
  776|   374k|        }
  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|   378k|            BaseHandle(oh.type_code() == ::ot_integer ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (319:24): [True: 150k, False: 227k]
  ------------------
  320|   378k|        {
  321|   378k|        }
_ZNK4qpdf7IntegercvbEv:
  330|   194k|        {
  331|   194k|            return obj != nullptr;
  332|   194k|        }
_ZN4qpdfeqERKNS_4NameENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  473|   338k|        {
  474|   338k|            return lhs && lhs.value() == rhs;
  ------------------
  |  Branch (474:20): [True: 242k, False: 95.6k]
  |  Branch (474:27): [True: 147k, False: 95.1k]
  ------------------
  475|   338k|        }
_ZN4qpdf4NameC2ERK16QPDFObjectHandle:
  449|   442k|            BaseHandle(oh.type_code() == ::ot_name ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (449:24): [True: 282k, False: 159k]
  ------------------
  450|   442k|        {
  451|   442k|        }
_ZNK4qpdf10BaseHandle2ohEv:
  805|   206k|    {
  806|   206k|        return {obj};
  807|   206k|    }
_ZN10QPDFObject6createI9QPDF_NullJEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|   670k|{
  989|   670k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   670k|}
_ZNK4qpdf7Integer5valueITkNSt3__18integralEiEET_v:
  361|  41.9k|        {
  362|  41.9k|            try {
  363|  41.9k|                return static_cast<T>(*this);
  364|  41.9k|            } catch (std::underflow_error&) {
  365|    110|                if constexpr (std::is_same_v<T, int>) {
  366|    110|                    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|    110|                return std::numeric_limits<T>::min();
  377|    234|            } catch (std::overflow_error&) {
  378|    234|                if constexpr (std::is_same_v<T, int>) {
  379|    234|                    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|    234|                return std::numeric_limits<T>::max();
  388|    234|            }
  389|  41.9k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEiEEv:
  339|  51.6k|        {
  340|  51.6k|            auto v = value();
  341|       |
  342|  51.6k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 236, False: 51.4k]
  ------------------
  343|    236|                throw std::overflow_error("Integer conversion overflow");
  344|    236|            }
  345|  51.4k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 110, False: 51.3k]
  ------------------
  346|    110|                throw std::underflow_error("Integer conversion underflow");
  347|    110|            }
  348|  51.3k|            return static_cast<T>(v);
  349|  51.4k|        }
_ZN4qpdf5ArrayaSERKS0_:
   36|  4.90k|        {
   37|  4.90k|            if (obj != other.obj) {
  ------------------
  |  Branch (37:17): [True: 4.90k, False: 0]
  ------------------
   38|  4.90k|                obj = other.obj;
   39|  4.90k|            }
   40|  4.90k|            return *this;
   41|  4.90k|        }
_ZN4qpdf5ArrayC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
   47|  97.4k|            BaseHandle(obj)
   48|  97.4k|        {
   49|  97.4k|        }
_ZN4qpdf5ArrayC2EONSt3__110shared_ptrI10QPDFObjectEE:
   52|  44.3k|            BaseHandle(std::move(obj))
   53|  44.3k|        {
   54|  44.3k|        }
_ZN4qpdf5ArrayaSERK16QPDFObjectHandle:
   63|  24.4k|        {
   64|  24.4k|            assign(::ot_array, oh);
   65|  24.4k|            return *this;
   66|  24.4k|        }
_ZN4qpdf5ArrayC2EO16QPDFObjectHandle:
   69|    884|            BaseHandle(oh.resolved_type_code() == ::ot_array ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (69:24): [True: 210, False: 674]
  ------------------
   70|    884|        {
   71|    884|        }
_ZN4qpdf14BaseDictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  220|  50.7k|            BaseHandle(QPDFObject::create<QPDF_Dictionary>(std::move(dict)))
  221|  50.7k|        {
  222|  50.7k|        }
_ZN4qpdf14BaseDictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  225|   278k|            BaseHandle(obj)
  226|   278k|        {
  227|   278k|        }
_ZN4qpdf14BaseDictionaryC2EO16QPDFObjectHandle:
  243|  14.8k|            BaseHandle(
  244|  14.8k|                oh.resolved_type_code() == ::ot_dictionary ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (244:17): [True: 13.5k, False: 1.30k]
  ------------------
  245|  14.8k|        {
  246|  14.8k|        }
_ZN4qpdf10DictionaryaSERK16QPDFObjectHandle:
  274|  26.2k|        {
  275|  26.2k|            assign(::ot_dictionary, oh);
  276|  26.2k|            return *this;
  277|  26.2k|        }
_ZN4qpdf10DictionaryC2EO16QPDFObjectHandle:
  280|  14.8k|            BaseDictionary(std::move(oh))
  281|  14.8k|        {
  282|  14.8k|        }
_ZN4qpdf10DictionaryaSEO16QPDFObjectHandle:
  286|    329|        {
  287|    329|            assign(::ot_dictionary, std::move(oh));
  288|    329|            return *this;
  289|    329|        }
_ZNKR4qpdf4NamecvNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEv:
  461|  42.9k|        {
  462|  42.9k|            return value();
  463|  42.9k|        }
_ZN4qpdf4NullC2Ev:
  483|      2|            BaseHandle(QPDFObject::create<QPDF_Null>())
  484|      2|        {
  485|      2|        }
_ZN4qpdf4Null4tempEv:
  496|  63.6k|        {
  497|  63.6k|            return temp_.oh();
  498|  63.6k|        }
_ZN4qpdf4Null7if_nullE16QPDFObjectHandle:
  503|  11.2k|        {
  504|  11.2k|            return oh ? std::move(oh) : Null::temp();
  ------------------
  |  Branch (504:20): [True: 6.05k, False: 5.14k]
  ------------------
  505|  11.2k|        }
_ZN4qpdf6StreamC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  515|   132k|            BaseHandle(obj)
  516|   132k|        {
  517|   132k|        }
_ZN4qpdf6StreamC2EONSt3__110shared_ptrI10QPDFObjectEE:
  520|   157k|            BaseHandle(std::move(obj))
  521|   157k|        {
  522|   157k|        }
_ZN4qpdf6StreamC2EO16QPDFObjectHandle:
  537|  43.4k|            BaseHandle(oh.type_code() == ::ot_stream ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (537:24): [True: 13.8k, False: 29.5k]
  ------------------
  538|  43.4k|        {
  539|  43.4k|        }
_ZNK4qpdf6Stream6LengthEv:
  563|  4.26k|        {
  564|  4.26k|            return {getDict()["/Length"]};
  565|  4.26k|        }
_ZNK4qpdf6Stream7SubtypeEv:
  592|  8.65k|        {
  593|  8.65k|            return {getDict()["/Subtype"]};
  594|  8.65k|        }
_ZNK4qpdf6Stream4TypeEv:
  601|  27.2k|        {
  602|  27.2k|            return {getDict()["/Type"]};
  603|  27.2k|        }
_ZNK4qpdf6Stream9getLengthEv:
  624|  1.13k|        {
  625|  1.13k|            return stream()->length;
  626|  1.13k|        }
_ZN4qpdf6Stream11replaceDictERK16QPDFObjectHandle:
  681|  4.01k|        {
  682|  4.01k|            auto s = stream();
  683|  4.01k|            s->stream_dict = new_dict;
  684|  4.01k|            setDictDescription();
  685|  4.01k|        }
_ZN4qpdf6StringC2ERK16QPDFObjectHandle:
  732|  80.4k|            BaseHandle(oh.type_code() == ::ot_string ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (732:24): [True: 59.5k, False: 20.8k]
  ------------------
  733|  80.4k|        {
  734|  80.4k|        }
_ZN4qpdf6StringC2EO16QPDFObjectHandle:
  737|   419k|            BaseHandle(oh.type_code() == ::ot_string ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (737:24): [True: 419k, False: 0]
  ------------------
  738|   419k|        {
  739|   419k|        }
_ZNK4qpdf10BaseHandle6obj_spEv:
  799|   166k|    {
  800|   166k|        return obj;
  801|   166k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eRKS0_:
  838|  50.6k|    {
  839|  50.6k|        if (obj != other.obj) {
  ------------------
  |  Branch (839:13): [True: 20.6k, False: 30.0k]
  ------------------
  840|  20.6k|            obj = other.resolved_type_code() == required ? other.obj : nullptr;
  ------------------
  |  Branch (840:19): [True: 19.0k, False: 1.63k]
  ------------------
  841|  20.6k|        }
  842|  50.6k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eOS0_:
  846|    329|    {
  847|    329|        if (obj != other.obj) {
  ------------------
  |  Branch (847:13): [True: 303, False: 26]
  ------------------
  848|    303|            obj = other.resolved_type_code() == required ? std::move(other.obj) : nullptr;
  ------------------
  |  Branch (848:19): [True: 303, False: 0]
  ------------------
  849|    303|        }
  850|    329|    }
_ZNK4qpdf10BaseHandle21no_ci_stop_damaged_ifEbRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  877|  4.01k|    {
  878|  4.01k|        if (condition) {
  ------------------
  |  Branch (878:13): [True: 0, False: 4.01k]
  ------------------
  879|      0|            throw std::runtime_error(message);
  880|      0|        }
  881|  4.01k|    }
_ZNK4qpdf10BaseHandle13no_ci_warn_ifEbRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  885|  11.2k|    {
  886|  11.2k|        if (condition) {
  ------------------
  |  Branch (886:13): [True: 0, False: 11.2k]
  ------------------
  887|      0|            warn(warning);
  888|      0|        }
  889|  11.2k|    }
_ZNK4qpdf10BaseHandle3getERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  901|  1.15M|    {
  902|  1.15M|        return (*this)[key];
  903|  1.15M|    }
_ZN9QPDF_Null6createENSt3__110shared_ptrI10QPDFObjectEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
  974|   284k|{
  975|   284k|    auto n = QPDFObject::create<QPDF_Null>();
  976|   284k|    n->setChildDescription(parent->getQPDF(), parent, static_descr, var_descr);
  977|   284k|    return n;
  978|   284k|}
_ZNK16QPDFObjectHandle8as_arrayEN4qpdf5typedE:
 1006|   139k|{
 1007|   139k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1007:9): [True: 0, False: 139k]
  ------------------
 1008|      0|        assertType("array", false);
 1009|      0|    }
 1010|   139k|    if (options & qpdf::any_flag || type_code() == ::ot_array ||
  ------------------
  |  Branch (1010:9): [True: 69.1k, False: 70.2k]
  |  Branch (1010:37): [True: 25.8k, False: 44.3k]
  ------------------
 1011|  95.0k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1011:10): [True: 0, False: 44.3k]
  |  Branch (1011:38): [True: 0, False: 0]
  ------------------
 1012|  95.0k|        return qpdf::Array(obj);
 1013|  95.0k|    }
 1014|  44.3k|    return qpdf::Array(std::shared_ptr<QPDFObject>());
 1015|   139k|}
_ZNK16QPDFObjectHandle13as_dictionaryEN4qpdf5typedE:
 1019|   278k|{
 1020|   278k|    if (options & qpdf::any_flag || type_code() == ::ot_dictionary ||
  ------------------
  |  Branch (1020:9): [True: 40.0k, False: 238k]
  |  Branch (1020:37): [True: 219k, False: 19.1k]
  ------------------
 1021|   259k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1021:10): [True: 0, False: 19.1k]
  |  Branch (1021:38): [True: 0, False: 0]
  ------------------
 1022|   259k|        return qpdf::Dictionary(obj);
 1023|   259k|    }
 1024|  19.1k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1024:9): [True: 0, False: 19.1k]
  ------------------
 1025|      0|        assertType("dictionary", false);
 1026|      0|    }
 1027|  19.1k|    return qpdf::Dictionary(std::shared_ptr<QPDFObject>());
 1028|   278k|}
_ZNK16QPDFObjectHandle9as_streamEN4qpdf5typedE:
 1032|   292k|{
 1033|   292k|    if (options & qpdf::any_flag || type_code() == ::ot_stream ||
  ------------------
  |  Branch (1033:9): [True: 0, False: 292k]
  |  Branch (1033:37): [True: 135k, False: 157k]
  ------------------
 1034|   157k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1034:10): [True: 0, False: 157k]
  |  Branch (1034:38): [True: 0, False: 0]
  ------------------
 1035|   132k|        return qpdf::Stream(obj);
 1036|   132k|    }
 1037|   160k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1037:9): [True: 0, False: 160k]
  ------------------
 1038|      0|        assertType("stream", false);
 1039|      0|    }
 1040|   160k|    return qpdf::Stream(std::shared_ptr<QPDFObject>());
 1041|   292k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  19.2k|{
  989|  19.2k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  19.2k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   273k|{
  989|   273k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   273k|}
_ZN4qpdf10BaseHandleC2EO16QPDFObjectHandle:
  793|   476k|        obj(std::move(oh.obj))
  794|   476k|    {
  795|   476k|    }
_ZN4qpdf10DictionaryC2Ev:
  256|  23.6k|        Dictionary() = default;
_ZN4qpdf14BaseDictionaryC2Ev:
  212|  23.6k|        BaseDictionary() = default;
_ZN4qpdf10DictionaryC2ERKS0_:
  262|  55.9k|        Dictionary(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryC2ERKS0_:
  232|  84.0k|        BaseDictionary(BaseDictionary const&) = default;
_ZN4qpdf10DictionaryaSEOS0_:
  265|  18.9k|        Dictionary& operator=(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryaSEOS0_:
  235|  73.5k|        BaseDictionary& operator=(BaseDictionary&&) = default;
_ZN4qpdf6StreamaSEOS0_:
  528|  5.16k|        Stream& operator=(Stream&&) = default;
_ZN10QPDFObject6createI9QPDF_BoolJRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|    893|{
  989|    893|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    893|}
_ZN10QPDFObject6createI12QPDF_IntegerJRxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  1.73M|{
  989|  1.73M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.73M|}
_ZN10QPDFObject6createI9QPDF_RealJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  20.9k|{
  989|  20.9k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  20.9k|}
_ZN10QPDFObject6createI11QPDF_StringJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   183k|{
  989|   183k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   183k|}
_ZN10QPDFObject6createI9QPDF_NameJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   157k|{
  989|   157k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   157k|}
_ZN10QPDFObject6createI10QPDF_ArrayJS1_EEENSt3__110shared_ptrIS_EEDpOT0_:
  988|    438|{
  989|    438|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    438|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEbEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  16.4k|{
  989|  16.4k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  16.4k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  28.9k|{
  989|  28.9k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  28.9k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_BoolEEPT_v:
  770|  4.49k|    {
  771|  4.49k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 4.49k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  4.49k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 4.49k, False: 0]
  ------------------
  775|  4.49k|            return &std::get<T>(obj->value);
  776|  4.49k|        }
  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|   151k|    {
  771|   151k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 939, False: 150k]
  ------------------
  772|    939|            return nullptr;
  773|    939|        }
  774|   150k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 150k, False: 0]
  ------------------
  775|   150k|            return &std::get<T>(obj->value);
  776|   150k|        }
  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|  56.9k|        {
  340|  56.9k|            auto v = value();
  341|       |
  342|  56.9k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 56.9k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  56.9k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 0, False: 56.9k]
  ------------------
  346|      0|                throw std::underflow_error("Integer conversion underflow");
  347|      0|            }
  348|  56.9k|            return static_cast<T>(v);
  349|  56.9k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEyEET_v:
  361|  25.1k|        {
  362|  25.1k|            try {
  363|  25.1k|                return static_cast<T>(*this);
  364|  25.1k|            } catch (std::underflow_error&) {
  365|       |                if constexpr (std::is_same_v<T, int>) {
  366|       |                    warn("requested value of integer is too small; returning INT_MIN");
  367|       |                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|       |                    warn("unsigned integer value request for negative number; returning 0");
  369|    116|                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|    116|                    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|    116|                return std::numeric_limits<T>::min();
  377|    116|            } 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.1k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEyEEv:
  339|  25.1k|        {
  340|  25.1k|            auto v = value();
  341|       |
  342|  25.1k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 25.1k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  25.1k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 116, False: 24.9k]
  ------------------
  346|    116|                throw std::underflow_error("Integer conversion underflow");
  347|    116|            }
  348|  24.9k|            return static_cast<T>(v);
  349|  25.1k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEjEET_v:
  361|  6.77k|        {
  362|  6.77k|            try {
  363|  6.77k|                return static_cast<T>(*this);
  364|  6.77k|            } 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|    122|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|    122|                    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|    122|                return std::numeric_limits<T>::min();
  377|    122|            } 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|     81|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|     81|                    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|     81|                return std::numeric_limits<T>::max();
  388|     81|            }
  389|  6.77k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEjEEv:
  339|  6.77k|        {
  340|  6.77k|            auto v = value();
  341|       |
  342|  6.77k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 81, False: 6.69k]
  ------------------
  343|     81|                throw std::overflow_error("Integer conversion overflow");
  344|     81|            }
  345|  6.69k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 122, False: 6.57k]
  ------------------
  346|    122|                throw std::underflow_error("Integer conversion underflow");
  347|    122|            }
  348|  6.57k|            return static_cast<T>(v);
  349|  6.69k|        }
_ZNK4qpdf10BaseHandle2asI9QPDF_RealEEPT_v:
  770|  89.3k|    {
  771|  89.3k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 89.3k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  89.3k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 89.3k, False: 0]
  ------------------
  775|  89.3k|            return &std::get<T>(obj->value);
  776|  89.3k|        }
  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|  1.96M|{
  989|  1.96M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.96M|}
_ZN10QPDFObject6createI9QPDF_NameJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  38.8k|{
  989|  38.8k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  38.8k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_NameEEPT_v:
  770|   324k|    {
  771|   324k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 324k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   324k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 321k, False: 3.24k]
  ------------------
  775|   321k|            return &std::get<T>(obj->value);
  776|   321k|        }
  777|  3.24k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 1, False: 3.24k]
  ------------------
  778|      1|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      1|        }
  780|  3.24k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 3.24k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  3.24k|        return nullptr;
  785|  3.24k|    }
_ZN10QPDFObject6createI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   466k|{
  989|   466k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   466k|}
_ZN10QPDFObject6createI11QPDF_StringJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    572|{
  989|    572|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    572|}
_ZNK4qpdf10BaseHandle2asI11QPDF_StringEEPT_v:
  770|   462k|    {
  771|   462k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 462k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   462k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 462k, False: 0]
  ------------------
  775|   462k|            return &std::get<T>(obj->value);
  776|   462k|        }
  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|  21.4M|    {
  771|  21.4M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 21.4M]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  21.4M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 21.4M, False: 0]
  ------------------
  775|  21.4M|            return &std::get<T>(obj->value);
  776|  21.4M|        }
  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|   220k|{
  989|   220k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   220k|}
_ZN10QPDFObject6createI9QPDF_RealJRdRiRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  53.8k|{
  989|  53.8k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  53.8k|}
_ZN9QPDF_RealC2Edib:
  981|  53.8k|    val(QUtil::double_to_string(value, decimal_places, trim_trailing_zeroes))
  982|  53.8k|{
  983|  53.8k|}
_ZN10QPDFObject6createI13QPDF_OperatorJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  22.0M|{
  989|  22.0M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  22.0M|}
_ZN10QPDFObject6createI10QPDF_ArrayJRKNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  27.7k|{
  989|  27.7k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  27.7k|}
_ZN15QPDF_DictionaryC2EONSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
  967|   273k|    items(std::move(items))
  968|   273k|{
  969|   273k|}
_ZN10QPDFObject6createI9QPDF_BoolJbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  25.0k|{
  989|  25.0k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  25.0k|}
_ZN10QPDFObject6createI12QPDF_IntegerJxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|   334k|{
  989|   334k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   334k|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   158k|{
  989|   158k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   158k|}
_ZNK4qpdf10BaseHandle2asI10QPDF_ArrayEEPT_v:
  770|  2.17M|    {
  771|  2.17M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 148k, False: 2.03M]
  ------------------
  772|   148k|            return nullptr;
  773|   148k|        }
  774|  2.03M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 1.97M, False: 59.6k]
  ------------------
  775|  1.97M|            return &std::get<T>(obj->value);
  776|  1.97M|        }
  777|  59.6k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 59.6k]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|  59.6k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 59.6k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  59.6k|        return nullptr;
  785|  59.6k|    }
_ZN4qpdf6Stream6LengthITkNSt3__18integralExEEvT_:
  582|  4.26k|        {
  583|  4.26k|            qpdf_expect(val >= 0);
  ------------------
  |  |   13|  4.26k|#define qpdf_expect assert
  ------------------
  |  Branch (583:13): [True: 4.26k, False: 0]
  ------------------
  584|  4.26k|            getDict().replace("/Length", Integer(val));
  585|  4.26k|        }
_ZN4qpdf6Stream6LengthITkNSt3__18integralEmEEvT_:
  582|  20.6k|        {
  583|  20.6k|            qpdf_expect(val >= 0);
  ------------------
  |  |   13|  20.6k|#define qpdf_expect assert
  ------------------
  |  Branch (583:13): [True: 20.6k, False: 0]
  ------------------
  584|  20.6k|            getDict().replace("/Length", Integer(val));
  585|  20.6k|        }
_ZN4qpdf7IntegerC2ITkNSt3__18integralEmEET_:
  307|  25.9k|            Integer(static_cast<long long>(value))
  308|  25.9k|        {
  309|       |            if constexpr (std::cmp_greater(
  310|       |                              std::numeric_limits<decltype(value)>::max(),
  311|  25.9k|                              std::numeric_limits<long long>::max())) {
  312|  25.9k|                if (std::cmp_greater(value, std::numeric_limits<long long>::max())) {
  ------------------
  |  Branch (312:21): [True: 0, False: 25.9k]
  ------------------
  313|      0|                    throw std::overflow_error("overflow constructing Integer");
  314|      0|                }
  315|  25.9k|            }
  316|  25.9k|        }
_ZN4qpdf10DictionaryC2EOS0_:
  264|  2.71k|        Dictionary(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryC2EOS0_:
  234|  2.71k|        BaseDictionary(BaseDictionary&&) = default;
_ZN4qpdf10DictionaryaSERKS0_:
  263|  5.99k|        Dictionary& operator=(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryaSERKS0_:
  233|  5.99k|        BaseDictionary& operator=(BaseDictionary const&) = default;
_ZN4qpdf5ArrayC2Ev:
   21|  4.90k|        Array() = default;

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

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

_ZNK4qpdf9Tokenizer7getTypeEv:
   64|  31.9M|        {
   65|  31.9M|            return this->type;
   66|  31.9M|        }
_ZNK4qpdf9Tokenizer8getValueEv:
   69|  29.7M|        {
   70|  29.7M|            return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string)
  ------------------
  |  Branch (70:21): [True: 2.89M, False: 26.8M]
  |  Branch (70:61): [True: 428k, False: 26.4M]
  ------------------
   71|  29.7M|                ? this->val
   72|  29.7M|                : this->raw_val;
   73|  29.7M|        }
_ZNK4qpdf9Tokenizer15getErrorMessageEv:
   81|  60.9k|        {
   82|  60.9k|            return this->error_message;
   83|  60.9k|        }

_ZN4QPDF3DocC2ERS_PNS_7MembersE:
  357|  24.5k|        qpdf(qpdf),
  358|  24.5k|        m(m)
  359|  24.5k|    {
  360|  24.5k|    }
_ZN4qpdf3Doc6ConfigC2Ev:
   43|  24.5k|                log_(QPDFLogger::defaultLogger())
   44|  24.5k|            {
   45|  24.5k|            }
_ZN4QPDF3Doc6CommonC2ERS_PNS_7MembersE:
 1334|   117k|    qpdf(qpdf),
 1335|   117k|    m(m),
 1336|   117k|    cf(m->cf),
 1337|   117k|    pages(m->pages),
 1338|   117k|    objects(m->objects)
 1339|   117k|{
 1340|   117k|}
_ZN4QPDF3Doc13LinearizationC2ERS0_:
  607|  24.5k|        Common(doc)
  608|  24.5k|    {
  609|  24.5k|    }
_ZN4QPDF3Doc6CommonC2ERS0_:
 1343|  92.6k|    Common(doc.qpdf, doc.m)
 1344|  92.6k|{
 1345|  92.6k|}
_ZN4QPDF3Doc7ObjectsC2ERS0_:
 1044|  24.5k|        Common(doc),
 1045|  24.5k|        foreign_(*this),
 1046|  24.5k|        streams_(*this)
 1047|  24.5k|    {
 1048|  24.5k|    }
_ZN4QPDF3Doc7Objects7ForeignC2ERNS0_6CommonE:
  959|  24.5k|            Common(common)
  960|  24.5k|        {
  961|  24.5k|        }
_ZN4QPDF3Doc7Objects7ForeignD2Ev:
  968|  24.5k|        ~Foreign() = default;
_ZN4QPDF3Doc5PagesC2ERS0_:
 1187|  24.5k|        Common(doc)
 1188|  24.5k|    {
 1189|  24.5k|    }
_ZN4QPDF3Doc5PagesD2Ev:
 1184|  24.5k|    ~Pages() = default;
_ZN4QPDF3Doc7ObjectsD2Ev:
 1041|  24.5k|    ~Objects() = default;
_ZN4QPDF3Doc7Objects7StreamsD2Ev:
  997|  24.5k|        ~Streams() = default;
_ZN4QPDF3Doc13LinearizationD2Ev:
  604|  24.5k|    ~Linearization() = default;
_ZN4QPDF3DocD2Ev:
  354|  24.5k|    ~Doc() = default;
_ZN4qpdf3Doc6Config12max_warningsEm:
  107|  10.4k|            {
  108|  10.4k|                max_warnings_ = val;
  109|  10.4k|                return *this;
  110|  10.4k|            }
_ZNK4qpdf3Doc6Config3logEv:
   75|  1.08M|            {
   76|  1.08M|                return log_;
   77|  1.08M|            }
_ZNK4qpdf3Doc6Config12max_warningsEv:
  101|  2.03M|            {
  102|  2.03M|                return max_warnings_;
  103|  2.03M|            }
_ZNK4qpdf3Doc6Config17suppress_warningsEv:
   88|  1.08M|            {
   89|  1.08M|                return suppress_warnings_;
   90|  1.08M|            }
_ZN4QPDF3docEv:
 1373|  21.7M|{
 1374|  21.7M|    return *m;
 1375|  21.7M|}
_ZN4QPDF3Doc8Resolver8resolvedEPS_10QPDFObjGen:
 1328|   315k|    {
 1329|   315k|        return qpdf->m->objects.resolve(og);
 1330|   315k|    }
_ZNK4QPDF3Doc7Objects12root_checkedEv:
 1076|   142k|    {
 1077|   142k|        return root_checked_;
 1078|   142k|    }
_ZN4QPDF3Doc7Objects12root_checkedEb:
 1082|  11.8k|    {
 1083|  11.8k|        root_checked_ = val;
 1084|  11.8k|    }
_ZN4QPDF20EncryptionParametersC2Ev:
  191|  24.5k|    EncryptionParameters() = default;
_ZN4QPDF7MembersD2Ev:
 1287|  24.5k|    ~Members() = default;
_ZN4QPDF15StringDecrypter13decryptStringERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  240|  11.3k|    {
  241|  11.3k|        qpdf->decryptString(val, og);
  242|  11.3k|    }
_ZNK4qpdf3Doc6Config19password_is_hex_keyEv:
   49|  1.00k|            {
   50|  1.00k|                return password_is_hex_key_;
   51|  1.00k|            }
_ZNK4qpdf3Doc6Config19ignore_xref_streamsEv:
   62|  9.17k|            {
   63|  9.17k|                return ignore_xref_streams_;
   64|  9.17k|            }
_ZNK4qpdf3Doc6Config17surpress_recoveryEv:
  114|   190k|            {
  115|   190k|                return surpress_recovery_;
  116|   190k|            }
_ZNK4qpdf3Doc6Config19immediate_copy_fromEv:
  127|  1.14k|            {
  128|  1.14k|                return immediate_copy_from_;
  129|  1.14k|            }
_ZN4QPDF8ObjCacheC2ENSt3__110shared_ptrI10QPDFObjectEExx:
  175|   417k|        object(std::move(object)),
  176|   417k|        end_before_space(end_before_space),
  177|   417k|        end_after_space(end_after_space)
  178|   417k|    {
  179|   417k|    }
_ZN4QPDF20EncryptionParameters1REv:
  204|  5.56k|    {
  205|  5.56k|        return R_;
  206|  5.56k|    }
_ZN4QPDF3Doc6configEv:
  364|  1.14k|    {
  365|  1.14k|        return cf;
  366|  1.14k|    }
_ZN4QPDF3Doc8acroformEv:
  406|  8.66k|    {
  407|  8.66k|        if (!acroform_) {
  ------------------
  |  Branch (407:13): [True: 8.66k, False: 0]
  ------------------
  408|  8.66k|            no_inspection();
  409|  8.66k|            init_acroform();
  410|  8.66k|        }
  411|  8.66k|        return *acroform_;
  412|  8.66k|    }
_ZN4QPDF3Doc13no_inspectionEv:
  457|  8.66k|    {
  458|  8.66k|        if (global::Options::inspection_mode()) {
  ------------------
  |  Branch (458:13): [True: 0, False: 8.66k]
  ------------------
  459|      0|            throw std::logic_error("Attempted unsupported operation in inspection mode");
  460|      0|        }
  461|  8.66k|    }
_ZN4QPDF3Doc10EncryptionC2EiiiiRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_SA_SA_SA_SA_b:
  496|  1.00k|        V(V),
  497|  1.00k|        R(R),
  498|  1.00k|        Length_bytes(Length_bytes),
  499|  1.00k|        P(static_cast<unsigned long long>(P)),
  500|  1.00k|        O(O),
  501|  1.00k|        U(U),
  502|  1.00k|        OE(OE),
  503|  1.00k|        UE(UE),
  504|  1.00k|        Perms(Perms),
  505|  1.00k|        id1(id1),
  506|  1.00k|        encrypt_metadata(encrypt_metadata)
  507|  1.00k|    {
  508|  1.00k|    }
_ZN4QPDF3Doc7Objects7Streams14pipeStreamDataEPS_10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
 1011|  31.4k|        {
 1012|  31.4k|            return qpdf->pipeStreamData(
 1013|  31.4k|                og,
 1014|  31.4k|                offset,
 1015|  31.4k|                length,
 1016|  31.4k|                dict,
 1017|  31.4k|                is_root_metadata,
 1018|  31.4k|                pipeline,
 1019|  31.4k|                suppress_warnings,
 1020|  31.4k|                will_retry);
 1021|  31.4k|        }
_ZN4QPDF3Doc7Objects7Streams6copierEv:
 1025|  2.27k|        {
 1026|  2.27k|            return copier_;
 1027|  2.27k|        }
_ZN4QPDF3Doc7Objects7streamsEv:
 1058|  1.14k|    {
 1059|  1.14k|        return streams_;
 1060|  1.14k|    }
_ZN4QPDF3Doc5Pages3allEv:
 1193|  78.4k|    {
 1194|  78.4k|        return !all_pages.empty() ? all_pages : cache();
  ------------------
  |  Branch (1194:16): [True: 61.7k, False: 16.6k]
  ------------------
 1195|  78.4k|    }
_ZN4QPDF3Doc5Pages5emptyEv:
 1199|  26.6k|    {
 1200|  26.6k|        return all().empty();
 1201|  26.6k|    }
_ZN4QPDF3Doc5Pages5beginEv:
 1211|  21.5k|    {
 1212|  21.5k|        return all().cbegin();
 1213|  21.5k|    }
_ZN4QPDF3Doc5Pages3endEv:
 1217|  21.5k|    {
 1218|  21.5k|        return all().cend();
 1219|  21.5k|    }
_ZN4QPDF3Doc7objectsEv:
 1355|  1.14k|{
 1356|  1.14k|    return m->objects;
 1357|  1.14k|};
_ZN4QPDF3Doc5pagesEv:
 1361|  21.7k|{
 1362|  21.7k|    return m->pages;
 1363|  21.7k|}
_ZNK4QPDF3Doc18reconstructed_xrefEv:
 1367|  21.6M|{
 1368|  21.6M|    return m->reconstructed_xref;
 1369|  21.6M|}
_ZN4QPDF3Doc6Common3toOImEExRKT_:
  319|  2.01M|        {
  320|  2.01M|            return QIntC::to_offset(i);
  321|  2.01M|        }
_ZN4QPDF3Doc6Common3toIIlEEiRKT_:
  331|  7.20k|        {
  332|  7.20k|            return QIntC::to_int(i);
  333|  7.20k|        }
_ZN4QPDF3Doc6Common3toIIxEEiRKT_:
  331|  2.82M|        {
  332|  2.82M|            return QIntC::to_int(i);
  333|  2.82M|        }
_ZN4QPDF3Doc6Common3toSIiEEmRKT_:
  325|  9.86k|        {
  326|  9.86k|            return QIntC::to_size(i);
  327|  9.86k|        }
_ZN4QPDF3Doc6Common3toSIyEEmRKT_:
  325|  13.6k|        {
  326|  13.6k|            return QIntC::to_size(i);
  327|  13.6k|        }
_ZN4QPDF3Doc6Common3toSIxEEmRKT_:
  325|  20.1k|        {
  326|  20.1k|            return QIntC::to_size(i);
  327|  20.1k|        }
_ZN4QPDF8ObjCacheC2Ev:
  170|  94.2k|    ObjCache() = default;
_ZN4QPDF3Doc6Common3toIImEEiRKT_:
  331|  53.9k|        {
  332|  53.9k|            return QIntC::to_int(i);
  333|  53.9k|        }

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

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

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

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

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

_ZN4qpdf4util17internal_error_ifIRA28_KcEEvbOT_:
   36|  10.3M|    {
   37|  10.3M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 10.3M]
  ------------------
   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|  10.3M|    }
_ZN4qpdf4util9assertionIRA44_KcEEvbOT_:
   27|   126k|    {
   28|   126k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 126k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   126k|    }
_ZN4qpdf4util15hex_decode_charEc:
   99|   153M|    {
  100|   153M|        return digit <= '9' && digit >= '0'
  ------------------
  |  Branch (100:16): [True: 145M, False: 8.87M]
  |  Branch (100:32): [True: 139M, False: 5.10M]
  ------------------
  101|   153M|            ? char(digit - '0')
  102|   153M|            : (digit >= 'a' ? char(digit - 'a' + 10)
  ------------------
  |  Branch (102:16): [True: 8.62M, False: 5.35M]
  ------------------
  103|  13.9M|                            : (digit >= 'A' ? char(digit - 'A' + 10) : '\20'));
  ------------------
  |  Branch (103:32): [True: 85.5k, False: 5.27M]
  ------------------
  104|   153M|    }
_ZN4qpdf4util8is_spaceEc:
  114|  66.5M|    {
  115|  66.5M|        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v';
  ------------------
  |  Branch (115:16): [True: 7.94M, False: 58.5M]
  |  Branch (115:29): [True: 1.06M, False: 57.5M]
  |  Branch (115:43): [True: 192k, False: 57.3M]
  |  Branch (115:57): [True: 442k, False: 56.8M]
  |  Branch (115:71): [True: 103k, False: 56.7M]
  |  Branch (115:85): [True: 47.4k, False: 56.7M]
  ------------------
  116|  66.5M|    }
_ZN4qpdf4util8is_digitEc:
  120|  11.4M|    {
  121|  11.4M|        return (ch >= '0' && ch <= '9');
  ------------------
  |  Branch (121:17): [True: 6.71M, False: 4.75M]
  |  Branch (121:30): [True: 6.45M, False: 265k]
  ------------------
  122|  11.4M|    }
_ZN4qpdf4util15hex_encode_charEc:
  127|  74.4M|    {
  128|  74.4M|        static auto constexpr hexchars = "0123456789abcdef";
  129|  74.4M|        return {'#', hexchars[static_cast<unsigned char>(c) >> 4], hexchars[c & 0x0f]};
  130|  74.4M|    }
_ZN4qpdf4util8is_utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  149|   579k|    {
  150|   579k|        return str.starts_with("\xfe\xff") || str.starts_with("\xff\xfe");
  ------------------
  |  Branch (150:16): [True: 81.5k, False: 498k]
  |  Branch (150:47): [True: 2.93k, False: 495k]
  ------------------
  151|   579k|    }
_ZN4qpdf4util16is_explicit_utf8ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  155|   495k|    {
  156|       |        // QPDF_String.cc knows that this is a 3-byte sequence.
  157|   495k|        return str.starts_with("\xef\xbb\xbf");
  158|   495k|    }
_ZN4qpdf4util9assertionIRA83_KcEEvbOT_:
   27|  88.3k|    {
   28|  88.3k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 88.3k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  88.3k|    }
_ZN4qpdf4util9assertionINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   27|   201k|    {
   28|   201k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 201k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   201k|    }
_ZN4qpdf4util9assertionIRA54_KcEEvbOT_:
   27|   104k|    {
   28|   104k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 104k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   104k|    }
_ZN4qpdf4util9assertionIRA57_KcEEvbOT_:
   27|  3.08k|    {
   28|  3.08k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.08k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.08k|    }
_ZN4qpdf4util9assertionIRA51_KcEEvbOT_:
   27|    979|    {
   28|    979|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 979]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    979|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralElQsr3stdE8integralIT_EEEbT0_:
   63|  24.5k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  24.5k|                          std::numeric_limits<T>::min())) {
   67|  24.5k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 24.5k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  24.5k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|  24.5k|                          std::numeric_limits<T>::max())) {
   74|  24.5k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 24.5k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|  24.5k|        }
   78|  24.5k|        return true;
   79|  24.5k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEiQsr3stdE8integralIT_EEEbT0_:
   63|  24.5k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  24.5k|                          std::numeric_limits<T>::min())) {
   67|  24.5k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 24.5k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  24.5k|        }
   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|  24.5k|        return true;
   79|  24.5k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEyQsr3stdE8integralIT_EEEbT0_:
   63|   104k|    {
   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|   104k|                          std::numeric_limits<T>::max())) {
   74|   104k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 104k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|   104k|        }
   78|   104k|        return true;
   79|   104k|    }
_ZN4qpdf4util9assertionIRA45_KcEEvbOT_:
   27|   670k|    {
   28|   670k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 670k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   670k|    }
_ZN4qpdf4util9assertionIRA53_KcEEvbOT_:
   27|  5.46k|    {
   28|  5.46k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 5.46k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  5.46k|    }
_ZN4qpdf4util9assertionIRA35_KcEEvbOT_:
   27|  4.74k|    {
   28|  4.74k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 4.74k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  4.74k|    }
_ZN4qpdf4util17internal_error_ifIRA34_KcEEvbOT_:
   36|  43.7M|    {
   37|  43.7M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 8, False: 43.7M]
  ------------------
   38|      8|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   39|      8|                                       .append(
   40|      8|                                           "\nThis is a qpdf bug. Please report at "
   41|      8|                                           "https://github.com/qpdf/qpdf/issues"));
   42|      8|        }
   43|  43.7M|    }
_ZN4qpdf4util9assertionIRA68_KcEEvbOT_:
   27|  6.12k|    {
   28|  6.12k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 6.12k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  6.12k|    }
_ZN4qpdf4util9assertionIRA65_KcEEvbOT_:
   27|  2.41k|    {
   28|  2.41k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.41k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.41k|    }
_ZN4qpdf4util9assertionIRA49_KcEEvbOT_:
   27|  4.90k|    {
   28|  4.90k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 4.90k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  4.90k|    }
_ZN4qpdf4util9assertionIRA43_KcEEvbOT_:
   27|  7.05k|    {
   28|  7.05k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 7.05k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  7.05k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA51_KcEEvbOT_:
   48|  1.43M|    {
   49|  1.43M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 21, False: 1.43M]
  ------------------
   50|     21|            throw std::runtime_error(std::forward<T>(msg));
   51|     21|        }
   52|  1.43M|    }
_ZN4qpdf4util9assertionIRA50_KcEEvbOT_:
   27|   288k|    {
   28|   288k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 288k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   288k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA23_KcEEvbOT_:
   48|   589k|    {
   49|   589k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 7, False: 589k]
  ------------------
   50|      7|            throw std::runtime_error(std::forward<T>(msg));
   51|      7|        }
   52|   589k|    }
_ZN4qpdf4util9assertionIRA52_KcEEvbOT_:
   27|  40.8M|    {
   28|  40.8M|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 40.8M]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  40.8M|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA44_KcEEvbOT_:
   48|  5.12k|    {
   49|  5.12k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 44, False: 5.08k]
  ------------------
   50|     44|            throw std::runtime_error(std::forward<T>(msg));
   51|     44|        }
   52|  5.12k|    }
_ZN4qpdf4util9assertionIRA58_KcEEvbOT_:
   27|  1.30k|    {
   28|  1.30k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 1.30k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  1.30k|    }
_ZN4qpdf4util9assertionIRA48_KcEEvbOT_:
   27|  23.2k|    {
   28|  23.2k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 23.2k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  23.2k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA73_KcEEvbOT_:
   48|  1.41k|    {
   49|  1.41k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.41k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.41k|    }
_ZN4qpdf4util9assertionIRA46_KcEEvbOT_:
   27|  5.21k|    {
   28|  5.21k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 5.21k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  5.21k|    }
_ZN4qpdf4util17no_ci_rt_error_ifINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   48|  8.95k|    {
   49|  8.95k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 8.95k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  8.95k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA69_KcEEvbOT_:
   48|  20.7k|    {
   49|  20.7k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 14, False: 20.7k]
  ------------------
   50|     14|            throw std::runtime_error(std::forward<T>(msg));
   51|     14|        }
   52|  20.7k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA59_KcEEvbOT_:
   48|  66.8k|    {
   49|  66.8k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 66.8k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  66.8k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA42_KcEEvbOT_:
   48|  4.49k|    {
   49|  4.49k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 4.49k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  4.49k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA49_KcEEvbOT_:
   48|  3.00k|    {
   49|  3.00k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 6, False: 2.99k]
  ------------------
   50|      6|            throw std::runtime_error(std::forward<T>(msg));
   51|      6|        }
   52|  3.00k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA88_KcEEvbOT_:
   48|  1.92k|    {
   49|  1.92k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.92k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.92k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEjQsr3stdE8integralIT_EEEbT0_:
   63|  1.92k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|       |                          std::numeric_limits<T>::min())) {
   67|       |            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
   68|       |                return false;
   69|       |            }
   70|       |        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|       |                          std::numeric_limits<T>::max())) {
   74|       |            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
   75|       |                return false;
   76|       |            }
   77|       |        }
   78|  1.92k|        return true;
   79|  1.92k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA58_KcEEvbOT_:
   48|  1.92k|    {
   49|  1.92k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.92k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.92k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA45_KcEEvbOT_:
   48|  1.92k|    {
   49|  1.92k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.92k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.92k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA32_KcEEvbOT_:
   48|  1.92k|    {
   49|  1.92k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 10, False: 1.91k]
  ------------------
   50|     10|            throw std::runtime_error(std::forward<T>(msg));
   51|     10|        }
   52|  1.92k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA35_KcEEvbOT_:
   48|  5.09k|    {
   49|  5.09k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 23, False: 5.07k]
  ------------------
   50|     23|            throw std::runtime_error(std::forward<T>(msg));
   51|     23|        }
   52|  5.09k|    }
_ZN4qpdf4util9assertionIRA47_KcEEvbOT_:
   27|   141k|    {
   28|   141k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 141k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   141k|    }
_ZN4qpdf4util9assertionIRA56_KcEEvbOT_:
   27|  1.06k|    {
   28|  1.06k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 1.06k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  1.06k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA53_KcEEvbOT_:
   48|  1.06k|    {
   49|  1.06k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 6, False: 1.05k]
  ------------------
   50|      6|            throw std::runtime_error(std::forward<T>(msg));
   51|      6|        }
   52|  1.06k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA92_KcEEvbOT_:
   48|  1.05k|    {
   49|  1.05k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.05k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.05k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA36_KcEEvbOT_:
   48|  1.05k|    {
   49|  1.05k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 10, False: 1.04k]
  ------------------
   50|     10|            throw std::runtime_error(std::forward<T>(msg));
   51|     10|        }
   52|  1.05k|    }

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

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

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

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

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

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

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

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

inflate_fast:
   50|  43.2k|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
   51|  43.2k|    struct inflate_state FAR *state;
   52|  43.2k|    z_const unsigned char FAR *in;      /* local strm->next_in */
   53|  43.2k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
   54|  43.2k|    unsigned char FAR *out;     /* local strm->next_out */
   55|  43.2k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
   56|  43.2k|    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|  43.2k|    unsigned wsize;             /* window size or zero if not using window */
   61|  43.2k|    unsigned whave;             /* valid bytes in the window */
   62|  43.2k|    unsigned wnext;             /* window write index */
   63|  43.2k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
   64|  43.2k|    unsigned long hold;         /* local strm->hold */
   65|  43.2k|    unsigned bits;              /* local strm->bits */
   66|  43.2k|    code const FAR *lcode;      /* local strm->lencode */
   67|  43.2k|    code const FAR *dcode;      /* local strm->distcode */
   68|  43.2k|    unsigned lmask;             /* mask for first level of length codes */
   69|  43.2k|    unsigned dmask;             /* mask for first level of distance codes */
   70|  43.2k|    code const *here;           /* retrieved table entry */
   71|  43.2k|    unsigned op;                /* code bits, operation, extra bits, or */
   72|       |                                /*  window position, window bytes to copy */
   73|  43.2k|    unsigned len;               /* match length, unused bytes */
   74|  43.2k|    unsigned dist;              /* match distance */
   75|  43.2k|    unsigned char FAR *from;    /* where to copy match from */
   76|       |
   77|       |    /* copy state to local variables */
   78|  43.2k|    state = (struct inflate_state FAR *)strm->state;
   79|  43.2k|    in = strm->next_in;
   80|  43.2k|    last = in + (strm->avail_in - 5);
   81|  43.2k|    out = strm->next_out;
   82|  43.2k|    beg = out - (start - strm->avail_out);
   83|  43.2k|    end = out + (strm->avail_out - 257);
   84|       |#ifdef INFLATE_STRICT
   85|       |    dmax = state->dmax;
   86|       |#endif
   87|  43.2k|    wsize = state->wsize;
   88|  43.2k|    whave = state->whave;
   89|  43.2k|    wnext = state->wnext;
   90|  43.2k|    window = state->window;
   91|  43.2k|    hold = state->hold;
   92|  43.2k|    bits = state->bits;
   93|  43.2k|    lcode = state->lencode;
   94|  43.2k|    dcode = state->distcode;
   95|  43.2k|    lmask = (1U << state->lenbits) - 1;
   96|  43.2k|    dmask = (1U << state->distbits) - 1;
   97|       |
   98|       |    /* decode literals and length/distances until end-of-block or not enough
   99|       |       input data or output space */
  100|  3.29M|    do {
  101|  3.29M|        if (bits < 15) {
  ------------------
  |  Branch (101:13): [True: 1.45M, False: 1.84M]
  ------------------
  102|  1.45M|            hold += (unsigned long)(*in++) << bits;
  103|  1.45M|            bits += 8;
  104|  1.45M|            hold += (unsigned long)(*in++) << bits;
  105|  1.45M|            bits += 8;
  106|  1.45M|        }
  107|  3.29M|        here = lcode + (hold & lmask);
  108|  3.37M|      dolen:
  109|  3.37M|        op = (unsigned)(here->bits);
  110|  3.37M|        hold >>= op;
  111|  3.37M|        bits -= op;
  112|  3.37M|        op = (unsigned)(here->op);
  113|  3.37M|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (113:13): [True: 1.69M, False: 1.67M]
  ------------------
  114|  1.69M|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  115|  1.69M|                    "inflate:         literal '%c'\n" :
  116|  1.69M|                    "inflate:         literal 0x%02x\n", here->val));
  117|  1.69M|            *out++ = (unsigned char)(here->val);
  118|  1.69M|        }
  119|  1.67M|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (119:18): [True: 1.59M, False: 87.2k]
  ------------------
  120|  1.59M|            len = (unsigned)(here->val);
  121|  1.59M|            op &= 15;                           /* number of extra bits */
  122|  1.59M|            if (op) {
  ------------------
  |  Branch (122:17): [True: 261k, False: 1.33M]
  ------------------
  123|   261k|                if (bits < op) {
  ------------------
  |  Branch (123:21): [True: 3.78k, False: 257k]
  ------------------
  124|  3.78k|                    hold += (unsigned long)(*in++) << bits;
  125|  3.78k|                    bits += 8;
  126|  3.78k|                }
  127|   261k|                len += (unsigned)hold & ((1U << op) - 1);
  128|   261k|                hold >>= op;
  129|   261k|                bits -= op;
  130|   261k|            }
  131|  1.59M|            Tracevv((stderr, "inflate:         length %u\n", len));
  132|  1.59M|            if (bits < 15) {
  ------------------
  |  Branch (132:17): [True: 382k, False: 1.20M]
  ------------------
  133|   382k|                hold += (unsigned long)(*in++) << bits;
  134|   382k|                bits += 8;
  135|   382k|                hold += (unsigned long)(*in++) << bits;
  136|   382k|                bits += 8;
  137|   382k|            }
  138|  1.59M|            here = dcode + (hold & dmask);
  139|  1.64M|          dodist:
  140|  1.64M|            op = (unsigned)(here->bits);
  141|  1.64M|            hold >>= op;
  142|  1.64M|            bits -= op;
  143|  1.64M|            op = (unsigned)(here->op);
  144|  1.64M|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (144:17): [True: 1.59M, False: 54.2k]
  ------------------
  145|  1.59M|                dist = (unsigned)(here->val);
  146|  1.59M|                op &= 15;                       /* number of extra bits */
  147|  1.59M|                if (bits < op) {
  ------------------
  |  Branch (147:21): [True: 1.78k, False: 1.58M]
  ------------------
  148|  1.78k|                    hold += (unsigned long)(*in++) << bits;
  149|  1.78k|                    bits += 8;
  150|  1.78k|                    if (bits < op) {
  ------------------
  |  Branch (150:25): [True: 0, False: 1.78k]
  ------------------
  151|      0|                        hold += (unsigned long)(*in++) << bits;
  152|      0|                        bits += 8;
  153|      0|                    }
  154|  1.78k|                }
  155|  1.59M|                dist += (unsigned)hold & ((1U << op) - 1);
  156|       |#ifdef INFLATE_STRICT
  157|       |                if (dist > dmax) {
  158|       |                    strm->msg = (z_const char *)
  159|       |                        "invalid distance too far back";
  160|       |                    state->mode = BAD;
  161|       |                    break;
  162|       |                }
  163|       |#endif
  164|  1.59M|                hold >>= op;
  165|  1.59M|                bits -= op;
  166|  1.59M|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  167|  1.59M|                op = (unsigned)(out - beg);     /* max distance in output */
  168|  1.59M|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (168:21): [True: 50.0k, False: 1.54M]
  ------------------
  169|  50.0k|                    op = dist - op;             /* distance back in window */
  170|  50.0k|                    if (op > whave) {
  ------------------
  |  Branch (170:25): [True: 151, False: 49.8k]
  ------------------
  171|    151|                        if (state->sane) {
  ------------------
  |  Branch (171:29): [True: 151, False: 0]
  ------------------
  172|    151|                            strm->msg = (z_const char *)
  173|    151|                                "invalid distance too far back";
  174|    151|                            state->mode = BAD;
  175|    151|                            break;
  176|    151|                        }
  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|    151|                    }
  197|  49.8k|                    from = window;
  198|  49.8k|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (198:25): [True: 3.35k, False: 46.5k]
  ------------------
  199|  3.35k|                        from += wsize - op;
  200|  3.35k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (200:29): [True: 1.03k, False: 2.31k]
  ------------------
  201|  1.03k|                            len -= op;
  202|   112k|                            do {
  203|   112k|                                *out++ = *from++;
  204|   112k|                            } while (--op);
  ------------------
  |  Branch (204:38): [True: 111k, False: 1.03k]
  ------------------
  205|  1.03k|                            from = out - dist;  /* rest from output */
  206|  1.03k|                        }
  207|  3.35k|                    }
  208|  46.5k|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (208:30): [True: 713, False: 45.8k]
  ------------------
  209|    713|                        from += wsize + wnext - op;
  210|    713|                        op -= wnext;
  211|    713|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (211:29): [True: 143, False: 570]
  ------------------
  212|    143|                            len -= op;
  213|  6.48k|                            do {
  214|  6.48k|                                *out++ = *from++;
  215|  6.48k|                            } while (--op);
  ------------------
  |  Branch (215:38): [True: 6.34k, False: 143]
  ------------------
  216|    143|                            from = window;
  217|    143|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (217:33): [True: 52, False: 91]
  ------------------
  218|     52|                                op = wnext;
  219|     52|                                len -= op;
  220|    762|                                do {
  221|    762|                                    *out++ = *from++;
  222|    762|                                } while (--op);
  ------------------
  |  Branch (222:42): [True: 710, False: 52]
  ------------------
  223|     52|                                from = out - dist;      /* rest from output */
  224|     52|                            }
  225|    143|                        }
  226|    713|                    }
  227|  45.8k|                    else {                      /* contiguous in window */
  228|  45.8k|                        from += wnext - op;
  229|  45.8k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (229:29): [True: 12.3k, False: 33.4k]
  ------------------
  230|  12.3k|                            len -= op;
  231|   589k|                            do {
  232|   589k|                                *out++ = *from++;
  233|   589k|                            } while (--op);
  ------------------
  |  Branch (233:38): [True: 577k, False: 12.3k]
  ------------------
  234|  12.3k|                            from = out - dist;  /* rest from output */
  235|  12.3k|                        }
  236|  45.8k|                    }
  237|   932k|                    while (len > 2) {
  ------------------
  |  Branch (237:28): [True: 882k, False: 49.8k]
  ------------------
  238|   882k|                        *out++ = *from++;
  239|   882k|                        *out++ = *from++;
  240|   882k|                        *out++ = *from++;
  241|   882k|                        len -= 3;
  242|   882k|                    }
  243|  49.8k|                    if (len) {
  ------------------
  |  Branch (243:25): [True: 19.5k, False: 30.3k]
  ------------------
  244|  19.5k|                        *out++ = *from++;
  245|  19.5k|                        if (len > 1)
  ------------------
  |  Branch (245:29): [True: 13.6k, False: 5.81k]
  ------------------
  246|  13.6k|                            *out++ = *from++;
  247|  19.5k|                    }
  248|  49.8k|                }
  249|  1.54M|                else {
  250|  1.54M|                    from = out - dist;          /* copy direct from output */
  251|  61.0M|                    do {                        /* minimum length is three */
  252|  61.0M|                        *out++ = *from++;
  253|  61.0M|                        *out++ = *from++;
  254|  61.0M|                        *out++ = *from++;
  255|  61.0M|                        len -= 3;
  256|  61.0M|                    } while (len > 2);
  ------------------
  |  Branch (256:30): [True: 59.5M, False: 1.54M]
  ------------------
  257|  1.54M|                    if (len) {
  ------------------
  |  Branch (257:25): [True: 566k, False: 974k]
  ------------------
  258|   566k|                        *out++ = *from++;
  259|   566k|                        if (len > 1)
  ------------------
  |  Branch (259:29): [True: 288k, False: 277k]
  ------------------
  260|   288k|                            *out++ = *from++;
  261|   566k|                    }
  262|  1.54M|                }
  263|  1.59M|            }
  264|  54.2k|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (264:22): [True: 54.2k, False: 17]
  ------------------
  265|  54.2k|                here = dcode + here->val + (hold & ((1U << op) - 1));
  266|  54.2k|                goto dodist;
  267|  54.2k|            }
  268|     17|            else {
  269|     17|                strm->msg = (z_const char *)"invalid distance code";
  270|     17|                state->mode = BAD;
  271|     17|                break;
  272|     17|            }
  273|  1.64M|        }
  274|  87.2k|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (274:18): [True: 83.6k, False: 3.60k]
  ------------------
  275|  83.6k|            here = lcode + here->val + (hold & ((1U << op) - 1));
  276|  83.6k|            goto dolen;
  277|  83.6k|        }
  278|  3.60k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (278:18): [True: 3.58k, False: 16]
  ------------------
  279|  3.58k|            Tracevv((stderr, "inflate:         end of block\n"));
  280|  3.58k|            state->mode = TYPE;
  281|  3.58k|            break;
  282|  3.58k|        }
  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|  3.37M|    } while (in < last && out < end);
  ------------------
  |  Branch (288:14): [True: 3.25M, False: 37.6k]
  |  Branch (288:27): [True: 3.25M, False: 1.79k]
  ------------------
  289|       |
  290|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  291|  43.2k|    len = bits >> 3;
  292|  43.2k|    in -= len;
  293|  43.2k|    bits -= len << 3;
  294|  43.2k|    hold &= (1U << bits) - 1;
  295|       |
  296|       |    /* update state and return */
  297|  43.2k|    strm->next_in = in;
  298|  43.2k|    strm->next_out = out;
  299|  43.2k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (299:33): [True: 21.0k, False: 22.1k]
  ------------------
  300|  43.2k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (300:34): [True: 41.4k, False: 1.80k]
  ------------------
  301|  41.4k|                                 257 + (end - out) : 257 - (out - end));
  302|  43.2k|    state->hold = hold;
  303|  43.2k|    state->bits = bits;
  304|  43.2k|    return;
  305|  43.2k|}

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

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

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

