jpeg_destroy:
   90|    121|{
   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|    121|  if (cinfo->mem != NULL)
  ------------------
  |  Branch (210:7): [True: 121, False: 0]
  ------------------
  211|    121|    (*cinfo->mem->self_destruct) (cinfo);
  212|       |  cinfo->mem = NULL;            /* be safe if jpeg_destroy is called twice */
  213|    121|  cinfo->global_state = 0;      /* mark it destroyed */
  214|    121|}
jpeg_alloc_quant_table:
  224|     39|{
  225|     39|  JQUANT_TBL *tbl;
  226|       |
  227|     39|  tbl = (JQUANT_TBL *)
  228|     39|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JQUANT_TBL));
  ------------------
  |  |  888|     39|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  229|     39|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  207|     39|#define FALSE   0               /* values of boolean */
  ------------------
  230|     39|  return tbl;
  231|     39|}

jpeg_CreateDecompress:
   40|    121|{
   41|    121|  int i;
   42|       |
   43|       |  /* Guard against version mismatches between library and caller. */
   44|    121|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   45|    121|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|    121|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (45:7): [True: 0, False: 121]
  ------------------
   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|    121|  if (structsize != sizeof(struct jpeg_decompress_struct))
  ------------------
  |  Branch (47:7): [True: 0, False: 121]
  ------------------
   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|    121|             (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|    121|  {
   58|    121|    struct jpeg_error_mgr *err = cinfo->err;
   59|    121|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   60|    121|    memset(cinfo, 0, sizeof(struct jpeg_decompress_struct));
   61|    121|    cinfo->err = err;
   62|    121|    cinfo->client_data = client_data;
   63|    121|  }
   64|    121|  cinfo->is_decompressor = TRUE;
  ------------------
  |  |  210|    121|#define TRUE    1
  ------------------
   65|       |
   66|       |  /* Initialize a memory manager instance for this object */
   67|    121|  jinit_memory_mgr((j_common_ptr)cinfo);
   68|       |
   69|       |  /* Zero out pointers to permanent structures. */
   70|    121|  cinfo->progress = NULL;
   71|    121|  cinfo->src = NULL;
   72|       |
   73|    605|  for (i = 0; i < NUM_QUANT_TBLS; i++)
  ------------------
  |  |   68|    605|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (73:15): [True: 484, False: 121]
  ------------------
   74|    484|    cinfo->quant_tbl_ptrs[i] = NULL;
   75|       |
   76|    605|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|    605|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (76:15): [True: 484, False: 121]
  ------------------
   77|    484|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   78|    484|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   79|    484|  }
   80|       |
   81|       |  /* Initialize marker processor so application can override methods
   82|       |   * for COM, APPn markers before calling jpeg_read_header.
   83|       |   */
   84|    121|  cinfo->marker_list = NULL;
   85|    121|  jinit_marker_reader(cinfo);
   86|       |
   87|       |  /* And initialize the overall input controller. */
   88|    121|  jinit_input_controller(cinfo);
   89|       |
   90|    121|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  |   34|    121|#define BITS_IN_JSAMPLE  8
  ------------------
   91|       |
   92|       |  /* OK, I'm ready */
   93|    121|  cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|    121|#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|    121|  cinfo->master = (struct jpeg_decomp_master *)
   99|    121|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    121|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  100|    121|                                sizeof(my_decomp_master));
  101|    121|  memset(cinfo->master, 0, sizeof(my_decomp_master));
  102|    121|#ifdef WITH_SIMD
  103|    121|  cinfo->master->simd_support = JSIMD_UNDEFINED;
  ------------------
  |  |   49|    121|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|    121|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  104|    121|  cinfo->master->simd_huffman = 1;
  105|    121|#endif
  106|    121|}
jpeg_destroy_decompress:
  115|    121|{
  116|    121|  jpeg_destroy((j_common_ptr)cinfo); /* use common routine */
  117|    121|}
jpeg_read_header:
  275|    121|{
  276|    121|  int retcode;
  277|       |
  278|    121|  if (cinfo->global_state != DSTATE_START &&
  ------------------
  |  |   48|    242|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (278:7): [True: 0, False: 121]
  ------------------
  279|      0|      cinfo->global_state != DSTATE_INHEADER)
  ------------------
  |  |   49|      0|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (279:7): [True: 0, False: 0]
  ------------------
  280|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  281|       |
  282|    121|  retcode = jpeg_consume_input(cinfo);
  283|       |
  284|    121|  switch (retcode) {
  ------------------
  |  Branch (284:11): [True: 1, False: 120]
  ------------------
  285|      0|  case JPEG_REACHED_SOS:
  ------------------
  |  | 1111|      0|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (285:3): [True: 0, False: 121]
  ------------------
  286|      0|    retcode = JPEG_HEADER_OK;
  ------------------
  |  | 1066|      0|#define JPEG_HEADER_OK           1 /* Found valid image datastream */
  ------------------
  287|      0|    break;
  288|      1|  case JPEG_REACHED_EOI:
  ------------------
  |  | 1112|      1|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (288:3): [True: 1, False: 120]
  ------------------
  289|      1|    if (require_image)          /* Complain if application wanted an image */
  ------------------
  |  Branch (289:9): [True: 1, False: 0]
  ------------------
  290|      1|      ERREXIT(cinfo, JERR_NO_IMAGE);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  291|       |    /* Reset to start state; it would be safer to require the application to
  292|       |     * call jpeg_abort, but we can't change it now for compatibility reasons.
  293|       |     * A side effect is to free any temporary memory (there shouldn't be any).
  294|       |     */
  295|      1|    jpeg_abort((j_common_ptr)cinfo); /* sets state = DSTATE_START */
  296|      1|    retcode = JPEG_HEADER_TABLES_ONLY;
  ------------------
  |  | 1067|      1|#define JPEG_HEADER_TABLES_ONLY  2 /* Found valid table-specs-only datastream */
  ------------------
  297|      1|    break;
  298|      0|  case JPEG_SUSPENDED:
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (298:3): [True: 0, False: 121]
  ------------------
  299|       |    /* no work */
  300|      0|    break;
  301|    121|  }
  302|       |
  303|      0|  return retcode;
  304|    121|}
jpeg_consume_input:
  321|    121|{
  322|    121|  int retcode = JPEG_SUSPENDED;
  ------------------
  |  | 1065|    121|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  323|       |
  324|       |  /* NB: every possible DSTATE value should be listed in this switch */
  325|    121|  switch (cinfo->global_state) {
  326|    121|  case DSTATE_START:
  ------------------
  |  |   48|    121|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (326:3): [True: 121, False: 0]
  ------------------
  327|       |    /* Start-of-datastream actions: reset appropriate modules */
  328|    121|    (*cinfo->inputctl->reset_input_controller) (cinfo);
  329|       |    /* Initialize application's data source module */
  330|    121|    (*cinfo->src->init_source) (cinfo);
  331|    121|    cinfo->global_state = DSTATE_INHEADER;
  ------------------
  |  |   49|    121|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  332|    121|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|    121|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  333|    121|  case DSTATE_INHEADER:
  ------------------
  |  |   49|    121|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (333:3): [True: 0, False: 121]
  ------------------
  334|    121|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  335|    121|    if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
  ------------------
  |  | 1111|    121|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (335:9): [True: 0, False: 121]
  ------------------
  336|       |      /* Set up default parameters based on header data */
  337|      0|      default_decompress_parms(cinfo);
  338|       |      /* Set global state: ready for start_decompress */
  339|      0|      cinfo->global_state = DSTATE_READY;
  ------------------
  |  |   50|      0|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  340|      0|    }
  341|    121|    break;
  342|      0|  case DSTATE_READY:
  ------------------
  |  |   50|      0|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (342:3): [True: 0, False: 121]
  ------------------
  343|       |    /* Can't advance past first SOS until start_decompress is called */
  344|      0|    retcode = JPEG_REACHED_SOS;
  ------------------
  |  | 1111|      0|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  345|      0|    break;
  346|      0|  case DSTATE_PRELOAD:
  ------------------
  |  |   51|      0|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (346:3): [True: 0, False: 121]
  ------------------
  347|      0|  case DSTATE_PRESCAN:
  ------------------
  |  |   52|      0|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (347:3): [True: 0, False: 121]
  ------------------
  348|      0|  case DSTATE_SCANNING:
  ------------------
  |  |   53|      0|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (348:3): [True: 0, False: 121]
  ------------------
  349|      0|  case DSTATE_RAW_OK:
  ------------------
  |  |   54|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (349:3): [True: 0, False: 121]
  ------------------
  350|      0|  case DSTATE_BUFIMAGE:
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (350:3): [True: 0, False: 121]
  ------------------
  351|      0|  case DSTATE_BUFPOST:
  ------------------
  |  |   56|      0|#define DSTATE_BUFPOST   208    /* looking for SOS/EOI in jpeg_finish_output */
  ------------------
  |  Branch (351:3): [True: 0, False: 121]
  ------------------
  352|      0|  case DSTATE_STOPPING:
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (352:3): [True: 0, False: 121]
  ------------------
  353|      0|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  354|      0|    break;
  355|      0|  default:
  ------------------
  |  Branch (355:3): [True: 0, False: 121]
  ------------------
  356|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  357|    121|  }
  358|      1|  return retcode;
  359|    121|}

jinit_input_controller:
  405|    121|{
  406|    121|  my_inputctl_ptr inputctl;
  407|       |
  408|       |  /* Create subobject in permanent pool */
  409|    121|  inputctl = (my_inputctl_ptr)
  410|    121|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    121|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  411|    121|                                sizeof(my_input_controller));
  412|    121|  cinfo->inputctl = (struct jpeg_input_controller *)inputctl;
  413|       |  /* Initialize method pointers */
  414|    121|  inputctl->pub.consume_input = consume_markers;
  415|    121|  inputctl->pub.reset_input_controller = reset_input_controller;
  416|    121|  inputctl->pub.start_input_pass = start_input_pass;
  417|    121|  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|    121|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  207|    121|#define FALSE   0               /* values of boolean */
  ------------------
  422|    121|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  207|    121|#define FALSE   0               /* values of boolean */
  ------------------
  423|    121|  inputctl->inheaders = TRUE;
  ------------------
  |  |  210|    121|#define TRUE    1
  ------------------
  424|    121|}
jdinput.c:consume_markers:
  332|    121|{
  333|    121|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  334|    121|  int val;
  335|       |
  336|    121|  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
  ------------------
  |  Branch (336:7): [True: 0, False: 121]
  ------------------
  337|      0|    return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|      0|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  338|       |
  339|    121|  val = (*cinfo->marker->read_markers) (cinfo);
  340|       |
  341|    121|  switch (val) {
  ------------------
  |  Branch (341:11): [True: 1, False: 120]
  ------------------
  342|      0|  case JPEG_REACHED_SOS:        /* Found SOS */
  ------------------
  |  | 1111|      0|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (342:3): [True: 0, False: 121]
  ------------------
  343|      0|    if (inputctl->inheaders) {  /* 1st SOS */
  ------------------
  |  Branch (343:9): [True: 0, False: 0]
  ------------------
  344|      0|      initial_setup(cinfo);
  345|      0|      inputctl->inheaders = FALSE;
  ------------------
  |  |  207|      0|#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|      0|    } else {                    /* 2nd or later SOS marker */
  351|      0|      if (!inputctl->pub.has_multiple_scans)
  ------------------
  |  Branch (351:11): [True: 0, False: 0]
  ------------------
  352|      0|        ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  353|      0|      start_input_pass(cinfo);
  354|      0|    }
  355|      0|    break;
  356|      1|  case JPEG_REACHED_EOI:        /* Found EOI */
  ------------------
  |  | 1112|      1|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (356:3): [True: 1, False: 120]
  ------------------
  357|      1|    inputctl->pub.eoi_reached = TRUE;
  ------------------
  |  |  210|      1|#define TRUE    1
  ------------------
  358|      1|    if (inputctl->inheaders) {  /* Tables-only datastream, apparently */
  ------------------
  |  Branch (358:9): [True: 1, False: 0]
  ------------------
  359|      1|      if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (359:11): [True: 0, False: 1]
  ------------------
  360|      0|        ERREXIT(cinfo, JERR_SOF_NO_SOS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  361|      1|    } 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|      0|      if (cinfo->output_scan_number > cinfo->input_scan_number)
  ------------------
  |  Branch (365:11): [True: 0, False: 0]
  ------------------
  366|      0|        cinfo->output_scan_number = cinfo->input_scan_number;
  367|      0|    }
  368|      1|    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: 121]
  ------------------
  370|      0|    break;
  371|    121|  }
  372|       |
  373|      1|  return val;
  374|    121|}
jdinput.c:reset_input_controller:
  383|    121|{
  384|    121|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  385|       |
  386|    121|  inputctl->pub.consume_input = consume_markers;
  387|    121|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  207|    121|#define FALSE   0               /* values of boolean */
  ------------------
  388|    121|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  207|    121|#define FALSE   0               /* values of boolean */
  ------------------
  389|    121|  inputctl->inheaders = TRUE;
  ------------------
  |  |  210|    121|#define TRUE    1
  ------------------
  390|       |  /* Reset other modules */
  391|    121|  (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
  392|    121|  (*cinfo->marker->reset_marker_reader) (cinfo);
  393|       |  /* Reset progression state -- would be cleaner if entropy decoder did this */
  394|       |  cinfo->coef_bits = NULL;
  395|    121|}

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

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

jmemmgr.c:GETENV_S:
   80|    121|{
   81|    121|  char *env;
   82|       |
   83|    121|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 121]
  ------------------
   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|    121|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 121]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|    121|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 121]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|    121|  env = getenv(name);
   97|    121|  if (!env)
  ------------------
  |  Branch (97:7): [True: 121, False: 0]
  ------------------
   98|    121|  {
   99|    121|    *buffer = 0;
  100|    121|    return 0;
  101|    121|  }
  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|}

jinit_memory_mgr:
 1196|    121|{
 1197|    121|  my_mem_ptr mem;
 1198|    121|  long max_to_use;
 1199|    121|  int pool;
 1200|    121|  size_t test_mac;
 1201|       |
 1202|    121|  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|    121|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|    121|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|    121|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1211:7): [Folded, False: 121]
  ------------------
 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|    121|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|    121|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1219|    121|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|    242|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1219:7): [True: 0, False: 121]
  ------------------
 1220|    121|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|    121|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|    121|#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|    121|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1224|       |
 1225|       |  /* Attempt to allocate memory manager's control block */
 1226|    121|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1227|       |
 1228|    121|  if (mem == NULL) {
  ------------------
  |  Branch (1228:7): [True: 0, False: 121]
  ------------------
 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|    121|  mem->pub.alloc_small = alloc_small;
 1235|    121|  mem->pub.alloc_large = alloc_large;
 1236|    121|  mem->pub.alloc_sarray = alloc_sarray;
 1237|    121|  mem->pub.alloc_barray = alloc_barray;
 1238|    121|  mem->pub.request_virt_sarray = request_virt_sarray;
 1239|    121|  mem->pub.request_virt_barray = request_virt_barray;
 1240|    121|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1241|    121|  mem->pub.access_virt_sarray = access_virt_sarray;
 1242|    121|  mem->pub.access_virt_barray = access_virt_barray;
 1243|    121|  mem->pub.free_pool = free_pool;
 1244|    121|  mem->pub.self_destruct = self_destruct;
 1245|       |
 1246|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1247|    121|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|    121|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1248|       |
 1249|       |  /* Initialize working state */
 1250|    121|  mem->pub.max_memory_to_use = max_to_use;
 1251|       |
 1252|    363|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|    121|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|    363|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1252:35): [True: 242, False: 121]
  ------------------
 1253|    242|    mem->small_list[pool] = NULL;
 1254|    242|    mem->large_list[pool] = NULL;
 1255|    242|  }
 1256|    121|  mem->virt_sarray_list = NULL;
 1257|    121|  mem->virt_barray_list = NULL;
 1258|       |
 1259|    121|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1260|       |
 1261|       |  /* Declare ourselves open for business */
 1262|    121|  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|    121|#ifndef NO_GETENV
 1271|    121|  {
 1272|    121|    char memenv[30] = { 0 };
 1273|       |
 1274|    121|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1274:9): [True: 121, False: 0]
  |  Branch (1274:45): [True: 0, False: 121]
  ------------------
 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|    121|  }
 1288|    121|#endif
 1289|       |
 1290|    121|}
jmemmgr.c:alloc_small:
  269|    523|{
  270|    523|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  271|    523|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  272|    523|  char *data_ptr;
  273|    523|  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|    523|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|    523|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (281:7): [True: 0, False: 523]
  ------------------
  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|    523|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|    523|#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|    523|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|    523|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (289:7): [True: 0, False: 523]
  ------------------
  290|    523|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|    523|#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|    523|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|    523|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (294:7): [True: 0, False: 523]
  |  Branch (294:22): [True: 0, False: 523]
  ------------------
  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|    523|  prev_hdr_ptr = NULL;
  297|    523|  hdr_ptr = mem->small_list[pool_id];
  298|    523|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (298:10): [True: 402, False: 121]
  ------------------
  299|    402|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (299:9): [True: 402, False: 0]
  ------------------
  300|    402|      break;                    /* found pool with enough space */
  301|      0|    prev_hdr_ptr = hdr_ptr;
  302|      0|    hdr_ptr = hdr_ptr->next;
  303|      0|  }
  304|       |
  305|       |  /* Time to make a new pool? */
  306|    523|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (306:7): [True: 121, False: 402]
  ------------------
  307|       |    /* min_request is what we need now, slop is what will be leftover */
  308|    121|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|    121|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  309|    121|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (309:9): [True: 121, False: 0]
  ------------------
  310|    121|      slop = first_pool_slop[pool_id];
  311|      0|    else
  312|      0|      slop = extra_pool_slop[pool_id];
  313|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  314|    121|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|    121|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (314:9): [True: 0, False: 121]
  ------------------
  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|    121|    for (;;) {
  318|    121|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  319|    121|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (319:11): [True: 121, False: 0]
  ------------------
  320|    121|        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|    121|    mem->total_space_allocated += min_request + slop;
  326|       |    /* Success, initialize the new pool header and add to end of list */
  327|    121|    hdr_ptr->next = NULL;
  328|    121|    hdr_ptr->bytes_used = 0;
  329|    121|    hdr_ptr->bytes_left = sizeofobject + slop;
  330|    121|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (330:9): [True: 121, False: 0]
  ------------------
  331|    121|      mem->small_list[pool_id] = hdr_ptr;
  332|      0|    else
  333|      0|      prev_hdr_ptr->next = hdr_ptr;
  334|    121|  }
  335|       |
  336|       |  /* OK, allocate the object from the current pool */
  337|    523|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  338|    523|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  339|    523|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|    523|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (339:7): [True: 523, False: 0]
  ------------------
  340|    523|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|    523|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|    523|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  341|    523|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  342|    523|  hdr_ptr->bytes_used += sizeofobject;
  343|    523|  hdr_ptr->bytes_left -= sizeofobject;
  344|       |
  345|    523|  return (void *)data_ptr;
  346|    523|}
jmemmgr.c:round_up_pow2:
   45|    523|{
   46|    523|  return ((a + b - 1) & (~(b - 1)));
   47|    523|}
jmemmgr.c:free_pool:
 1099|    242|{
 1100|    242|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
 1101|    242|  small_pool_ptr shdr_ptr;
 1102|    242|  large_pool_ptr lhdr_ptr;
 1103|    242|  size_t space_freed;
 1104|       |
 1105|    242|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|    242|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (1105:7): [True: 0, False: 242]
  |  Branch (1105:22): [True: 0, False: 242]
  ------------------
 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|    242|  if (pool_id == JPOOL_IMAGE) {
  ------------------
  |  |  889|    242|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (1114:7): [True: 121, False: 121]
  ------------------
 1115|    121|    jvirt_sarray_ptr sptr;
 1116|    121|    jvirt_barray_ptr bptr;
 1117|       |
 1118|    121|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1118:40): [True: 0, False: 121]
  ------------------
 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|    121|    mem->virt_sarray_list = NULL;
 1125|    121|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1125:40): [True: 0, False: 121]
  ------------------
 1126|      0|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1126:11): [True: 0, False: 0]
  ------------------
 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|      0|    }
 1131|    121|    mem->virt_barray_list = NULL;
 1132|    121|  }
 1133|       |
 1134|       |  /* Release large objects */
 1135|    242|  lhdr_ptr = mem->large_list[pool_id];
 1136|    242|  mem->large_list[pool_id] = NULL;
 1137|       |
 1138|    242|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1138:10): [True: 0, False: 242]
  ------------------
 1139|      0|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1140|      0|    space_freed = lhdr_ptr->bytes_used +
 1141|      0|                  lhdr_ptr->bytes_left +
 1142|      0|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|      0|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1143|      0|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1144|      0|    mem->total_space_allocated -= space_freed;
 1145|      0|    lhdr_ptr = next_lhdr_ptr;
 1146|      0|  }
 1147|       |
 1148|       |  /* Release small objects */
 1149|    242|  shdr_ptr = mem->small_list[pool_id];
 1150|    242|  mem->small_list[pool_id] = NULL;
 1151|       |
 1152|    363|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1152:10): [True: 121, False: 242]
  ------------------
 1153|    121|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1154|    121|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1155|    121|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|    121|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1156|    121|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1157|    121|    mem->total_space_allocated -= space_freed;
 1158|    121|    shdr_ptr = next_shdr_ptr;
 1159|    121|  }
 1160|    242|}
jmemmgr.c:self_destruct:
 1170|    121|{
 1171|    121|  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|    363|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|    121|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|    363|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1177:35): [True: 242, False: 121]
  ------------------
 1178|    242|    free_pool(cinfo, pool);
 1179|    242|  }
 1180|       |
 1181|       |  /* Release the memory manager control block too. */
 1182|    121|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1183|    121|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1184|       |
 1185|    121|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1186|    121|}

jpeg_get_small:
   33|    242|{
   34|    242|  return (void *)MALLOC(sizeofobject);
  ------------------
  |  |  520|    242|#define MALLOC(size)  malloc(size)
  ------------------
   35|    242|}
jpeg_free_small:
   39|    242|{
   40|    242|  free(object);
   41|    242|}
jpeg_mem_init:
  102|    121|{
  103|    121|  return 0;                     /* just set max_memory_to_use to 0 */
  104|    121|}
jpeg_mem_term:
  108|    121|{
  109|       |  /* no work */
  110|    121|}

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

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

_ZN4JSON10JSON_valueC2ENS_12value_type_eE:
  306|  1.60M|            type_code(type_code)
  307|  1.60M|        {
  308|  1.60M|        }
_ZN4JSON15JSON_dictionaryC2Ev:
  316|  77.3k|            JSON_value(vt_dictionary)
  317|  77.3k|        {
  318|  77.3k|        }
_ZN4JSON9JSON_nullC2Ev:
  350|  49.1k|            JSON_value(vt_null)
  351|  49.1k|        {
  352|  49.1k|        }
_ZN4JSON10JSON_arrayC2Ev:
  396|  49.9k|        JSON_value(vt_array)
  397|  49.9k|    {
  398|  49.9k|    }
_ZN4JSON10JSON_valueD2Ev:
  309|  1.60M|        virtual ~JSON_value() = default;
_ZN4JSONC2Ev:
   50|  4.14M|    JSON() = default;
_ZN4JSON15JSON_dictionaryD2Ev:
  319|  77.3k|        ~JSON_dictionary() override = default;
_ZN4JSON10JSON_arrayD2Ev:
  399|  49.9k|    ~JSON_array() override = default;
_ZN4JSON11JSON_stringD2Ev:
  327|  1.22M|        ~JSON_string() override = default;
_ZN4JSON11JSON_numberD2Ev:
  336|   196k|        ~JSON_number() override = default;
_ZN4JSON7MembersD2Ev:
  378|  1.60M|        ~Members() = default;

_ZN4qpdf10BaseHandleD2Ev:
  131|  54.7M|        ~BaseHandle() = default;
_ZN4qpdf10BaseHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  120|  17.1M|            obj(obj) {};
_ZN4qpdf10BaseHandleC2ERKS0_:
  123|  21.3M|        BaseHandle(BaseHandle const&) = default;
_ZNK4qpdf10BaseHandleeqERKS0_:
   67|  92.6k|        {
   68|  92.6k|            return obj == other.obj;
   69|  92.6k|        }
_ZNK4qpdf10BaseHandle5emptyEv:
   82|  4.29k|        {
   83|  4.29k|            return size() == 0;
   84|  4.29k|        }
_ZN4qpdf10BaseHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
  122|  6.05M|            obj(std::move(obj)) {};
_ZN4qpdf10BaseHandleC2Ev:
  118|  1.51M|        BaseHandle() = default;
_ZN4qpdf10BaseHandleaSEOS0_:
  126|   546k|        BaseHandle& operator=(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleC2EOS0_:
  125|  6.10M|        BaseHandle(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleaSERKS0_:
  124|   671k|        BaseHandle& operator=(BaseHandle const&) = default;

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

_ZN5QIntC11range_checkIxEEvRKT_S3_:
  274|   149k|    {
  275|   149k|        if ((delta > 0) != (cur > 0)) {
  ------------------
  |  Branch (275:13): [True: 136k, False: 12.7k]
  ------------------
  276|   136k|            return;
  277|   136k|        }
  278|  12.7k|        QIntC::range_check_error<T>(cur, delta);
  279|  12.7k|    }
_ZN5QIntC17range_check_errorIxEEvRKT_S3_:
  257|  12.7k|    {
  258|  12.7k|        if ((delta > 0) && ((std::numeric_limits<T>::max() - cur) < delta)) {
  ------------------
  |  Branch (258:13): [True: 12.7k, False: 5]
  |  Branch (258:28): [True: 30, False: 12.6k]
  ------------------
  259|     30|            std::ostringstream msg;
  260|     30|            msg.imbue(std::locale::classic());
  261|     30|            msg << "adding " << delta << " to " << cur << " would cause an integer overflow";
  262|     30|            throw std::range_error(msg.str());
  263|  12.6k|        } else if ((delta < 0) && ((std::numeric_limits<T>::min() - cur) > delta)) {
  ------------------
  |  Branch (263:20): [True: 0, False: 12.6k]
  |  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|  12.7k|    }
_ZN5QIntC7to_sizeIxEEmRKT_:
  215|  34.8M|    {
  216|  34.8M|        return IntConverter<T, size_t>::convert(i);
  217|  34.8M|    }
_ZN5QIntC12IntConverterIxmLb1ELb0EE7convertERKx:
  119|  34.8M|        {
  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|  34.8M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  34.8M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 34.8M]
  |  Branch (124:28): [True: 0, False: 34.8M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  34.8M|            return static_cast<To>(i);
  128|  34.8M|        }
_ZN5QIntC9to_offsetImEExRKT_:
  222|  7.61M|    {
  223|  7.61M|        return IntConverter<T, qpdf_offset_t>::convert(i);
  224|  7.61M|    }
_ZN5QIntC12IntConverterImxLb0ELb1EE7convertERKm:
  147|  7.61M|        {
  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|  7.61M|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  7.61M|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 7.61M]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|  7.61M|            return static_cast<To>(i);
  155|  7.61M|        }
_ZN5QIntC7to_sizeIlEEmRKT_:
  215|  5.48M|    {
  216|  5.48M|        return IntConverter<T, size_t>::convert(i);
  217|  5.48M|    }
_ZN5QIntC12IntConverterIlmLb1ELb0EE7convertERKl:
  119|  5.48M|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|  5.48M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  5.48M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 5.48M]
  |  Branch (124:28): [True: 0, False: 5.48M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  5.48M|            return static_cast<To>(i);
  128|  5.48M|        }
_ZN5QIntC6to_intImEEiRKT_:
  201|   209k|    {
  202|   209k|        return IntConverter<T, int>::convert(i);
  203|   209k|    }
_ZN5QIntC12IntConverterImiLb0ELb1EE7convertERKm:
  147|   209k|        {
  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|   209k|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|   209k|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 23, False: 209k]
  ------------------
  152|     23|                error(i);
  153|     23|            }
  154|   209k|            return static_cast<To>(i);
  155|   209k|        }
_ZN5QIntC12IntConverterImiLb0ELb1EE5errorEm:
  159|     23|        {
  160|     23|            std::ostringstream msg;
  161|     23|            msg.imbue(std::locale::classic());
  162|     23|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  163|     23|                << "-byte unsigned type to a " << sizeof(To) << "-byte signed type";
  164|     23|            throw std::range_error(msg.str());
  165|     23|        }
_ZN5QIntC7to_sizeIiEEmRKT_:
  215|  67.0k|    {
  216|  67.0k|        return IntConverter<T, size_t>::convert(i);
  217|  67.0k|    }
_ZN5QIntC12IntConverterIimLb1ELb0EE7convertERKi:
  119|   167M|        {
  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|   167M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   167M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 167M]
  |  Branch (124:28): [True: 0, False: 167M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   167M|            return static_cast<To>(i);
  128|   167M|        }
_ZN5QIntC6to_intIxEEiRKT_:
  201|  4.71M|    {
  202|  4.71M|        return IntConverter<T, int>::convert(i);
  203|  4.71M|    }
_ZN5QIntC12IntConverterIxiLb1ELb1EE7convertERKx:
   94|  4.71M|        {
   95|       |            // From and To are both signed.
   96|  4.71M|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 664, False: 4.71M]
  |  Branch (96:57): [True: 695, False: 4.71M]
  ------------------
   97|  1.35k|                error(i);
   98|  1.35k|            }
   99|  4.71M|            return static_cast<To>(i);
  100|  4.71M|        }
_ZN5QIntC12IntConverterIxiLb1ELb1EE5errorEx:
  104|  1.35k|        {
  105|  1.35k|            std::ostringstream msg;
  106|  1.35k|            msg.imbue(std::locale::classic());
  107|  1.35k|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  108|  1.35k|                << "-byte signed type to a " << sizeof(To) << "-byte signed type";
  109|  1.35k|            throw std::range_error(msg.str());
  110|  1.35k|        }
_ZN5QIntC7to_sizeImEEmRKT_:
  215|     67|    {
  216|     67|        return IntConverter<T, size_t>::convert(i);
  217|     67|    }
_ZN5QIntC12IntConverterImmLb0ELb0EE7convertERKm:
   69|  69.2k|        {
   70|       |            // From and To are both unsigned.
   71|  69.2k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 69.2k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  69.2k|            return static_cast<To>(i);
   75|  69.2k|        }
_ZN5QIntC7to_uintIiEEjRKT_:
  208|  22.0k|    {
  209|  22.0k|        return IntConverter<T, unsigned int>::convert(i);
  210|  22.0k|    }
_ZN5QIntC12IntConverterIijLb1ELb0EE7convertERKi:
  119|  22.0k|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|  22.0k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  22.0k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 22.0k]
  |  Branch (124:28): [True: 0, False: 22.0k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  22.0k|            return static_cast<To>(i);
  128|  22.0k|        }
_ZN5QIntC6to_intIlEEiRKT_:
  201|  8.11k|    {
  202|  8.11k|        return IntConverter<T, int>::convert(i);
  203|  8.11k|    }
_ZN5QIntC12IntConverterIliLb1ELb1EE7convertERKl:
   94|  8.11k|        {
   95|       |            // From and To are both signed.
   96|  8.11k|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 0, False: 8.11k]
  |  Branch (96:57): [True: 0, False: 8.11k]
  ------------------
   97|      0|                error(i);
   98|      0|            }
   99|  8.11k|            return static_cast<To>(i);
  100|  8.11k|        }
_ZN5QIntC7to_sizeIyEEmRKT_:
  215|  12.0k|    {
  216|  12.0k|        return IntConverter<T, size_t>::convert(i);
  217|  12.0k|    }
_ZN5QIntC12IntConverterIymLb0ELb0EE7convertERKy:
   69|  12.0k|        {
   70|       |            // From and To are both unsigned.
   71|  12.0k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 12.0k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  12.0k|            return static_cast<To>(i);
   75|  12.0k|        }
_ZN5QIntC8to_ulongIcEEmRKT_:
  236|   370k|    {
  237|   370k|        return IntConverter<T, unsigned long>::convert(i);
  238|   370k|    }
_ZN5QIntC12IntConverterIcmLb1ELb0EE7convertERKc:
  119|   370k|        {
  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|   370k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   370k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 370k]
  |  Branch (124:28): [True: 0, False: 370k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   370k|            return static_cast<To>(i);
  128|   370k|        }
_ZN5QIntC8to_ulongIhEEmRKT_:
  236|   461M|    {
  237|   461M|        return IntConverter<T, unsigned long>::convert(i);
  238|   461M|    }
_ZN5QIntC12IntConverterIhmLb0ELb0EE7convertERKh:
   69|   461M|        {
   70|       |            // From and To are both unsigned.
   71|   461M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 461M]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   461M|            return static_cast<To>(i);
   75|   461M|        }
_ZN5QIntC8to_ulongIiEEmRKT_:
  236|   167M|    {
  237|   167M|        return IntConverter<T, unsigned long>::convert(i);
  238|   167M|    }
_ZN5QIntC9to_ushortIiEEtRKT_:
  194|  64.8M|    {
  195|  64.8M|        return IntConverter<T, unsigned short>::convert(i);
  196|  64.8M|    }
_ZN5QIntC12IntConverterIitLb1ELb0EE7convertERKi:
  119|  64.8M|        {
  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|  64.8M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  64.8M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 64.8M]
  |  Branch (124:28): [True: 0, False: 64.8M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  64.8M|            return static_cast<To>(i);
  128|  64.8M|        }
_ZN5QIntC20range_check_subtractIxEEvRKT_S3_:
  302|  1.03k|    {
  303|  1.03k|        if ((delta >= 0) == (cur >= 0)) {
  ------------------
  |  Branch (303:13): [True: 863, False: 175]
  ------------------
  304|    863|            return;
  305|    863|        }
  306|    175|        QIntC::range_check_subtract_error<T>(cur, delta);
  307|    175|    }
_ZN5QIntC26range_check_subtract_errorIxEEvRKT_S3_:
  284|    175|    {
  285|    175|        if ((delta > 0) && ((std::numeric_limits<T>::min() + delta) > cur)) {
  ------------------
  |  Branch (285:13): [True: 0, False: 175]
  |  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|    175|        } else if ((delta < 0) && ((std::numeric_limits<T>::max() + delta) < cur)) {
  ------------------
  |  Branch (291:20): [True: 175, False: 0]
  |  Branch (291:35): [True: 1, False: 174]
  ------------------
  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|    175|    }
_ZN5QIntC7to_sizeIjEEmRKT_:
  215|  17.9k|    {
  216|  17.9k|        return IntConverter<T, size_t>::convert(i);
  217|  17.9k|    }
_ZN5QIntC12IntConverterIjmLb0ELb0EE7convertERKj:
   69|  17.9k|        {
   70|       |            // From and To are both unsigned.
   71|  17.9k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 17.9k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  17.9k|            return static_cast<To>(i);
   75|  17.9k|        }
_ZN5QIntC7to_uintImEEjRKT_:
  208|   628k|    {
  209|   628k|        return IntConverter<T, unsigned int>::convert(i);
  210|   628k|    }
_ZN5QIntC12IntConverterImjLb0ELb0EE7convertERKm:
   69|   628k|        {
   70|       |            // From and To are both unsigned.
   71|   628k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 628k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   628k|            return static_cast<To>(i);
   75|   628k|        }
_ZN5QIntC8to_ulongImEEmRKT_:
  236|  69.2k|    {
  237|  69.2k|        return IntConverter<T, unsigned long>::convert(i);
  238|  69.2k|    }

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

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

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

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

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

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

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

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

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

_ZN10QPDFObjGenC2Eii:
   40|  1.43M|        obj(obj),
   41|  1.43M|        gen(gen)
   42|  1.43M|    {
   43|  1.43M|    }
_ZNK10QPDFObjGenltERKS_:
   46|  52.0M|    {
   47|  52.0M|        return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen);
  ------------------
  |  Branch (47:16): [True: 29.3M, False: 22.7M]
  |  Branch (47:36): [True: 5.77M, False: 16.9M]
  |  Branch (47:54): [True: 86.4k, False: 5.68M]
  ------------------
   48|  52.0M|    }
_ZNK10QPDFObjGeneqERKS_:
   51|   146k|    {
   52|   146k|        return obj == rhs.obj && gen == rhs.gen;
  ------------------
  |  Branch (52:16): [True: 139k, False: 6.38k]
  |  Branch (52:34): [True: 139k, False: 144]
  ------------------
   53|   146k|    }
_ZNK10QPDFObjGenneERKS_:
   56|   131k|    {
   57|   131k|        return !(*this == rhs);
   58|   131k|    }
_ZNK10QPDFObjGen6getObjEv:
   61|  1.71M|    {
   62|  1.71M|        return obj;
   63|  1.71M|    }
_ZNK10QPDFObjGen6getGenEv:
   66|  4.85k|    {
   67|  4.85k|        return gen;
   68|  4.85k|    }
_ZNK10QPDFObjGen10isIndirectEv:
   71|  6.35M|    {
   72|  6.35M|        return obj != 0;
   73|  6.35M|    }
_ZNK10QPDFObjGen7unparseEc:
   76|  1.30M|    {
   77|  1.30M|        return std::to_string(obj) + separator + std::to_string(gen);
   78|  1.30M|    }
_ZN10QPDFObjGen3set3addES_:
  111|   209k|        {
  112|   209k|            if (og.isIndirect()) {
  ------------------
  |  Branch (112:17): [True: 144k, False: 65.2k]
  ------------------
  113|   144k|                if (count(og)) {
  ------------------
  |  Branch (113:21): [True: 16.7k, False: 127k]
  ------------------
  114|  16.7k|                    return false;
  115|  16.7k|                }
  116|   127k|                emplace(og);
  117|   127k|            }
  118|   192k|            return true;
  119|   209k|        }
_ZN10QPDFObjGenC2Ev:
   38|  23.1M|    QPDFObjGen() = default;

_ZN16QPDFObjectHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
 1315|  16.3M|        qpdf::BaseHandle(obj)
 1316|  16.3M|    {
 1317|  16.3M|    }
_ZN16QPDFObjectHandleC2ERKS_:
  290|  21.0M|    QPDFObjectHandle(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilter16PipelineAccessor11setPipelineEPS0_P8Pipeline:
  176|  30.9k|            {
  177|  30.9k|                f->setPipeline(p);
  178|  30.9k|            }
_ZN16QPDFObjectHandle9RectangleC2Ev:
  236|  1.32k|            llx(0.0),
  237|  1.32k|            lly(0.0),
  238|  1.32k|            urx(0.0),
  239|  1.32k|            ury(0.0)
  240|  1.32k|        {
  241|  1.32k|        }
_ZN16QPDFObjectHandle9RectangleC2Edddd:
  243|  42.1k|            llx(llx),
  244|  42.1k|            lly(lly),
  245|  42.1k|            urx(urx),
  246|  42.1k|            ury(ury)
  247|  42.1k|        {
  248|  42.1k|        }
_ZN16QPDFObjectHandle6MatrixC2Edddddd:
  272|    316|            a(a),
  273|    316|            b(b),
  274|    316|            c(c),
  275|    316|            d(d),
  276|    316|            e(e),
  277|    316|            f(f)
  278|    316|        {
  279|    316|        }
_ZN16QPDFObjectHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
 1319|  5.54M|        qpdf::BaseHandle(std::move(obj))
 1320|  5.54M|    {
 1321|  5.54M|    }
_ZN16QPDFObjectHandle6getObjEv:
 1324|   172k|    {
 1325|   172k|        return obj;
 1326|   172k|    }
_ZNK16QPDFObjectHandle14QPDFArrayItems8iteratorneERKS1_:
 1518|   129k|        {
 1519|   129k|            return !operator==(other);
 1520|   129k|        }
_ZNK4qpdf10BaseHandlecvbEv:
 1559|  34.6M|    {
 1560|  34.6M|        return static_cast<bool>(obj);
 1561|  34.6M|    }
_ZNK4qpdf10BaseHandlecv16QPDFObjectHandleEv:
 1565|   252k|    {
 1566|   252k|        return {obj};
 1567|   252k|    }
_ZN16QPDFObjectHandleC2Ev:
  289|  1.48M|    QPDFObjectHandle() = default;
_ZN16QPDFObjectHandleaSEOS_:
  293|   487k|    QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleC2EOS_:
  292|  6.10M|    QPDFObjectHandle(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorD2Ev:
 1491|  10.1k|        virtual ~iterator() = default;
_ZN16QPDFObjectHandleaSERKS_:
  291|   644k|    QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilterC2Ev:
  163|  52.2k|        TokenFilter() = default;
_ZN16QPDFObjectHandle11TokenFilterD2Ev:
  164|  15.5k|        virtual ~TokenFilter() = default;

_ZN16QPDFObjectHelper15getObjectHandleEv:
   45|  68.0k|    {
   46|  68.0k|        return {obj};
   47|  68.0k|    }
_ZN16QPDFObjectHelperC2E16QPDFObjectHandle:
   38|   172k|        qpdf::BaseHandle(oh.getObj())
   39|   172k|    {
   40|   172k|    }
_ZNK16QPDFObjectHelper15getObjectHandleEv:
   50|  20.5k|    {
   51|  20.5k|        return {obj};
   52|  20.5k|    }
_ZN16QPDFObjectHelper2ohEv:
   58|   323k|    {
   59|   323k|        return {obj};
   60|   323k|    }

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

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

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

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

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

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

_ZN13QPDFTokenizer5TokenC2Ev:
   71|  5.90M|            type(tt_bad)
   72|  5.90M|        {
   73|  5.90M|        }
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES8_S8_:
   81|  5.90M|            type(type),
   82|  5.90M|            value(value),
   83|  5.90M|            raw_value(raw_value),
   84|  5.90M|            error_message(error_message)
   85|  5.90M|        {
   86|  5.90M|        }
_ZNK13QPDFTokenizer5Token7getTypeEv:
   89|  11.3M|        {
   90|  11.3M|            return this->type;
   91|  11.3M|        }
_ZNK13QPDFTokenizer5Token8getValueEv:
   94|  5.13M|        {
   95|  5.13M|            return this->value;
   96|  5.13M|        }
_ZNK13QPDFTokenizer5Token11getRawValueEv:
   99|  2.45M|        {
  100|  2.45M|            return this->raw_value;
  101|  2.45M|        }
_ZNK13QPDFTokenizer5Token9isIntegerEv:
  116|  2.50M|        {
  117|  2.50M|            return this->type == tt_integer;
  118|  2.50M|        }
_ZNK13QPDFTokenizer5Token6isWordERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  126|  6.33M|        {
  127|  6.33M|            return this->type == tt_word && this->value == value;
  ------------------
  |  Branch (127:20): [True: 2.20M, False: 4.12M]
  |  Branch (127:45): [True: 534k, False: 1.66M]
  ------------------
  128|  6.33M|        }

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

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

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

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

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

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

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

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

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

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

_ZN11InputSource13setLastOffsetEx:
   15|  42.2M|{
   16|  42.2M|    this->last_offset = offset;
   17|  42.2M|}
_ZNK11InputSource13getLastOffsetEv:
   21|  24.7M|{
   22|  24.7M|    return this->last_offset;
   23|  24.7M|}
_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.1k, False: 2.80k]
  ------------------
   36|  10.1k|        auto next_line = str.find_first_not_of("\n\r"sv, eol);
   37|  10.1k|        str.resize(eol);
   38|  10.1k|        if (eol != std::string::npos) {
  ------------------
  |  Branch (38:13): [True: 10.1k, False: 0]
  ------------------
   39|  10.1k|            seek(last_offset + static_cast<qpdf_offset_t>(next_line), SEEK_SET);
   40|  10.1k|            return eol;
   41|  10.1k|        }
   42|  10.1k|    }
   43|       |    // We did not necessarily find the end of the trailing newline sequence.
   44|  2.80k|    seek(last_offset, SEEK_SET);
   45|  2.80k|    findAndSkipNextEOL();
   46|  2.80k|    return eol;
   47|  12.9k|}
_ZN11InputSource8readLineEm:
   51|  12.9k|{
   52|  12.9k|    return read_line(max_line_length);
   53|  12.9k|}
_ZN11InputSource9findFirstEPKcxmRNS_6FinderE:
   65|  89.5k|{
   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|  89.5k|    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|  89.5k|    size_t size = sizeof(buf) - 1;
   79|  89.5k|    util::assertion(
   80|  89.5k|        !(strlen(start_chars) < 1 || strlen(start_chars) > size),
  ------------------
  |  Branch (80:11): [True: 0, False: 89.5k]
  |  Branch (80:38): [True: 0, False: 89.5k]
  ------------------
   81|  89.5k|        "InputSource::findSource called with too small or too large of a character sequence" //
   82|  89.5k|    );
   83|       |
   84|  89.5k|    char* p = nullptr;
   85|  89.5k|    qpdf_offset_t buf_offset = offset;
   86|  89.5k|    size_t bytes_read = 0;
   87|       |
   88|       |    // Guarantee that we return from this loop. Each time through, we either return, advance p, or
   89|       |    // restart the loop with a condition that will cause return on the next pass. Eventually we will
   90|       |    // either be out of range or hit EOF, either of which forces us to return.
   91|  5.52M|    while (true) {
  ------------------
  |  Branch (91:12): [True: 5.52M, Folded]
  ------------------
   92|       |        // Do we need to read more data? Pretend size = 5, buf starts at 0, and start_chars has 3
   93|       |        // characters. buf[5] is valid and null. If p == 2, start_chars could be buf[2] through
   94|       |        // buf[4], so p + strlen(start_chars) == buf + size is okay. If p points to buf[size], since
   95|       |        // strlen(start_chars) is always >= 1, this overflow test will be correct for that case
   96|       |        // regardless of start_chars.
   97|  5.52M|        if ((p == nullptr) || ((p + strlen(start_chars)) > (buf + bytes_read))) {
  ------------------
  |  Branch (97:13): [True: 89.5k, False: 5.43M]
  |  Branch (97:31): [True: 201k, False: 5.23M]
  ------------------
   98|   291k|            if (p) {
  ------------------
  |  Branch (98:17): [True: 201k, False: 89.5k]
  ------------------
   99|   201k|                QTC::TC(
  100|   201k|                    "libtests", "InputSource read next block", ((p == buf + bytes_read) ? 0 : 1));
  ------------------
  |  Branch (100:65): [True: 193k, False: 8.26k]
  ------------------
  101|   201k|                buf_offset += (p - buf);
  102|   201k|            }
  103|   291k|            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|   291k|            bytes_read = this->read(buf, size);
  108|   291k|            if (bytes_read < strlen(start_chars)) {
  ------------------
  |  Branch (108:17): [True: 40.8k, False: 250k]
  ------------------
  109|  40.8k|                QTC::TC("libtests", "InputSource find EOF", bytes_read == 0 ? 0 : 1);
  ------------------
  |  Branch (109:61): [True: 34.2k, False: 6.57k]
  ------------------
  110|  40.8k|                return false;
  111|  40.8k|            }
  112|   250k|            memset(buf + bytes_read, '\0', 1 + (size - bytes_read));
  113|   250k|            p = buf;
  114|   250k|        }
  115|       |
  116|       |        // Search for the first character.
  117|  5.48M|        if ((p = static_cast<char*>(
  ------------------
  |  Branch (117:13): [True: 5.29M, False: 193k]
  ------------------
  118|       |                 // line-break
  119|  5.48M|                 memchr(p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) != nullptr) {
  120|  5.29M|            if (p == buf) {
  ------------------
  |  Branch (120:17): [True: 11.4k, False: 5.28M]
  ------------------
  121|  11.4k|                QTC::TC("libtests", "InputSource found match at buf[0]");
  122|  11.4k|            }
  123|       |            // Found first letter.
  124|  5.29M|            if (len != 0) {
  ------------------
  |  Branch (124:17): [True: 26.4k, False: 5.26M]
  ------------------
  125|       |                // Make sure it's in range.
  126|  26.4k|                size_t p_relative_offset = QIntC::to_size((p - buf) + (buf_offset - offset));
  127|  26.4k|                if (p_relative_offset >= len) {
  ------------------
  |  Branch (127:21): [True: 2.31k, False: 24.1k]
  ------------------
  128|       |                    // out of range
  129|  2.31k|                    QTC::TC("libtests", "InputSource out of range");
  130|  2.31k|                    return false;
  131|  2.31k|                }
  132|  26.4k|            }
  133|  5.28M|            if ((p + strlen(start_chars)) > (buf + bytes_read)) {
  ------------------
  |  Branch (133:17): [True: 2.74k, False: 5.28M]
  ------------------
  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.74k|                QTC::TC("libtests", "InputSource not enough bytes");
  137|  2.74k|                continue;
  138|  2.74k|            }
  139|       |
  140|       |            // See if p points to a sequence matching start_chars. We already checked above to make
  141|       |            // sure we are not going to overrun memory.
  142|  5.28M|            if (strncmp(p, start_chars, strlen(start_chars)) == 0) {
  ------------------
  |  Branch (142:17): [True: 153k, False: 5.13M]
  ------------------
  143|       |                // Call finder.check() with the input source positioned to the point of the match.
  144|   153k|                this->seek(buf_offset + (p - buf), SEEK_SET);
  145|   153k|                if (finder.check()) {
  ------------------
  |  Branch (145:21): [True: 46.3k, False: 107k]
  ------------------
  146|  46.3k|                    return true;
  147|   107k|                } else {
  148|   107k|                    QTC::TC("libtests", "InputSource start_chars matched but not check");
  149|   107k|                }
  150|  5.13M|            } else {
  151|  5.13M|                QTC::TC("libtests", "InputSource first char matched but not string");
  152|  5.13M|            }
  153|       |            // This occurrence of the first character wasn't a match. Skip over it and keep
  154|       |            // searching.
  155|  5.24M|            ++p;
  156|  5.24M|        } else {
  157|       |            // Trigger reading the next block
  158|   193k|            p = buf + bytes_read;
  159|   193k|        }
  160|  5.48M|    }
  161|  89.5k|}
_ZN11InputSource8findLastEPKcxmRNS_6FinderE:
  165|  21.7k|{
  166|  21.7k|    bool found = false;
  167|  21.7k|    qpdf_offset_t after_found_offset = 0;
  168|  21.7k|    qpdf_offset_t cur_offset = offset;
  169|  21.7k|    size_t cur_len = len;
  170|  27.6k|    while (this->findFirst(start_chars, cur_offset, cur_len, finder)) {
  ------------------
  |  Branch (170:12): [True: 5.93k, False: 21.7k]
  ------------------
  171|  5.93k|        if (found) {
  ------------------
  |  Branch (171:13): [True: 378, False: 5.56k]
  ------------------
  172|    378|            QTC::TC("libtests", "InputSource findLast found more than one");
  173|  5.56k|        } else {
  174|  5.56k|            found = true;
  175|  5.56k|        }
  176|  5.93k|        after_found_offset = this->tell();
  177|  5.93k|        cur_offset = after_found_offset;
  178|  5.93k|        cur_len = len - QIntC::to_size((cur_offset - offset));
  179|  5.93k|    }
  180|  21.7k|    if (found) {
  ------------------
  |  Branch (180:9): [True: 5.56k, False: 16.1k]
  ------------------
  181|       |        this->seek(after_found_offset, SEEK_SET);
  182|  5.56k|    }
  183|  21.7k|    return found;
  184|  21.7k|}
_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|  1.60M|    value(std::move(value))
   20|  1.60M|{
   21|  1.60M|}
_ZN4JSONC2ENSt3__110unique_ptrINS_10JSON_valueENS0_14default_deleteIS2_EEEE:
   24|  1.60M|    m(new Members(std::move(value)))
   25|  1.60M|{
   26|  1.60M|}
_ZN4JSON10writeCloseEP8PipelinebmPKc:
   30|   127k|{
   31|   127k|    if (first) {
  ------------------
  |  Branch (31:9): [True: 13.7k, False: 113k]
  ------------------
   32|  13.7k|        *p << delimiter;
   33|   113k|    } else {
   34|   113k|        std::string s{"\n"};
   35|   113k|        s.append(2 * depth, ' ');
   36|   113k|        *p << s + delimiter;
   37|   113k|    }
   38|   127k|}
_ZN4JSON9writeNextEP8PipelineRbm:
   42|  1.58M|{
   43|  1.58M|    if (first) {
  ------------------
  |  Branch (43:9): [True: 113k, False: 1.46M]
  ------------------
   44|   113k|        first = false;
   45|   113k|        std::string s{"\n"};
   46|   113k|        s.append(2 * depth, ' ');
   47|   113k|        *p << s;
   48|  1.46M|    } else {
   49|  1.46M|        std::string s{",\n"};
   50|  1.46M|        s.append(2 * depth, ' ');
   51|  1.46M|        *p << s;
   52|  1.46M|    }
   53|  1.58M|}
_ZN4JSON19writeDictionaryOpenEP8PipelineRbm:
   57|  77.2k|{
   58|  77.2k|    *p << "{";
   59|  77.2k|    first = true;
   60|  77.2k|}
_ZN4JSON14writeArrayOpenEP8PipelineRbm:
   64|  49.8k|{
   65|  49.8k|    *p << "[";
   66|  49.8k|    first = true;
   67|  49.8k|}
_ZN4JSON20writeDictionaryCloseEP8Pipelinebm:
   71|  77.2k|{
   72|  77.2k|    writeClose(p, first, depth, "}");
   73|  77.2k|}
_ZN4JSON15writeArrayCloseEP8Pipelinebm:
   77|  49.8k|{
   78|  49.8k|    writeClose(p, first, depth, "]");
   79|  49.8k|}
_ZN4JSON18writeDictionaryKeyEP8PipelineRbRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
   83|   313k|{
   84|   313k|    writeNext(p, first, depth);
   85|   313k|    *p << std::string("\"") + key + "\": ";
   86|   313k|}
_ZN4JSON19writeDictionaryItemEP8PipelineRbRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKS_m:
   91|   313k|{
   92|   313k|    writeDictionaryKey(p, first, key, depth);
   93|   313k|    value.write(p, depth);
   94|   313k|}
_ZN4JSON14writeArrayItemEP8PipelineRbRKS_m:
   98|  1.26M|{
   99|  1.26M|    writeNext(p, first, depth);
  100|  1.26M|    element.write(p, depth);
  101|  1.26M|}
_ZNK4JSON15JSON_dictionary5writeEP8Pipelinem:
  105|  77.2k|{
  106|  77.2k|    bool first = true;
  107|  77.2k|    writeDictionaryOpen(p, first, depth);
  108|   313k|    for (auto const& iter: members) {
  ------------------
  |  Branch (108:26): [True: 313k, False: 77.2k]
  ------------------
  109|   313k|        writeDictionaryItem(p, first, iter.first, iter.second, 1 + depth);
  110|   313k|    }
  111|  77.2k|    writeDictionaryClose(p, first, depth);
  112|  77.2k|}
_ZNK4JSON10JSON_array5writeEP8Pipelinem:
  116|  49.8k|{
  117|  49.8k|    bool first = true;
  118|  49.8k|    writeArrayOpen(p, first, depth);
  119|  1.26M|    for (auto const& element: elements) {
  ------------------
  |  Branch (119:29): [True: 1.26M, False: 49.8k]
  ------------------
  120|  1.26M|        writeArrayItem(p, first, element, 1 + depth);
  121|  1.26M|    }
  122|  49.8k|    writeArrayClose(p, first, depth);
  123|  49.8k|}
_ZN4JSON11JSON_stringC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  126|  1.22M|    JSON_value(vt_string),
  127|  1.22M|    utf8(utf8)
  128|  1.22M|{
  129|  1.22M|}
_ZNK4JSON11JSON_string5writeEP8Pipelinem:
  133|  1.22M|{
  134|  1.22M|    *p << std::string("\"") + Writer::encode_string(utf8) + "\"";
  135|  1.22M|}
_ZN4JSON11JSON_numberC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  150|   196k|    JSON_value(vt_number),
  151|   196k|    encoded(value)
  152|   196k|{
  153|   196k|}
_ZNK4JSON11JSON_number5writeEP8Pipelinem:
  157|   196k|{
  158|   196k|    *p << encoded;
  159|   196k|}
_ZN4JSON9JSON_boolC2Eb:
  162|  3.50k|    JSON_value(vt_bool),
  163|  3.50k|    value(val)
  164|  3.50k|{
  165|  3.50k|}
_ZNK4JSON9JSON_bool5writeEP8Pipelinem:
  169|  3.50k|{
  170|  3.50k|    *p << (value ? "true" : "false");
  ------------------
  |  Branch (170:12): [True: 3.04k, False: 463]
  ------------------
  171|  3.50k|}
_ZNK4JSON9JSON_null5writeEP8Pipelinem:
  175|  49.1k|{
  176|  49.1k|    *p << "null";
  177|  49.1k|}
_ZNK4JSON5writeEP8Pipelinem:
  198|  1.60M|{
  199|  1.60M|    if (!m) {
  ------------------
  |  Branch (199:9): [True: 0, False: 1.60M]
  ------------------
  200|      0|        *p << "null";
  201|  1.60M|    } else {
  202|  1.60M|        m->value->write(p, depth);
  203|  1.60M|    }
  204|  1.60M|}
_ZNK4JSON7unparseEv:
  208|  18.5k|{
  209|  18.5k|    if (!m) {
  ------------------
  |  Branch (209:9): [True: 0, False: 18.5k]
  ------------------
  210|      0|        return "null";
  211|      0|    }
  212|  18.5k|    std::string s;
  213|  18.5k|    Pl_String p("unparse", nullptr, s);
  214|  18.5k|    write(&p, 0);
  215|  18.5k|    return s;
  216|  18.5k|}
_ZN4JSON6Writer13encode_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  220|  1.63M|{
  221|  1.63M|    static auto constexpr hexchars = "0123456789abcdef";
  222|       |
  223|  1.63M|    auto begin = str.cbegin();
  224|  1.63M|    auto end = str.cend();
  225|  1.63M|    auto iter = begin;
  226|   197M|    while (iter != end) {
  ------------------
  |  Branch (226:12): [True: 195M, False: 1.59M]
  ------------------
  227|   195M|        auto c = static_cast<unsigned char>(*iter);
  228|   195M|        if ((c > 34 && c != '\\') || c == ' ' || c == 33) {
  ------------------
  |  Branch (228:14): [True: 193M, False: 1.86M]
  |  Branch (228:24): [True: 193M, False: 2.88k]
  |  Branch (228:38): [True: 1.82M, False: 51.0k]
  |  Branch (228:50): [True: 8.87k, False: 42.1k]
  ------------------
  229|       |            // Optimistically check that no char in str requires escaping. Hopefully we can just
  230|       |            // return the input str.
  231|   195M|            ++iter;
  232|   195M|        } 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|  42.1k|            std::string result{begin, iter};
  236|       |
  237|   407M|            for (; iter != end; ++iter) {
  ------------------
  |  Branch (237:20): [True: 407M, False: 42.1k]
  ------------------
  238|   407M|                auto ch = static_cast<unsigned char>(*iter);
  239|   407M|                if ((ch > 34 && ch != '\\') || ch == ' ' || ch == 33) {
  ------------------
  |  Branch (239:22): [True: 379M, False: 28.0M]
  |  Branch (239:33): [True: 379M, False: 16.7k]
  |  Branch (239:48): [True: 155k, False: 27.8M]
  |  Branch (239:61): [True: 13.7k, False: 27.8M]
  ------------------
  240|       |                    // Check for most common case first.
  241|   379M|                    result += *iter;
  242|   379M|                } else {
  243|  27.8M|                    switch (ch) {
  244|  16.7k|                    case '\\':
  ------------------
  |  Branch (244:21): [True: 16.7k, False: 27.8M]
  ------------------
  245|  16.7k|                        result += "\\\\";
  246|  16.7k|                        break;
  247|  83.4k|                    case '\"':
  ------------------
  |  Branch (247:21): [True: 83.4k, False: 27.7M]
  ------------------
  248|  83.4k|                        result += "\\\"";
  249|  83.4k|                        break;
  250|  12.2M|                    case '\b':
  ------------------
  |  Branch (250:21): [True: 12.2M, False: 15.6M]
  ------------------
  251|  12.2M|                        result += "\\b";
  252|  12.2M|                        break;
  253|  52.0k|                    case '\f':
  ------------------
  |  Branch (253:21): [True: 52.0k, False: 27.8M]
  ------------------
  254|  52.0k|                        result += "\\f";
  255|  52.0k|                        break;
  256|  83.8k|                    case '\n':
  ------------------
  |  Branch (256:21): [True: 83.8k, False: 27.7M]
  ------------------
  257|  83.8k|                        result += "\\n";
  258|  83.8k|                        break;
  259|  1.74k|                    case '\r':
  ------------------
  |  Branch (259:21): [True: 1.74k, False: 27.8M]
  ------------------
  260|  1.74k|                        result += "\\r";
  261|  1.74k|                        break;
  262|  97.0k|                    case '\t':
  ------------------
  |  Branch (262:21): [True: 97.0k, False: 27.7M]
  ------------------
  263|  97.0k|                        result += "\\t";
  264|  97.0k|                        break;
  265|  15.3M|                    default:
  ------------------
  |  Branch (265:21): [True: 15.3M, False: 12.5M]
  ------------------
  266|  15.3M|                        result += ch < 16 ? "\\u000" : "\\u001";
  ------------------
  |  Branch (266:35): [True: 15.3M, False: 34.9k]
  ------------------
  267|  15.3M|                        result += hexchars[ch % 16];
  268|  27.8M|                    }
  269|  27.8M|                }
  270|   407M|            }
  271|  42.1k|            return result;
  272|  42.1k|        }
  273|   195M|    }
  274|  1.59M|    return str;
  275|  1.63M|}
_ZN4JSON14makeDictionaryEv:
  279|  77.3k|{
  280|  77.3k|    return {std::make_unique<JSON_dictionary>()};
  281|  77.3k|}
_ZN4JSON19addDictionaryMemberERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  285|   313k|{
  286|   313k|    if (auto* obj = m ? dynamic_cast<JSON_dictionary*>(m->value.get()) : nullptr) {
  ------------------
  |  Branch (286:15): [True: 313k, False: 0]
  ------------------
  287|   313k|        return obj->members[Writer::encode_string(key)] = val.m ? val : makeNull();
  ------------------
  |  Branch (287:59): [True: 313k, False: 0]
  ------------------
  288|   313k|    } else {
  289|      0|        throw std::runtime_error("JSON::addDictionaryMember called on non-dictionary");
  290|      0|    }
  291|   313k|}
_ZN4JSON9makeArrayEv:
  295|  49.9k|{
  296|  49.9k|    return {std::make_unique<JSON_array>()};
  297|  49.9k|}
_ZN4JSON15addArrayElementERKS_:
  301|  1.26M|{
  302|  1.26M|    if (auto* arr = m ? dynamic_cast<JSON_array*>(m->value.get()) : nullptr) {
  ------------------
  |  Branch (302:15): [True: 1.26M, False: 0]
  ------------------
  303|  1.26M|        if (val.m) {
  ------------------
  |  Branch (303:13): [True: 1.26M, False: 0]
  ------------------
  304|  1.26M|            arr->elements.push_back(val);
  305|  1.26M|        } else {
  306|      0|            arr->elements.push_back(makeNull());
  307|      0|        }
  308|  1.26M|        return arr->elements.back();
  309|  1.26M|    }
  310|      0|    throw std::runtime_error("JSON::addArrayElement called on non-array");
  311|      0|    return {}; // unreachable
  312|  1.26M|}
_ZN4JSON10makeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  316|  1.22M|{
  317|  1.22M|    return {std::make_unique<JSON_string>(utf8)};
  318|  1.22M|}
_ZN4JSON10makeNumberERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  334|   196k|{
  335|   196k|    return {std::make_unique<JSON_number>(encoded)};
  336|   196k|}
_ZN4JSON8makeBoolEb:
  340|  3.50k|{
  341|  3.50k|    return {std::make_unique<JSON_bool>(value)};
  342|  3.50k|}
_ZN4JSON8makeNullEv:
  346|  49.1k|{
  347|  49.1k|    return {std::make_unique<JSON_null>()};
  348|  49.1k|}
_ZNK4JSON7isArrayEv:
  358|  1.57M|{
  359|  1.57M|    return m ? m->value->type_code == vt_array : false;
  ------------------
  |  Branch (359:12): [True: 1.57M, False: 0]
  ------------------
  360|  1.57M|}
_ZNK4JSON12isDictionaryEv:
  364|  1.74M|{
  365|  1.74M|    return m && m->value->type_code == vt_dictionary;
  ------------------
  |  Branch (365:12): [True: 1.74M, False: 0]
  |  Branch (365:17): [True: 173k, False: 1.57M]
  ------------------
  366|  1.74M|}
_ZN4JSON5parseERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1342|  18.5k|{
 1343|  18.5k|    is::OffsetBuffer bis("json input", s);
 1344|  18.5k|    JSONParser jp(bis, nullptr);
 1345|  18.5k|    return jp.parse();
 1346|  18.5k|}
_ZN4JSON8setStartEx:
 1350|  1.60M|{
 1351|  1.60M|    if (m) {
  ------------------
  |  Branch (1351:9): [True: 1.60M, False: 0]
  ------------------
 1352|  1.60M|        m->start = start;
 1353|  1.60M|    }
 1354|  1.60M|}
_ZN4JSON6setEndEx:
 1358|  1.72M|{
 1359|  1.72M|    if (m) {
  ------------------
  |  Branch (1359:9): [True: 1.72M, False: 0]
  ------------------
 1360|  1.72M|        m->end = end;
 1361|  1.72M|    }
 1362|  1.72M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParserC2ER11InputSourcePN4JSON7ReactorE:
  577|  18.5k|            is(is),
  578|  18.5k|            reactor(reactor),
  579|  18.5k|            p(buf)
  580|  18.5k|        {
  581|  18.5k|        }
JSON.cc:_ZN12_GLOBAL__N_110JSONParser5parseEv:
 1317|  18.5k|{
 1318|  3.86M|    while (!done) {
  ------------------
  |  Branch (1318:12): [True: 3.84M, False: 18.5k]
  ------------------
 1319|  3.84M|        getToken();
 1320|  3.84M|        handleToken();
 1321|  3.84M|    }
 1322|  18.5k|    if (parser_state != ps_done) {
  ------------------
  |  Branch (1322:9): [True: 0, False: 18.5k]
  ------------------
 1323|      0|        QTC::TC("libtests", "JSON parse premature EOF");
 1324|      0|        throw std::runtime_error("JSON: premature end of input");
 1325|      0|    }
 1326|  18.5k|    auto const& tos = stack.back().item;
 1327|  18.5k|    if (reactor && !(tos.isArray() || tos.isDictionary())) {
  ------------------
  |  Branch (1327:9): [True: 0, False: 18.5k]
  |  Branch (1327:22): [True: 0, False: 0]
  |  Branch (1327:39): [True: 0, False: 0]
  ------------------
 1328|      0|        reactor->topLevelScalar();
 1329|      0|    }
 1330|  18.5k|    return tos;
 1331|  18.5k|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser8getTokenEv:
  807|  3.84M|{
  808|  3.84M|    token.clear();
  809|       |
  810|       |    // Keep track of UTF-16 surrogate pairs.
  811|  3.84M|    unsigned long high_surrogate = 0;
  812|  3.84M|    qpdf_offset_t high_offset = 0;
  813|       |
  814|   385M|    while (true) {
  ------------------
  |  Branch (814:12): [True: 385M, Folded]
  ------------------
  815|   385M|        if (p == (buf + bytes)) {
  ------------------
  |  Branch (815:13): [True: 58.6k, False: 385M]
  ------------------
  816|  58.6k|            p = buf;
  817|  58.6k|            bytes = is.read(buf, sizeof(buf));
  818|  58.6k|            if (bytes == 0) {
  ------------------
  |  Branch (818:17): [True: 18.5k, False: 40.1k]
  ------------------
  819|  18.5k|                done = true;
  820|  18.5k|                break;
  821|  18.5k|            }
  822|  58.6k|        }
  823|       |
  824|   385M|        if ((*p < 32 && *p >= 0)) {
  ------------------
  |  Branch (824:14): [True: 4.43M, False: 380M]
  |  Branch (824:25): [True: 1.72M, False: 2.70M]
  ------------------
  825|  1.72M|            if (*p == '\t' || *p == '\n' || *p == '\r') {
  ------------------
  |  Branch (825:17): [True: 0, False: 1.72M]
  |  Branch (825:31): [True: 1.72M, False: 0]
  |  Branch (825:45): [True: 0, False: 0]
  ------------------
  826|       |                // Legal white space not permitted in strings. This will always end the current
  827|       |                // token (unless we are still before the start of the token).
  828|  1.72M|                if (lex_state == ls_top) {
  ------------------
  |  Branch (828:21): [True: 1.69M, False: 28.6k]
  ------------------
  829|  1.69M|                    ignore();
  830|  1.69M|                } else {
  831|  28.6k|                    break;
  832|  28.6k|                }
  833|       |
  834|  1.72M|            } 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|   383M|        } else if (*p == ',') {
  ------------------
  |  Branch (839:20): [True: 1.71M, False: 381M]
  ------------------
  840|  1.71M|            if (lex_state == ls_top) {
  ------------------
  |  Branch (840:17): [True: 1.47M, False: 245k]
  ------------------
  841|  1.47M|                ignore(ls_comma);
  842|  1.47M|                return;
  843|  1.47M|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (843:24): [True: 25.0k, False: 220k]
  ------------------
  844|  25.0k|                append();
  845|   220k|            } else {
  846|   220k|                break;
  847|   220k|            }
  848|   381M|        } else if (*p == ':') {
  ------------------
  |  Branch (848:20): [True: 452k, False: 381M]
  ------------------
  849|   452k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (849:17): [True: 313k, False: 139k]
  ------------------
  850|   313k|                ignore(ls_colon);
  851|   313k|                return;
  852|   313k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (852:24): [True: 139k, False: 0]
  ------------------
  853|   139k|                append();
  854|   139k|            } else {
  855|      0|                break;
  856|      0|            }
  857|   381M|        } else if (*p == ' ') {
  ------------------
  |  Branch (857:20): [True: 13.3M, False: 368M]
  ------------------
  858|  13.3M|            if (lex_state == ls_top) {
  ------------------
  |  Branch (858:17): [True: 11.4M, False: 1.89M]
  ------------------
  859|  11.4M|                ignore();
  860|  11.4M|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (860:24): [True: 1.89M, False: 0]
  ------------------
  861|  1.89M|                append();
  862|  1.89M|            } else {
  863|      0|                break;
  864|      0|            }
  865|   368M|        } else if (*p == '{') {
  ------------------
  |  Branch (865:20): [True: 77.8k, False: 368M]
  ------------------
  866|  77.8k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (866:17): [True: 77.3k, False: 493]
  ------------------
  867|  77.3k|                token_start = offset;
  868|  77.3k|                ignore(ls_begin_dict);
  869|  77.3k|                return;
  870|  77.3k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (870:24): [True: 493, False: 0]
  ------------------
  871|    493|                append();
  872|    493|            } else {
  873|      0|                break;
  874|      0|            }
  875|   368M|        } else if (*p == '}') {
  ------------------
  |  Branch (875:20): [True: 77.7k, False: 367M]
  ------------------
  876|  77.7k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (876:17): [True: 77.2k, False: 497]
  ------------------
  877|  77.2k|                ignore(ls_end_dict);
  878|  77.2k|                return;
  879|  77.2k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (879:24): [True: 497, False: 0]
  ------------------
  880|    497|                append();
  881|    497|            } else {
  882|      0|                break;
  883|      0|            }
  884|   367M|        } else if (*p == '[') {
  ------------------
  |  Branch (884:20): [True: 58.4k, False: 367M]
  ------------------
  885|  58.4k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (885:17): [True: 49.9k, False: 8.49k]
  ------------------
  886|  49.9k|                token_start = offset;
  887|  49.9k|                ignore(ls_begin_array);
  888|  49.9k|                return;
  889|  49.9k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (889:24): [True: 8.49k, False: 0]
  ------------------
  890|  8.49k|                append();
  891|  8.49k|            } else {
  892|      0|                break;
  893|      0|            }
  894|   367M|        } else if (*p == ']') {
  ------------------
  |  Branch (894:20): [True: 53.1k, False: 367M]
  ------------------
  895|  53.1k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (895:17): [True: 49.9k, False: 3.26k]
  ------------------
  896|  49.9k|                ignore(ls_end_array);
  897|  49.9k|                return;
  898|  49.9k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (898:24): [True: 3.26k, False: 0]
  ------------------
  899|  3.26k|                append();
  900|  3.26k|            } else {
  901|      0|                break;
  902|      0|            }
  903|   367M|        } else {
  904|   367M|            switch (lex_state) {
  905|  1.78M|            case ls_top:
  ------------------
  |  Branch (905:13): [True: 1.78M, False: 366M]
  ------------------
  906|  1.78M|                token_start = offset;
  907|  1.78M|                if (*p == '"') {
  ------------------
  |  Branch (907:21): [True: 1.53M, False: 249k]
  ------------------
  908|  1.53M|                    ignore(ls_string);
  909|  1.53M|                } else if ((*p >= 'a') && (*p <= 'z')) {
  ------------------
  |  Branch (909:28): [True: 52.6k, False: 196k]
  |  Branch (909:43): [True: 52.6k, False: 0]
  ------------------
  910|  52.6k|                    append(ls_alpha);
  911|   196k|                } else if (*p == '-') {
  ------------------
  |  Branch (911:28): [True: 1.21k, False: 195k]
  ------------------
  912|  1.21k|                    append(ls_number_minus);
  913|   195k|                } else if ((*p >= '1') && (*p <= '9')) {
  ------------------
  |  Branch (913:28): [True: 111k, False: 83.3k]
  |  Branch (913:43): [True: 111k, False: 0]
  ------------------
  914|   111k|                    append(ls_number_before_point);
  915|   111k|                } else if (*p == '0') {
  ------------------
  |  Branch (915:28): [True: 83.3k, False: 2]
  ------------------
  916|  83.3k|                    append(ls_number_leading_zero);
  917|  83.3k|                } else {
  918|      2|                    QTC::TC("libtests", "JSON parse bad character");
  919|      2|                    throw std::runtime_error(
  920|      2|                        "JSON: offset " + std::to_string(offset) + ": unexpected character " +
  921|      2|                        std::string(p, 1));
  922|      2|                }
  923|  1.78M|                break;
  924|       |
  925|  1.78M|            case ls_number_minus:
  ------------------
  |  Branch (925:13): [True: 1.21k, False: 367M]
  ------------------
  926|  1.21k|                if ((*p >= '1') && (*p <= '9')) {
  ------------------
  |  Branch (926:21): [True: 1.01k, False: 206]
  |  Branch (926:36): [True: 1.01k, False: 0]
  ------------------
  927|  1.01k|                    append(ls_number_before_point);
  928|  1.01k|                } else if (*p == '0') {
  ------------------
  |  Branch (928:28): [True: 206, False: 0]
  ------------------
  929|    206|                    append(ls_number_leading_zero);
  930|    206|                } else {
  931|      0|                    QTC::TC("libtests", "JSON parse number minus no digits");
  932|      0|                    throw std::runtime_error(
  933|      0|                        "JSON: offset " + std::to_string(offset) +
  934|      0|                        ": numeric literal: no digit after minus sign");
  935|      0|                }
  936|  1.21k|                break;
  937|       |
  938|  4.75k|            case ls_number_leading_zero:
  ------------------
  |  Branch (938:13): [True: 4.75k, False: 367M]
  ------------------
  939|  4.75k|                if (*p == '.') {
  ------------------
  |  Branch (939:21): [True: 4.73k, False: 25]
  ------------------
  940|  4.73k|                    append(ls_number_point);
  941|  4.73k|                } else if (*p == 'e' || *p == 'E') {
  ------------------
  |  Branch (941:28): [True: 0, False: 25]
  |  Branch (941:41): [True: 0, False: 25]
  ------------------
  942|      0|                    append(ls_number_e);
  943|     25|                } else {
  944|     25|                    QTC::TC("libtests", "JSON parse leading zero");
  945|     25|                    throw std::runtime_error(
  946|     25|                        "JSON: offset " + std::to_string(offset) + ": number with leading zero");
  947|     25|                }
  948|  4.73k|                break;
  949|       |
  950|   168k|            case ls_number_before_point:
  ------------------
  |  Branch (950:13): [True: 168k, False: 367M]
  ------------------
  951|   168k|                if ((*p >= '0') && (*p <= '9')) {
  ------------------
  |  Branch (951:21): [True: 165k, False: 3.30k]
  |  Branch (951:36): [True: 165k, False: 0]
  ------------------
  952|   165k|                    append();
  953|   165k|                } else if (*p == '.') {
  ------------------
  |  Branch (953:28): [True: 3.30k, False: 0]
  ------------------
  954|  3.30k|                    append(ls_number_point);
  955|  3.30k|                } 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|   168k|                break;
  961|       |
  962|  8.03k|            case ls_number_point:
  ------------------
  |  Branch (962:13): [True: 8.03k, False: 367M]
  ------------------
  963|  8.03k|                if ((*p >= '0') && (*p <= '9')) {
  ------------------
  |  Branch (963:21): [True: 8.03k, False: 0]
  |  Branch (963:36): [True: 8.03k, False: 0]
  ------------------
  964|  8.03k|                    append(ls_number_after_point);
  965|  8.03k|                } else {
  966|      0|                    tokenError();
  967|      0|                }
  968|  8.03k|                break;
  969|       |
  970|   103k|            case ls_number_after_point:
  ------------------
  |  Branch (970:13): [True: 103k, False: 367M]
  ------------------
  971|   103k|                if ((*p >= '0') && (*p <= '9')) {
  ------------------
  |  Branch (971:21): [True: 103k, False: 0]
  |  Branch (971:36): [True: 103k, False: 0]
  ------------------
  972|   103k|                    append();
  973|   103k|                } 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|   103k|                break;
  979|       |
  980|      0|            case ls_number_e:
  ------------------
  |  Branch (980:13): [True: 0, False: 367M]
  ------------------
  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: 367M]
  ------------------
  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: 367M]
  ------------------
  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|   158k|            case ls_alpha:
  ------------------
  |  Branch (1007:13): [True: 158k, False: 367M]
  ------------------
 1008|   158k|                if ((*p >= 'a') && (*p <= 'z')) {
  ------------------
  |  Branch (1008:21): [True: 158k, False: 0]
  |  Branch (1008:36): [True: 158k, False: 0]
  ------------------
 1009|   158k|                    append();
 1010|   158k|                } else {
 1011|      0|                    tokenError();
 1012|      0|                }
 1013|   158k|                break;
 1014|       |
 1015|   321M|            case ls_string:
  ------------------
  |  Branch (1015:13): [True: 321M, False: 46.8M]
  ------------------
 1016|   321M|                if (*p == '"') {
  ------------------
  |  Branch (1016:21): [True: 1.53M, False: 319M]
  ------------------
 1017|  1.53M|                    if (high_offset) {
  ------------------
  |  Branch (1017:25): [True: 0, False: 1.53M]
  ------------------
 1018|      0|                        QTC::TC("libtests", "JSON 16 dangling high");
 1019|      0|                        throw std::runtime_error(
 1020|      0|                            "JSON: offset " + std::to_string(high_offset) +
 1021|      0|                            ": UTF-16 high surrogate not followed by low surrogate");
 1022|      0|                    }
 1023|  1.53M|                    ignore(ls_after_string);
 1024|  1.53M|                    return;
 1025|   319M|                } else if (*p == '\\') {
  ------------------
  |  Branch (1025:28): [True: 13.9M, False: 305M]
  ------------------
 1026|  13.9M|                    ignore(ls_backslash);
 1027|   305M|                } else {
 1028|   305M|                    append();
 1029|   305M|                }
 1030|   319M|                break;
 1031|       |
 1032|   319M|            case ls_backslash:
  ------------------
  |  Branch (1032:13): [True: 13.9M, False: 353M]
  ------------------
 1033|  13.9M|                lex_state = ls_string;
 1034|  13.9M|                switch (*p) {
 1035|  8.36k|                case '\\':
  ------------------
  |  Branch (1035:17): [True: 8.36k, False: 13.9M]
  ------------------
 1036|  50.1k|                case '\"':
  ------------------
  |  Branch (1036:17): [True: 41.7k, False: 13.8M]
  ------------------
 1037|  50.1k|                case '/':
  ------------------
  |  Branch (1037:17): [True: 0, False: 13.9M]
  ------------------
 1038|       |                    // \/ is allowed in json input, but so is /, so we don't map / to \/ in output.
 1039|  50.1k|                    token += *p;
 1040|  50.1k|                    break;
 1041|  6.10M|                case 'b':
  ------------------
  |  Branch (1041:17): [True: 6.10M, False: 7.83M]
  ------------------
 1042|  6.10M|                    token += '\b';
 1043|  6.10M|                    break;
 1044|  26.0k|                case 'f':
  ------------------
  |  Branch (1044:17): [True: 26.0k, False: 13.9M]
  ------------------
 1045|  26.0k|                    token += '\f';
 1046|  26.0k|                    break;
 1047|  41.9k|                case 'n':
  ------------------
  |  Branch (1047:17): [True: 41.9k, False: 13.8M]
  ------------------
 1048|  41.9k|                    token += '\n';
 1049|  41.9k|                    break;
 1050|    874|                case 'r':
  ------------------
  |  Branch (1050:17): [True: 874, False: 13.9M]
  ------------------
 1051|    874|                    token += '\r';
 1052|    874|                    break;
 1053|  48.5k|                case 't':
  ------------------
  |  Branch (1053:17): [True: 48.5k, False: 13.8M]
  ------------------
 1054|  48.5k|                    token += '\t';
 1055|  48.5k|                    break;
 1056|  7.66M|                case 'u':
  ------------------
  |  Branch (1056:17): [True: 7.66M, False: 6.26M]
  ------------------
 1057|  7.66M|                    lex_state = ls_u4;
 1058|  7.66M|                    u_count = 0;
 1059|  7.66M|                    u_value = 0;
 1060|  7.66M|                    break;
 1061|      0|                default:
  ------------------
  |  Branch (1061:17): [True: 0, False: 13.9M]
  ------------------
 1062|      0|                    lex_state = ls_backslash;
 1063|      0|                    tokenError();
 1064|  13.9M|                }
 1065|  13.9M|                ignore();
 1066|  13.9M|                break;
 1067|       |
 1068|  30.6M|            case ls_u4:
  ------------------
  |  Branch (1068:13): [True: 30.6M, False: 337M]
  ------------------
 1069|  30.6M|                using ui = unsigned int;
 1070|  30.6M|                if (ui val = ui(util::hex_decode_char(*p)); val < 16) {
  ------------------
  |  Branch (1070:61): [True: 30.6M, False: 0]
  ------------------
 1071|  30.6M|                    u_value = 16 * u_value + val;
 1072|  30.6M|                } else {
 1073|      0|                    tokenError();
 1074|      0|                }
 1075|  30.6M|                if (++u_count == 4) {
  ------------------
  |  Branch (1075:21): [True: 7.66M, False: 23.0M]
  ------------------
 1076|  7.66M|                    handle_u_code(u_value, offset - 5, high_surrogate, high_offset, token);
 1077|  7.66M|                    lex_state = ls_string;
 1078|  7.66M|                }
 1079|  30.6M|                ignore();
 1080|  30.6M|                break;
 1081|       |
 1082|      0|            default:
  ------------------
  |  Branch (1082:13): [True: 0, False: 367M]
  ------------------
 1083|      0|                throw std::logic_error("JSONParser::getToken : trying to handle delimiter state");
 1084|   367M|            }
 1085|   367M|        }
 1086|   385M|    }
 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|   267k|    if (!token.empty()) {
  ------------------
  |  Branch (1091:9): [True: 249k, False: 18.5k]
  ------------------
 1092|   249k|        switch (lex_state) {
 1093|      0|        case ls_top:
  ------------------
  |  Branch (1093:9): [True: 0, False: 249k]
  ------------------
 1094|       |            // Can't happen
 1095|      0|            throw std::logic_error("tok_start set in ls_top while parsing");
 1096|      0|            break;
 1097|       |
 1098|  78.8k|        case ls_number_leading_zero:
  ------------------
  |  Branch (1098:9): [True: 78.8k, False: 170k]
  ------------------
 1099|   188k|        case ls_number_before_point:
  ------------------
  |  Branch (1099:9): [True: 109k, False: 139k]
  ------------------
 1100|   196k|        case ls_number_after_point:
  ------------------
  |  Branch (1100:9): [True: 8.03k, False: 241k]
  ------------------
 1101|   196k|            lex_state = ls_number;
 1102|   196k|            break;
 1103|       |
 1104|      0|        case ls_number:
  ------------------
  |  Branch (1104:9): [True: 0, False: 249k]
  ------------------
 1105|  52.6k|        case ls_alpha:
  ------------------
  |  Branch (1105:9): [True: 52.6k, False: 196k]
  ------------------
 1106|       |            // terminal state
 1107|  52.6k|            break;
 1108|       |
 1109|      0|        default:
  ------------------
  |  Branch (1109:9): [True: 0, False: 249k]
  ------------------
 1110|      0|            tokenError();
 1111|   249k|        }
 1112|   249k|    }
 1113|   267k|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser6ignoreEv:
  790|  57.7M|{
  791|  57.7M|    ++p;
  792|  57.7M|    ++offset;
  793|  57.7M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser6ignoreENS0_11lex_state_eE:
  799|  19.0M|{
  800|  19.0M|    lex_state = next;
  801|  19.0M|    ++p;
  802|  19.0M|    ++offset;
  803|  19.0M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser6appendEv:
  770|   308M|{
  771|   308M|    token += *p;
  772|   308M|    ++p;
  773|   308M|    ++offset;
  774|   308M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser6appendENS0_11lex_state_eE:
  780|   266k|{
  781|   266k|    lex_state = next;
  782|   266k|    token += *p;
  783|   266k|    ++p;
  784|   266k|    ++offset;
  785|   266k|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser13handle_u_codeEmxRmRxRNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  674|  7.66M|{
  675|  7.66M|    if ((codepoint & 0xFC00) == 0xD800) {
  ------------------
  |  Branch (675:9): [True: 0, False: 7.66M]
  ------------------
  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|  7.66M|    } else if ((codepoint & 0xFC00) == 0xDC00) {
  ------------------
  |  Branch (687:16): [True: 0, False: 7.66M]
  ------------------
  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|  7.66M|    } else {
  699|  7.66M|        result += QUtil::toUTF8(codepoint);
  700|  7.66M|    }
  701|  7.66M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser11handleTokenEv:
 1117|  3.84M|{
 1118|  3.84M|    if (lex_state == ls_top) {
  ------------------
  |  Branch (1118:9): [True: 18.5k, False: 3.82M]
  ------------------
 1119|  18.5k|        return;
 1120|  18.5k|    }
 1121|       |
 1122|  3.82M|    if (parser_state == ps_done) {
  ------------------
  |  Branch (1122:9): [True: 0, False: 3.82M]
  ------------------
 1123|      0|        QTC::TC("libtests", "JSON parse junk after object");
 1124|      0|        throw std::runtime_error(
 1125|      0|            "JSON: offset " + std::to_string(offset) +
 1126|      0|            ": material follows end of object: " + token);
 1127|      0|    }
 1128|       |
 1129|  3.82M|    const static JSON null_item = JSON::makeNull();
 1130|  3.82M|    JSON item;
 1131|  3.82M|    auto tos = stack.empty() ? null_item : stack.back().item;
  ------------------
  |  Branch (1131:16): [True: 18.5k, False: 3.80M]
  ------------------
 1132|  3.82M|    auto ls = lex_state;
 1133|  3.82M|    lex_state = ls_top;
 1134|       |
 1135|  3.82M|    switch (ls) {
 1136|  77.3k|    case ls_begin_dict:
  ------------------
  |  Branch (1136:5): [True: 77.3k, False: 3.74M]
  ------------------
 1137|  77.3k|        item = JSON::makeDictionary();
 1138|  77.3k|        break;
 1139|       |
 1140|  49.9k|    case ls_begin_array:
  ------------------
  |  Branch (1140:5): [True: 49.9k, False: 3.77M]
  ------------------
 1141|  49.9k|        item = JSON::makeArray();
 1142|  49.9k|        break;
 1143|       |
 1144|   313k|    case ls_colon:
  ------------------
  |  Branch (1144:5): [True: 313k, False: 3.51M]
  ------------------
 1145|   313k|        if (parser_state != ps_dict_after_key) {
  ------------------
  |  Branch (1145:13): [True: 0, False: 313k]
  ------------------
 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|   313k|        parser_state = ps_dict_after_colon;
 1151|   313k|        return;
 1152|       |
 1153|  1.47M|    case ls_comma:
  ------------------
  |  Branch (1153:5): [True: 1.47M, False: 2.35M]
  ------------------
 1154|  1.47M|        if (!((parser_state == ps_dict_after_item) || (parser_state == ps_array_after_item))) {
  ------------------
  |  Branch (1154:15): [True: 249k, False: 1.22M]
  |  Branch (1154:55): [True: 1.22M, False: 0]
  ------------------
 1155|      0|            QTC::TC("libtests", "JSON parse unexpected ,");
 1156|      0|            throw std::runtime_error(
 1157|      0|                "JSON: offset " + std::to_string(offset) + ": unexpected comma");
 1158|      0|        }
 1159|  1.47M|        if (parser_state == ps_dict_after_item) {
  ------------------
  |  Branch (1159:13): [True: 249k, False: 1.22M]
  ------------------
 1160|   249k|            parser_state = ps_dict_after_comma;
 1161|  1.22M|        } else if (parser_state == ps_array_after_item) {
  ------------------
  |  Branch (1161:20): [True: 1.22M, False: 0]
  ------------------
 1162|  1.22M|            parser_state = ps_array_after_comma;
 1163|  1.22M|        } else {
 1164|      0|            throw std::logic_error("JSONParser::handleToken: unexpected parser state for comma");
 1165|      0|        }
 1166|  1.47M|        return;
 1167|       |
 1168|  1.47M|    case ls_end_array:
  ------------------
  |  Branch (1168:5): [True: 49.9k, False: 3.77M]
  ------------------
 1169|  49.9k|        if (!(parser_state == ps_array_begin || parser_state == ps_array_after_item)) {
  ------------------
  |  Branch (1169:15): [True: 421, False: 49.4k]
  |  Branch (1169:49): [True: 49.4k, 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|  49.9k|        parser_state = stack.back().state;
 1175|  49.9k|        tos.setEnd(offset);
 1176|  49.9k|        if (reactor) {
  ------------------
  |  Branch (1176:13): [True: 0, False: 49.9k]
  ------------------
 1177|      0|            reactor->containerEnd(tos);
 1178|      0|        }
 1179|  49.9k|        if (parser_state != ps_done) {
  ------------------
  |  Branch (1179:13): [True: 49.9k, False: 0]
  ------------------
 1180|  49.9k|            stack.pop_back();
 1181|  49.9k|        }
 1182|  49.9k|        return;
 1183|       |
 1184|  77.2k|    case ls_end_dict:
  ------------------
  |  Branch (1184:5): [True: 77.2k, False: 3.74M]
  ------------------
 1185|  77.2k|        if (!((parser_state == ps_dict_begin) || (parser_state == ps_dict_after_item))) {
  ------------------
  |  Branch (1185:15): [True: 13.3k, False: 63.9k]
  |  Branch (1185:50): [True: 63.9k, 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|  77.2k|        parser_state = stack.back().state;
 1191|  77.2k|        tos.setEnd(offset);
 1192|  77.2k|        if (reactor) {
  ------------------
  |  Branch (1192:13): [True: 0, False: 77.2k]
  ------------------
 1193|      0|            reactor->containerEnd(tos);
 1194|      0|        }
 1195|  77.2k|        if (parser_state != ps_done) {
  ------------------
  |  Branch (1195:13): [True: 58.7k, False: 18.5k]
  ------------------
 1196|  58.7k|            stack.pop_back();
 1197|  58.7k|        }
 1198|  77.2k|        return;
 1199|       |
 1200|   196k|    case ls_number:
  ------------------
  |  Branch (1200:5): [True: 196k, False: 3.63M]
  ------------------
 1201|   196k|        item = JSON::makeNumber(token);
 1202|   196k|        break;
 1203|       |
 1204|  52.6k|    case ls_alpha:
  ------------------
  |  Branch (1204:5): [True: 52.6k, False: 3.77M]
  ------------------
 1205|  52.6k|        if (token == "true") {
  ------------------
  |  Branch (1205:13): [True: 3.04k, False: 49.6k]
  ------------------
 1206|  3.04k|            item = JSON::makeBool(true);
 1207|  49.6k|        } else if (token == "false") {
  ------------------
  |  Branch (1207:20): [True: 463, False: 49.1k]
  ------------------
 1208|    463|            item = JSON::makeBool(false);
 1209|  49.1k|        } else if (token == "null") {
  ------------------
  |  Branch (1209:20): [True: 49.1k, False: 0]
  ------------------
 1210|  49.1k|            item = JSON::makeNull();
 1211|  49.1k|        } else {
 1212|      0|            QTC::TC("libtests", "JSON parse invalid keyword");
 1213|      0|            throw std::runtime_error(
 1214|      0|                "JSON: offset " + std::to_string(offset) + ": invalid keyword " + token);
 1215|      0|        }
 1216|  52.6k|        break;
 1217|       |
 1218|  1.53M|    case ls_after_string:
  ------------------
  |  Branch (1218:5): [True: 1.53M, False: 2.28M]
  ------------------
 1219|  1.53M|        if (parser_state == ps_dict_begin || parser_state == ps_dict_after_comma) {
  ------------------
  |  Branch (1219:13): [True: 64.0k, False: 1.47M]
  |  Branch (1219:46): [True: 249k, False: 1.22M]
  ------------------
 1220|   313k|            dict_key = token;
 1221|   313k|            dict_key_offset = token_start;
 1222|   313k|            parser_state = ps_dict_after_key;
 1223|   313k|            return;
 1224|  1.22M|        } else {
 1225|  1.22M|            item = JSON::makeString(token);
 1226|  1.22M|        }
 1227|  1.22M|        break;
 1228|       |
 1229|  1.22M|    default:
  ------------------
  |  Branch (1229:5): [True: 0, False: 3.82M]
  ------------------
 1230|      0|        throw std::runtime_error(
 1231|      0|            "JSON: offset " + std::to_string(offset) + ": premature end of input");
 1232|      0|        break;
 1233|  3.82M|    }
 1234|       |
 1235|  1.60M|    item.setStart(token_start);
 1236|  1.60M|    item.setEnd(offset);
 1237|       |
 1238|  1.60M|    switch (parser_state) {
  ------------------
  |  Branch (1238:13): [True: 1.60M, False: 0]
  ------------------
 1239|      0|    case ps_dict_begin:
  ------------------
  |  Branch (1239:5): [True: 0, False: 1.60M]
  ------------------
 1240|      0|    case ps_dict_after_comma:
  ------------------
  |  Branch (1240:5): [True: 0, False: 1.60M]
  ------------------
 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|   313k|    case ps_dict_after_colon:
  ------------------
  |  Branch (1246:5): [True: 313k, False: 1.28M]
  ------------------
 1247|   313k|        if (!reactor || !reactor->dictionaryItem(dict_key, item)) {
  ------------------
  |  Branch (1247:13): [True: 313k, False: 0]
  |  Branch (1247:25): [True: 0, False: 0]
  ------------------
 1248|   313k|            tos.addDictionaryMember(dict_key, item);
 1249|   313k|        }
 1250|   313k|        parser_state = ps_dict_after_item;
 1251|   313k|        break;
 1252|       |
 1253|  49.5k|    case ps_array_begin:
  ------------------
  |  Branch (1253:5): [True: 49.5k, False: 1.55M]
  ------------------
 1254|  1.26M|    case ps_array_after_comma:
  ------------------
  |  Branch (1254:5): [True: 1.22M, False: 381k]
  ------------------
 1255|  1.26M|        if (!reactor || !reactor->arrayItem(item)) {
  ------------------
  |  Branch (1255:13): [True: 1.26M, False: 0]
  |  Branch (1255:25): [True: 0, False: 0]
  ------------------
 1256|  1.26M|            tos.addArrayElement(item);
 1257|  1.26M|        }
 1258|  1.26M|        parser_state = ps_array_after_item;
 1259|  1.26M|        break;
 1260|       |
 1261|  18.5k|    case ps_top:
  ------------------
  |  Branch (1261:5): [True: 18.5k, False: 1.58M]
  ------------------
 1262|  18.5k|        if (!(item.isDictionary() || item.isArray())) {
  ------------------
  |  Branch (1262:15): [True: 18.5k, 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|  18.5k|        parser_state = ps_done;
 1268|  18.5k|        break;
 1269|       |
 1270|      0|    case ps_dict_after_key:
  ------------------
  |  Branch (1270:5): [True: 0, False: 1.60M]
  ------------------
 1271|      0|        QTC::TC("libtests", "JSON parse expected colon");
 1272|      0|        throw std::runtime_error("JSON: offset " + std::to_string(offset) + ": expected ':'");
 1273|      0|        break;
 1274|       |
 1275|      0|    case ps_dict_after_item:
  ------------------
  |  Branch (1275:5): [True: 0, False: 1.60M]
  ------------------
 1276|      0|        QTC::TC("libtests", "JSON parse expected , or }");
 1277|      0|        throw std::runtime_error(
 1278|      0|            "JSON: offset " + std::to_string(offset) + ": expected ',' or '}'");
 1279|      0|        break;
 1280|       |
 1281|      0|    case ps_array_after_item:
  ------------------
  |  Branch (1281:5): [True: 0, False: 1.60M]
  ------------------
 1282|      0|        QTC::TC("libtests", "JSON parse expected, or ]");
 1283|      0|        throw std::runtime_error(
 1284|      0|            "JSON: offset " + std::to_string(offset) + ": expected ',' or ']'");
 1285|      0|        break;
 1286|       |
 1287|      0|    case ps_done:
  ------------------
  |  Branch (1287:5): [True: 0, False: 1.60M]
  ------------------
 1288|      0|        throw std::logic_error("JSONParser::handleToken: unexpected parser state");
 1289|  1.60M|    }
 1290|       |
 1291|  1.60M|    if (item.isDictionary() || item.isArray()) {
  ------------------
  |  Branch (1291:9): [True: 77.3k, False: 1.52M]
  |  Branch (1291:32): [True: 49.9k, False: 1.47M]
  ------------------
 1292|   127k|        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|   127k|        if (item.isDictionary()) {
  ------------------
  |  Branch (1296:13): [True: 77.3k, False: 49.9k]
  ------------------
 1297|  77.3k|            if (reactor) {
  ------------------
  |  Branch (1297:17): [True: 0, False: 77.3k]
  ------------------
 1298|      0|                reactor->dictionaryStart();
 1299|      0|            }
 1300|  77.3k|            parser_state = ps_dict_begin;
 1301|  77.3k|        } else if (item.isArray()) {
  ------------------
  |  Branch (1301:20): [True: 49.9k, False: 0]
  ------------------
 1302|  49.9k|            if (reactor) {
  ------------------
  |  Branch (1302:17): [True: 0, False: 49.9k]
  ------------------
 1303|      0|                reactor->arrayStart();
 1304|      0|            }
 1305|  49.9k|            parser_state = ps_array_begin;
 1306|  49.9k|        }
 1307|       |
 1308|   127k|        if (stack.size() > 500) {
  ------------------
  |  Branch (1308:13): [True: 0, False: 127k]
  ------------------
 1309|      0|            throw std::runtime_error(
 1310|      0|                "JSON: offset " + std::to_string(offset) + ": maximum object depth exceeded");
 1311|      0|        }
 1312|   127k|    }
 1313|  1.60M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser10StackFrameC2ENS0_14parser_state_eER4JSON:
  625|   127k|                state(state),
  626|   127k|                item(item)
  627|   127k|            {
  628|   127k|            }

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

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

_ZN10NNTreeImpl4warnERK16QPDFObjectHandleRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   32|  6.80k|{
   33|  6.80k|    qpdf.warn(qpdf_e_damaged_pdf, get_description(node), 0, msg);
   34|  6.80k|    if (++error_count > 5 && qpdf.doc().reconstructed_xref()) {
  ------------------
  |  Branch (34:9): [True: 3.23k, False: 3.56k]
  |  Branch (34:30): [True: 2.09k, False: 1.14k]
  ------------------
   35|  2.09k|        error(node, "too many errors - giving up");
   36|  2.09k|    }
   37|  6.80k|}
_ZNK10NNTreeImpl5errorERK16QPDFObjectHandleRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   41|  3.61k|{
   42|  3.61k|    throw QPDFExc(qpdf_e_damaged_pdf, qpdf.getFilename(), get_description(node), 0, msg);
   43|  3.61k|}
_ZN14NNTreeIterator12updateIValueEb:
   47|  78.1k|{
   48|       |    // ivalue should never be used inside the class since we return a pointer/reference to it. Every
   49|       |    // bit of code that ever changes what object the iterator points to should take care to call
   50|       |    // updateIValue. Failure to do this means that any old references to *iter will point to
   51|       |    // incorrect objects, though the next dereference of the iterator will fix it. This isn't
   52|       |    // necessarily catastrophic, but it would be confusing. The test suite attempts to exercise
   53|       |    // various cases to ensure we don't introduce that bug in the future, but sadly it's tricky to
   54|       |    // verify by reasoning about the code that this constraint is always satisfied. Whenever we
   55|       |    // update what the iterator points to, we should call setItemNumber, which calls this. If we
   56|       |    // change what the iterator points to in some other way, such as replacing a value or removing
   57|       |    // an item and making the iterator point at a different item in potentially the same position,
   58|       |    // we must call updateIValue as well. These cases are handled, and for good measure, we also
   59|       |    // call updateIValue in operator* and operator->.
   60|       |
   61|  78.1k|    Array items = node[impl.itemsKey()];
   62|  78.1k|    ivalue.first = items[item_number];
   63|  78.1k|    ivalue.second = items[item_number + 1];
   64|  78.1k|    if (ivalue.second) {
  ------------------
  |  Branch (64:9): [True: 76.0k, False: 2.14k]
  ------------------
   65|  76.0k|        return;
   66|  76.0k|    }
   67|       |
   68|  2.14k|    if (item_number < 0 || !node) {
  ------------------
  |  Branch (68:9): [True: 2.09k, False: 49]
  |  Branch (68:28): [True: 0, False: 49]
  ------------------
   69|  2.09k|        util::assertion(
   70|  2.09k|            allow_invalid, "attempt made to dereference an invalid name/number tree iterator");
   71|  2.09k|        return;
   72|  2.09k|    }
   73|     49|    impl.error(node, "update ivalue: items array is too short");
   74|     49|}
_ZN14NNTreeIterator10getNextKidERNS_11PathElementEb:
   78|  1.10k|{
   79|  1.96k|    while (true) {
  ------------------
  |  Branch (79:12): [True: 1.86k, Folded]
  ------------------
   80|  1.86k|        pe.kid_number += backward ? -1 : 1;
  ------------------
  |  Branch (80:26): [True: 0, False: 1.86k]
  ------------------
   81|  1.86k|        Dictionary result = pe.node["/Kids"][pe.kid_number];
   82|  1.86k|        if (result.contains("/Kids") || result.contains(impl.itemsKey())) {
  ------------------
  |  Branch (82:13): [True: 201, False: 1.66k]
  |  Branch (82:13): [True: 492, False: 1.37k]
  |  Branch (82:41): [True: 291, False: 1.37k]
  ------------------
   83|    492|            return result;
   84|    492|        }
   85|  1.37k|        if (pe.kid_number < 0 || std::cmp_greater_equal(pe.kid_number, pe.node["/Kids"].size())) {
  ------------------
  |  Branch (85:13): [True: 0, False: 1.37k]
  |  Branch (85:13): [True: 506, False: 865]
  |  Branch (85:34): [True: 506, False: 865]
  ------------------
   86|    506|            return {};
   87|    506|        }
   88|    865|        impl.warn(pe.node, "skipping over invalid kid at index " + std::to_string(pe.kid_number));
   89|    865|    }
   90|  1.10k|}
_ZN14NNTreeIterator9incrementEb:
   93|  29.4k|{
   94|  29.4k|    if (item_number < 0) {
  ------------------
  |  Branch (94:9): [True: 0, False: 29.4k]
  ------------------
   95|      0|        deepen(impl.tree_root, !backward, true);
   96|      0|        return;
   97|      0|    }
   98|       |
   99|  32.5k|    while (valid()) {
  ------------------
  |  Branch (99:12): [True: 31.6k, False: 974]
  ------------------
  100|  31.6k|        item_number += backward ? -2 : 2;
  ------------------
  |  Branch (100:24): [True: 0, False: 31.6k]
  ------------------
  101|  31.6k|        Array items = node[impl.itemsKey()];
  102|  31.6k|        if (item_number < 0 || std::cmp_greater_equal(item_number, items.size())) {
  ------------------
  |  Branch (102:13): [True: 0, False: 31.6k]
  |  Branch (102:32): [True: 1.23k, False: 30.3k]
  ------------------
  103|  1.23k|            setItemNumber(QPDFObjectHandle(), -1);
  104|  1.95k|            while (!path.empty()) {
  ------------------
  |  Branch (104:20): [True: 1.10k, False: 848]
  ------------------
  105|  1.10k|                auto& element = path.back();
  106|  1.10k|                if (auto pe_node = getNextKid(element, backward)) {
  ------------------
  |  Branch (106:26): [True: 492, False: 610]
  ------------------
  107|    492|                    if (deepen(pe_node, !backward, false)) {
  ------------------
  |  Branch (107:25): [True: 387, False: 105]
  ------------------
  108|    387|                        break;
  109|    387|                    }
  110|    610|                } else {
  111|    610|                    path.pop_back();
  112|    610|                }
  113|  1.10k|            }
  114|  1.23k|        }
  115|  31.6k|        if (item_number >= 0) {
  ------------------
  |  Branch (115:13): [True: 30.7k, False: 848]
  ------------------
  116|  30.7k|            items = node[impl.itemsKey()];
  117|  30.7k|            if (std::cmp_greater_equal(item_number + 1, items.size())) {
  ------------------
  |  Branch (117:17): [True: 362, False: 30.4k]
  ------------------
  118|    362|                impl.warn(node, "items array doesn't have enough elements");
  119|  30.4k|            } else if (!impl.keyValid(items[item_number])) {
  ------------------
  |  Branch (119:24): [True: 1.11k, False: 29.3k]
  ------------------
  120|  1.11k|                impl.warn(node, ("item " + std::to_string(item_number) + " has the wrong type"));
  121|  29.3k|            } else if (!impl.value_valid(items[item_number + 1])) {
  ------------------
  |  Branch (121:24): [True: 869, False: 28.4k]
  ------------------
  122|    869|                impl.warn(node, "item " + std::to_string(item_number + 1) + " is invalid");
  123|  28.4k|            } else {
  124|  28.4k|                return;
  125|  28.4k|            }
  126|  30.7k|        }
  127|  31.6k|    }
  128|  29.4k|}
_ZN14NNTreeIterator11resetLimitsEN4qpdf10DictionaryENSt3__115__list_iteratorINS_11PathElementEPvEE:
  132|  5.91k|{
  133|  5.91k|    while (true) {
  ------------------
  |  Branch (133:12): [True: 5.91k, Folded]
  ------------------
  134|  5.91k|        if (parent == path.end()) {
  ------------------
  |  Branch (134:13): [True: 3.13k, False: 2.78k]
  ------------------
  135|  3.13k|            a_node.erase("/Limits");
  136|  3.13k|            return;
  137|  3.13k|        }
  138|       |
  139|  2.78k|        QPDFObjectHandle first;
  140|  2.78k|        QPDFObjectHandle last;
  141|  2.78k|        Array items = a_node[impl.itemsKey()];
  142|  2.78k|        size_t nitems = items.size();
  143|  2.78k|        if (nitems >= 2) {
  ------------------
  |  Branch (143:13): [True: 2.65k, False: 127]
  ------------------
  144|  2.65k|            first = items[0];
  145|  2.65k|            last = items[(nitems - 1u) & ~1u];
  146|  2.65k|        } else {
  147|    127|            Array kids = a_node["/Kids"];
  148|    127|            size_t nkids = kids.size();
  149|    127|            if (nkids > 0) {
  ------------------
  |  Branch (149:17): [True: 127, False: 0]
  ------------------
  150|    127|                Array first_limits = kids[0]["/Limits"];
  151|    127|                if (first_limits.size() >= 2) {
  ------------------
  |  Branch (151:21): [True: 127, False: 0]
  ------------------
  152|    127|                    first = first_limits[0];
  153|    127|                    last = kids[nkids - 1u]["/Limits"][1];
  154|    127|                }
  155|    127|            }
  156|    127|        }
  157|  2.78k|        if (!(first && last)) {
  ------------------
  |  Branch (157:15): [True: 2.78k, False: 0]
  |  Branch (157:24): [True: 2.78k, False: 0]
  ------------------
  158|      0|            impl.warn(a_node, "unable to determine limits");
  159|  2.78k|        } else {
  160|  2.78k|            Array olimits = a_node["/Limits"];
  161|  2.78k|            if (olimits.size() == 2) {
  ------------------
  |  Branch (161:17): [True: 2.42k, False: 352]
  ------------------
  162|  2.42k|                auto ofirst = olimits[0];
  163|  2.42k|                auto olast = olimits[1];
  164|  2.42k|                if (impl.keyValid(ofirst) && impl.keyValid(olast) &&
  ------------------
  |  Branch (164:21): [True: 2.42k, False: 0]
  |  Branch (164:21): [True: 0, False: 2.42k]
  |  Branch (164:46): [True: 2.42k, False: 0]
  ------------------
  165|  2.42k|                    impl.compareKeys(first, ofirst) == 0 && impl.compareKeys(last, olast) == 0) {
  ------------------
  |  Branch (165:21): [True: 2.42k, False: 0]
  |  Branch (165:61): [True: 0, False: 2.42k]
  ------------------
  166|      0|                    return;
  167|      0|                }
  168|  2.42k|            }
  169|  2.78k|            if (a_node != path.begin()->node) {
  ------------------
  |  Branch (169:17): [True: 2.65k, False: 127]
  ------------------
  170|  2.65k|                a_node.replace("/Limits", Array({first, last}));
  171|  2.65k|            }
  172|  2.78k|        }
  173|       |
  174|  2.78k|        if (parent == path.begin()) {
  ------------------
  |  Branch (174:13): [True: 2.78k, False: 0]
  ------------------
  175|  2.78k|            return;
  176|  2.78k|        }
  177|      0|        a_node = parent->node;
  178|      0|        --parent;
  179|      0|    }
  180|  5.91k|}
_ZN14NNTreeIterator5splitEN4qpdf10DictionaryENSt3__115__list_iteratorINS_11PathElementEPvEE:
  184|  5.56k|{
  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|  5.56k|    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|  5.56k|    Array kids = to_split["/Kids"];
  216|  5.56k|    size_t nkids = kids.size();
  217|  5.56k|    Array items = to_split[impl.itemsKey()];
  218|  5.56k|    size_t nitems = items.size();
  219|       |
  220|  5.56k|    Array first_half;
  221|  5.56k|    size_t n = 0;
  222|  5.56k|    std::string key;
  223|  5.56k|    size_t threshold = static_cast<size_t>(impl.split_threshold);
  224|  5.56k|    if (nkids > 0) {
  ------------------
  |  Branch (224:9): [True: 127, False: 5.43k]
  ------------------
  225|    127|        first_half = kids;
  226|    127|        n = nkids;
  227|    127|        key = "/Kids";
  228|  5.43k|    } else {
  229|  5.43k|        util::assertion(nitems > 0, "NNTreeIterator::split called on invalid node");
  230|  5.43k|        first_half = items;
  231|  5.43k|        n = nitems;
  232|  5.43k|        threshold *= 2;
  233|  5.43k|        key = impl.itemsKey();
  234|  5.43k|    }
  235|       |
  236|  5.56k|    if (n <= threshold) {
  ------------------
  |  Branch (236:9): [True: 5.38k, False: 176]
  ------------------
  237|  5.38k|        return;
  238|  5.38k|    }
  239|       |
  240|    176|    bool is_root = parent == path.end();
  241|    176|    bool is_leaf = nitems > 0;
  242|       |
  243|       |    // CURRENT STATE: tree is in original state; iterator is valid and unchanged.
  244|       |
  245|    176|    if (is_root) {
  ------------------
  |  Branch (245:9): [True: 49, False: 127]
  ------------------
  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|     49|        Dictionary first_node = impl.qpdf.makeIndirectObject(Dictionary({{key, first_half}}));
  261|     49|        auto new_kids = Array::empty();
  262|     49|        new_kids.push_back(first_node);
  263|     49|        to_split.erase("/Limits"); // already shouldn't be there for root
  264|     49|        to_split.erase(impl.itemsKey());
  265|     49|        to_split.replace("/Kids", new_kids);
  266|     49|        if (is_leaf) {
  ------------------
  |  Branch (266:13): [True: 49, False: 0]
  ------------------
  267|     49|            node = first_node;
  268|     49|        } else {
  269|      0|            auto next = path.begin();
  270|      0|            next->node = first_node;
  271|      0|        }
  272|     49|        this->path.emplace_front(to_split, 0);
  273|     49|        parent = path.begin();
  274|     49|        to_split = first_node;
  275|     49|    }
  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|    176|    auto second_half = Array::empty();
  283|    176|    auto start_idx = static_cast<int>((n / 2) & ~1u);
  284|  6.16k|    while (std::cmp_greater(first_half.size(), start_idx)) {
  ------------------
  |  Branch (284:12): [True: 5.98k, False: 176]
  ------------------
  285|  5.98k|        second_half.push_back(first_half[start_idx]);
  286|  5.98k|        first_half.erase(start_idx);
  287|  5.98k|    }
  288|    176|    resetLimits(to_split, parent);
  289|       |
  290|       |    // Create a new node to contain the second half
  291|    176|    Dictionary second_node = impl.qpdf.makeIndirectObject(Dictionary({{key, second_half}}));
  292|    176|    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|    176|    Array parent_kids = parent->node["/Kids"];
  303|    176|    if (!parent_kids) {
  ------------------
  |  Branch (303:9): [True: 0, False: 176]
  ------------------
  304|      0|        impl.error(parent->node, "parent node has no /Kids array");
  305|      0|    }
  306|    176|    parent_kids.insert(parent->kid_number + 1, second_node);
  307|    176|    auto cur_elem = parent;
  308|    176|    ++cur_elem; // points to end() for leaf nodes
  309|    176|    int old_idx = (is_leaf ? item_number : cur_elem->kid_number);
  ------------------
  |  Branch (309:20): [True: 176, False: 0]
  ------------------
  310|    176|    if (old_idx >= start_idx) {
  ------------------
  |  Branch (310:9): [True: 176, False: 0]
  ------------------
  311|    176|        ++parent->kid_number;
  312|    176|        if (is_leaf) {
  ------------------
  |  Branch (312:13): [True: 176, False: 0]
  ------------------
  313|    176|            setItemNumber(second_node, item_number - start_idx);
  314|    176|        } else {
  315|      0|            cur_elem->node = second_node;
  316|      0|            cur_elem->kid_number -= start_idx;
  317|      0|        }
  318|    176|    }
  319|    176|    if (!is_root) {
  ------------------
  |  Branch (319:9): [True: 127, False: 49]
  ------------------
  320|    127|        auto next = parent->node;
  321|    127|        resetLimits(next, parent);
  322|    127|        --parent;
  323|    127|        split(next, parent);
  324|    127|    }
  325|    176|}
_ZN14NNTreeIterator15lastPathElementEv:
  329|  10.8k|{
  330|  10.8k|    return path.empty() ? path.end() : std::prev(path.end());
  ------------------
  |  Branch (330:12): [True: 6.26k, False: 4.60k]
  ------------------
  331|  10.8k|}
_ZN14NNTreeIterator11insertAfterERK16QPDFObjectHandleS2_:
  335|  5.08k|{
  336|  5.08k|    if (!valid()) {
  ------------------
  |  Branch (336:9): [True: 0, False: 5.08k]
  ------------------
  337|      0|        impl.insertFirst(key, value);
  338|      0|        deepen(impl.tree_root, true, false);
  339|      0|        return;
  340|      0|    }
  341|       |
  342|  5.08k|    Array items = node[impl.itemsKey()];
  343|  5.08k|    if (!items) {
  ------------------
  |  Branch (343:9): [True: 0, False: 5.08k]
  ------------------
  344|      0|        impl.error(node, "node contains no items array");
  345|      0|    }
  346|       |
  347|  5.08k|    if (std::cmp_less(items.size(), item_number + 2)) {
  ------------------
  |  Branch (347:9): [True: 0, False: 5.08k]
  ------------------
  348|      0|        impl.error(node, "insert: items array is too short");
  349|      0|    }
  350|  5.08k|    if (!(key && value)) {
  ------------------
  |  Branch (350:11): [True: 5.08k, False: 0]
  |  Branch (350:18): [True: 5.08k, False: 0]
  ------------------
  351|      0|        impl.error(node, "insert: key or value is null");
  352|      0|    }
  353|  5.08k|    if (!impl.value_valid(value)) {
  ------------------
  |  Branch (353:9): [True: 0, False: 5.08k]
  ------------------
  354|      0|        impl.error(node, "insert: value is invalid");
  355|      0|    }
  356|  5.08k|    items.insert(item_number + 2, key);
  357|  5.08k|    items.insert(item_number + 3, value);
  358|  5.08k|    resetLimits(node, lastPathElement());
  359|  5.08k|    split(node, lastPathElement());
  360|  5.08k|    increment(false);
  361|  5.08k|}
_ZNK14NNTreeIteratoreqERKS_:
  455|  28.4k|{
  456|  28.4k|    if (item_number == -1 && other.item_number == -1) {
  ------------------
  |  Branch (456:9): [True: 2.47k, False: 25.9k]
  |  Branch (456:30): [True: 2.47k, False: 0]
  ------------------
  457|  2.47k|        return true;
  458|  2.47k|    }
  459|  25.9k|    if (path.size() != other.path.size()) {
  ------------------
  |  Branch (459:9): [True: 2.92k, False: 23.0k]
  ------------------
  460|  2.92k|        return false;
  461|  2.92k|    }
  462|  23.0k|    auto tpi = path.begin();
  463|  23.0k|    auto opi = other.path.begin();
  464|  23.0k|    while (tpi != path.end()) {
  ------------------
  |  Branch (464:12): [True: 0, False: 23.0k]
  ------------------
  465|      0|        if (tpi->kid_number != opi->kid_number) {
  ------------------
  |  Branch (465:13): [True: 0, False: 0]
  ------------------
  466|      0|            return false;
  467|      0|        }
  468|      0|        ++tpi;
  469|      0|        ++opi;
  470|      0|    }
  471|  23.0k|    return item_number == other.item_number;
  472|  23.0k|}
_ZN14NNTreeIterator6deepenEN4qpdf10DictionaryEbb:
  476|  12.1k|{
  477|       |    // Starting at this node, descend through the first or last kid until we reach a node with
  478|       |    // items. If we succeed, return true; otherwise return false and leave path alone.
  479|       |
  480|  12.1k|    auto opath = path;
  481|       |
  482|  12.1k|    auto fail = [this, &opath](Dictionary const& failed_node, std::string const& msg) {
  483|  12.1k|        impl.warn(failed_node, msg);
  484|  12.1k|        path = opath;
  485|  12.1k|        return false;
  486|  12.1k|    };
  487|       |
  488|  12.1k|    QPDFObjGen::set seen;
  489|  12.1k|    for (auto const& i: path) {
  ------------------
  |  Branch (489:23): [True: 955, False: 12.1k]
  ------------------
  490|    955|        seen.add(i.node);
  491|    955|    }
  492|  18.4k|    while (true) {
  ------------------
  |  Branch (492:12): [True: 18.4k, Folded]
  ------------------
  493|  18.4k|        if (!seen.add(a_node)) {
  ------------------
  |  Branch (493:13): [True: 172, False: 18.2k]
  ------------------
  494|    172|            return fail(a_node, "loop detected while traversing name/number tree");
  495|    172|        }
  496|       |
  497|  18.2k|        if (!a_node) {
  ------------------
  |  Branch (497:13): [True: 0, False: 18.2k]
  ------------------
  498|      0|            return fail(a_node, "non-dictionary node while traversing name/number tree");
  499|      0|        }
  500|       |
  501|  18.2k|        Array items = a_node[impl.itemsKey()];
  502|  18.2k|        int nitems = static_cast<int>(items.size());
  503|  18.2k|        if (nitems > 1) {
  ------------------
  |  Branch (503:13): [True: 9.71k, False: 8.54k]
  ------------------
  504|  9.71k|            setItemNumber(a_node, first ? 0 : nitems - 2);
  ------------------
  |  Branch (504:35): [True: 9.71k, False: 0]
  ------------------
  505|  9.71k|            return true;
  506|  9.71k|        }
  507|       |
  508|  8.54k|        Array kids = a_node["/Kids"];
  509|  8.54k|        int nkids = static_cast<int>(kids.size());
  510|  8.54k|        if (nkids == 0) {
  ------------------
  |  Branch (510:13): [True: 1.78k, False: 6.75k]
  ------------------
  511|  1.78k|            if (allow_empty && items) {
  ------------------
  |  Branch (511:17): [True: 1.73k, False: 50]
  |  Branch (511:32): [True: 867, False: 872]
  ------------------
  512|    867|                setItemNumber(a_node, -1);
  513|    867|                return true;
  514|    867|            }
  515|    922|            return fail(
  516|    922|                a_node,
  517|    922|                "name/number tree node has neither non-empty " + impl.itemsKey() + " nor /Kids");
  518|  1.78k|        }
  519|       |
  520|  6.75k|        int kid_number = first ? 0 : nkids - 1;
  ------------------
  |  Branch (520:26): [True: 6.75k, False: 0]
  ------------------
  521|  6.75k|        addPathElement(a_node, kid_number);
  522|  6.75k|        Dictionary next = kids[kid_number];
  523|  6.75k|        if (!next) {
  ------------------
  |  Branch (523:13): [True: 483, False: 6.27k]
  ------------------
  524|    483|            return fail(a_node, "kid number " + std::to_string(kid_number) + " is invalid");
  525|    483|        }
  526|  6.27k|        if (!next.indirect()) {
  ------------------
  |  Branch (526:13): [True: 30, False: 6.24k]
  ------------------
  527|     30|            if (impl.auto_repair) {
  ------------------
  |  Branch (527:17): [True: 30, False: 0]
  ------------------
  528|     30|                impl.warn(
  529|     30|                    a_node,
  530|     30|                    "converting kid number " + std::to_string(kid_number) +
  531|     30|                        " to an indirect object");
  532|     30|                next = impl.qpdf.makeIndirectObject(next);
  533|     30|                kids.set(kid_number, next);
  534|     30|            } 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|     30|        }
  540|       |
  541|  6.27k|        a_node = next;
  542|  6.27k|    }
  543|  12.1k|}
_ZN10NNTreeImpl5beginEv:
  547|  11.6k|{
  548|  11.6k|    iterator result(*this);
  549|  11.6k|    result.deepen(tree_root, true, true);
  550|  11.6k|    return result;
  551|  11.6k|}
_ZNK10NNTreeImpl11compareKeysE16QPDFObjectHandleS0_:
  563|  49.3k|{
  564|       |    // We don't call this without calling keyValid first
  565|  49.3k|    qpdf_assert_debug(keyValid(a));
  ------------------
  |  |   11|  49.3k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (565:5): [True: 49.3k, False: 0]
  ------------------
  566|  49.3k|    qpdf_assert_debug(keyValid(b));
  ------------------
  |  |   11|  49.3k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (566:5): [True: 49.3k, False: 0]
  ------------------
  567|  49.3k|    if (key_type == ::ot_string) {
  ------------------
  |  Branch (567:9): [True: 40.7k, False: 8.60k]
  ------------------
  568|  40.7k|        auto as = a.getUTF8Value();
  569|  40.7k|        auto bs = b.getUTF8Value();
  570|  40.7k|        return as < bs ? -1 : (as > bs ? 1 : 0);
  ------------------
  |  Branch (570:16): [True: 1.41k, False: 39.3k]
  |  Branch (570:32): [True: 36.7k, False: 2.61k]
  ------------------
  571|  40.7k|    }
  572|  8.60k|    auto as = a.getIntValue();
  573|  8.60k|    auto bs = b.getIntValue();
  574|  8.60k|    return as < bs ? -1 : (as > bs ? 1 : 0);
  ------------------
  |  Branch (574:12): [True: 2.58k, False: 6.02k]
  |  Branch (574:28): [True: 5.76k, False: 256]
  ------------------
  575|  49.3k|}
_ZNK10NNTreeImpl12binarySearchERK16QPDFObjectHandleRKN4qpdf5ArrayEmbb:
  584|  10.4k|{
  585|  10.4k|    size_t max_idx = std::bit_ceil(num_items);
  586|       |
  587|  10.4k|    int step = static_cast<int>(max_idx / 2);
  588|  10.4k|    int checks = static_cast<int>(std::bit_width(max_idx)); // AppImage gcc version returns size_t
  589|  10.4k|    int idx = step;
  590|  10.4k|    int found_idx = -1;
  591|       |
  592|  50.1k|    for (int i = 0; i < checks; ++i) {
  ------------------
  |  Branch (592:21): [True: 40.5k, False: 9.58k]
  ------------------
  593|  40.5k|        int status = -1;
  594|  40.5k|        if (std::cmp_less(idx, num_items)) {
  ------------------
  |  Branch (594:13): [True: 26.1k, False: 14.4k]
  ------------------
  595|  26.1k|            status = search_kids ? compareKeyKid(key, items, idx) : compareKeyItem(key, items, idx);
  ------------------
  |  Branch (595:22): [True: 6.45k, False: 19.6k]
  ------------------
  596|  26.1k|            if (status == 0) {
  ------------------
  |  Branch (596:17): [True: 891, False: 25.2k]
  ------------------
  597|    891|                return idx;
  598|    891|            }
  599|  25.2k|            if (status > 0) {
  ------------------
  |  Branch (599:17): [True: 22.1k, False: 3.03k]
  ------------------
  600|  22.1k|                found_idx = idx;
  601|  22.1k|            }
  602|  25.2k|        }
  603|  39.6k|        step = std::max(step / 2, 1);
  604|  39.6k|        idx += status * step;
  605|  39.6k|    }
  606|  9.58k|    return return_prev_if_not_found ? found_idx : -1;
  ------------------
  |  Branch (606:12): [True: 8.72k, False: 858]
  ------------------
  607|  10.4k|}
_ZNK10NNTreeImpl14compareKeyItemERK16QPDFObjectHandleRKN4qpdf5ArrayEi:
  611|  19.6k|{
  612|  19.6k|    if (!keyValid(items[2 * idx])) {
  ------------------
  |  Branch (612:9): [True: 120, False: 19.5k]
  ------------------
  613|    120|        error(tree_root, ("item at index " + std::to_string(2 * idx) + " is not the right type"));
  614|    120|    }
  615|  19.6k|    return compareKeys(key, items[2 * idx]);
  616|  19.6k|}
_ZNK10NNTreeImpl13compareKeyKidERK16QPDFObjectHandleRKN4qpdf5ArrayEi:
  620|  6.45k|{
  621|  6.45k|    Dictionary kid = kids[idx];
  622|  6.45k|    if (!kid) {
  ------------------
  |  Branch (622:9): [True: 93, False: 6.36k]
  ------------------
  623|     93|        error(tree_root, "invalid kid at index " + std::to_string(idx));
  624|     93|    }
  625|  6.45k|    Array limits = kid["/Limits"];
  626|  6.45k|    if (!(keyValid(limits[0]) && keyValid(limits[1]))) {
  ------------------
  |  Branch (626:9): [True: 235, False: 6.22k]
  |  Branch (626:11): [True: 6.24k, False: 216]
  |  Branch (626:34): [True: 6.12k, False: 112]
  ------------------
  627|    235|        error(kids[idx], "node is missing /Limits");
  628|    235|    }
  629|  6.45k|    if (compareKeys(key, limits[0]) < 0) {
  ------------------
  |  Branch (629:9): [True: 666, False: 5.79k]
  ------------------
  630|    666|        return -1;
  631|    666|    }
  632|  5.79k|    if (compareKeys(key, limits[1]) > 0) {
  ------------------
  |  Branch (632:9): [True: 4.89k, False: 897]
  ------------------
  633|  4.89k|        return 1;
  634|  4.89k|    }
  635|    897|    return 0;
  636|  5.79k|}
_ZN10NNTreeImpl6repairEv:
  657|    606|{
  658|    606|    auto new_node = Dictionary({{itemsKey(), Array::empty()}});
  659|    606|    NNTreeImpl repl(qpdf, new_node, key_type, value_valid, false);
  660|    606|    std::map<QPDFObjectHandle, QPDFObjectHandle, Cmp> items;
  661|  23.1k|    for (auto const& [key, value]: *this) {
  ------------------
  |  Branch (661:34): [True: 23.1k, False: 606]
  ------------------
  662|  23.1k|        if (key && value && repl.keyValid(key) && repl.value_valid(value)) {
  ------------------
  |  Branch (662:13): [True: 23.1k, False: 7]
  |  Branch (662:13): [True: 22.8k, False: 244]
  |  Branch (662:20): [True: 23.1k, False: 0]
  |  Branch (662:29): [True: 22.9k, False: 125]
  |  Branch (662:51): [True: 22.8k, False: 112]
  ------------------
  663|  22.8k|            items.insert_or_assign(key, value);
  664|  22.8k|        }
  665|  23.1k|    }
  666|  5.43k|    for (auto const& [key, value]: items) {
  ------------------
  |  Branch (666:34): [True: 5.43k, False: 606]
  ------------------
  667|  5.43k|        repl.insert(key, value);
  668|  5.43k|    }
  669|    606|    tree_root.replace("/Kids", new_node["/Kids"]);
  670|    606|    tree_root.replace(itemsKey(), new_node[itemsKey()]);
  671|    606|}
_ZN10NNTreeImpl4findERK16QPDFObjectHandleb:
  675|  9.47k|{
  676|  9.47k|    try {
  677|  9.47k|        return findInternal(key, return_prev_if_not_found);
  678|  9.47k|    } catch (QPDFExc& e) {
  679|  1.48k|        if (auto_repair) {
  ------------------
  |  Branch (679:13): [True: 1.48k, False: 0]
  ------------------
  680|  1.48k|            warn(tree_root, std::string("attempting to repair after error: ") + e.what());
  681|  1.48k|            repair();
  682|  1.48k|            return findInternal(key, return_prev_if_not_found);
  683|  1.48k|        } else {
  684|      0|            throw;
  685|      0|        }
  686|  1.48k|    }
  687|  9.47k|}
_ZN10NNTreeImpl12findInternalERK16QPDFObjectHandleb:
  691|  9.54k|{
  692|  9.54k|    auto first_item = begin();
  693|  9.54k|    if (!first_item.valid()) {
  ------------------
  |  Branch (693:9): [True: 1.22k, False: 8.31k]
  ------------------
  694|  1.22k|        return end();
  695|  1.22k|    }
  696|  8.31k|    if (!keyValid(first_item->first)) {
  ------------------
  |  Branch (696:9): [True: 58, False: 8.26k]
  ------------------
  697|     58|        error(tree_root, "encountered invalid key in find");
  698|     58|    }
  699|  8.31k|    if (!value_valid(first_item->second)) {
  ------------------
  |  Branch (699:9): [True: 297, False: 8.02k]
  ------------------
  700|    297|        error(tree_root, "encountered invalid value in find");
  701|    297|    }
  702|  8.31k|    if (compareKeys(key, first_item->first) < 0) {
  ------------------
  |  Branch (702:9): [True: 130, False: 8.18k]
  ------------------
  703|       |        // Before the first key
  704|    130|        return end();
  705|    130|    }
  706|       |
  707|  8.18k|    QPDFObjGen::set seen;
  708|  8.18k|    auto node = tree_root;
  709|  8.18k|    iterator result(*this);
  710|       |
  711|  11.8k|    while (true) {
  ------------------
  |  Branch (711:12): [True: 10.5k, Folded]
  ------------------
  712|  10.5k|        if (!seen.add(node)) {
  ------------------
  |  Branch (712:13): [True: 35, False: 10.5k]
  ------------------
  713|     35|            error(node, "loop detected in find");
  714|     35|        }
  715|       |
  716|  10.5k|        Array items = node[itemsKey()];
  717|  10.5k|        size_t nitems = items.size();
  718|  10.5k|        if (nitems > 1) {
  ------------------
  |  Branch (718:13): [True: 6.89k, False: 3.66k]
  ------------------
  719|  6.89k|            int idx = binarySearch(key, items, nitems / 2, return_prev_if_not_found, false);
  720|  6.89k|            if (idx >= 0) {
  ------------------
  |  Branch (720:17): [True: 6.34k, False: 555]
  ------------------
  721|  6.34k|                result.setItemNumber(node, 2 * idx);
  722|  6.34k|                if (!result.impl.keyValid(result.ivalue.first)) {
  ------------------
  |  Branch (722:21): [True: 0, False: 6.34k]
  ------------------
  723|      0|                    error(node, "encountered invalid key in find");
  724|      0|                }
  725|  6.34k|                if (!result.impl.value_valid(result.ivalue.second)) {
  ------------------
  |  Branch (725:21): [True: 71, False: 6.27k]
  ------------------
  726|     71|                    error(tree_root, "encountered invalid value in find");
  727|     71|                }
  728|  6.34k|            }
  729|  6.89k|            return result;
  730|  6.89k|        }
  731|       |
  732|  3.66k|        Array kids = node["/Kids"];
  733|  3.66k|        size_t nkids = kids.size();
  734|  3.66k|        if (nkids == 0) {
  ------------------
  |  Branch (734:13): [True: 56, False: 3.61k]
  ------------------
  735|     56|            error(node, "bad node during find");
  736|     56|        }
  737|  3.66k|        int idx = binarySearch(key, kids, nkids, true, true);
  738|  3.66k|        if (idx == -1) {
  ------------------
  |  Branch (738:13): [True: 38, False: 3.63k]
  ------------------
  739|     38|            error(node, "unexpected -1 from binary search of kids; limits may by wrong");
  740|     38|        }
  741|  3.66k|        result.addPathElement(node, idx);
  742|  3.66k|        node = kids[idx];
  743|  3.66k|    }
  744|  8.18k|}
_ZN10NNTreeImpl11insertFirstERK16QPDFObjectHandleS2_:
  748|    348|{
  749|    348|    auto iter = begin();
  750|    348|    Array items = iter.node[items_key];
  751|    348|    if (!items) {
  ------------------
  |  Branch (751:9): [True: 0, False: 348]
  ------------------
  752|      0|        error(tree_root, "unable to find a valid items node");
  753|      0|    }
  754|    348|    if (!(key && value)) {
  ------------------
  |  Branch (754:11): [True: 348, False: 0]
  |  Branch (754:18): [True: 348, False: 0]
  ------------------
  755|      0|        error(tree_root, "unable to insert null key or value");
  756|      0|    }
  757|    348|    if (!value_valid(value)) {
  ------------------
  |  Branch (757:9): [True: 0, False: 348]
  ------------------
  758|      0|        error(tree_root, "attempting to insert an invalid value");
  759|      0|    }
  760|    348|    items.insert(0, key);
  761|    348|    items.insert(1, value);
  762|    348|    iter.setItemNumber(iter.node, 0);
  763|    348|    iter.resetLimits(iter.node, iter.lastPathElement());
  764|    348|    iter.split(iter.node, iter.lastPathElement());
  765|    348|    return iter;
  766|    348|}
_ZN10NNTreeImpl6insertERK16QPDFObjectHandleS2_:
  770|  5.43k|{
  771|  5.43k|    auto iter = find(key, true);
  772|  5.43k|    if (!iter.valid()) {
  ------------------
  |  Branch (772:9): [True: 348, False: 5.08k]
  ------------------
  773|    348|        return insertFirst(key, value);
  774|  5.08k|    } else if (compareKeys(key, iter->first) == 0) {
  ------------------
  |  Branch (774:16): [True: 0, False: 5.08k]
  ------------------
  775|      0|        Array items = iter.node[itemsKey()];
  776|      0|        items.set(iter.item_number + 1, value);
  777|      0|        iter.updateIValue();
  778|  5.08k|    } else {
  779|  5.08k|        iter.insertAfter(key, value);
  780|  5.08k|    }
  781|  5.08k|    return iter;
  782|  5.43k|}
_ZN10NNTreeImpl8validateEb:
  800|  1.17k|{
  801|  1.17k|    bool first = true;
  802|  1.17k|    QPDFObjectHandle last_key;
  803|  1.17k|    try {
  804|  1.67k|        for (auto const& [key, value]: *this) {
  ------------------
  |  Branch (804:38): [True: 1.67k, False: 1.17k]
  ------------------
  805|  1.67k|            if (!keyValid(key)) {
  ------------------
  |  Branch (805:17): [True: 124, False: 1.55k]
  ------------------
  806|    124|                error(tree_root, "invalid key in validate");
  807|    124|            }
  808|  1.67k|            if (!value_valid(value)) {
  ------------------
  |  Branch (808:17): [True: 111, False: 1.56k]
  ------------------
  809|    111|                error(tree_root, "invalid value in validate");
  810|    111|            }
  811|  1.67k|            if (first) {
  ------------------
  |  Branch (811:17): [True: 612, False: 1.06k]
  ------------------
  812|    612|                first = false;
  813|  1.06k|            } else if (last_key && compareKeys(last_key, key) != -1) {
  ------------------
  |  Branch (813:24): [True: 827, False: 235]
  |  Branch (813:24): [True: 229, False: 833]
  |  Branch (813:36): [True: 229, False: 598]
  ------------------
  814|    229|                error(tree_root, "keys are not sorted in validate");
  815|    229|            }
  816|  1.67k|            last_key = key;
  817|  1.67k|        }
  818|  1.17k|    } catch (QPDFExc& e) {
  819|    514|        if (a_repair) {
  ------------------
  |  Branch (819:13): [True: 514, False: 0]
  ------------------
  820|    514|            warn(tree_root, std::string("attempting to repair after error: ") + e.what());
  821|    514|            repair();
  822|    514|        }
  823|    514|        return false;
  824|    514|    }
  825|    658|    return true;
  826|  1.17k|}
_ZN24QPDFNameTreeObjectHelperD2Ev:
  847|    522|QPDFNameTreeObjectHelper::~QPDFNameTreeObjectHelper() = default;
_ZN24QPDFNameTreeObjectHelperC2E16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS0_EEEb:
  860|    522|    QPDFObjectHelper(oh),
  861|    522|    m(std::make_shared<Members>(oh, q, value_validator, auto_repair))
  862|    522|{
  863|    522|}
_ZN24QPDFNameTreeObjectHelper8iteratorC2ERKNSt3__110shared_ptrI14NNTreeIteratorEE:
  872|  1.78k|    impl(i)
  873|  1.78k|{
  874|  1.78k|}
_ZN24QPDFNameTreeObjectHelper8iterator12updateIValueEv:
  900|    148|{
  901|    148|    if (impl->valid()) {
  ------------------
  |  Branch (901:9): [True: 148, False: 0]
  ------------------
  902|    148|        auto p = *impl;
  903|    148|        ivalue.first = p->first.getUTF8Value();
  904|    148|        ivalue.second = p->second;
  905|    148|    } else {
  906|      0|        ivalue.first = "";
  907|      0|        ivalue.second = QPDFObjectHandle();
  908|      0|    }
  909|    148|}
_ZN24QPDFNameTreeObjectHelper8iteratorptEv:
  920|    148|{
  921|    148|    updateIValue();
  922|    148|    return &ivalue;
  923|    148|}
_ZNK24QPDFNameTreeObjectHelper8iteratoreqERKS0_:
  927|    890|{
  928|    890|    return *(impl) == *(other.impl);
  929|    890|}
_ZNK24QPDFNameTreeObjectHelper3endEv:
  953|    890|{
  954|    890|    return {std::make_shared<NNTreeIterator>(m->impl.end())};
  955|    890|}
_ZN24QPDFNameTreeObjectHelper4findERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
  965|  1.27k|{
  966|  1.27k|    auto i = m->impl.find(QPDFObjectHandle::newUnicodeString(key), return_prev_if_not_found);
  967|  1.27k|    return {std::make_shared<NNTreeIterator>(i)};
  968|  1.27k|}
_ZN24QPDFNameTreeObjectHelper10findObjectERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEER16QPDFObjectHandle:
  992|  1.27k|{
  993|  1.27k|    auto i = find(name);
  994|  1.27k|    if (i == end()) {
  ------------------
  |  Branch (994:9): [True: 742, False: 530]
  ------------------
  995|    742|        return false;
  996|    742|    }
  997|    530|    oh = i->second;
  998|    530|    return true;
  999|  1.27k|}
_ZN24QPDFNameTreeObjectHelper8validateEb:
 1017|    522|{
 1018|    522|    return m->impl.validate(repair);
 1019|    522|}
_ZN26QPDFNumberTreeObjectHelperD2Ev:
 1042|    650|QPDFNumberTreeObjectHelper::~QPDFNumberTreeObjectHelper() = default;
_ZN26QPDFNumberTreeObjectHelperC2E16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS0_EEEb:
 1056|    650|    QPDFObjectHelper(oh),
 1057|    650|    m(std::make_shared<Members>(oh, q, value_validator, auto_repair))
 1058|    650|{
 1059|    650|}
_ZN26QPDFNumberTreeObjectHelper8iteratorC2ERKNSt3__110shared_ptrI14NNTreeIteratorEE:
 1068|  3.47k|    impl(i)
 1069|  3.47k|{
 1070|  3.47k|}
_ZN26QPDFNumberTreeObjectHelper8iterator12updateIValueEv:
 1096|  3.11k|{
 1097|  3.11k|    if (impl->valid()) {
  ------------------
  |  Branch (1097:9): [True: 3.11k, False: 0]
  ------------------
 1098|  3.11k|        auto p = *impl;
 1099|  3.11k|        this->ivalue.first = p->first.getIntValue();
 1100|  3.11k|        this->ivalue.second = p->second;
 1101|  3.11k|    } else {
 1102|      0|        this->ivalue.first = 0;
 1103|      0|        this->ivalue.second = QPDFObjectHandle();
 1104|      0|    }
 1105|  3.11k|}
_ZN26QPDFNumberTreeObjectHelper8iteratorptEv:
 1116|  3.11k|{
 1117|  3.11k|    updateIValue();
 1118|  3.11k|    return &this->ivalue;
 1119|  3.11k|}
_ZNK26QPDFNumberTreeObjectHelper8iteratoreqERKS0_:
 1123|  1.73k|{
 1124|  1.73k|    return *(impl) == *(other.impl);
 1125|  1.73k|}
_ZNK26QPDFNumberTreeObjectHelper3endEv:
 1149|  1.73k|{
 1150|  1.73k|    return {std::make_shared<NNTreeIterator>(m->impl.end())};
 1151|  1.73k|}
_ZN26QPDFNumberTreeObjectHelper4findExb:
 1161|  2.76k|{
 1162|  2.76k|    auto i = m->impl.find(QPDFObjectHandle::newInteger(key), return_prev_if_not_found);
 1163|  2.76k|    return {std::make_shared<NNTreeIterator>(i)};
 1164|  2.76k|}
_ZN26QPDFNumberTreeObjectHelper19findObjectAtOrBelowExR16QPDFObjectHandleRx:
 1220|  2.76k|{
 1221|  2.76k|    auto i = find(idx, true);
 1222|  2.76k|    if (i == end()) {
  ------------------
  |  Branch (1222:9): [True: 697, False: 2.06k]
  ------------------
 1223|    697|        return false;
 1224|    697|    }
 1225|  2.06k|    oh = i->second;
 1226|  2.06k|    QIntC::range_check_subtract(idx, i->first);
 1227|  2.06k|    offset = idx - i->first;
 1228|  2.06k|    return true;
 1229|  2.76k|}
_ZN26QPDFNumberTreeObjectHelper8validateEb:
 1247|    650|{
 1248|    650|    return m->impl.validate(repair);
 1249|    650|}
NNTree.cc:_ZL15get_descriptionRK16QPDFObjectHandle:
   22|  10.4k|{
   23|  10.4k|    std::string result("Name/Number tree node");
   24|  10.4k|    if (node.indirect()) {
  ------------------
  |  Branch (24:9): [True: 8.61k, False: 1.80k]
  ------------------
   25|  8.61k|        result += " (object " + std::to_string(node.getObjectID()) + ")";
   26|  8.61k|    }
   27|  10.4k|    return result;
   28|  10.4k|}
NNTree.cc:_ZZN14NNTreeIterator6deepenEN4qpdf10DictionaryEbbENK3$_0clERKS1_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  482|  1.57k|    auto fail = [this, &opath](Dictionary const& failed_node, std::string const& msg) {
  483|  1.57k|        impl.warn(failed_node, msg);
  484|  1.57k|        path = opath;
  485|  1.57k|        return false;
  486|  1.57k|    };
NNTree.cc:_ZNK12_GLOBAL__N_13CmpclERK16QPDFObjectHandleS3_:
  644|   161k|        {
  645|   161k|            Integer l = lhs;
  646|   161k|            Integer r = rhs;
  647|   161k|            if (l && r) {
  ------------------
  |  Branch (647:17): [True: 5.55k, False: 155k]
  |  Branch (647:22): [True: 5.55k, False: 0]
  ------------------
  648|  5.55k|                return l.value() < r.value();
  649|  5.55k|            }
  650|   155k|            return lhs.getUTF8Value() < rhs.getUTF8Value();
  651|   161k|        }
_ZN24QPDFNameTreeObjectHelper7MembersC2ER16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS1_EEEb:
  836|    522|        impl(q, oh, ::ot_string, value_validator, auto_repair)
  837|    522|    {
  838|    522|    }
_ZN24QPDFNameTreeObjectHelper7MembersD2Ev:
  840|    522|    ~Members() = default;
_ZN26QPDFNumberTreeObjectHelper7MembersC2ER16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS1_EEEb:
 1031|    650|        impl(q, oh, ::ot_integer, value_validator, auto_repair)
 1032|    650|    {
 1033|    650|    }
_ZN26QPDFNumberTreeObjectHelper7MembersD2Ev:
 1035|    650|    ~Members() = default;

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

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

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

_ZN17Pl_ASCII85DecoderC2EPKcP8Pipeline:
   12|  3.37k|    Pipeline(identifier, next)
   13|  3.37k|{
   14|  3.37k|    util::assertion(next, "Attempt to create Pl_ASCII85Decoder with nullptr as next");
   15|  3.37k|}
_ZN17Pl_ASCII85Decoder5writeEPKhm:
   19|  3.32k|{
   20|  3.32k|    if (eod > 1) {
  ------------------
  |  Branch (20:9): [True: 209, False: 3.11k]
  ------------------
   21|    209|        return;
   22|    209|    }
   23|   224k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (23:24): [True: 222k, False: 2.44k]
  ------------------
   24|   222k|        switch (buf[i]) {
  ------------------
  |  Branch (24:17): [True: 7.34k, False: 214k]
  ------------------
   25|  3.33k|        case ' ':
  ------------------
  |  Branch (25:9): [True: 3.33k, False: 218k]
  ------------------
   26|  3.56k|        case '\f':
  ------------------
  |  Branch (26:9): [True: 221, False: 221k]
  ------------------
   27|  3.78k|        case '\v':
  ------------------
  |  Branch (27:9): [True: 222, False: 221k]
  ------------------
   28|  4.03k|        case '\t':
  ------------------
  |  Branch (28:9): [True: 255, False: 221k]
  ------------------
   29|  5.03k|        case '\r':
  ------------------
  |  Branch (29:9): [True: 993, False: 221k]
  ------------------
   30|  7.34k|        case '\n':
  ------------------
  |  Branch (30:9): [True: 2.31k, False: 219k]
  ------------------
   31|  7.34k|            QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
   32|       |            // ignore whitespace
   33|  7.34k|            continue;
   34|   222k|        }
   35|   214k|        if (eod > 1) {
  ------------------
  |  Branch (35:13): [True: 217, False: 214k]
  ------------------
   36|    217|            break;
   37|   214k|        } else if (eod == 1) {
  ------------------
  |  Branch (37:20): [True: 273, False: 214k]
  ------------------
   38|    273|            util::no_ci_rt_error_if(buf[i] != '>', "broken end-of-data sequence in base 85 data");
   39|    273|            flush();
   40|    273|            eod = 2;
   41|   214k|        } else {
   42|   214k|            switch (buf[i]) {
   43|    281|            case '~':
  ------------------
  |  Branch (43:13): [True: 281, False: 213k]
  ------------------
   44|    281|                eod = 1;
   45|    281|                break;
   46|       |
   47|  1.31k|            case 'z':
  ------------------
  |  Branch (47:13): [True: 1.31k, False: 212k]
  ------------------
   48|  1.31k|                if (pos != 0) {
  ------------------
  |  Branch (48:21): [True: 46, False: 1.26k]
  ------------------
   49|     46|                    throw std::runtime_error("unexpected z during base 85 decode");
   50|     46|                }
   51|  1.26k|                unsigned char zeroes[4];
   52|  1.26k|                memset(zeroes, '\0', 4);
   53|  1.26k|                next()->write(zeroes, 4);
   54|  1.26k|                break;
   55|       |
   56|   212k|            default:
  ------------------
  |  Branch (56:13): [True: 212k, False: 1.59k]
  ------------------
   57|   212k|                if (buf[i] < 33 || buf[i] > 117) {
  ------------------
  |  Branch (57:21): [True: 184, False: 212k]
  |  Branch (57:36): [True: 114, False: 212k]
  ------------------
   58|    298|                    error = true;
   59|    298|                    throw std::runtime_error("character out of range during base 85 decode");
   60|   212k|                } else {
   61|   212k|                    this->inbuf[this->pos++] = buf[i];
   62|   212k|                    if (pos == 5) {
  ------------------
  |  Branch (62:25): [True: 42.0k, False: 170k]
  ------------------
   63|  42.0k|                        flush();
   64|  42.0k|                    }
   65|   212k|                }
   66|   212k|                break;
   67|   214k|            }
   68|   214k|        }
   69|   214k|    }
   70|  3.11k|}
_ZN17Pl_ASCII85Decoder5flushEv:
   74|  45.3k|{
   75|  45.3k|    if (this->pos == 0) {
  ------------------
  |  Branch (75:9): [True: 2.60k, False: 42.7k]
  ------------------
   76|  2.60k|        return;
   77|  2.60k|    }
   78|  42.7k|    unsigned long lval = 0;
   79|   256k|    for (int i = 0; i < 5; ++i) {
  ------------------
  |  Branch (79:21): [True: 213k, False: 42.7k]
  ------------------
   80|   213k|        lval *= 85;
   81|   213k|        lval += (this->inbuf[i] - 33U);
   82|   213k|    }
   83|       |
   84|  42.7k|    unsigned char outbuf[4];
   85|  42.7k|    memset(outbuf, 0, 4);
   86|   213k|    for (int i = 3; i >= 0; --i) {
  ------------------
  |  Branch (86:21): [True: 171k, False: 42.7k]
  ------------------
   87|   171k|        outbuf[i] = lval & 0xff;
   88|   171k|        lval >>= 8;
   89|   171k|    }
   90|       |
   91|  42.7k|    QTC::TC("libtests", "Pl_ASCII85Decoder partial flush", (this->pos == 5) ? 0 : 1);
  ------------------
  |  Branch (91:60): [True: 42.0k, False: 691]
  ------------------
   92|       |    // Reset before calling getNext()->write in case that throws an exception.
   93|  42.7k|    auto t = this->pos - 1;
   94|  42.7k|    this->pos = 0;
   95|  42.7k|    memset(this->inbuf, 117, 5);
   96|       |
   97|  42.7k|    next()->write(outbuf, t);
   98|  42.7k|}
_ZN17Pl_ASCII85Decoder6finishEv:
  102|  3.33k|{
  103|  3.33k|    if (error) {
  ------------------
  |  Branch (103:9): [True: 261, False: 3.07k]
  ------------------
  104|    261|        return;
  105|    261|    }
  106|  3.07k|    flush();
  107|  3.07k|    next()->finish();
  108|  3.07k|}

_ZN18Pl_ASCIIHexDecoderC2EPKcP8Pipeline:
   13|    462|    Pipeline(identifier, next)
   14|    462|{
   15|    462|    util::assertion(next, "Attempt to create Pl_ASCIIHexDecoder with nullptr as next");
   16|    462|}
_ZN18Pl_ASCIIHexDecoder5writeEPKhm:
   20|    998|{
   21|    998|    if (eod) {
  ------------------
  |  Branch (21:9): [True: 394, False: 604]
  ------------------
   22|    394|        return;
   23|    394|    }
   24|  6.04k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (24:24): [True: 5.68k, False: 362]
  ------------------
   25|  5.68k|        char ch = static_cast<char>(toupper(buf[i]));
   26|  5.68k|        switch (ch) {
   27|    383|        case ' ':
  ------------------
  |  Branch (27:9): [True: 383, False: 5.29k]
  ------------------
   28|    843|        case '\f':
  ------------------
  |  Branch (28:9): [True: 460, False: 5.22k]
  ------------------
   29|  1.08k|        case '\v':
  ------------------
  |  Branch (29:9): [True: 241, False: 5.44k]
  ------------------
   30|  1.34k|        case '\t':
  ------------------
  |  Branch (30:9): [True: 261, False: 5.42k]
  ------------------
   31|  1.56k|        case '\r':
  ------------------
  |  Branch (31:9): [True: 215, False: 5.46k]
  ------------------
   32|  1.78k|        case '\n':
  ------------------
  |  Branch (32:9): [True: 222, False: 5.46k]
  ------------------
   33|  1.78k|            QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space");
   34|       |            // ignore whitespace
   35|  1.78k|            break;
   36|       |
   37|     45|        case '>':
  ------------------
  |  Branch (37:9): [True: 45, False: 5.63k]
  ------------------
   38|     45|            eod = true;
   39|     45|            flush();
   40|     45|            break;
   41|       |
   42|  3.85k|        default:
  ------------------
  |  Branch (42:9): [True: 3.85k, False: 1.82k]
  ------------------
   43|  3.85k|            if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F')) {
  ------------------
  |  Branch (43:18): [True: 3.72k, False: 132]
  |  Branch (43:31): [True: 2.44k, False: 1.28k]
  |  Branch (43:46): [True: 1.27k, False: 140]
  |  Branch (43:59): [True: 1.21k, False: 54]
  ------------------
   44|  3.66k|                inbuf[pos++] = ch;
   45|  3.66k|                if (pos == 2) {
  ------------------
  |  Branch (45:21): [True: 1.77k, False: 1.88k]
  ------------------
   46|  1.77k|                    flush();
   47|  1.77k|                }
   48|  3.66k|            } else {
   49|    194|                char t[2];
   50|    194|                t[0] = ch;
   51|    194|                t[1] = 0;
   52|    194|                throw std::runtime_error("character out of range during base Hex decode: "s + t);
   53|    194|            }
   54|  3.66k|            break;
   55|  5.68k|        }
   56|  5.48k|        if (eod) {
  ------------------
  |  Branch (56:13): [True: 45, False: 5.44k]
  ------------------
   57|     45|            break;
   58|     45|        }
   59|  5.48k|    }
   60|    604|}
_ZN18Pl_ASCIIHexDecoder5flushEv:
   64|  2.14k|{
   65|  2.14k|    if (pos == 0) {
  ------------------
  |  Branch (65:9): [True: 261, False: 1.87k]
  ------------------
   66|    261|        QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush");
   67|    261|        return;
   68|    261|    }
   69|  1.87k|    int b[2];
   70|  5.63k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (70:21): [True: 3.75k, False: 1.87k]
  ------------------
   71|  3.75k|        if (inbuf[i] >= 'A') {
  ------------------
  |  Branch (71:13): [True: 1.21k, False: 2.54k]
  ------------------
   72|  1.21k|            b[i] = inbuf[i] - 'A' + 10;
   73|  2.54k|        } else {
   74|  2.54k|            b[i] = inbuf[i] - '0';
   75|  2.54k|        }
   76|  3.75k|    }
   77|  1.87k|    auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
   78|       |
   79|  1.87k|    QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", (pos == 2) ? 0 : 1);
  ------------------
  |  Branch (79:61): [True: 1.77k, False: 107]
  ------------------
   80|       |    // Reset before calling getNext()->write in case that throws an exception.
   81|  1.87k|    pos = 0;
   82|  1.87k|    inbuf[0] = '0';
   83|  1.87k|    inbuf[1] = '0';
   84|  1.87k|    inbuf[2] = '\0';
   85|       |
   86|  1.87k|    next()->write(&ch, 1);
   87|  1.87k|}
_ZN18Pl_ASCIIHexDecoder6finishEv:
   91|    323|{
   92|    323|    flush();
   93|    323|    next()->finish();
   94|    323|}

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

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

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

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

_ZN8Pl_Flate7MembersC2EmNS_8action_eE:
   27|  17.9k|    out_bufsize(out_bufsize),
   28|  17.9k|    action(action),
   29|  17.9k|    initialized(false),
   30|  17.9k|    zdata(nullptr)
   31|  17.9k|{
   32|  17.9k|    this->outbuf = QUtil::make_shared_array<unsigned char>(out_bufsize);
   33|       |    // Indirect through zdata to reach the z_stream so we don't have to include zlib.h in
   34|       |    // Pl_Flate.hh.  This means people using shared library versions of qpdf don't have to have zlib
   35|       |    // development files available, which particularly helps in a Windows environment.
   36|  17.9k|    zdata = new z_stream;
   37|       |
   38|  17.9k|    util::no_ci_rt_error_if(
   39|  17.9k|        out_bufsize > UINT_MAX,
   40|  17.9k|        "Pl_Flate: zlib doesn't support buffer sizes larger than unsigned int");
   41|       |
   42|  17.9k|    z_stream& zstream = *(static_cast<z_stream*>(this->zdata));
   43|  17.9k|    zstream.zalloc = nullptr;
   44|  17.9k|    zstream.zfree = nullptr;
   45|  17.9k|    zstream.opaque = nullptr;
   46|  17.9k|    zstream.next_in = nullptr;
   47|  17.9k|    zstream.avail_in = 0;
   48|  17.9k|    zstream.next_out = this->outbuf.get();
   49|  17.9k|    zstream.avail_out = QIntC::to_uint(out_bufsize);
   50|       |
   51|  17.9k|    if (action == a_deflate && Pl_Flate::zopfli_enabled()) {
  ------------------
  |  Branch (51:9): [True: 0, False: 17.9k]
  |  Branch (51:32): [True: 0, False: 0]
  ------------------
   52|      0|        zopfli_buf = std::make_unique<std::string>();
   53|      0|    }
   54|  17.9k|}
_ZN8Pl_Flate7MembersD2Ev:
   57|  17.9k|{
   58|  17.9k|    if (initialized) {
  ------------------
  |  Branch (58:9): [True: 1.48k, False: 16.4k]
  ------------------
   59|  1.48k|        z_stream& zstream = *(static_cast<z_stream*>(zdata));
   60|  1.48k|        if (action == a_deflate) {
  ------------------
  |  Branch (60:13): [True: 0, False: 1.48k]
  ------------------
   61|      0|            deflateEnd(&zstream);
   62|  1.48k|        } else {
   63|  1.48k|            inflateEnd(&zstream);
   64|  1.48k|        }
   65|  1.48k|    }
   66|       |
   67|  17.9k|    delete static_cast<z_stream*>(this->zdata);
   68|  17.9k|    zdata = nullptr;
   69|  17.9k|}
_ZN8Pl_FlateC2EPKcP8PipelineNS_8action_eEj:
   73|  17.9k|    Pipeline(identifier, next),
   74|  17.9k|    m(std::make_unique<Members>(QIntC::to_size(out_bufsize_int), action))
   75|  17.9k|{
   76|  17.9k|    util::assertion(next, "Attempt to create Pl_Flate with nullptr as next");
   77|  17.9k|}
_ZN8Pl_FlateD2Ev:
   80|  17.9k|Pl_Flate::~Pl_Flate() = default;
_ZN8Pl_Flate12memory_limitEv:
   84|  3.94k|{
   85|  3.94k|    return ::memory_limit;
   86|  3.94k|}
_ZN8Pl_Flate15setWarnCallbackENSt3__18functionIFvPKciEEE:
   96|  17.9k|{
   97|  17.9k|    m->callback = callback;
   98|  17.9k|}
_ZN8Pl_Flate4warnEPKci:
  102|  3.53k|{
  103|  3.53k|    if (m->callback) {
  ------------------
  |  Branch (103:9): [True: 3.53k, False: 0]
  ------------------
  104|  3.53k|        m->callback(msg, code);
  105|  3.53k|    }
  106|  3.53k|}
_ZN8Pl_Flate5writeEPKhm:
  110|  73.9k|{
  111|  73.9k|    util::assertion(
  112|  73.9k|        m->outbuf.get(), identifier + ": Pl_Flate: write() called after finish() called");
  113|  73.9k|    if (m->zopfli_buf) {
  ------------------
  |  Branch (113:9): [True: 0, False: 73.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|  73.9k|    static size_t const max_bytes = 1 << 30;
  120|  73.9k|    size_t bytes_left = len;
  121|  73.9k|    unsigned char const* buf = data;
  122|   140k|    while (bytes_left > 0) {
  ------------------
  |  Branch (122:12): [True: 66.3k, False: 73.9k]
  ------------------
  123|  66.3k|        size_t bytes = (bytes_left >= max_bytes ? max_bytes : bytes_left);
  ------------------
  |  Branch (123:25): [True: 0, False: 66.3k]
  ------------------
  124|  66.3k|        handleData(buf, bytes, (m->action == a_inflate ? Z_SYNC_FLUSH : Z_NO_FLUSH));
  ------------------
  |  Branch (124:33): [True: 66.3k, False: 0]
  ------------------
  125|  66.3k|        bytes_left -= bytes;
  126|  66.3k|        buf += bytes;
  127|  66.3k|    }
  128|  73.9k|}
_ZN8Pl_Flate10handleDataEPKhmi:
  132|  73.9k|{
  133|  73.9k|    util::no_ci_rt_error_if(
  134|  73.9k|        len > UINT_MAX, "Pl_Flate: zlib doesn't support data blocks larger than int");
  135|  73.9k|    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|  73.9k|    zstream.next_in = const_cast<unsigned char*>(data);
  139|  73.9k|    zstream.avail_in = QIntC::to_uint(len);
  140|       |
  141|  73.9k|    if (!m->initialized) {
  ------------------
  |  Branch (141:9): [True: 8.17k, False: 65.7k]
  ------------------
  142|  8.17k|        int err = Z_OK;
  143|       |
  144|       |        // deflateInit and inflateInit are macros that use old-style casts.
  145|  8.17k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  146|  8.17k|# pragma GCC diagnostic push
  147|  8.17k|# pragma GCC diagnostic ignored "-Wold-style-cast"
  148|  8.17k|#endif
  149|  8.17k|        if (m->action == a_deflate) {
  ------------------
  |  Branch (149:13): [True: 0, False: 8.17k]
  ------------------
  150|      0|            err = deflateInit(&zstream, compression_level);
  151|  8.17k|        } else {
  152|  8.17k|            err = inflateInit(&zstream);
  153|  8.17k|        }
  154|  8.17k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  155|  8.17k|# pragma GCC diagnostic pop
  156|  8.17k|#endif
  157|       |
  158|  8.17k|        checkError("Init", err);
  159|  8.17k|        m->initialized = true;
  160|  8.17k|    }
  161|       |
  162|  73.9k|    int err = Z_OK;
  163|       |
  164|  73.9k|    bool done = false;
  165|   146k|    while (!done) {
  ------------------
  |  Branch (165:12): [True: 75.0k, False: 71.5k]
  ------------------
  166|  75.0k|        if (m->action == a_deflate) {
  ------------------
  |  Branch (166:13): [True: 0, False: 75.0k]
  ------------------
  167|      0|            err = deflate(&zstream, flush);
  168|  75.0k|        } else {
  169|  75.0k|            err = inflate(&zstream, flush);
  170|  75.0k|        }
  171|  75.0k|        if ((m->action == a_inflate) && (err != Z_OK) && zstream.msg &&
  ------------------
  |  Branch (171:13): [True: 75.0k, False: 0]
  |  Branch (171:41): [True: 12.8k, False: 62.2k]
  |  Branch (171:58): [True: 4.53k, False: 8.27k]
  ------------------
  172|  4.53k|            (strcmp(zstream.msg, "incorrect data check") == 0)) {
  ------------------
  |  Branch (172:13): [True: 2.33k, False: 2.19k]
  ------------------
  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|  2.33k|            err = Z_STREAM_END;
  176|  2.33k|        }
  177|  75.0k|        switch (err) {
  178|  3.53k|        case Z_BUF_ERROR:
  ------------------
  |  Branch (178:9): [True: 3.53k, False: 71.5k]
  ------------------
  179|       |            // Probably shouldn't be able to happen, but possible as a boundary condition: if the
  180|       |            // last call to inflate exactly filled the output buffer, it's possible that the next
  181|       |            // call to inflate could have nothing to do. There are PDF files in the wild that have
  182|       |            // this error (including at least one in qpdf's test suite). In some cases, we want to
  183|       |            // know about this, because it indicates incorrect compression, so call a callback if
  184|       |            // provided.
  185|  3.53k|            warn("input stream is complete but output may still be valid", err);
  186|  3.53k|            done = true;
  187|  3.53k|            break;
  188|       |
  189|  6.97k|        case Z_STREAM_END:
  ------------------
  |  Branch (189:9): [True: 6.97k, False: 68.0k]
  ------------------
  190|  6.97k|            done = true;
  191|       |            // fall through
  192|       |
  193|  69.2k|        case Z_OK:
  ------------------
  |  Branch (193:9): [True: 62.2k, False: 12.8k]
  ------------------
  194|  69.2k|            {
  195|  69.2k|                if ((zstream.avail_in == 0) && (zstream.avail_out > 0)) {
  ------------------
  |  Branch (195:21): [True: 66.5k, False: 2.68k]
  |  Branch (195:48): [True: 66.4k, False: 44]
  ------------------
  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|  66.4k|                    done = true;
  199|  66.4k|                }
  200|  69.2k|                uLong ready = QIntC::to_ulong(m->out_bufsize - zstream.avail_out);
  201|  69.2k|                if (ready > 0) {
  ------------------
  |  Branch (201:21): [True: 56.0k, False: 13.1k]
  ------------------
  202|  56.0k|                    if (::memory_limit && m->action != a_deflate) {
  ------------------
  |  Branch (202:25): [True: 56.0k, False: 0]
  |  Branch (202:43): [True: 56.0k, False: 0]
  ------------------
  203|  56.0k|                        m->written += ready;
  204|  56.0k|                        if (m->written > ::memory_limit) {
  ------------------
  |  Branch (204:29): [True: 46, False: 56.0k]
  ------------------
  205|     46|                            throw std::runtime_error("PL_Flate memory limit exceeded");
  206|     46|                        }
  207|  56.0k|                    }
  208|  56.0k|                    next()->write(m->outbuf.get(), ready);
  209|  56.0k|                    zstream.next_out = m->outbuf.get();
  210|  56.0k|                    zstream.avail_out = QIntC::to_uint(m->out_bufsize);
  211|  56.0k|                }
  212|  69.2k|            }
  213|  69.1k|            break;
  214|       |
  215|  69.1k|        default:
  ------------------
  |  Branch (215:9): [True: 2.29k, False: 72.7k]
  ------------------
  216|  2.29k|            checkError("data", err);
  217|  75.0k|        }
  218|  75.0k|    }
  219|  73.9k|}
_ZN8Pl_Flate6finishEv:
  223|  17.3k|{
  224|  17.3k|    if (m->written > ::memory_limit) {
  ------------------
  |  Branch (224:9): [True: 38, False: 17.2k]
  ------------------
  225|     38|        throw std::runtime_error("PL_Flate memory limit exceeded");
  226|     38|    }
  227|  17.2k|    try {
  228|  17.2k|        if (m->zopfli_buf) {
  ------------------
  |  Branch (228:13): [True: 0, False: 17.2k]
  ------------------
  229|      0|            finish_zopfli();
  230|  17.2k|        } else if (m->outbuf.get()) {
  ------------------
  |  Branch (230:20): [True: 17.2k, False: 0]
  ------------------
  231|  17.2k|            if (m->initialized) {
  ------------------
  |  Branch (231:17): [True: 7.63k, False: 9.66k]
  ------------------
  232|  7.63k|                z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  233|  7.63k|                unsigned char buf[1];
  234|  7.63k|                buf[0] = '\0';
  235|  7.63k|                handleData(buf, 0, Z_FINISH);
  236|  7.63k|                int err = Z_OK;
  237|  7.63k|                if (m->action == a_deflate) {
  ------------------
  |  Branch (237:21): [True: 0, False: 7.63k]
  ------------------
  238|      0|                    err = deflateEnd(&zstream);
  239|  7.63k|                } else {
  240|  7.63k|                    err = inflateEnd(&zstream);
  241|  7.63k|                }
  242|  7.63k|                m->initialized = false;
  243|  7.63k|                checkError("End", err);
  244|  7.63k|            }
  245|       |
  246|  17.2k|            m->outbuf = nullptr;
  247|  17.2k|        }
  248|  17.2k|    } catch (std::exception& e) {
  249|    955|        try {
  250|    955|            next()->finish();
  251|    955|        } catch (...) {
  252|       |            // ignore secondary exception
  253|     13|        }
  254|    955|        throw std::runtime_error(e.what());
  255|    955|    }
  256|  16.3k|    next()->finish();
  257|  16.3k|}
_ZN8Pl_Flate10checkErrorEPKci:
  267|  17.1k|{
  268|  17.1k|    z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  269|  17.1k|    if (error_code != Z_OK) {
  ------------------
  |  Branch (269:9): [True: 2.29k, False: 14.8k]
  ------------------
  270|  2.29k|        char const* action_str = (m->action == a_deflate ? "deflate" : "inflate");
  ------------------
  |  Branch (270:35): [True: 0, False: 2.29k]
  ------------------
  271|  2.29k|        std::string msg = identifier + ": " + action_str + ": " + prefix + ": ";
  272|       |
  273|  2.29k|        if (zstream.msg) {
  ------------------
  |  Branch (273:13): [True: 2.19k, False: 102]
  ------------------
  274|  2.19k|            msg += zstream.msg;
  275|  2.19k|        } else {
  276|    102|            switch (error_code) {
  277|      0|            case Z_ERRNO:
  ------------------
  |  Branch (277:13): [True: 0, False: 102]
  ------------------
  278|      0|                msg += "zlib system error";
  279|      0|                break;
  280|       |
  281|      0|            case Z_STREAM_ERROR:
  ------------------
  |  Branch (281:13): [True: 0, False: 102]
  ------------------
  282|      0|                msg += "zlib stream error";
  283|      0|                break;
  284|       |
  285|      0|            case Z_DATA_ERROR:
  ------------------
  |  Branch (285:13): [True: 0, False: 102]
  ------------------
  286|      0|                msg += "zlib data error";
  287|      0|                break;
  288|       |
  289|      0|            case Z_MEM_ERROR:
  ------------------
  |  Branch (289:13): [True: 0, False: 102]
  ------------------
  290|      0|                msg += "zlib memory error";
  291|      0|                break;
  292|       |
  293|      0|            case Z_BUF_ERROR:
  ------------------
  |  Branch (293:13): [True: 0, False: 102]
  ------------------
  294|      0|                msg += "zlib buffer error";
  295|      0|                break;
  296|       |
  297|      0|            case Z_VERSION_ERROR:
  ------------------
  |  Branch (297:13): [True: 0, False: 102]
  ------------------
  298|      0|                msg += "zlib version error";
  299|      0|                break;
  300|       |
  301|    102|            default:
  ------------------
  |  Branch (301:13): [True: 102, False: 0]
  ------------------
  302|    102|                msg += std::string("zlib unknown error (") + std::to_string(error_code) + ")";
  303|    102|                break;
  304|    102|            }
  305|    102|        }
  306|       |
  307|  2.29k|        throw std::runtime_error(msg);
  308|  2.29k|    }
  309|  17.1k|}

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

_ZN10Pl_OStreamC2EPKcRNSt3__113basic_ostreamIcNS2_11char_traitsIcEEEE:
   19|      2|    Pipeline(identifier, nullptr),
   20|      2|    m(std::make_unique<Members>(os))
   21|      2|{
   22|      2|}
_ZN10Pl_OStreamD2Ev:
   25|      2|Pl_OStream::~Pl_OStream() = default;
_ZN10Pl_OStream5writeEPKhm:
   29|  2.60M|{
   30|  2.60M|    m->os.write(reinterpret_cast<char const*>(buf), static_cast<std::streamsize>(len));
   31|  2.60M|}
_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.47k|    Pipeline(identifier, next),
   31|  1.47k|    action(action)
   32|  1.47k|{
   33|  1.47k|    util::assertion(next, "Attempt to create Pl_PNGFilter with nullptr as next");
   34|  1.47k|    util::no_ci_rt_error_if(
   35|  1.47k|        samples_per_pixel < 1, "PNGFilter created with invalid samples_per_pixel");
   36|  1.47k|    util::no_ci_rt_error_if(
   37|  1.47k|        !(bits_per_sample == 1 || bits_per_sample == 2 || bits_per_sample == 4 ||
  ------------------
  |  Branch (37:11): [True: 72, False: 1.40k]
  |  Branch (37:35): [True: 67, False: 1.34k]
  |  Branch (37:59): [True: 66, False: 1.27k]
  ------------------
   38|  1.27k|          bits_per_sample == 8 || bits_per_sample == 16),
  ------------------
  |  Branch (38:11): [True: 1.15k, False: 116]
  |  Branch (38:35): [True: 99, False: 17]
  ------------------
   39|  1.47k|        "PNGFilter created with invalid bits_per_sample not 1, 2, 4, 8, or 16");
   40|  1.47k|    auto bits_per_pixel = 1ULL * bits_per_sample * samples_per_pixel;
   41|  1.47k|    util::no_ci_rt_error_if(
   42|  1.47k|        !util::fits<uint32_t>(bits_per_pixel + 7),
   43|  1.47k|        "PNGFilter created with bits_per_sample and samples_per_pixel values that cause overflow");
   44|  1.47k|    bytes_per_pixel = static_cast<uint32_t>((bits_per_pixel + 7) / 8);
   45|  1.47k|    auto bpr = ((columns * bits_per_pixel) + 7) / 8;
   46|  1.47k|    util::no_ci_rt_error_if(
   47|  1.47k|        bpr == 0 || !util::fits<uint32_t>(bpr), "PNGFilter created with invalid columns value");
  ------------------
  |  Branch (47:9): [True: 23, False: 1.45k]
  |  Branch (47:21): [True: 0, False: 1.45k]
  ------------------
   48|  1.47k|    util::no_ci_rt_error_if(
   49|  1.47k|        memory_limit > 0 && bpr > (memory_limit / 2U), "PNGFilter memory limit exceeded");
  ------------------
  |  Branch (49:9): [True: 1.45k, False: 23]
  |  Branch (49:29): [True: 7, False: 1.44k]
  ------------------
   50|  1.47k|    bytes_per_row = static_cast<uint32_t>(bpr);
   51|  1.47k|    buf1 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   52|  1.47k|    buf2 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   53|  1.47k|    memset(buf1.get(), 0, bytes_per_row + 1);
   54|  1.47k|    memset(buf2.get(), 0, bytes_per_row + 1);
   55|  1.47k|    cur_row = buf1.get();
   56|  1.47k|    prev_row = buf2.get();
   57|       |
   58|       |    // number of bytes per incoming row
   59|  1.47k|    incoming = (action == a_encode ? bytes_per_row : bytes_per_row + 1);
  ------------------
  |  Branch (59:17): [True: 0, False: 1.47k]
  ------------------
   60|  1.47k|}
_ZN12Pl_PNGFilter5writeEPKhm:
   70|  11.7k|{
   71|  11.7k|    size_t left = incoming - pos;
   72|  11.7k|    size_t offset = 0;
   73|   973k|    while (len >= left) {
  ------------------
  |  Branch (73:12): [True: 961k, False: 11.7k]
  ------------------
   74|       |        // finish off current row
   75|   961k|        memcpy(cur_row + pos, data + offset, left);
   76|   961k|        offset += left;
   77|   961k|        len -= left;
   78|       |
   79|   961k|        processRow();
   80|       |
   81|       |        // Swap rows
   82|   961k|        unsigned char* t = prev_row;
   83|   961k|        prev_row = cur_row;
   84|   961k|        cur_row = t ? t : buf2.get();
  ------------------
  |  Branch (84:19): [True: 961k, False: 10]
  ------------------
   85|   961k|        memset(cur_row, 0, bytes_per_row + 1);
   86|   961k|        left = incoming;
   87|   961k|        pos = 0;
   88|   961k|    }
   89|  11.7k|    if (len) {
  ------------------
  |  Branch (89:9): [True: 11.1k, False: 629]
  ------------------
   90|  11.1k|        memcpy(cur_row + pos, data + offset, len);
   91|  11.1k|    }
   92|  11.7k|    pos += len;
   93|  11.7k|}
_ZN12Pl_PNGFilter10processRowEv:
   97|   962k|{
   98|   962k|    if (action == a_encode) {
  ------------------
  |  Branch (98:9): [True: 0, False: 962k]
  ------------------
   99|      0|        encodeRow();
  100|   962k|    } else {
  101|   962k|        decodeRow();
  102|   962k|    }
  103|   962k|}
_ZN12Pl_PNGFilter9decodeRowEv:
  107|   962k|{
  108|   962k|    int filter = cur_row[0];
  109|   962k|    if (prev_row) {
  ------------------
  |  Branch (109:9): [True: 962k, False: 0]
  ------------------
  110|   962k|        switch (filter) {
  111|   279k|        case 0:
  ------------------
  |  Branch (111:9): [True: 279k, False: 682k]
  ------------------
  112|   279k|            break;
  113|   148k|        case 1:
  ------------------
  |  Branch (113:9): [True: 148k, False: 813k]
  ------------------
  114|   148k|            decodeSub();
  115|   148k|            break;
  116|   340k|        case 2:
  ------------------
  |  Branch (116:9): [True: 340k, False: 621k]
  ------------------
  117|   340k|            decodeUp();
  118|   340k|            break;
  119|  2.42k|        case 3:
  ------------------
  |  Branch (119:9): [True: 2.42k, False: 959k]
  ------------------
  120|  2.42k|            decodeAverage();
  121|  2.42k|            break;
  122|  1.51k|        case 4:
  ------------------
  |  Branch (122:9): [True: 1.51k, False: 960k]
  ------------------
  123|  1.51k|            decodePaeth();
  124|  1.51k|            break;
  125|   189k|        default:
  ------------------
  |  Branch (125:9): [True: 189k, False: 772k]
  ------------------
  126|       |            // ignore
  127|   189k|            break;
  128|   962k|        }
  129|   962k|    }
  130|       |
  131|   962k|    next()->write(cur_row + 1, bytes_per_row);
  132|   962k|}
_ZN12Pl_PNGFilter9decodeSubEv:
  136|   148k|{
  137|   148k|    unsigned char* buffer = cur_row + 1;
  138|   148k|    unsigned int bpp = bytes_per_pixel;
  139|       |
  140|  1.03M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (140:30): [True: 890k, False: 148k]
  ------------------
  141|   890k|        unsigned char left = 0;
  142|       |
  143|   890k|        if (i >= bpp) {
  ------------------
  |  Branch (143:13): [True: 741k, False: 148k]
  ------------------
  144|   741k|            left = buffer[i - bpp];
  145|   741k|        }
  146|       |
  147|   890k|        buffer[i] = static_cast<unsigned char>(buffer[i] + left);
  148|   890k|    }
  149|   148k|}
_ZN12Pl_PNGFilter8decodeUpEv:
  153|   340k|{
  154|   340k|    unsigned char* buffer = cur_row + 1;
  155|   340k|    unsigned char* above_buffer = prev_row + 1;
  156|       |
  157|  2.13M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (157:30): [True: 1.79M, False: 340k]
  ------------------
  158|  1.79M|        unsigned char up = above_buffer[i];
  159|  1.79M|        buffer[i] = static_cast<unsigned char>(buffer[i] + up);
  160|  1.79M|    }
  161|   340k|}
_ZN12Pl_PNGFilter13decodeAverageEv:
  165|  2.42k|{
  166|  2.42k|    unsigned char* buffer = cur_row + 1;
  167|  2.42k|    unsigned char* above_buffer = prev_row + 1;
  168|  2.42k|    auto bpp = bytes_per_pixel;
  169|       |
  170|   275k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (170:30): [True: 273k, False: 2.42k]
  ------------------
  171|   273k|        int left = 0;
  172|   273k|        int up = 0;
  173|       |
  174|   273k|        if (i >= bpp) {
  ------------------
  |  Branch (174:13): [True: 238k, False: 34.8k]
  ------------------
  175|   238k|            left = buffer[i - bpp];
  176|   238k|        }
  177|       |
  178|   273k|        up = above_buffer[i];
  179|   273k|        buffer[i] = static_cast<unsigned char>(buffer[i] + (left + up) / 2);
  180|   273k|    }
  181|  2.42k|}
_ZN12Pl_PNGFilter11decodePaethEv:
  185|  1.51k|{
  186|  1.51k|    unsigned char* buffer = cur_row + 1;
  187|  1.51k|    unsigned char* above_buffer = prev_row + 1;
  188|  1.51k|    auto bpp = bytes_per_pixel;
  189|       |
  190|   323k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (190:30): [True: 321k, False: 1.51k]
  ------------------
  191|   321k|        int left = 0;
  192|   321k|        int up = above_buffer[i];
  193|   321k|        int upper_left = 0;
  194|       |
  195|   321k|        if (i >= bpp) {
  ------------------
  |  Branch (195:13): [True: 320k, False: 1.52k]
  ------------------
  196|   320k|            left = buffer[i - bpp];
  197|   320k|            upper_left = above_buffer[i - bpp];
  198|   320k|        }
  199|       |
  200|   321k|        buffer[i] = static_cast<unsigned char>(buffer[i] + PaethPredictor(left, up, upper_left));
  201|   321k|    }
  202|  1.51k|}
_ZN12Pl_PNGFilter14PaethPredictorEiii:
  206|   321k|{
  207|   321k|    int p = a + b - c;
  208|   321k|    int pa = abs_diff(p, a);
  209|   321k|    int pb = abs_diff(p, b);
  210|   321k|    int pc = abs_diff(p, c);
  211|       |
  212|   321k|    if (pa <= pb && pa <= pc) {
  ------------------
  |  Branch (212:9): [True: 318k, False: 2.82k]
  |  Branch (212:21): [True: 318k, False: 319]
  ------------------
  213|   318k|        return a;
  214|   318k|    }
  215|  3.14k|    if (pb <= pc) {
  ------------------
  |  Branch (215:9): [True: 2.75k, False: 392]
  ------------------
  216|  2.75k|        return b;
  217|  2.75k|    }
  218|    392|    return c;
  219|  3.14k|}
_ZN12Pl_PNGFilter6finishEv:
  239|  1.33k|{
  240|  1.33k|    if (pos) {
  ------------------
  |  Branch (240:9): [True: 654, False: 679]
  ------------------
  241|       |        // write partial row
  242|    654|        processRow();
  243|    654|    }
  244|  1.33k|    prev_row = nullptr;
  245|  1.33k|    cur_row = buf1.get();
  246|  1.33k|    pos = 0;
  247|  1.33k|    memset(cur_row, 0, bytes_per_row + 1);
  248|       |
  249|  1.33k|    next()->finish();
  250|  1.33k|}
Pl_PNGFilter.cc:_ZL8abs_diffii:
   19|   965k|{
   20|   965k|    return a > b ? a - b : b - a;
  ------------------
  |  Branch (20:12): [True: 14.3k, False: 951k]
  ------------------
   21|   965k|}

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

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

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

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

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

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

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

_ZN26QPDFAcroFormDocumentHelperC2ER4QPDF:
   24|  15.6k|    QPDFDocumentHelper(qpdf),
   25|  15.6k|    m(std::make_shared<Members>(qpdf))
   26|  15.6k|{
   27|  15.6k|}
_ZN4qpdf4impl8AcroForm8validateEb:
   43|  15.6k|{
   44|  15.6k|    invalidateCache();
   45|  15.6k|    analyze();
   46|  15.6k|}
_ZN4qpdf4impl8AcroForm15invalidateCacheEv:
   56|  15.6k|{
   57|  15.6k|    cache_valid_ = false;
   58|  15.6k|    fields_.clear();
   59|  15.6k|    annotation_to_field_.clear();
   60|  15.6k|    bad_fields_.clear();
   61|  15.6k|    unnamed_fields_.clear();
   62|  15.6k|    name_to_fields_.clear();
   63|  15.6k|}
_ZN26QPDFAcroFormDocumentHelper27getWidgetAnnotationsForPageE20QPDFPageObjectHelper:
  279|  17.9k|{
  280|  17.9k|    return m->getWidgetAnnotationsForPage(h);
  281|  17.9k|}
_ZN4qpdf4impl8AcroForm27getWidgetAnnotationsForPageE20QPDFPageObjectHelper:
  285|  27.7k|{
  286|  27.7k|    return h.getAnnotations("/Widget");
  287|  27.7k|}
_ZN26QPDFAcroFormDocumentHelper21getFieldForAnnotationE26QPDFAnnotationObjectHelper:
  312|  1.71k|{
  313|  1.71k|    return m->getFieldForAnnotation(h);
  314|  1.71k|}
_ZN4qpdf4impl8AcroForm21getFieldForAnnotationE26QPDFAnnotationObjectHelper:
  318|  20.2k|{
  319|  20.2k|    QPDFObjectHandle oh = h.getObjectHandle();
  320|  20.2k|    if (!oh.isDictionaryOfType("", "/Widget")) {
  ------------------
  |  Branch (320:9): [True: 0, False: 20.2k]
  ------------------
  321|      0|        return Null::temp();
  322|      0|    }
  323|  20.2k|    analyze();
  324|  20.2k|    QPDFObjGen og(oh.getObjGen());
  325|  20.2k|    if (annotation_to_field_.contains(og)) {
  ------------------
  |  Branch (325:9): [True: 18.3k, False: 1.90k]
  ------------------
  326|  18.3k|        return annotation_to_field_[og];
  327|  18.3k|    }
  328|  1.90k|    return Null::temp();
  329|  20.2k|}
_ZN4qpdf4impl8AcroForm7analyzeEv:
  333|  35.9k|{
  334|  35.9k|    if (cache_valid_) {
  ------------------
  |  Branch (334:9): [True: 20.2k, False: 15.6k]
  ------------------
  335|  20.2k|        return;
  336|  20.2k|    }
  337|  15.6k|    cache_valid_ = true;
  338|  15.6k|    QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
  339|  15.6k|    if (!(acroform.isDictionary() && acroform.hasKey("/Fields"))) {
  ------------------
  |  Branch (339:9): [True: 10.0k, False: 5.65k]
  |  Branch (339:11): [True: 5.74k, False: 9.94k]
  |  Branch (339:38): [True: 5.65k, False: 91]
  ------------------
  340|  10.0k|        return;
  341|  10.0k|    }
  342|  5.65k|    QPDFObjectHandle fields = acroform.getKey("/Fields");
  343|  5.65k|    if (Array fa = fields) {
  ------------------
  |  Branch (343:15): [True: 5.63k, False: 17]
  ------------------
  344|       |        // Traverse /AcroForm to find annotations and map them bidirectionally to fields.
  345|  32.8k|        for (auto const& field: fa) {
  ------------------
  |  Branch (345:31): [True: 32.8k, False: 5.63k]
  ------------------
  346|  32.8k|            traverseField(field, {}, 0);
  347|  32.8k|        }
  348|  5.63k|    } else {
  349|     17|        acroform.warn("/Fields key of /AcroForm dictionary is not an array; ignoring");
  350|     17|        fields = Array::empty();
  351|     17|    }
  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|  6.86k|    for (QPDFPageObjectHelper ph: pages) {
  ------------------
  |  Branch (360:33): [True: 6.86k, False: 5.65k]
  ------------------
  361|  20.5k|        for (auto const& iter: getWidgetAnnotationsForPage(ph)) {
  ------------------
  |  Branch (361:30): [True: 20.5k, False: 6.86k]
  ------------------
  362|  20.5k|            QPDFObjectHandle annot(iter.getObjectHandle());
  363|  20.5k|            QPDFObjGen og(annot.getObjGen());
  364|  20.5k|            if (!annotation_to_field_.contains(og)) {
  ------------------
  |  Branch (364:17): [True: 12.9k, False: 7.66k]
  ------------------
  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|  12.9k|                annot.warn(
  371|  12.9k|                    "this widget annotation is not reachable from /AcroForm in the document "
  372|  12.9k|                    "catalog");
  373|  12.9k|                annotation_to_field_[og] = QPDFFormFieldObjectHelper(annot);
  374|  12.9k|                fields_[og].annotations.emplace_back(annot);
  375|  12.9k|            }
  376|  20.5k|        }
  377|  6.86k|    }
  378|  5.65k|}
_ZN4qpdf4impl8AcroForm13traverseFieldE16QPDFObjectHandleRKS2_i:
  382|  62.2k|{
  383|  62.2k|    if (depth > 100) {
  ------------------
  |  Branch (383:9): [True: 0, False: 62.2k]
  ------------------
  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|  62.2k|    if (!field.indirect()) {
  ------------------
  |  Branch (388:9): [True: 17.8k, False: 44.4k]
  ------------------
  389|  17.8k|        field.warn(
  390|  17.8k|            "encountered a direct object as a field or annotation while traversing /AcroForm; "
  391|  17.8k|            "ignoring field or annotation");
  392|  17.8k|        return false;
  393|  17.8k|    }
  394|  44.4k|    if (field == parent) {
  ------------------
  |  Branch (394:9): [True: 92, False: 44.3k]
  ------------------
  395|     92|        field.warn("loop detected while traversing /AcroForm");
  396|     92|        return false;
  397|     92|    }
  398|  44.3k|    if (!field.isDictionary()) {
  ------------------
  |  Branch (398:9): [True: 28.6k, False: 15.6k]
  ------------------
  399|  28.6k|        field.warn(
  400|  28.6k|            "encountered a non-dictionary as a field or annotation while traversing /AcroForm; "
  401|  28.6k|            "ignoring field or annotation");
  402|  28.6k|        return false;
  403|  28.6k|    }
  404|  15.6k|    QPDFObjGen og(field.getObjGen());
  405|  15.6k|    if (unnamed_fields_.contains(og)) {
  ------------------
  |  Branch (405:9): [True: 614, False: 15.0k]
  ------------------
  406|    614|        bad_fields_.insert(og);
  407|    614|    }
  408|  15.6k|    if (fields_.contains(og) || annotation_to_field_.contains(og) || bad_fields_.contains(og)) {
  ------------------
  |  Branch (408:9): [True: 561, False: 15.1k]
  |  Branch (408:33): [True: 292, False: 14.8k]
  |  Branch (408:70): [True: 738, False: 14.0k]
  ------------------
  409|  1.59k|        field.warn("loop detected while traversing /AcroForm");
  410|  1.59k|        return false;
  411|  1.59k|    }
  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|  14.0k|    FormNode node = field;
  420|  14.0k|    const bool is_field = node.field();
  421|  14.0k|    const bool is_annotation = node.widget();
  422|       |
  423|  14.0k|    QTC::TC("qpdf", "QPDFAcroFormDocumentHelper field found", (depth == 0) ? 0 : 1);
  ------------------
  |  Branch (423:63): [True: 4.52k, False: 9.54k]
  ------------------
  424|  14.0k|    QTC::TC("qpdf", "QPDFAcroFormDocumentHelper annotation found", (is_field ? 0 : 1));
  ------------------
  |  Branch (424:69): [True: 11.8k, False: 2.18k]
  ------------------
  425|       |
  426|  14.0k|    if (!is_field && !is_annotation) {
  ------------------
  |  Branch (426:9): [True: 2.18k, False: 11.8k]
  |  Branch (426:22): [True: 1.55k, False: 630]
  ------------------
  427|  1.55k|        field.warn(
  428|  1.55k|            "encountered an object that is neither field nor annotation while traversing "
  429|  1.55k|            "/AcroForm");
  430|  1.55k|        return false;
  431|  1.55k|    }
  432|       |
  433|  12.5k|    if (is_annotation) {
  ------------------
  |  Branch (433:9): [True: 8.55k, False: 3.96k]
  ------------------
  434|  8.55k|        auto our_field = (is_field ? field : parent);
  ------------------
  |  Branch (434:27): [True: 7.92k, False: 630]
  ------------------
  435|  8.55k|        fields_[our_field].annotations.emplace_back(field);
  436|  8.55k|        annotation_to_field_[og] = QPDFFormFieldObjectHelper(our_field);
  437|  8.55k|    }
  438|       |
  439|  12.5k|    if (!is_field) {
  ------------------
  |  Branch (439:9): [True: 630, False: 11.8k]
  ------------------
  440|    630|        return true;
  441|    630|    }
  442|       |
  443|  11.8k|    if (depth != 0 && field["/Parent"] != parent) {
  ------------------
  |  Branch (443:9): [True: 8.35k, False: 3.52k]
  |  Branch (443:9): [True: 1.42k, False: 10.4k]
  |  Branch (443:23): [True: 1.42k, False: 6.93k]
  ------------------
  444|  27.9k|        for (auto const& kid: Array(field["/Parent"]["/Kids"])) {
  ------------------
  |  Branch (444:29): [True: 27.9k, False: 1.13k]
  ------------------
  445|  27.9k|            if (kid == field) {
  ------------------
  |  Branch (445:17): [True: 291, False: 27.6k]
  ------------------
  446|    291|                field.warn("while traversing /AcroForm found field with two parents");
  447|    291|                return true;
  448|    291|            }
  449|  27.9k|        }
  450|  9.20k|        for (auto const& kid: Array(field["/Parent"]["/Kids"])) {
  ------------------
  |  Branch (450:29): [True: 9.20k, False: 1.05k]
  ------------------
  451|  9.20k|            if (kid == parent) {
  ------------------
  |  Branch (451:17): [True: 76, False: 9.12k]
  ------------------
  452|     76|                field.warn("loop detected while traversing /AcroForm");
  453|     76|                return false;
  454|     76|            }
  455|  9.20k|        }
  456|  1.05k|        field.warn("encountered invalid /Parent entry while traversing /AcroForm; correcting");
  457|  1.05k|        field.replaceKey("/Parent", parent);
  458|  1.05k|    }
  459|       |
  460|  11.5k|    if (node.T()) {
  ------------------
  |  Branch (460:9): [True: 9.28k, False: 2.22k]
  ------------------
  461|  9.28k|        auto old = fields_.find(og);
  462|  9.28k|        if (old != fields_.end() && !old->second.name.empty()) {
  ------------------
  |  Branch (462:13): [True: 6.54k, False: 2.74k]
  |  Branch (462:13): [True: 0, False: 9.28k]
  |  Branch (462:37): [True: 0, False: 6.54k]
  ------------------
  463|       |            // We might be updating after a name change, so remove any old information
  464|      0|            name_to_fields_[old->second.name].erase(og);
  465|      0|        }
  466|  9.28k|        std::string name = node.fully_qualified_name();
  467|  9.28k|        fields_[og].name = name;
  468|  9.28k|        name_to_fields_[name].insert(og);
  469|  9.28k|    } else if (!is_annotation) {
  ------------------
  |  Branch (469:16): [True: 1.11k, False: 1.11k]
  ------------------
  470|  1.11k|        unnamed_fields_.insert(og);
  471|  1.11k|    }
  472|       |
  473|  55.1k|    for (auto const& kid: node.Kids()) {
  ------------------
  |  Branch (473:25): [True: 55.1k, False: 11.5k]
  ------------------
  474|  55.1k|        if (bad_fields_.contains(kid)) {
  ------------------
  |  Branch (474:13): [True: 25.7k, False: 29.4k]
  ------------------
  475|  25.7k|            continue;
  476|  25.7k|        }
  477|       |
  478|  29.4k|        if (!traverseField(kid, field, 1 + depth)) {
  ------------------
  |  Branch (478:13): [True: 20.8k, False: 8.62k]
  ------------------
  479|  20.8k|            bad_fields_.insert(kid);
  480|  20.8k|        }
  481|  29.4k|    }
  482|  11.5k|    return true;
  483|  11.8k|}
_ZN4qpdf4impl8AcroForm18getNeedAppearancesEv:
  493|  44.5k|{
  494|  44.5k|    bool result = false;
  495|  44.5k|    QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
  496|  44.5k|    if (acroform.isDictionary() && acroform.getKey("/NeedAppearances").isBool()) {
  ------------------
  |  Branch (496:9): [True: 11.8k, False: 32.7k]
  |  Branch (496:9): [True: 2.45k, False: 42.1k]
  |  Branch (496:36): [True: 2.45k, False: 9.43k]
  ------------------
  497|  2.45k|        result = acroform.getKey("/NeedAppearances").getBoolValue();
  498|  2.45k|    }
  499|  44.5k|    return result;
  500|  44.5k|}
_ZN4qpdf4impl8AcroForm18setNeedAppearancesEb:
  510|  2.21k|{
  511|  2.21k|    QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
  512|  2.21k|    if (!acroform.isDictionary()) {
  ------------------
  |  Branch (512:9): [True: 0, False: 2.21k]
  ------------------
  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.21k|    if (val) {
  ------------------
  |  Branch (518:9): [True: 0, False: 2.21k]
  ------------------
  519|      0|        acroform.replaceKey("/NeedAppearances", QPDFObjectHandle::newBool(true));
  520|  2.21k|    } else {
  521|  2.21k|        acroform.removeKey("/NeedAppearances");
  522|  2.21k|    }
  523|  2.21k|}
_ZN26QPDFAcroFormDocumentHelper27generateAppearancesIfNeededEv:
  527|  7.94k|{
  528|  7.94k|    m->generateAppearancesIfNeeded();
  529|  7.94k|}
_ZN4qpdf4impl8AcroForm27generateAppearancesIfNeededEv:
  533|  7.94k|{
  534|  7.94k|    if (!getNeedAppearances()) {
  ------------------
  |  Branch (534:9): [True: 5.52k, False: 2.42k]
  ------------------
  535|  5.52k|        return;
  536|  5.52k|    }
  537|       |
  538|  2.90k|    for (auto const& page: QPDFPageDocumentHelper(qpdf).getAllPages()) {
  ------------------
  |  Branch (538:26): [True: 2.90k, False: 2.42k]
  ------------------
  539|  9.43k|        for (auto& aoh: getWidgetAnnotationsForPage(page)) {
  ------------------
  |  Branch (539:23): [True: 9.43k, False: 2.90k]
  ------------------
  540|  9.43k|            QPDFFormFieldObjectHelper ffh = getFieldForAnnotation(aoh);
  541|  9.43k|            if (ffh.getFieldType() == "/Btn") {
  ------------------
  |  Branch (541:17): [True: 658, False: 8.78k]
  ------------------
  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|    658|                if (ffh.isRadioButton() || ffh.isCheckbox()) {
  ------------------
  |  Branch (546:21): [True: 298, False: 360]
  |  Branch (546:44): [True: 349, False: 11]
  ------------------
  547|    647|                    ffh.setV(ffh.getValue());
  548|    647|                }
  549|  8.78k|            } else {
  550|  8.78k|                ffh.generateAppearance(aoh);
  551|  8.78k|            }
  552|  9.43k|        }
  553|  2.90k|    }
  554|  2.42k|    setNeedAppearances(false);
  555|  2.42k|}

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

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

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

_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_:
    9|   614k|    std::runtime_error(createWhat(filename, object, (offset ? offset : -1), message)),
  ------------------
  |  Branch (9:54): [True: 430k, False: 183k]
  ------------------
   10|   614k|    error_code(error_code),
   11|   614k|    filename(filename),
   12|   614k|    object(object),
   13|   614k|    offset(offset ? offset : -1),
  ------------------
  |  Branch (13:12): [True: 430k, False: 183k]
  ------------------
   14|   614k|    message(message)
   15|   614k|{
   16|   614k|}
_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_b:
   25|   302k|    std::runtime_error(
   26|   302k|        createWhat(filename, object, (offset || zero_offset_valid ? offset : -1), message)),
  ------------------
  |  Branch (26:39): [True: 301k, False: 69]
  |  Branch (26:49): [True: 69, False: 0]
  ------------------
   27|   302k|    error_code(error_code),
   28|   302k|    filename(filename),
   29|   302k|    object(object),
   30|   302k|    offset(offset || zero_offset_valid ? offset : -1),
  ------------------
  |  Branch (30:12): [True: 301k, False: 69]
  |  Branch (30:22): [True: 69, False: 0]
  ------------------
   31|   302k|    message(message)
   32|   302k|{
   33|   302k|}
_ZN7QPDFExc10createWhatERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_xS8_:
   41|   916k|{
   42|   916k|    std::string result;
   43|   916k|    if (!filename.empty()) {
  ------------------
  |  Branch (43:9): [True: 744k, False: 172k]
  ------------------
   44|   744k|        result += filename;
   45|   744k|    }
   46|   916k|    if (!(object.empty() && offset < 0)) {
  ------------------
  |  Branch (46:11): [True: 147k, False: 769k]
  |  Branch (46:29): [True: 106k, False: 40.9k]
  ------------------
   47|   810k|        if (!filename.empty()) {
  ------------------
  |  Branch (47:13): [True: 638k, False: 171k]
  ------------------
   48|   638k|            result += " (";
   49|   638k|        }
   50|   810k|        if (!object.empty()) {
  ------------------
  |  Branch (50:13): [True: 769k, False: 40.9k]
  ------------------
   51|   769k|            result += object;
   52|   769k|            if (offset >= 0) {
  ------------------
  |  Branch (52:17): [True: 585k, False: 183k]
  ------------------
   53|   585k|                result += ", ";
   54|   585k|            }
   55|   769k|        }
   56|   810k|        if (offset >= 0) {
  ------------------
  |  Branch (56:13): [True: 626k, False: 183k]
  ------------------
   57|   626k|            result += "offset " + std::to_string(offset);
   58|   626k|        }
   59|   810k|        if (!filename.empty()) {
  ------------------
  |  Branch (59:13): [True: 638k, False: 171k]
  ------------------
   60|   638k|            result += ")";
   61|   638k|        }
   62|   810k|    }
   63|   916k|    if (!result.empty()) {
  ------------------
  |  Branch (63:9): [True: 916k, False: 148]
  ------------------
   64|   916k|        result += ": ";
   65|   916k|    }
   66|   916k|    result += message;
   67|   916k|    return result;
   68|   916k|}

_ZN25QPDFFormFieldObjectHelperC2E16QPDFObjectHandle:
   34|  23.3k|    QPDFObjectHelper(o),
   35|  23.3k|    m(std::make_shared<Members>(oh()))
   36|  23.3k|{
   37|  23.3k|}
_ZN25QPDFFormFieldObjectHelperC2Ev:
   40|  21.4k|    QPDFObjectHelper(Null::temp()),
   41|  21.4k|    m(std::make_shared<Members>(QPDFObjectHandle()))
   42|  21.4k|{
   43|  21.4k|}
_ZNK4qpdf4impl8FormNode9inheritedERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
   92|  17.2k|{
   93|  17.2k|    if (!obj) {
  ------------------
  |  Branch (93:9): [True: 742, False: 16.5k]
  ------------------
   94|    742|        return null_oh;
   95|    742|    }
   96|  16.5k|    auto node = *this;
   97|  16.5k|    QPDFObjGen::set seen;
   98|  16.5k|    size_t depth = 0; // Don't bother with loop detection until depth becomes suspicious
   99|  26.2k|    while (node.Parent() && (++depth < 10 || seen.add(node))) {
  ------------------
  |  Branch (99:12): [True: 12.2k, False: 14.0k]
  |  Branch (99:12): [True: 11.5k, False: 14.6k]
  |  Branch (99:30): [True: 10.1k, False: 2.05k]
  |  Branch (99:46): [True: 1.44k, False: 607]
  ------------------
  100|  11.5k|        node = node.Parent();
  101|  11.5k|        if (auto const& result = node[name]) {
  ------------------
  |  Branch (101:25): [True: 1.81k, False: 9.78k]
  ------------------
  102|  1.81k|            return {result};
  103|  1.81k|        }
  104|  11.5k|    }
  105|  14.6k|    return acroform ? from_AcroForm(name) : null_oh;
  ------------------
  |  Branch (105:12): [True: 0, False: 14.6k]
  ------------------
  106|  16.5k|}
_ZNK4qpdf4impl8FormNode18inheritable_stringERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  116|  7.79k|{
  117|  7.79k|    if (auto fv = inheritable_value<String>(name)) {
  ------------------
  |  Branch (117:14): [True: 1.11k, False: 6.67k]
  ------------------
  118|  1.11k|        return fv.utf8_value();
  119|  1.11k|    }
  120|  6.67k|    return {};
  121|  7.79k|}
_ZN25QPDFFormFieldObjectHelper12getFieldTypeEv:
  134|  9.43k|{
  135|  9.43k|    if (auto ft = m->FT()) {
  ------------------
  |  Branch (135:14): [True: 8.74k, False: 699]
  ------------------
  136|  8.74k|        return ft;
  137|  8.74k|    }
  138|    699|    return {};
  139|  9.43k|}
_ZNK4qpdf4impl8FormNode20fully_qualified_nameEv:
  149|  9.28k|{
  150|  9.28k|    std::string result;
  151|  9.28k|    auto node = *this;
  152|  9.28k|    QPDFObjGen::set seen;
  153|  9.28k|    size_t depth = 0; // Don't bother with loop detection until depth becomes suspicious
  154|  45.9k|    while (node && (++depth < 10 || seen.add(node))) {
  ------------------
  |  Branch (154:12): [True: 38.1k, False: 7.82k]
  |  Branch (154:21): [True: 32.2k, False: 5.84k]
  |  Branch (154:37): [True: 4.37k, False: 1.46k]
  ------------------
  155|  36.6k|        if (auto T = node.T()) {
  ------------------
  |  Branch (155:18): [True: 35.1k, False: 1.54k]
  ------------------
  156|  35.1k|            if (!result.empty()) {
  ------------------
  |  Branch (156:17): [True: 25.8k, False: 9.30k]
  ------------------
  157|  25.8k|                result.insert(0, 1, '.');
  158|  25.8k|            }
  159|  35.1k|            result.insert(0, T.utf8_value());
  160|  35.1k|        }
  161|  36.6k|        node = node.Parent();
  162|  36.6k|    }
  163|  9.28k|    return result;
  164|  9.28k|}
_ZN25QPDFFormFieldObjectHelper8getValueEv:
  213|    647|{
  214|    647|    return Null::if_null(m->V<QPDFObjectHandle>());
  215|    647|}
_ZNK4qpdf4impl8FormNode5valueEv:
  225|  7.79k|{
  226|  7.79k|    return inheritable_string("/V");
  227|  7.79k|}
_ZN25QPDFFormFieldObjectHelper19getDefaultResourcesEv:
  249|  9.05k|{
  250|  9.05k|    return Null::if_null(m->getDefaultResources());
  251|  9.05k|}
_ZN4qpdf4impl8FormNode19getDefaultResourcesEv:
  255|  13.7k|{
  256|  13.7k|    return from_AcroForm("/DR");
  257|  13.7k|}
_ZNK4qpdf4impl8FormNode18default_appearanceEv:
  267|  7.79k|{
  268|  7.79k|    if (auto DA = inheritable_value<String>("/DA")) {
  ------------------
  |  Branch (268:14): [True: 6.25k, False: 1.53k]
  ------------------
  269|  6.25k|        return DA.utf8_value();
  270|  6.25k|    }
  271|  1.53k|    if (String DA = from_AcroForm("/DA")) {
  ------------------
  |  Branch (271:16): [True: 12, False: 1.52k]
  ------------------
  272|     12|        return DA.utf8_value();
  273|     12|    }
  274|  1.52k|    return {};
  275|  1.53k|}
_ZN4qpdf4impl8FormNode8getFlagsEv:
  307|  4.63k|{
  308|  4.63k|    auto f = inheritable_value<QPDFObjectHandle>("/Ff");
  309|  4.63k|    return f.isInteger() ? f.getIntValueAsInt() : 0;
  ------------------
  |  Branch (309:12): [True: 1.71k, False: 2.92k]
  ------------------
  310|  4.63k|}
_ZN25QPDFFormFieldObjectHelper10isCheckboxEv:
  326|    360|{
  327|    360|    return m->isCheckbox();
  328|    360|}
_ZN4qpdf4impl8FormNode10isCheckboxEv:
  332|  1.00k|{
  333|  1.00k|    return FT() == "/Btn" && (getFlags() & (ff_btn_radio | ff_btn_pushbutton)) == 0;
  ------------------
  |  Branch (333:12): [True: 1.00k, False: 0]
  |  Branch (333:30): [True: 698, False: 309]
  ------------------
  334|  1.00k|}
_ZN25QPDFFormFieldObjectHelper13isRadioButtonEv:
  350|    658|{
  351|    658|    return m->isRadioButton();
  352|    658|}
_ZN4qpdf4impl8FormNode13isRadioButtonEv:
  356|  1.22k|{
  357|  1.22k|    return FT() == "/Btn" && (getFlags() & ff_btn_radio) == ff_btn_radio;
  ------------------
  |  Branch (357:12): [True: 1.19k, False: 31]
  |  Branch (357:30): [True: 833, False: 360]
  ------------------
  358|  1.22k|}
_ZN4qpdf4impl8FormNode8isChoiceEv:
  380|  9.91k|{
  381|  9.91k|    return FT() == "/Ch";
  382|  9.91k|}
_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|  30.8k|    for (auto const& item: inheritable_value<Array>("/Opt")) {
  ------------------
  |  Branch (397:26): [True: 30.8k, False: 2.11k]
  ------------------
  398|  30.8k|        if (item.isString()) {
  ------------------
  |  Branch (398:13): [True: 20.0k, False: 10.8k]
  ------------------
  399|  20.0k|            result.emplace_back(item.getUTF8Value());
  400|  20.0k|        } else if (item.size() == 2) {
  ------------------
  |  Branch (400:20): [True: 180, False: 10.6k]
  ------------------
  401|    180|            auto display = item.getArrayItem(1);
  402|    180|            if (display.isString()) {
  ------------------
  |  Branch (402:17): [True: 132, False: 48]
  ------------------
  403|    132|                result.emplace_back(display.getUTF8Value());
  404|    132|            }
  405|    180|        }
  406|  30.8k|    }
  407|  2.11k|    return result;
  408|  2.11k|}
_ZN4qpdf4impl8FormNode17setFieldAttributeERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKNS_4NameE:
  424|    264|{
  425|    264|    replace(key, value);
  426|    264|}
_ZN25QPDFFormFieldObjectHelper4setVE16QPDFObjectHandleb:
  442|    647|{
  443|    647|    m->setV(value, need_appearances);
  444|    647|}
_ZN4qpdf4impl8FormNode4setVE16QPDFObjectHandleb:
  448|    647|{
  449|    647|    if (FT() == "/Btn") {
  ------------------
  |  Branch (449:9): [True: 647, False: 0]
  ------------------
  450|    647|        Name name = value;
  451|    647|        if (isCheckbox()) {
  ------------------
  |  Branch (451:13): [True: 349, False: 298]
  ------------------
  452|    349|            if (!name) {
  ------------------
  |  Branch (452:17): [True: 85, False: 264]
  ------------------
  453|     85|                warn("ignoring attempt to set a checkbox field to a value whose type is not name");
  454|     85|                return;
  455|     85|            }
  456|       |            // Accept any value other than /Off to mean checked. Files have been seen that use
  457|       |            // /1 or other values.
  458|    264|            setCheckBoxValue(name != "/Off");
  459|    264|            return;
  460|    349|        }
  461|    298|        if (isRadioButton()) {
  ------------------
  |  Branch (461:13): [True: 298, False: 0]
  ------------------
  462|    298|            if (!name) {
  ------------------
  |  Branch (462:17): [True: 30, False: 268]
  ------------------
  463|     30|                warn(
  464|     30|                    "ignoring attempt to set a radio button field to an object that is not a name");
  465|     30|                return;
  466|     30|            }
  467|    268|            setRadioButtonValue(name);
  468|    268|            return;
  469|    298|        }
  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|    298|    }
  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|    364|{
  503|    364|    qpdf_expect(name);
  ------------------
  |  |   13|    364|#define qpdf_expect assert
  ------------------
  |  Branch (503:5): [True: 364, 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|    364|    auto kids = Kids();
  512|    364|    if (!kids) {
  ------------------
  |  Branch (512:9): [True: 165, False: 199]
  ------------------
  513|       |        // This is most likely one of the individual buttons. Try calling on the parent.
  514|    165|        auto parent = Parent();
  515|    165|        if (parent.Kids()) {
  ------------------
  |  Branch (515:13): [True: 96, False: 69]
  ------------------
  516|     96|            parent.setRadioButtonValue(name);
  517|     96|            return;
  518|     96|        }
  519|    165|    }
  520|    268|    if (!isRadioButton() || !kids) {
  ------------------
  |  Branch (520:9): [True: 31, False: 237]
  |  Branch (520:29): [True: 69, False: 168]
  ------------------
  521|    100|        warn("don't know how to set the value of this field as a radio button");
  522|    100|        return;
  523|    100|    }
  524|    168|    replace("/V", name);
  525|  1.76k|    for (FormNode kid: kids) {
  ------------------
  |  Branch (525:22): [True: 1.76k, False: 168]
  ------------------
  526|  1.76k|        auto ap = kid.AP();
  527|  1.76k|        QPDFObjectHandle annot;
  528|  1.76k|        if (!ap) {
  ------------------
  |  Branch (528:13): [True: 1.58k, False: 180]
  ------------------
  529|       |            // The widget may be below. If there is more than one, just find the first one.
  530|  5.15k|            for (FormNode grandkid: kid.Kids()) {
  ------------------
  |  Branch (530:35): [True: 5.15k, False: 1.41k]
  ------------------
  531|  5.15k|                ap = grandkid.AP();
  532|  5.15k|                if (ap) {
  ------------------
  |  Branch (532:21): [True: 166, False: 4.99k]
  ------------------
  533|    166|                    annot = grandkid;
  534|    166|                    break;
  535|    166|                }
  536|  5.15k|            }
  537|  1.58k|        } else {
  538|    180|            annot = kid;
  539|    180|        }
  540|  1.76k|        if (!annot) {
  ------------------
  |  Branch (540:13): [True: 1.41k, False: 346]
  ------------------
  541|  1.41k|            warn("unable to set the value of this radio button");
  542|  1.41k|            continue;
  543|  1.41k|        }
  544|    346|        if (ap["/N"].contains(name.value())) {
  ------------------
  |  Branch (544:13): [True: 101, False: 245]
  ------------------
  545|    101|            annot.replace("/AS", name);
  546|    245|        } else {
  547|    245|            annot.replace("/AS", Name("/Off"));
  548|    245|        }
  549|    346|    }
  550|    168|}
_ZN4qpdf4impl8FormNode16setCheckBoxValueEb:
  554|    264|{
  555|    264|    auto ap = AP();
  556|    264|    QPDFObjectHandle annot;
  557|    264|    if (ap) {
  ------------------
  |  Branch (557:9): [True: 164, False: 100]
  ------------------
  558|    164|        annot = oh();
  559|    164|    } else {
  560|       |        // The widget may be below. If there is more than one, just find the first one.
  561|  1.10k|        for (FormNode kid: Kids()) {
  ------------------
  |  Branch (561:26): [True: 1.10k, False: 81]
  ------------------
  562|  1.10k|            ap = kid.AP();
  563|  1.10k|            if (ap) {
  ------------------
  |  Branch (563:17): [True: 19, False: 1.08k]
  ------------------
  564|     19|                annot = kid;
  565|     19|                break;
  566|     19|            }
  567|  1.10k|        }
  568|    100|    }
  569|    264|    std::string on_value;
  570|    264|    if (value) {
  ------------------
  |  Branch (570:9): [True: 185, False: 79]
  ------------------
  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|    185|        if (ap) {
  ------------------
  |  Branch (573:13): [True: 123, False: 62]
  ------------------
  574|    153|            for (auto const& item: Dictionary(ap["/N"])) {
  ------------------
  |  Branch (574:34): [True: 153, False: 31]
  ------------------
  575|    153|                if (item.first != "/Off") {
  ------------------
  |  Branch (575:21): [True: 92, False: 61]
  ------------------
  576|     92|                    on_value = item.first;
  577|     92|                    break;
  578|     92|                }
  579|    153|            }
  580|    123|        }
  581|    185|        if (on_value.empty()) {
  ------------------
  |  Branch (581:13): [True: 93, False: 92]
  ------------------
  582|     93|            on_value = "/Yes";
  583|     93|        }
  584|    185|    }
  585|       |
  586|       |    // Set /AS to the on value or /Off in addition to setting /V.
  587|    264|    auto name = Name(value ? on_value : "/Off");
  ------------------
  |  Branch (587:22): [True: 185, False: 79]
  ------------------
  588|    264|    setFieldAttribute("/V", name);
  589|    264|    if (!annot) {
  ------------------
  |  Branch (589:9): [True: 81, False: 183]
  ------------------
  590|     81|        warn("unable to set the value of this checkbox");
  591|     81|        return;
  592|     81|    }
  593|    183|    annot.replace("/AS", name);
  594|    183|}
_ZN25QPDFFormFieldObjectHelper18generateAppearanceER26QPDFAnnotationObjectHelper:
  598|  8.78k|{
  599|  8.78k|    m->generateAppearance(aoh);
  600|  8.78k|}
_ZN4qpdf4impl8FormNode18generateAppearanceER26QPDFAnnotationObjectHelper:
  604|  8.78k|{
  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|  8.78k|    auto ft = FT();
  608|  8.78k|    if (ft == "/Tx" || ft == "/Ch") {
  ------------------
  |  Branch (608:9): [True: 5.48k, False: 3.29k]
  |  Branch (608:24): [True: 2.48k, False: 816]
  ------------------
  609|  7.96k|        generateTextAppearance(aoh);
  610|  7.96k|    }
  611|  8.78k|}
_ZN4qpdf4impl8FormNode22generateTextAppearanceER26QPDFAnnotationObjectHelper:
  881|  7.96k|{
  882|  7.96k|    no_ci_warn_if(
  883|  7.96k|        !Dictionary(aoh), // There is no guarantee that aoh is a dictionary
  884|  7.96k|        "cannot generate appearance for non-dictionary annotation" //
  885|  7.96k|    );
  886|  7.96k|    Stream AS = aoh.getAppearanceStream("/N"); // getAppearanceStream returns a stream or null.
  887|  7.96k|    if (!AS) {
  ------------------
  |  Branch (887:9): [True: 3.70k, False: 4.26k]
  ------------------
  888|  3.70k|        QPDFObjectHandle::Rectangle rect = aoh.getRect(); // may silently be invalid / all zeros
  889|  3.70k|        QPDFObjectHandle::Rectangle bbox(0, 0, rect.urx - rect.llx, rect.ury - rect.lly);
  890|  3.70k|        auto* pdf = qpdf();
  891|  3.70k|        no_ci_stop_damaged_if(!pdf, "unable to get owning QPDF for appearance generation");
  892|  3.70k|        AS = pdf->newStream("/Tx BMC\nEMC\n");
  893|  3.70k|        AS.replaceDict(Dictionary(
  894|  3.70k|            {{"/BBox", QPDFObjectHandle::newFromRectangle(bbox)},
  895|  3.70k|             {"/Resources", Dictionary({{"/ProcSet", Array({Name("/PDF"), Name("/Text")})}})},
  896|  3.70k|             {"/Type", Name("/XObject")},
  897|  3.70k|             {"/Subtype", Name("/Form")}}));
  898|  3.70k|        if (auto ap = AP()) {
  ------------------
  |  Branch (898:18): [True: 995, False: 2.71k]
  ------------------
  899|    995|            ap.replace("/N", AS);
  900|  2.71k|        } else {
  901|  2.71k|            aoh.replace("/AP", Dictionary({{"/N", AS}}));
  902|  2.71k|        }
  903|  3.70k|    }
  904|       |
  905|  7.96k|    if (AS.obj_sp().use_count() > 3) {
  ------------------
  |  Branch (905:9): [True: 476, False: 7.48k]
  ------------------
  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|    476|        auto data = AS.getStreamData(qpdf_dl_all);
  918|    476|        AS = AS.copy();
  919|    476|        AS.replaceStreamData(std::move(data), Null::temp(), Null::temp());
  920|    476|        if (Dictionary AP = aoh.getAppearanceDictionary()) {
  ------------------
  |  Branch (920:24): [True: 450, False: 26]
  ------------------
  921|    450|            AP.replace("/N", AS);
  922|    450|        } else {
  923|     26|            aoh.replace("/AP", Dictionary({{"/N", AS}}));
  924|       |            // aoh is a dictionary, so insertion will succeed. No need to check by retrieving it.
  925|     26|        }
  926|    476|    }
  927|  7.96k|    QPDFObjectHandle bbox_obj = AS.getDict()["/BBox"];
  928|  7.96k|    if (!bbox_obj.isRectangle()) {
  ------------------
  |  Branch (928:9): [True: 147, False: 7.81k]
  ------------------
  929|    147|        aoh.warn("unable to get appearance stream bounding box");
  930|    147|        return;
  931|    147|    }
  932|  7.81k|    QPDFObjectHandle::Rectangle bbox = bbox_obj.getArrayAsRectangle();
  933|  7.81k|    std::string DA = default_appearance();
  934|  7.81k|    std::string V = value();
  935|       |
  936|  7.81k|    TfFinder tff;
  937|  7.81k|    Pl_QPDFTokenizer tok("tf", &tff);
  938|  7.81k|    tok.writeString(DA);
  939|  7.81k|    tok.finish();
  940|  7.81k|    double tf = tff.getTf();
  941|  7.81k|    DA = tff.getDA();
  942|       |
  943|  7.81k|    std::string (*encoder)(std::string const&, char) = &QUtil::utf8_to_ascii;
  944|  7.81k|    std::string font_name = tff.getFontName();
  945|  7.81k|    if (!font_name.empty()) {
  ------------------
  |  Branch (945:9): [True: 4.77k, False: 3.03k]
  ------------------
  946|       |        // See if the font is encoded with something we know about.
  947|  4.77k|        Dictionary resources = AS.getDict()["/Resources"];
  948|  4.77k|        Dictionary font = resources["/Font"][font_name];
  949|  4.77k|        if (!font) {
  ------------------
  |  Branch (949:13): [True: 4.74k, False: 38]
  ------------------
  950|  4.74k|            font = getDefaultResources()["/Font"][font_name];
  951|  4.74k|            if (resources) {
  ------------------
  |  Branch (951:17): [True: 2.89k, False: 1.85k]
  ------------------
  952|  2.89k|                if (resources.indirect()) {
  ------------------
  |  Branch (952:21): [True: 340, False: 2.55k]
  ------------------
  953|    340|                    resources = resources.qpdf()->makeIndirectObject(resources.copy());
  954|    340|                    AS.getDict().replace("/Resources", resources);
  955|    340|                }
  956|       |                // Use mergeResources to force /Font to be local
  957|  2.89k|                QPDFObjectHandle res = resources;
  958|  2.89k|                res.mergeResources(Dictionary({{"/Font", Dictionary::empty()}}));
  959|  2.89k|                res.getKey("/Font").replace(font_name, font);
  960|  2.89k|            }
  961|  4.74k|        }
  962|       |
  963|  4.77k|        if (Name Encoding = font["/Encoding"]) {
  ------------------
  |  Branch (963:18): [True: 164, False: 4.61k]
  ------------------
  964|    164|            if (Encoding == "/WinAnsiEncoding") {
  ------------------
  |  Branch (964:17): [True: 62, False: 102]
  ------------------
  965|     62|                encoder = &QUtil::utf8_to_win_ansi;
  966|    102|            } else if (Encoding == "/MacRomanEncoding") {
  ------------------
  |  Branch (966:24): [True: 43, False: 59]
  ------------------
  967|     43|                encoder = &QUtil::utf8_to_mac_roman;
  968|     43|            }
  969|    164|        }
  970|  4.77k|    }
  971|       |
  972|  7.81k|    V = (*encoder)(V, '?');
  973|       |
  974|  7.81k|    std::vector<std::string> opt;
  975|  7.81k|    if (isChoice() && (getFlags() & ff_ch_combo) == 0) {
  ------------------
  |  Branch (975:9): [True: 2.43k, False: 5.38k]
  |  Branch (975:23): [True: 2.11k, False: 314]
  ------------------
  976|  2.11k|        opt = getChoices();
  977|  20.1k|        for (auto& o: opt) {
  ------------------
  |  Branch (977:21): [True: 20.1k, False: 2.11k]
  ------------------
  978|  20.1k|            o = (*encoder)(o, '?');
  979|  20.1k|        }
  980|  2.11k|    }
  981|       |
  982|  7.81k|    std::string result;
  983|  7.81k|    pl::String pl(result);
  984|  7.81k|    ValueSetter vs(DA, V, opt, tf, bbox);
  985|  7.81k|    Pl_QPDFTokenizer vs_tok("", &vs, &pl);
  986|  7.81k|    vs_tok.writeString(AS.getStreamData(qpdf_dl_all));
  987|  7.81k|    vs_tok.finish();
  988|  7.81k|    AS.replaceStreamData(std::move(result), Null::temp(), Null::temp());
  989|  7.81k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinderC2Ev:
  800|  7.79k|        TfFinder() = default;
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinder11handleTokenERKN13QPDFTokenizer5TokenE:
  805|  2.15M|        {
  806|  2.15M|            auto ttype = token.getType();
  807|  2.15M|            auto const& value = token.getValue();
  808|  2.15M|            DA.emplace_back(token.getRawValue());
  809|  2.15M|            switch (ttype) {
  810|  61.6k|            case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (810:13): [True: 61.6k, False: 2.09M]
  ------------------
  811|  75.4k|            case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (811:13): [True: 13.7k, False: 2.14M]
  ------------------
  812|  75.4k|                last_num = strtod(value.c_str(), nullptr);
  813|  75.4k|                last_num_idx = QIntC::to_int(DA.size() - 1);
  814|  75.4k|                break;
  815|       |
  816|  42.6k|            case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (816:13): [True: 42.6k, False: 2.11M]
  ------------------
  817|  42.6k|                last_name = value;
  818|  42.6k|                break;
  819|       |
  820|   146k|            case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (820:13): [True: 146k, False: 2.00M]
  ------------------
  821|   146k|                if (token.isWord("Tf")) {
  ------------------
  |  Branch (821:21): [True: 6.29k, False: 140k]
  ------------------
  822|  6.29k|                    if ((last_num > 1.0) && (last_num < 1000.0)) {
  ------------------
  |  Branch (822:25): [True: 5.62k, False: 667]
  |  Branch (822:45): [True: 5.38k, False: 247]
  ------------------
  823|       |                        // These ranges are arbitrary but keep us from doing insane things or
  824|       |                        // suffering from over/underflow
  825|  5.38k|                        tf = last_num;
  826|  5.38k|                    }
  827|  6.29k|                    tf_idx = last_num_idx;
  828|  6.29k|                    font_name = last_name;
  829|  6.29k|                }
  830|   146k|                break;
  831|       |
  832|  1.89M|            default:
  ------------------
  |  Branch (832:13): [True: 1.89M, False: 264k]
  ------------------
  833|  1.89M|                break;
  834|  2.15M|            }
  835|  2.15M|        }
QPDFFormFieldObjectHelper.cc:_ZNK12_GLOBAL__N_18TfFinder5getTfEv:
  839|  7.79k|        {
  840|  7.79k|            return tf;
  841|  7.79k|        }
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinder5getDAEv:
  850|  7.79k|        {
  851|  7.79k|            std::string result;
  852|  7.79k|            int i = -1;
  853|  2.15M|            for (auto const& cur: DA) {
  ------------------
  |  Branch (853:33): [True: 2.15M, False: 7.79k]
  ------------------
  854|  2.15M|                if (++i == tf_idx) {
  ------------------
  |  Branch (854:21): [True: 4.86k, False: 2.15M]
  ------------------
  855|  4.86k|                    double delta = strtod(cur.c_str(), nullptr) - tf;
  856|  4.86k|                    if (delta > 0.001 || delta < -0.001) {
  ------------------
  |  Branch (856:25): [True: 53, False: 4.81k]
  |  Branch (856:42): [True: 416, False: 4.39k]
  ------------------
  857|       |                        // tf doesn't match the font size passed to Tf, so substitute.
  858|    469|                        QTC::TC("qpdf", "QPDFFormFieldObjectHelper fallback Tf");
  859|    469|                        result += QUtil::double_to_string(tf);
  860|    469|                        continue;
  861|    469|                    }
  862|  4.86k|                }
  863|  2.15M|                result += cur;
  864|  2.15M|            }
  865|  7.79k|            return result;
  866|  7.79k|        }
QPDFFormFieldObjectHelper.cc:_ZNK12_GLOBAL__N_18TfFinder11getFontNameEv:
  844|  7.79k|        {
  845|  7.79k|            return font_name;
  846|  7.79k|        }
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetterC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_RKNS1_6vectorIS7_NS5_IS7_EEEEdRKN16QPDFObjectHandle9RectangleE:
  646|  7.79k|    DA(DA),
  647|  7.79k|    V(V),
  648|  7.79k|    opt(opt),
  649|  7.79k|    tf(tf),
  650|  7.79k|    bbox(bbox)
  651|  7.79k|{
  652|  7.79k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetter11handleTokenERKN13QPDFTokenizer5TokenE:
  656|   551k|{
  657|   551k|    QPDFTokenizer::token_type_e ttype = token.getType();
  658|   551k|    std::string value = token.getValue();
  659|   551k|    bool do_replace = false;
  660|   551k|    switch (state) {
  ------------------
  |  Branch (660:13): [True: 551k, False: 0]
  ------------------
  661|   271k|    case st_top:
  ------------------
  |  Branch (661:5): [True: 271k, False: 279k]
  ------------------
  662|   271k|        writeToken(token);
  663|   271k|        if (token.isWord("BMC")) {
  ------------------
  |  Branch (663:13): [True: 6.03k, False: 265k]
  ------------------
  664|  6.03k|            state = st_bmc;
  665|  6.03k|        }
  666|   271k|        break;
  667|       |
  668|  12.0k|    case st_bmc:
  ------------------
  |  Branch (668:5): [True: 12.0k, False: 539k]
  ------------------
  669|  12.0k|        if ((ttype == QPDFTokenizer::tt_space) || (ttype == QPDFTokenizer::tt_comment)) {
  ------------------
  |  Branch (669:13): [True: 6.04k, False: 6.04k]
  |  Branch (669:51): [True: 15, False: 6.03k]
  ------------------
  670|  6.05k|            writeToken(token);
  671|  6.05k|        } else {
  672|  6.03k|            state = st_emc;
  673|  6.03k|        }
  674|       |        // fall through to emc
  675|       |
  676|   258k|    case st_emc:
  ------------------
  |  Branch (676:5): [True: 246k, False: 305k]
  ------------------
  677|   258k|        if (token.isWord("EMC")) {
  ------------------
  |  Branch (677:13): [True: 5.96k, False: 252k]
  ------------------
  678|  5.96k|            do_replace = true;
  679|  5.96k|            state = st_end;
  680|  5.96k|        }
  681|   258k|        break;
  682|       |
  683|  21.3k|    case st_end:
  ------------------
  |  Branch (683:5): [True: 21.3k, False: 529k]
  ------------------
  684|  21.3k|        writeToken(token);
  685|  21.3k|        break;
  686|   551k|    }
  687|   551k|    if (do_replace) {
  ------------------
  |  Branch (687:9): [True: 5.96k, False: 545k]
  ------------------
  688|  5.96k|        writeAppearance();
  689|  5.96k|    }
  690|   551k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetter15writeAppearanceEv:
  704|  7.63k|{
  705|  7.63k|    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|  7.63k|    double tfh = 1.2 * tf;
  711|  7.63k|    int dx = 1;
  712|       |
  713|       |    // Write one or more lines, centered vertically, possibly with one row highlighted.
  714|       |
  715|  7.63k|    auto max_rows = static_cast<size_t>((bbox.ury - bbox.lly) / tfh);
  716|  7.63k|    bool highlight = false;
  717|  7.63k|    size_t highlight_idx = 0;
  718|       |
  719|  7.63k|    std::vector<std::string> lines;
  720|  7.63k|    if (opt.empty() || (max_rows < 2)) {
  ------------------
  |  Branch (720:9): [True: 6.65k, False: 974]
  |  Branch (720:24): [True: 232, False: 742]
  ------------------
  721|  6.89k|        lines.push_back(V);
  722|  6.89k|    } else {
  723|       |        // Figure out what rows to write
  724|    742|        size_t nopt = opt.size();
  725|    742|        size_t found_idx = 0;
  726|    742|        bool found = false;
  727|  10.7k|        for (found_idx = 0; found_idx < nopt; ++found_idx) {
  ------------------
  |  Branch (727:29): [True: 10.4k, False: 332]
  ------------------
  728|  10.4k|            if (opt.at(found_idx) == V) {
  ------------------
  |  Branch (728:17): [True: 410, False: 9.99k]
  ------------------
  729|    410|                found = true;
  730|    410|                break;
  731|    410|            }
  732|  10.4k|        }
  733|    742|        if (found) {
  ------------------
  |  Branch (733:13): [True: 410, False: 332]
  ------------------
  734|       |            // Try to make the found item the second one, but adjust for under/overflow.
  735|    410|            int wanted_first = QIntC::to_int(found_idx) - 1;
  736|    410|            int wanted_last = QIntC::to_int(found_idx + max_rows) - 2;
  737|    410|            QTC::TC("qpdf", "QPDFFormFieldObjectHelper list found");
  738|    410|            if (wanted_first < 0) {
  ------------------
  |  Branch (738:17): [True: 193, False: 217]
  ------------------
  739|    193|                QTC::TC("qpdf", "QPDFFormFieldObjectHelper list first too low");
  740|    193|                wanted_last -= wanted_first;
  741|    193|                wanted_first = 0;
  742|    193|            }
  743|    410|            if (wanted_last >= QIntC::to_int(nopt)) {
  ------------------
  |  Branch (743:17): [True: 354, False: 56]
  ------------------
  744|    354|                QTC::TC("qpdf", "QPDFFormFieldObjectHelper list last too high");
  745|    354|                auto diff = wanted_last - QIntC::to_int(nopt) + 1;
  746|    354|                wanted_first = std::max(0, wanted_first - diff);
  747|    354|                wanted_last -= diff;
  748|    354|            }
  749|    410|            highlight = true;
  750|    410|            highlight_idx = found_idx - QIntC::to_size(wanted_first);
  751|  9.53k|            for (size_t i = QIntC::to_size(wanted_first); i <= QIntC::to_size(wanted_last); ++i) {
  ------------------
  |  Branch (751:59): [True: 9.12k, False: 410]
  ------------------
  752|  9.12k|                lines.push_back(opt.at(i));
  753|  9.12k|            }
  754|    410|        } else {
  755|    332|            QTC::TC("qpdf", "QPDFFormFieldObjectHelper list not found");
  756|       |            // include our value and the first n-1 rows
  757|    332|            highlight_idx = 0;
  758|    332|            highlight = true;
  759|    332|            lines.push_back(V);
  760|  3.44k|            for (size_t i = 0; ((i < nopt) && (i < (max_rows - 1))); ++i) {
  ------------------
  |  Branch (760:33): [True: 3.13k, False: 305]
  |  Branch (760:47): [True: 3.10k, False: 27]
  ------------------
  761|  3.10k|                lines.push_back(opt.at(i));
  762|  3.10k|            }
  763|    332|        }
  764|    742|    }
  765|       |
  766|       |    // Write the lines centered vertically, highlighting if needed
  767|  7.63k|    size_t nlines = lines.size();
  768|  7.63k|    double dy = bbox.ury - ((bbox.ury - bbox.lly - (static_cast<double>(nlines) * tfh)) / 2.0);
  769|  7.63k|    if (highlight) {
  ------------------
  |  Branch (769:9): [True: 719, False: 6.91k]
  ------------------
  770|    719|        write(
  771|    719|            "q\n0.85 0.85 0.85 rg\n" + QUtil::double_to_string(bbox.llx) + " " +
  772|    719|            QUtil::double_to_string(
  773|    719|                bbox.lly + dy - (tfh * (static_cast<double>(highlight_idx + 1)))) +
  774|    719|            " " + QUtil::double_to_string(bbox.urx - bbox.llx) + " " +
  775|    719|            QUtil::double_to_string(tfh) + " re f\nQ\n");
  776|    719|    }
  777|  7.63k|    dy -= tf;
  778|  7.63k|    write("q\nBT\n" + DA + "\n");
  779|  27.0k|    for (size_t i = 0; i < nlines; ++i) {
  ------------------
  |  Branch (779:24): [True: 19.4k, False: 7.63k]
  ------------------
  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|  19.4k|        if (i == 0) {
  ------------------
  |  Branch (783:13): [True: 7.61k, False: 11.8k]
  ------------------
  784|  7.61k|            write(
  785|  7.61k|                QUtil::double_to_string(bbox.llx + static_cast<double>(dx)) + " " +
  786|  7.61k|                QUtil::double_to_string(bbox.lly + static_cast<double>(dy)) + " Td\n");
  787|  11.8k|        } else {
  788|  11.8k|            write("0 " + QUtil::double_to_string(-tfh) + " Td\n");
  789|  11.8k|        }
  790|  19.4k|        write(QPDFObjectHandle::newString(lines.at(i)).unparse() + " Tj\n");
  791|  19.4k|    }
  792|  7.63k|    write("ET\nQ\nEMC");
  793|  7.63k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetter9handleEOFEv:
  694|  7.61k|{
  695|  7.61k|    if (!replaced) {
  ------------------
  |  Branch (695:9): [True: 1.67k, False: 5.94k]
  ------------------
  696|  1.67k|        QTC::TC("qpdf", "QPDFFormFieldObjectHelper replaced BMC at EOF");
  697|  1.67k|        write("/Tx BMC\n");
  698|  1.67k|        writeAppearance();
  699|  1.67k|    }
  700|  7.61k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetterD2Ev:
  624|  7.79k|        ~ValueSetter() override = default;
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinderD2Ev:
  801|  7.79k|        ~TfFinder() final = default;
_ZN25QPDFFormFieldObjectHelper7MembersC2ERK16QPDFObjectHandle:
   28|  44.8k|        FormNode(oh)
   29|  44.8k|    {
   30|  44.8k|    }

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

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

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

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

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

_ZN25QPDFOutlineDocumentHelper8Accessor9checkSeenERS_10QPDFObjGen:
   23|  4.48k|{
   24|  4.48k|    return !dh.m->seen.add(og);
   25|  4.48k|}
_ZN25QPDFOutlineDocumentHelperC2ER4QPDF:
   28|  7.95k|    QPDFDocumentHelper(qpdf),
   29|  7.95k|    m(std::make_shared<Members>())
   30|  7.95k|{
   31|  7.95k|    validate();
   32|  7.95k|}
_ZN25QPDFOutlineDocumentHelper8validateEb:
   42|  7.95k|{
   43|  7.95k|    m->outlines.clear();
   44|  7.95k|    m->names_dest = nullptr;
   45|       |
   46|  7.95k|    QPDFObjectHandle root = qpdf.getRoot();
   47|  7.95k|    if (!root.hasKey("/Outlines")) {
  ------------------
  |  Branch (47:9): [True: 7.17k, False: 779]
  ------------------
   48|  7.17k|        return;
   49|  7.17k|    }
   50|    779|    auto outlines = root.getKey("/Outlines");
   51|    779|    if (!(outlines.isDictionary() && outlines.hasKey("/First"))) {
  ------------------
  |  Branch (51:9): [True: 43, False: 736]
  |  Branch (51:11): [True: 760, False: 19]
  |  Branch (51:38): [True: 736, False: 24]
  ------------------
   52|     43|        return;
   53|     43|    }
   54|    736|    QPDFObjectHandle cur = outlines.getKey("/First");
   55|    736|    QPDFObjGen::set seen;
   56|  2.15k|    while (!cur.null()) {
  ------------------
  |  Branch (56:12): [True: 1.48k, False: 672]
  ------------------
   57|  1.48k|        if (!seen.add(cur)) {
  ------------------
  |  Branch (57:13): [True: 64, False: 1.41k]
  ------------------
   58|     64|            cur.warn("Loop detected loop in /Outlines tree");
   59|     64|            return;
   60|     64|        }
   61|  1.41k|        m->outlines.emplace_back(QPDFOutlineObjectHelper::Accessor::create(cur, *this, 1));
   62|  1.41k|        cur = cur.getKey("/Next");
   63|  1.41k|    }
   64|    736|}
_ZN25QPDFOutlineDocumentHelper16initializeByPageEv:
   80|  18.1k|{
   81|  18.1k|    std::list<QPDFOutlineObjectHelper> queue;
   82|  18.1k|    queue.insert(queue.end(), m->outlines.begin(), m->outlines.end());
   83|       |
   84|  22.9k|    while (!queue.empty()) {
  ------------------
  |  Branch (84:12): [True: 4.82k, False: 18.1k]
  ------------------
   85|  4.82k|        QPDFOutlineObjectHelper oh = queue.front();
   86|  4.82k|        queue.pop_front();
   87|  4.82k|        m->by_page[oh.getDestPage().getObjGen()].push_back(oh);
   88|  4.82k|        std::vector<QPDFOutlineObjectHelper> kids = oh.getKids();
   89|  4.82k|        queue.insert(queue.end(), kids.begin(), kids.end());
   90|  4.82k|    }
   91|  18.1k|}
_ZN25QPDFOutlineDocumentHelper18getOutlinesForPageE10QPDFObjGen:
   95|  18.5k|{
   96|  18.5k|    if (m->by_page.empty()) {
  ------------------
  |  Branch (96:9): [True: 18.1k, False: 390]
  ------------------
   97|  18.1k|        initializeByPage();
   98|  18.1k|    }
   99|  18.5k|    if (m->by_page.contains(og)) {
  ------------------
  |  Branch (99:9): [True: 107, False: 18.4k]
  ------------------
  100|    107|        return m->by_page[og];
  101|    107|    }
  102|  18.4k|    return {};
  103|  18.5k|}
_ZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandle:
  107|  1.81k|{
  108|  1.81k|    QPDFObjectHandle result;
  109|  1.81k|    if (name.isName()) {
  ------------------
  |  Branch (109:9): [True: 135, False: 1.68k]
  ------------------
  110|    135|        if (!m->dest_dict) {
  ------------------
  |  Branch (110:13): [True: 85, False: 50]
  ------------------
  111|     85|            m->dest_dict = qpdf.getRoot().getKey("/Dests");
  112|     85|        }
  113|    135|        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: 784, False: 896]
  ------------------
  116|    784|            auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
  117|    784|            if (dests.isDictionary()) {
  ------------------
  |  Branch (117:17): [True: 522, False: 262]
  ------------------
  118|    522|                m->names_dest = std::make_unique<QPDFNameTreeObjectHelper>(
  119|    522|                    dests,
  120|    522|                    qpdf,
  121|    522|                    [](QPDFObjectHandle const& o) -> bool {
  122|    522|                        return o.isArray() || o.contains("/D");
  123|    522|                    },
  124|    522|                    true);
  125|    522|                m->names_dest->validate();
  126|    522|            }
  127|    784|        }
  128|  1.68k|        if (m->names_dest) {
  ------------------
  |  Branch (128:13): [True: 1.27k, False: 408]
  ------------------
  129|  1.27k|            if (m->names_dest->findObject(name.getUTF8Value(), result)) {
  ------------------
  |  Branch (129:17): [True: 148, False: 1.12k]
  ------------------
  130|    148|                QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest");
  131|    148|            }
  132|  1.27k|        }
  133|  1.68k|    }
  134|  1.81k|    if (!result) {
  ------------------
  |  Branch (134:9): [True: 1.00k, False: 811]
  ------------------
  135|  1.00k|        return QPDFObjectHandle::newNull();
  136|  1.00k|    }
  137|    811|    if (result.isDictionary()) {
  ------------------
  |  Branch (137:9): [True: 136, False: 675]
  ------------------
  138|    136|        return result.getKey("/D");
  139|    136|    }
  140|    675|    return result;
  141|    811|}
_ZN25QPDFOutlineDocumentHelper7MembersC2Ev:
   10|  7.95k|    Members() = default;
_ZN25QPDFOutlineDocumentHelper7MembersD2Ev:
   12|  7.95k|    ~Members() = default;
QPDFOutlineDocumentHelper.cc:_ZZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandleENK3$_0clERKS0_:
  121|  62.5k|                    [](QPDFObjectHandle const& o) -> bool {
  122|  62.5k|                        return o.isArray() || o.contains("/D");
  ------------------
  |  Branch (122:32): [True: 58.2k, False: 4.36k]
  |  Branch (122:47): [True: 3.45k, False: 901]
  ------------------
  123|  62.5k|                    },

_ZN23QPDFOutlineObjectHelper7MembersC2ER25QPDFOutlineDocumentHelper:
    8|  4.48k|    dh(dh)
    9|  4.48k|{
   10|  4.48k|}
_ZN23QPDFOutlineObjectHelperC2E16QPDFObjectHandleR25QPDFOutlineDocumentHelperi:
   14|  4.48k|    QPDFObjectHelper(a_oh),
   15|  4.48k|    m(new Members(dh))
   16|  4.48k|{
   17|  4.48k|    if (depth > 50) {
  ------------------
  |  Branch (17:9): [True: 0, False: 4.48k]
  ------------------
   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.48k|    if (QPDFOutlineDocumentHelper::Accessor::checkSeen(m->dh, a_oh.getObjGen())) {
  ------------------
  |  Branch (22:9): [True: 2.19k, False: 2.28k]
  ------------------
   23|  2.19k|        a_oh.warn("Loop detected loop in /Outlines tree");
   24|  2.19k|        return;
   25|  2.19k|    }
   26|       |
   27|  2.28k|    QPDFObjGen::set children;
   28|  2.28k|    QPDFObjectHandle cur = a_oh.getKey("/First");
   29|  5.35k|    while (!cur.null() && cur.isIndirect()) {
  ------------------
  |  Branch (29:12): [True: 3.28k, False: 2.06k]
  |  Branch (29:27): [True: 3.24k, False: 48]
  ------------------
   30|  3.24k|        if (!children.add(cur)) {
  ------------------
  |  Branch (30:13): [True: 175, False: 3.06k]
  ------------------
   31|    175|            cur.warn("Loop detected loop in /Outlines tree");
   32|    175|            break;
   33|    175|        }
   34|  3.06k|        QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth);
   35|  3.06k|        new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this);
   36|  3.06k|        m->kids.emplace_back(new_ooh);
   37|  3.06k|        cur = cur.getKey("/Next");
   38|  3.06k|    }
   39|  2.28k|}
_ZN23QPDFOutlineObjectHelper7getKidsEv:
   49|  4.29k|{
   50|  4.29k|    return m->kids;
   51|  4.29k|}
_ZN23QPDFOutlineObjectHelper7getDestEv:
   55|  4.82k|{
   56|  4.82k|    auto dest = get("/Dest");
   57|  4.82k|    if (dest.null()) {
  ------------------
  |  Branch (57:9): [True: 3.57k, False: 1.24k]
  ------------------
   58|  3.57k|        auto const& A = get("/A");
   59|  3.57k|        if (Name(A["/S"]) == "/GoTo") {
  ------------------
  |  Branch (59:13): [True: 1.60k, False: 1.96k]
  ------------------
   60|  1.60k|            dest = A["/D"];
   61|  1.60k|        }
   62|  3.57k|    }
   63|  4.82k|    if (dest.null()) {
  ------------------
  |  Branch (63:9): [True: 2.00k, False: 2.81k]
  ------------------
   64|  2.00k|        return QPDFObjectHandle::newNull();
   65|  2.00k|    }
   66|  2.81k|    if (dest.isName() || dest.isString()) {
  ------------------
  |  Branch (66:9): [True: 135, False: 2.68k]
  |  Branch (66:26): [True: 1.68k, False: 1.00k]
  ------------------
   67|  1.81k|        return m->dh.resolveNamedDest(dest);
   68|  1.81k|    }
   69|  1.00k|    return dest;
   70|  2.81k|}
_ZN23QPDFOutlineObjectHelper11getDestPageEv:
   74|  4.82k|{
   75|  4.82k|    QPDFObjectHandle dest = getDest();
   76|  4.82k|    if (!dest.empty() && dest.isArray()) {
  ------------------
  |  Branch (76:9): [True: 1.15k, False: 3.66k]
  |  Branch (76:26): [True: 1.09k, False: 53]
  ------------------
   77|  1.09k|        return dest.getArrayItem(0);
   78|  1.09k|    }
   79|  3.72k|    return QPDFObjectHandle::newNull();
   80|  4.82k|}

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

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

_ZN4qpdf4impl6Parser13parse_contentER11InputSourceNSt3__110shared_ptrINS4_7variantIJNS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEN10QPDFObject10JSON_DescrENSD_10ChildDescrENSD_14ObjStreamDescrEEEEEERNS_9TokenizerEP4QPDF:
   75|  14.4M|{
   76|  14.4M|    static const std::string content("content"); // GCC12 - make constexpr
   77|  14.4M|    auto p = Parser(
   78|  14.4M|        input,
   79|  14.4M|        std::move(sp_description),
   80|  14.4M|        content,
   81|  14.4M|        tokenizer,
   82|  14.4M|        nullptr,
   83|  14.4M|        context,
   84|  14.4M|        true,
   85|  14.4M|        0,
   86|  14.4M|        0,
   87|  14.4M|        context && context->doc().reconstructed_xref());
  ------------------
  |  Branch (87:9): [True: 14.4M, False: 0]
  |  Branch (87:20): [True: 14.4M, False: 4.25k]
  ------------------
   88|  14.4M|    if (auto result = p.parse(true)) {
  ------------------
  |  Branch (88:14): [True: 14.4M, False: 8.16k]
  ------------------
   89|  14.4M|        return {result, false};
   90|  14.4M|    }
   91|  8.16k|    return {{}, p.empty_};
   92|  14.4M|}
_ZN4qpdf4impl6Parser5parseER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERNS_9TokenizerEPN16QPDFObjectHandle15StringDecrypterER4QPDFb:
  129|   142k|{
  130|   142k|    return Parser(
  131|   142k|               input,
  132|   142k|               make_description(input.getName(), object_description),
  133|   142k|               object_description,
  134|   142k|               tokenizer,
  135|   142k|               decrypter,
  136|   142k|               &context,
  137|   142k|               true,
  138|   142k|               0,
  139|   142k|               0,
  140|   142k|               sanity_checks)
  141|   142k|        .parse();
  142|   142k|}
_ZN4qpdf4impl6Parser5parseERNS_2is12OffsetBufferEiiRNS_9TokenizerER4QPDF:
  147|  22.8k|{
  148|  22.8k|    return Parser(
  149|  22.8k|               input,
  150|  22.8k|               std::make_shared<QPDFObject::Description>(
  151|  22.8k|                   QPDFObject::ObjStreamDescr(stream_id, obj_id)),
  152|  22.8k|               "",
  153|  22.8k|               tokenizer,
  154|  22.8k|               nullptr,
  155|  22.8k|               &context,
  156|  22.8k|               true,
  157|  22.8k|               stream_id,
  158|  22.8k|               obj_id)
  159|  22.8k|        .parse();
  160|  22.8k|}
_ZN4qpdf4impl6Parser5parseEb:
  164|  14.6M|{
  165|  14.6M|    try {
  166|  14.6M|        return parse_first(content_stream);
  167|  14.6M|    } catch (Error&) {
  168|  9.16k|        return {};
  169|  9.16k|    } catch (QPDFExc& e) {
  170|  4.24k|        throw e;
  171|  4.24k|    } catch (std::logic_error& e) {
  172|      3|        throw e;
  173|  1.66k|    } catch (std::exception& e) {
  174|  1.66k|        warn("treating object as null because of error during parsing: "s + e.what());
  175|  1.66k|        return {};
  176|  1.66k|    }
  177|  14.6M|}
_ZN4qpdf4impl6Parser11parse_firstEb:
  181|  14.6M|{
  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|  14.6M|    QPDF::Doc::ParseGuard pg(context_);
  188|  14.6M|    start_ = input_.tell();
  189|  14.6M|    if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (189:9): [True: 4.21k, False: 14.6M]
  ------------------
  190|  4.21k|        warn(tokenizer_.getErrorMessage());
  191|  4.21k|    }
  192|       |
  193|  14.6M|    switch (tokenizer_.getType()) {
  194|  4.34k|    case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (194:5): [True: 4.34k, False: 14.6M]
  ------------------
  195|  4.34k|        if (content_stream) {
  ------------------
  |  Branch (195:13): [True: 3.81k, False: 526]
  ------------------
  196|       |            // In content stream mode, leave object uninitialized to indicate EOF
  197|  3.81k|            empty_ = true;
  198|  3.81k|            return {};
  199|  3.81k|        }
  200|    526|        warn("unexpected EOF");
  201|    526|        return {};
  202|       |
  203|  4.05k|    case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (203:5): [True: 4.05k, False: 14.6M]
  ------------------
  204|  4.05k|        return {};
  205|       |
  206|    366|    case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (206:5): [True: 366, False: 14.6M]
  ------------------
  207|    678|    case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (207:5): [True: 312, False: 14.6M]
  ------------------
  208|    678|        warn("treating unexpected brace token as null");
  209|    678|        return {};
  210|       |
  211|    944|    case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (211:5): [True: 944, False: 14.6M]
  ------------------
  212|    944|        warn("treating unexpected array close token as null");
  213|    944|        return {};
  214|       |
  215|    603|    case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (215:5): [True: 603, False: 14.6M]
  ------------------
  216|    603|        warn("unexpected dictionary close token");
  217|    603|        return {};
  218|       |
  219|  16.3k|    case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (219:5): [True: 16.3k, False: 14.6M]
  ------------------
  220|   151k|    case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (220:5): [True: 135k, False: 14.5M]
  ------------------
  221|   151k|        stack_.clear();
  222|   151k|        stack_.emplace_back(
  223|   151k|            input_,
  224|   151k|            (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array : st_dictionary_key);
  ------------------
  |  Branch (224:13): [True: 16.3k, False: 135k]
  ------------------
  225|   151k|        frame_ = &stack_.back();
  226|   151k|        return parse_remainder(content_stream);
  227|       |
  228|    717|    case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (228:5): [True: 717, False: 14.6M]
  ------------------
  229|    717|        return with_description<QPDF_Bool>(tokenizer_.getValue() == "true");
  230|       |
  231|    513|    case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (231:5): [True: 513, False: 14.6M]
  ------------------
  232|    513|        return {QPDFObject::create<QPDF_Null>()};
  233|       |
  234|   110k|    case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (234:5): [True: 110k, False: 14.5M]
  ------------------
  235|   110k|        return with_description<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  236|       |
  237|  62.5k|    case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (237:5): [True: 62.5k, False: 14.5M]
  ------------------
  238|  62.5k|        return with_description<QPDF_Real>(tokenizer_.getValue());
  239|       |
  240|  46.8k|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (240:5): [True: 46.8k, False: 14.5M]
  ------------------
  241|  46.8k|        return with_description<QPDF_Name>(tokenizer_.getValue());
  242|       |
  243|  14.2M|    case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (243:5): [True: 14.2M, False: 387k]
  ------------------
  244|  14.2M|        {
  245|  14.2M|            auto const& value = tokenizer_.getValue();
  246|  14.2M|            if (content_stream) {
  ------------------
  |  Branch (246:17): [True: 14.2M, False: 6.70k]
  ------------------
  247|  14.2M|                return with_description<QPDF_Operator>(value);
  248|  14.2M|            } else if (value == "endobj") {
  ------------------
  |  Branch (248:24): [True: 215, False: 6.49k]
  ------------------
  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|    215|                empty_ = true;
  254|    215|                input_.seek(input_.getLastOffset(), SEEK_SET);
  255|    215|                if (!content_stream) {
  ------------------
  |  Branch (255:21): [True: 215, False: 0]
  ------------------
  256|    215|                    warn("empty object treated as null");
  257|    215|                }
  258|    215|                return {};
  259|  6.49k|            } else {
  260|  6.49k|                warn("unknown token while reading object; treating as string");
  261|  6.49k|                return with_description<QPDF_String>(value);
  262|  6.49k|            }
  263|  14.2M|        }
  264|       |
  265|  3.57k|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (265:5): [True: 3.57k, False: 14.6M]
  ------------------
  266|  3.57k|        if (decrypter_) {
  ------------------
  |  Branch (266:13): [True: 201, False: 3.37k]
  ------------------
  267|    201|            std::string s{tokenizer_.getValue()};
  268|    201|            decrypter_->decryptString(s);
  269|    201|            return with_description<QPDF_String>(s);
  270|  3.37k|        } else {
  271|  3.37k|            return with_description<QPDF_String>(tokenizer_.getValue());
  272|  3.37k|        }
  273|       |
  274|      0|    default:
  ------------------
  |  Branch (274:5): [True: 0, False: 14.6M]
  ------------------
  275|      0|        warn("treating unknown token type as null while reading object");
  276|      0|        return {};
  277|  14.6M|    }
  278|  14.6M|}
_ZN4qpdf4impl6Parser15parse_remainderEb:
  282|   151k|{
  283|       |    // This method must take care not to resolve any objects. Don't check the type of any object
  284|       |    // without first ensuring that it is a direct object. Otherwise, doing so may have the side
  285|       |    // effect of reading the object and changing the file pointer. If you do this, it will cause a
  286|       |    // logic error to be thrown from QPDF::inParse().
  287|       |
  288|   151k|    bad_count_ = 0;
  289|   151k|    bool b_contents = false;
  290|       |
  291|  6.67M|    while (true) {
  ------------------
  |  Branch (291:12): [True: 6.66M, Folded]
  ------------------
  292|  6.66M|        if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (292:13): [True: 46.5k, False: 6.61M]
  ------------------
  293|  46.5k|            warn(tokenizer_.getErrorMessage());
  294|  46.5k|        }
  295|  6.66M|        ++good_count_; // optimistically
  296|       |
  297|  6.66M|        if (int_count_ != 0) {
  ------------------
  |  Branch (297:13): [True: 1.70M, False: 4.95M]
  ------------------
  298|       |            // Special handling of indirect references. Treat integer tokens as part of an indirect
  299|       |            // reference until proven otherwise.
  300|  1.70M|            if (tokenizer_.getType() == QPDFTokenizer::tt_integer) {
  ------------------
  |  Branch (300:17): [True: 1.03M, False: 666k]
  ------------------
  301|  1.03M|                if (++int_count_ > 2) {
  ------------------
  |  Branch (301:21): [True: 564k, False: 470k]
  ------------------
  302|       |                    // Process the oldest buffered integer.
  303|   564k|                    add_int(int_count_);
  304|   564k|                }
  305|  1.03M|                last_offset_buffer_[int_count_ % 2] = input_.getLastOffset();
  306|  1.03M|                int_buffer_[int_count_ % 2] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  307|  1.03M|                continue;
  308|       |
  309|  1.03M|            } else if (
  310|   666k|                int_count_ >= 2 && tokenizer_.getType() == QPDFTokenizer::tt_word &&
  ------------------
  |  Branch (310:17): [True: 470k, False: 196k]
  |  Branch (310:36): [True: 422k, False: 48.2k]
  ------------------
  311|   422k|                tokenizer_.getValue() == "R") {
  ------------------
  |  Branch (311:17): [True: 400k, False: 22.4k]
  ------------------
  312|   400k|                if (!context_) {
  ------------------
  |  Branch (312:21): [True: 0, False: 400k]
  ------------------
  313|      0|                    throw std::logic_error(
  314|      0|                        "Parser::parse called without context on an object with indirect "
  315|      0|                        "references");
  316|      0|                }
  317|   400k|                auto id = QIntC::to_int(int_buffer_[(int_count_ - 1) % 2]);
  318|   400k|                auto gen = QIntC::to_int(int_buffer_[(int_count_) % 2]);
  319|   400k|                if (!(id < 1 || gen < 0 || gen >= 65535)) {
  ------------------
  |  Branch (319:23): [True: 2.30k, False: 397k]
  |  Branch (319:33): [True: 311, False: 397k]
  |  Branch (319:44): [True: 329, False: 397k]
  ------------------
  320|   397k|                    add(ParseGuard::getObject(context_, id, gen, parse_pdf_));
  321|   397k|                } else {
  322|  2.94k|                    add_bad_null(
  323|  2.94k|                        "treating bad indirect reference (" + std::to_string(id) + " " +
  324|  2.94k|                        std::to_string(gen) + " R) as null");
  325|  2.94k|                }
  326|   400k|                int_count_ = 0;
  327|   400k|                continue;
  328|       |
  329|   400k|            } else if (int_count_ > 0) {
  ------------------
  |  Branch (329:24): [True: 266k, False: 0]
  ------------------
  330|       |                // Process the buffered integers before processing the current token.
  331|   266k|                if (int_count_ > 1) {
  ------------------
  |  Branch (331:21): [True: 70.7k, False: 196k]
  ------------------
  332|  70.7k|                    add_int(int_count_ - 1);
  333|  70.7k|                }
  334|   266k|                add_int(int_count_);
  335|   266k|                int_count_ = 0;
  336|   266k|            }
  337|  1.70M|        }
  338|       |
  339|  5.22M|        switch (tokenizer_.getType()) {
  340|  7.02k|        case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (340:9): [True: 7.02k, False: 5.21M]
  ------------------
  341|  7.02k|            warn("parse error while reading object");
  342|  7.02k|            if (content_stream) {
  ------------------
  |  Branch (342:17): [True: 187, False: 6.84k]
  ------------------
  343|       |                // In content stream mode, leave object uninitialized to indicate EOF
  344|    187|                return {};
  345|    187|            }
  346|  6.84k|            warn("unexpected EOF");
  347|  6.84k|            return {};
  348|       |
  349|  39.4k|        case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (349:9): [True: 39.4k, False: 5.18M]
  ------------------
  350|  39.4k|            check_too_many_bad_tokens();
  351|  39.4k|            add_null();
  352|  39.4k|            continue;
  353|       |
  354|  2.06k|        case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (354:9): [True: 2.06k, False: 5.22M]
  ------------------
  355|  5.04k|        case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (355:9): [True: 2.98k, False: 5.22M]
  ------------------
  356|  5.04k|            add_bad_null("treating unexpected brace token as null");
  357|  5.04k|            continue;
  358|       |
  359|   126k|        case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (359:9): [True: 126k, False: 5.09M]
  ------------------
  360|   126k|            if (frame_->state == st_array) {
  ------------------
  |  Branch (360:17): [True: 123k, False: 2.85k]
  ------------------
  361|   123k|                auto object = frame_->null_count > 100
  ------------------
  |  Branch (361:31): [True: 359, False: 123k]
  ------------------
  362|   123k|                    ? QPDFObject::create<QPDF_Array>(std::move(frame_->olist), true)
  363|   123k|                    : QPDFObject::create<QPDF_Array>(std::move(frame_->olist));
  364|   123k|                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|   123k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (369:21): [True: 8.58k, False: 115k]
  ------------------
  370|  8.58k|                    return object;
  371|  8.58k|                }
  372|   115k|                stack_.pop_back();
  373|   115k|                frame_ = &stack_.back();
  374|   115k|                add(std::move(object));
  375|   115k|            } else {
  376|  2.85k|                if (sanity_checks_) {
  ------------------
  |  Branch (376:21): [True: 2.02k, False: 825]
  ------------------
  377|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  378|       |                    // unusable.
  379|  2.02k|                    warn("unexpected array close token; giving up on reading object");
  380|  2.02k|                    return {};
  381|  2.02k|                }
  382|    825|                add_bad_null("treating unexpected array close token as null");
  383|    825|            }
  384|   115k|            continue;
  385|       |
  386|   199k|        case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (386:9): [True: 199k, False: 5.02M]
  ------------------
  387|   199k|            if (frame_->state <= st_dictionary_value) {
  ------------------
  |  Branch (387:17): [True: 196k, False: 2.26k]
  ------------------
  388|       |                // Attempt to recover more or less gracefully from invalid dictionaries.
  389|   196k|                auto& dict = frame_->dict;
  390|       |
  391|   196k|                if (frame_->state == st_dictionary_value) {
  ------------------
  |  Branch (391:21): [True: 12.0k, False: 184k]
  ------------------
  392|  12.0k|                    warn(
  393|  12.0k|                        frame_->offset,
  394|  12.0k|                        "dictionary ended prematurely; using null as value for last key");
  395|  12.0k|                    dict[frame_->key] = QPDFObject::create<QPDF_Null>();
  396|  12.0k|                }
  397|   196k|                if (!frame_->olist.empty()) {
  ------------------
  |  Branch (397:21): [True: 59.9k, False: 136k]
  ------------------
  398|  59.9k|                    if (sanity_checks_) {
  ------------------
  |  Branch (398:25): [True: 54.1k, False: 5.80k]
  ------------------
  399|  54.1k|                        warn(
  400|  54.1k|                            frame_->offset,
  401|  54.1k|                            "expected dictionary keys but found non-name objects; ignoring");
  402|  54.1k|                    } else {
  403|  5.80k|                        fix_missing_keys();
  404|  5.80k|                    }
  405|  59.9k|                }
  406|       |
  407|   196k|                if (!frame_->contents_string.empty() && dict.contains("/Type") &&
  ------------------
  |  Branch (407:21): [True: 91, False: 196k]
  |  Branch (407:21): [True: 11, False: 196k]
  |  Branch (407:57): [True: 57, False: 34]
  ------------------
  408|     57|                    dict["/Type"].isNameAndEquals("/Sig") && dict.contains("/ByteRange") &&
  ------------------
  |  Branch (408:21): [True: 21, False: 36]
  |  Branch (408:62): [True: 11, False: 10]
  ------------------
  409|     11|                    dict.contains("/Contents") && dict["/Contents"].isString()) {
  ------------------
  |  Branch (409:21): [True: 11, False: 0]
  |  Branch (409:51): [True: 11, False: 0]
  ------------------
  410|     11|                    dict["/Contents"] = QPDFObjectHandle::newString(frame_->contents_string);
  411|     11|                    dict["/Contents"].setParsedOffset(frame_->contents_offset);
  412|     11|                }
  413|   196k|                auto object = QPDFObject::create<QPDF_Dictionary>(std::move(dict));
  414|   196k|                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|   196k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (419:21): [True: 117k, False: 79.7k]
  ------------------
  420|   117k|                    return object;
  421|   117k|                }
  422|  79.7k|                stack_.pop_back();
  423|  79.7k|                frame_ = &stack_.back();
  424|  79.7k|                add(std::move(object));
  425|  79.7k|            } else {
  426|  2.26k|                if (sanity_checks_) {
  ------------------
  |  Branch (426:21): [True: 1.67k, False: 591]
  ------------------
  427|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  428|       |                    // unusable.
  429|  1.67k|                    warn("unexpected dictionary close token; giving up on reading object");
  430|  1.67k|                    return {};
  431|  1.67k|                }
  432|    591|                add_bad_null("unexpected dictionary close token");
  433|    591|            }
  434|  80.3k|            continue;
  435|       |
  436|   201k|        case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (436:9): [True: 201k, False: 5.02M]
  ------------------
  437|   301k|        case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (437:9): [True: 100k, False: 5.12M]
  ------------------
  438|   301k|            if (stack_.size() > max_nesting) {
  ------------------
  |  Branch (438:17): [True: 88, False: 301k]
  ------------------
  439|     88|                limits_error(
  440|     88|                    "parser-max-nesting", "ignoring excessively deeply nested data structure");
  441|     88|            }
  442|   301k|            b_contents = false;
  443|   301k|            stack_.emplace_back(
  444|   301k|                input_,
  445|   301k|                (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array
  ------------------
  |  Branch (445:17): [True: 200k, False: 101k]
  ------------------
  446|   301k|                                                                       : st_dictionary_key);
  447|   301k|            frame_ = &stack_.back();
  448|   301k|            continue;
  449|       |
  450|  13.3k|        case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (450:9): [True: 13.3k, False: 5.21M]
  ------------------
  451|  13.3k|            add_scalar<QPDF_Bool>(tokenizer_.getValue() == "true");
  452|  13.3k|            continue;
  453|       |
  454|  50.7k|        case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (454:9): [True: 50.7k, False: 5.17M]
  ------------------
  455|  50.7k|            add_null();
  456|  50.7k|            continue;
  457|       |
  458|   949k|        case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (458:9): [True: 949k, False: 4.27M]
  ------------------
  459|   949k|            if (!content_stream) {
  ------------------
  |  Branch (459:17): [True: 667k, False: 282k]
  ------------------
  460|       |                // Buffer token in case it is part of an indirect reference.
  461|   667k|                last_offset_buffer_[1] = input_.getLastOffset();
  462|   667k|                int_buffer_[1] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  463|   667k|                int_count_ = 1;
  464|   667k|            } else {
  465|   282k|                add_scalar<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  466|   282k|            }
  467|   949k|            continue;
  468|       |
  469|   155k|        case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (469:9): [True: 155k, False: 5.06M]
  ------------------
  470|   155k|            add_scalar<QPDF_Real>(tokenizer_.getValue());
  471|   155k|            continue;
  472|       |
  473|  2.18M|        case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (473:9): [True: 2.18M, False: 3.03M]
  ------------------
  474|  2.18M|            if (frame_->state == st_dictionary_key) {
  ------------------
  |  Branch (474:17): [True: 799k, False: 1.39M]
  ------------------
  475|   799k|                frame_->key = tokenizer_.getValue();
  476|   799k|                frame_->state = st_dictionary_value;
  477|   799k|                b_contents = decrypter_ && frame_->key == "/Contents";
  ------------------
  |  Branch (477:30): [True: 45.0k, False: 754k]
  |  Branch (477:44): [True: 817, False: 44.2k]
  ------------------
  478|   799k|                continue;
  479|  1.39M|            } else {
  480|  1.39M|                add_scalar<QPDF_Name>(tokenizer_.getValue());
  481|  1.39M|            }
  482|  1.39M|            continue;
  483|       |
  484|  1.39M|        case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (484:9): [True: 876k, False: 4.34M]
  ------------------
  485|   876k|            if (content_stream) {
  ------------------
  |  Branch (485:17): [True: 640k, False: 235k]
  ------------------
  486|   640k|                add_scalar<QPDF_Operator>(tokenizer_.getValue());
  487|   640k|                continue;
  488|   640k|            }
  489|       |
  490|   235k|            if (sanity_checks_) {
  ------------------
  |  Branch (490:17): [True: 224k, False: 10.9k]
  ------------------
  491|   224k|                if (tokenizer_.getValue() == "endobj" || tokenizer_.getValue() == "endstream") {
  ------------------
  |  Branch (491:21): [True: 2.16k, False: 222k]
  |  Branch (491:58): [True: 522, False: 222k]
  ------------------
  492|       |                    // During sanity checks, assume an unexpected endobj or endstream indicates that
  493|       |                    // we are parsing past the end of the object.
  494|  2.68k|                    warn(
  495|  2.68k|                        "unexpected 'endobj' or 'endstream' while reading object; giving up on "
  496|  2.68k|                        "reading object");
  497|  2.68k|                    return {};
  498|  2.68k|                }
  499|       |
  500|   222k|                add_bad_null("unknown token while reading object; treating as null");
  501|   222k|                continue;
  502|   224k|            }
  503|       |
  504|  10.9k|            warn("unknown token while reading object; treating as string");
  505|  10.9k|            check_too_many_bad_tokens();
  506|  10.9k|            add_scalar<QPDF_String>(tokenizer_.getValue());
  507|       |
  508|  10.9k|            continue;
  509|       |
  510|   309k|        case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (510:9): [True: 309k, False: 4.91M]
  ------------------
  511|   309k|            {
  512|   309k|                auto const& val = tokenizer_.getValue();
  513|   309k|                if (decrypter_) {
  ------------------
  |  Branch (513:21): [True: 13.0k, False: 295k]
  ------------------
  514|  13.0k|                    if (b_contents) {
  ------------------
  |  Branch (514:25): [True: 314, False: 12.7k]
  ------------------
  515|    314|                        frame_->contents_string = val;
  516|    314|                        frame_->contents_offset = input_.getLastOffset();
  517|    314|                        b_contents = false;
  518|    314|                    }
  519|  13.0k|                    std::string s{val};
  520|  13.0k|                    decrypter_->decryptString(s);
  521|  13.0k|                    add_scalar<QPDF_String>(s);
  522|   295k|                } else {
  523|   295k|                    add_scalar<QPDF_String>(val);
  524|   295k|                }
  525|   309k|            }
  526|   309k|            continue;
  527|       |
  528|      0|        default:
  ------------------
  |  Branch (528:9): [True: 0, False: 5.22M]
  ------------------
  529|      0|            add_bad_null("treating unknown token type as null while reading object");
  530|  5.22M|        }
  531|  5.22M|    }
  532|   151k|}
_ZN4qpdf4impl6Parser3addEONSt3__110shared_ptrI10QPDFObjectEE:
  536|  4.29M|{
  537|  4.29M|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (537:9): [True: 3.55M, False: 741k]
  ------------------
  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|  3.55M|        frame_->olist.emplace_back(std::move(obj));
  541|  3.55M|    } else {
  542|   741k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, std::move(obj)); !res.second) {
  ------------------
  |  Branch (542:84): [True: 9.31k, False: 732k]
  ------------------
  543|  9.31k|            warn_duplicate_key();
  544|  9.31k|        }
  545|   741k|        frame_->state = st_dictionary_key;
  546|   741k|    }
  547|  4.29M|}
_ZN4qpdf4impl6Parser8add_nullEv:
  551|   311k|{
  552|   311k|    const static ObjectPtr null_obj = QPDFObject::create<QPDF_Null>();
  553|       |
  554|   311k|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (554:9): [True: 275k, False: 35.9k]
  ------------------
  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|   275k|        frame_->olist.emplace_back(null_obj);
  558|   275k|    } else {
  559|  35.9k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, null_obj); !res.second) {
  ------------------
  |  Branch (559:78): [True: 1.90k, False: 34.0k]
  ------------------
  560|  1.90k|            warn_duplicate_key();
  561|  1.90k|        }
  562|  35.9k|        frame_->state = st_dictionary_key;
  563|  35.9k|    }
  564|   311k|    ++frame_->null_count;
  565|   311k|}
_ZN4qpdf4impl6Parser12add_bad_nullERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  569|   231k|{
  570|   231k|    warn(msg);
  571|   231k|    check_too_many_bad_tokens();
  572|   231k|    add_null();
  573|   231k|}
_ZN4qpdf4impl6Parser7add_intEi:
  577|   902k|{
  578|   902k|    auto obj = QPDFObject::create<QPDF_Integer>(int_buffer_[count % 2]);
  579|   902k|    obj->setDescription(context_, description_, last_offset_buffer_[count % 2]);
  580|   902k|    add(std::move(obj));
  581|   902k|}
_ZN4qpdf4impl6Parser15set_descriptionERNSt3__110shared_ptrI10QPDFObjectEEx:
  610|   320k|{
  611|   320k|    if (obj) {
  ------------------
  |  Branch (611:9): [True: 320k, False: 0]
  ------------------
  612|   320k|        obj->setDescription(context_, description_, parsed_offset);
  613|   320k|    }
  614|   320k|}
_ZN4qpdf4impl6Parser16fix_missing_keysEv:
  618|  5.80k|{
  619|  5.80k|    std::set<std::string> names;
  620|  13.4k|    for (auto& obj: frame_->olist) {
  ------------------
  |  Branch (620:19): [True: 13.4k, False: 5.80k]
  ------------------
  621|  13.4k|        if (obj.raw_type_code() == ::ot_name) {
  ------------------
  |  Branch (621:13): [True: 255, False: 13.1k]
  ------------------
  622|    255|            names.insert(obj.getName());
  623|    255|        }
  624|  13.4k|    }
  625|  5.80k|    int next_fake_key = 1;
  626|  13.4k|    for (auto const& item: frame_->olist) {
  ------------------
  |  Branch (626:26): [True: 13.4k, False: 5.80k]
  ------------------
  627|  13.4k|        while (true) {
  ------------------
  |  Branch (627:16): [True: 13.4k, Folded]
  ------------------
  628|  13.4k|            const std::string key = "/QPDFFake" + std::to_string(next_fake_key++);
  629|  13.4k|            const bool found_fake = !frame_->dict.contains(key) && !names.contains(key);
  ------------------
  |  Branch (629:37): [True: 13.4k, False: 22]
  |  Branch (629:68): [True: 13.4k, False: 2]
  ------------------
  630|  13.4k|            QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1));
  ------------------
  |  Branch (630:55): [True: 13.4k, False: 24]
  ------------------
  631|  13.4k|            if (found_fake) {
  ------------------
  |  Branch (631:17): [True: 13.4k, False: 24]
  ------------------
  632|  13.4k|                warn(
  633|  13.4k|                    frame_->offset,
  634|  13.4k|                    "expected dictionary key but found non-name object; inserting key " + key);
  635|  13.4k|                frame_->dict[key] = item;
  636|  13.4k|                break;
  637|  13.4k|            }
  638|  13.4k|        }
  639|  13.4k|    }
  640|  5.80k|}
_ZN4qpdf4impl6Parser25check_too_many_bad_tokensEv:
  644|   290k|{
  645|   290k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (645:52): [True: 220k, False: 69.9k]
  |  Branch (645:66): [True: 66.8k, False: 3.16k]
  ------------------
  646|   290k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (646:9): [True: 329, False: 290k]
  |  Branch (646:42): [True: 0, False: 290k]
  ------------------
  647|    329|        if (bad_count_) {
  ------------------
  |  Branch (647:13): [True: 201, False: 128]
  ------------------
  648|    201|            limits_error(
  649|    201|                "parser-max-container-size-damaged",
  650|    201|                "encountered errors while parsing an array or dictionary with more than " +
  651|    201|                    std::to_string(limit) + " elements; giving up on reading object");
  652|    201|        }
  653|    329|        limits_error(
  654|    329|            "parser-max-container-size",
  655|    329|            "encountered an array or dictionary with more than " + std::to_string(limit) +
  656|    329|                " elements during xref recovery; giving up on reading object");
  657|    329|    }
  658|   290k|    if (max_bad_count_ && --max_bad_count_ == 0) {
  ------------------
  |  Branch (658:9): [True: 290k, False: 329]
  |  Branch (658:27): [True: 1.63k, False: 288k]
  ------------------
  659|  1.63k|        limits_error(
  660|  1.63k|            "parser-max-errors", "too many errors during parsing; treating object as null");
  661|  1.63k|    }
  662|   290k|    if (good_count_ > 4) {
  ------------------
  |  Branch (662:9): [True: 106k, False: 184k]
  ------------------
  663|   106k|        good_count_ = 0;
  664|   106k|        bad_count_ = 1;
  665|   106k|        return;
  666|   106k|    }
  667|   184k|    if (++bad_count_ > 5 ||
  ------------------
  |  Branch (667:9): [True: 6.84k, False: 177k]
  ------------------
  668|   177k|        (frame_->state != st_array && std::cmp_less(max_bad_count_, frame_->olist.size()))) {
  ------------------
  |  Branch (668:10): [True: 110k, False: 67.7k]
  |  Branch (668:39): [True: 2.27k, False: 107k]
  ------------------
  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.14k|        warn("too many errors; giving up on reading object");
  672|  7.14k|        throw Error();
  673|  7.14k|    }
  674|   177k|    good_count_ = 0;
  675|   177k|}
_ZN4qpdf4impl6Parser12limits_errorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  679|  2.05k|{
  680|  2.05k|    Limits::error();
  681|  2.05k|    warn("limits error("s + limit + "): " + msg);
  682|  2.05k|    throw Error();
  683|  2.05k|}
_ZNK4qpdf4impl6Parser4warnERK7QPDFExc:
  687|   424k|{
  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|   424k|    if (context_) {
  ------------------
  |  Branch (691:9): [True: 424k, False: 0]
  ------------------
  692|   424k|        context_->warn(e);
  693|   424k|    } else {
  694|      0|        throw e;
  695|      0|    }
  696|   424k|}
_ZN4qpdf4impl6Parser18warn_duplicate_keyEv:
  700|  11.2k|{
  701|  11.2k|    warn(
  702|  11.2k|        frame_->offset,
  703|  11.2k|        "dictionary has duplicated key " + frame_->key +
  704|  11.2k|            "; last occurrence overrides earlier ones");
  705|  11.2k|    check_too_many_bad_tokens();
  706|  11.2k|}
_ZNK4qpdf4impl6Parser4warnExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  710|   424k|{
  711|   424k|    if (stream_id_) {
  ------------------
  |  Branch (711:9): [True: 14.7k, False: 409k]
  ------------------
  712|  14.7k|        std::string descr = "object "s + std::to_string(obj_id_) + " 0";
  713|  14.7k|        std::string name = context_->getFilename() + " object stream " + std::to_string(stream_id_);
  714|  14.7k|        warn(QPDFExc(qpdf_e_damaged_pdf, name, descr, offset, msg));
  715|   409k|    } else {
  716|   409k|        warn(QPDFExc(qpdf_e_damaged_pdf, input_.getName(), object_description_, offset, msg));
  717|   409k|    }
  718|   424k|}
_ZNK4qpdf4impl6Parser4warnERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  722|   333k|{
  723|   333k|    warn(input_.getLastOffset(), msg);
  724|   333k|}
_ZN4QPDF3Doc10ParseGuardC2EPS_:
   26|  14.6M|        objects(qpdf ? &qpdf->m->objects : nullptr)
  ------------------
  |  Branch (26:17): [True: 14.6M, False: 0]
  ------------------
   27|  14.6M|    {
   28|  14.6M|        if (objects) {
  ------------------
  |  Branch (28:13): [True: 14.6M, False: 0]
  ------------------
   29|  14.6M|            objects->inParse(true);
   30|  14.6M|        }
   31|  14.6M|    }
_ZN4QPDF3Doc10ParseGuardD2Ev:
   40|  14.6M|    {
   41|  14.6M|        if (objects) {
  ------------------
  |  Branch (41:13): [True: 14.6M, False: 0]
  ------------------
   42|  14.6M|            objects->inParse(false);
   43|  14.6M|        }
   44|  14.6M|    }
_ZN4QPDF3Doc10ParseGuard9getObjectEPS_iib:
   35|   397k|    {
   36|   397k|        return qpdf->m->objects.getObjectForParser(id, gen, parse_pdf);
   37|   397k|    }
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_BoolJbEEE16QPDFObjectHandleDpOT0_:
  602|    717|{
  603|    717|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    717|    obj->setDescription(context_, description_, start_);
  605|    717|    return {obj};
  606|    717|}
_ZN4qpdf4impl6Parser16with_descriptionI12QPDF_IntegerJxEEE16QPDFObjectHandleDpOT0_:
  602|   109k|{
  603|   109k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|   109k|    obj->setDescription(context_, description_, start_);
  605|   109k|    return {obj};
  606|   109k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  62.5k|{
  603|  62.5k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  62.5k|    obj->setDescription(context_, description_, start_);
  605|  62.5k|    return {obj};
  606|  62.5k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  46.8k|{
  603|  46.8k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  46.8k|    obj->setDescription(context_, description_, start_);
  605|  46.8k|    return {obj};
  606|  46.8k|}
_ZN4qpdf4impl6Parser16with_descriptionI13QPDF_OperatorJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  14.2M|{
  603|  14.2M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  14.2M|    obj->setDescription(context_, description_, start_);
  605|  14.2M|    return {obj};
  606|  14.2M|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  9.31k|{
  603|  9.31k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  9.31k|    obj->setDescription(context_, description_, start_);
  605|  9.31k|    return {obj};
  606|  9.31k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|    200|{
  603|    200|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    200|    obj->setDescription(context_, description_, start_);
  605|    200|    return {obj};
  606|    200|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_BoolJbEEEvDpOT0_:
  586|  13.3k|{
  587|  13.3k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 7.09k, False: 6.29k]
  |  Branch (587:66): [True: 5.06k, False: 1.23k]
  ------------------
  588|  13.3k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 45, False: 13.3k]
  |  Branch (588:42): [True: 0, False: 13.3k]
  ------------------
  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|  13.3k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  13.3k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  13.3k|    add(std::move(obj));
  597|  13.3k|}
_ZN4qpdf4impl6Parser10add_scalarI12QPDF_IntegerJxEEEvDpOT0_:
  586|   282k|{
  587|   282k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 4.21k, False: 278k]
  |  Branch (587:66): [True: 277k, False: 472]
  ------------------
  588|   282k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 19, False: 282k]
  |  Branch (588:42): [True: 0, False: 282k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     19|        max_bad_count_ = 1;
  592|     19|        check_too_many_bad_tokens(); // always throws Error()
  593|     19|    }
  594|   282k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   282k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   282k|    add(std::move(obj));
  597|   282k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   155k|{
  587|   155k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 23.9k, False: 131k]
  |  Branch (587:66): [True: 121k, False: 9.94k]
  ------------------
  588|   155k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 54, False: 155k]
  |  Branch (588:42): [True: 0, False: 155k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     54|        max_bad_count_ = 1;
  592|     54|        check_too_many_bad_tokens(); // always throws Error()
  593|     54|    }
  594|   155k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   155k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   155k|    add(std::move(obj));
  597|   155k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  1.39M|{
  587|  1.39M|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 985k, False: 404k]
  |  Branch (587:66): [True: 379k, False: 25.2k]
  ------------------
  588|  1.39M|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 64, False: 1.39M]
  |  Branch (588:42): [True: 0, False: 1.39M]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     64|        max_bad_count_ = 1;
  592|     64|        check_too_many_bad_tokens(); // always throws Error()
  593|     64|    }
  594|  1.39M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  1.39M|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  1.39M|    add(std::move(obj));
  597|  1.39M|}
_ZN4qpdf4impl6Parser10add_scalarI13QPDF_OperatorJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   640k|{
  587|   640k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 126k, False: 513k]
  |  Branch (587:66): [True: 513k, False: 289]
  ------------------
  588|   640k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 90, False: 640k]
  |  Branch (588:42): [True: 0, False: 640k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     90|        max_bad_count_ = 1;
  592|     90|        check_too_many_bad_tokens(); // always throws Error()
  593|     90|    }
  594|   640k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   640k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   640k|    add(std::move(obj));
  597|   640k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   306k|{
  587|   306k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 95.2k, False: 211k]
  |  Branch (587:66): [True: 205k, False: 6.46k]
  ------------------
  588|   306k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 47, False: 306k]
  |  Branch (588:42): [True: 0, False: 306k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     47|        max_bad_count_ = 1;
  592|     47|        check_too_many_bad_tokens(); // always throws Error()
  593|     47|    }
  594|   306k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   306k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   306k|    add(std::move(obj));
  597|   306k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  13.0k|{
  587|  13.0k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 8.86k, False: 4.19k]
  |  Branch (587:66): [True: 4.15k, False: 37]
  ------------------
  588|  13.0k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 10, False: 13.0k]
  |  Branch (588:42): [True: 0, False: 13.0k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     10|        max_bad_count_ = 1;
  592|     10|        check_too_many_bad_tokens(); // always throws Error()
  593|     10|    }
  594|  13.0k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  13.0k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  13.0k|    add(std::move(obj));
  597|  13.0k|}

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

_ZN4qpdf9Tokenizer5resetEv:
   85|  47.9M|{
   86|  47.9M|    state = st_before_token;
   87|  47.9M|    type = tt::tt_bad;
   88|  47.9M|    val.clear();
   89|  47.9M|    raw_val.clear();
   90|  47.9M|    error_message = "";
   91|  47.9M|    before_token = true;
   92|  47.9M|    in_token = false;
   93|  47.9M|    char_to_unread = '\0';
   94|  47.9M|    inline_image_bytes = 0;
   95|  47.9M|    string_depth = 0;
   96|  47.9M|    bad = false;
   97|  47.9M|}
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  100|  1.31k|    type(type),
  101|  1.31k|    value(value),
  102|  1.31k|    raw_value(value)
  103|  1.31k|{
  104|  1.31k|    if (type == tt_string) {
  ------------------
  |  Branch (104:9): [True: 0, False: 1.31k]
  ------------------
  105|      0|        raw_value = QPDFObjectHandle::newString(value).unparse();
  106|  1.31k|    } else if (type == tt_name) {
  ------------------
  |  Branch (106:16): [True: 0, False: 1.31k]
  ------------------
  107|      0|        raw_value = QPDFObjectHandle::newName(value).unparse();
  108|      0|    }
  109|  1.31k|}
_ZN13QPDFTokenizerC2Ev:
  112|  15.5k|    m(std::make_unique<qpdf::Tokenizer>())
  113|  15.5k|{
  114|  15.5k|}
_ZN13QPDFTokenizerD2Ev:
  116|  15.5k|QPDFTokenizer::~QPDFTokenizer() = default;
_ZN4qpdf9TokenizerC2Ev:
  119|   198k|{
  120|   198k|    reset();
  121|   198k|}
_ZN13QPDFTokenizer8allowEOFEv:
  125|  15.5k|{
  126|  15.5k|    m->allowEOF();
  127|  15.5k|}
_ZN4qpdf9Tokenizer8allowEOFEv:
  131|  56.9k|{
  132|  56.9k|    allow_eof = true;
  133|  56.9k|}
_ZN13QPDFTokenizer16includeIgnorableEv:
  137|  15.5k|{
  138|  15.5k|    m->includeIgnorable();
  139|  15.5k|}
_ZN4qpdf9Tokenizer16includeIgnorableEv:
  143|  15.5k|{
  144|  15.5k|    include_ignorable = true;
  145|  15.5k|}
_ZN4qpdf9Tokenizer7isSpaceEc:
  149|  77.4M|{
  150|  77.4M|    return (ch == '\0' || util::is_space(ch));
  ------------------
  |  Branch (150:13): [True: 26.6M, False: 50.8M]
  |  Branch (150:27): [True: 8.99M, False: 41.8M]
  ------------------
  151|  77.4M|}
_ZN4qpdf9Tokenizer11isDelimiterEc:
  155|   373M|{
  156|   373M|    return is_delimiter(ch);
  157|   373M|}
_ZN4qpdf9Tokenizer16presentCharacterEc:
  167|  23.1k|{
  168|  23.1k|    handleCharacter(ch);
  169|       |
  170|  23.1k|    if (in_token) {
  ------------------
  |  Branch (170:9): [True: 0, False: 23.1k]
  ------------------
  171|      0|        raw_val += ch;
  172|      0|    }
  173|  23.1k|}
_ZN4qpdf9Tokenizer15handleCharacterEc:
  177|   659M|{
  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|   659M|    switch (state) {
  182|      0|    case st_top:
  ------------------
  |  Branch (182:5): [True: 0, False: 659M]
  ------------------
  183|      0|        inTop(ch);
  184|      0|        return;
  185|       |
  186|   779k|    case st_in_space:
  ------------------
  |  Branch (186:5): [True: 779k, False: 658M]
  ------------------
  187|   779k|        inSpace(ch);
  188|   779k|        return;
  189|       |
  190|  7.13M|    case st_in_comment:
  ------------------
  |  Branch (190:5): [True: 7.13M, False: 652M]
  ------------------
  191|  7.13M|        inComment(ch);
  192|  7.13M|        return;
  193|       |
  194|   608k|    case st_lt:
  ------------------
  |  Branch (194:5): [True: 608k, False: 659M]
  ------------------
  195|   608k|        inLt(ch);
  196|   608k|        return;
  197|       |
  198|   308k|    case st_gt:
  ------------------
  |  Branch (198:5): [True: 308k, False: 659M]
  ------------------
  199|   308k|        inGt(ch);
  200|   308k|        return;
  201|       |
  202|   160M|    case st_in_string:
  ------------------
  |  Branch (202:5): [True: 160M, False: 499M]
  ------------------
  203|   160M|        inString(ch);
  204|   160M|        return;
  205|       |
  206|  78.8M|    case st_name:
  ------------------
  |  Branch (206:5): [True: 78.8M, False: 580M]
  ------------------
  207|  78.8M|        inName(ch);
  208|  78.8M|        return;
  209|       |
  210|  7.23M|    case st_number:
  ------------------
  |  Branch (210:5): [True: 7.23M, False: 652M]
  ------------------
  211|  7.23M|        inNumber(ch);
  212|  7.23M|        return;
  213|       |
  214|   894k|    case st_real:
  ------------------
  |  Branch (214:5): [True: 894k, False: 658M]
  ------------------
  215|   894k|        inReal(ch);
  216|   894k|        return;
  217|       |
  218|   267k|    case st_string_after_cr:
  ------------------
  |  Branch (218:5): [True: 267k, False: 659M]
  ------------------
  219|   267k|        inStringAfterCR(ch);
  220|   267k|        return;
  221|       |
  222|   157k|    case st_string_escape:
  ------------------
  |  Branch (222:5): [True: 157k, False: 659M]
  ------------------
  223|   157k|        inStringEscape(ch);
  224|   157k|        return;
  225|       |
  226|  72.5k|    case st_char_code:
  ------------------
  |  Branch (226:5): [True: 72.5k, False: 659M]
  ------------------
  227|  72.5k|        inCharCode(ch);
  228|  72.5k|        return;
  229|       |
  230|   288M|    case st_literal:
  ------------------
  |  Branch (230:5): [True: 288M, False: 371M]
  ------------------
  231|   288M|        inLiteral(ch);
  232|   288M|        return;
  233|       |
  234|  18.5M|    case st_inline_image:
  ------------------
  |  Branch (234:5): [True: 18.5M, False: 641M]
  ------------------
  235|  18.5M|        inInlineImage(ch);
  236|  18.5M|        return;
  237|       |
  238|  8.57M|    case st_in_hexstring:
  ------------------
  |  Branch (238:5): [True: 8.57M, False: 651M]
  ------------------
  239|  8.57M|        inHexstring(ch);
  240|  8.57M|        return;
  241|       |
  242|  8.56M|    case st_in_hexstring_2nd:
  ------------------
  |  Branch (242:5): [True: 8.56M, False: 651M]
  ------------------
  243|  8.56M|        inHexstring2nd(ch);
  244|  8.56M|        return;
  245|       |
  246|  1.86M|    case st_name_hex1:
  ------------------
  |  Branch (246:5): [True: 1.86M, False: 657M]
  ------------------
  247|  1.86M|        inNameHex1(ch);
  248|  1.86M|        return;
  249|       |
  250|  24.3k|    case st_name_hex2:
  ------------------
  |  Branch (250:5): [True: 24.3k, False: 659M]
  ------------------
  251|  24.3k|        inNameHex2(ch);
  252|  24.3k|        return;
  253|       |
  254|   133k|    case st_sign:
  ------------------
  |  Branch (254:5): [True: 133k, False: 659M]
  ------------------
  255|   133k|        inSign(ch);
  256|   133k|        return;
  257|       |
  258|  26.9k|    case st_decimal:
  ------------------
  |  Branch (258:5): [True: 26.9k, False: 659M]
  ------------------
  259|  26.9k|        inDecimal(ch);
  260|  26.9k|        return;
  261|       |
  262|  76.6M|    case (st_before_token):
  ------------------
  |  Branch (262:5): [True: 76.6M, False: 583M]
  ------------------
  263|  76.6M|        inBeforeToken(ch);
  264|  76.6M|        return;
  265|       |
  266|      0|    case (st_token_ready):
  ------------------
  |  Branch (266:5): [True: 0, False: 659M]
  ------------------
  267|      0|        inTokenReady(ch);
  268|      0|        return;
  269|       |
  270|      0|    default:
  ------------------
  |  Branch (270:5): [True: 0, False: 659M]
  ------------------
  271|      0|        throw std::logic_error("INTERNAL ERROR: invalid state while reading token");
  272|   659M|    }
  273|   659M|}
_ZN4qpdf9Tokenizer13inBeforeTokenEc:
  284|  76.6M|{
  285|       |    // Note: we specifically do not use ctype here.  It is locale-dependent.
  286|  76.6M|    if (isSpace(ch)) {
  ------------------
  |  Branch (286:9): [True: 35.1M, False: 41.5M]
  ------------------
  287|  35.1M|        before_token = !include_ignorable;
  288|  35.1M|        in_token = include_ignorable;
  289|  35.1M|        if (include_ignorable) {
  ------------------
  |  Branch (289:13): [True: 360k, False: 34.7M]
  ------------------
  290|   360k|            state = st_in_space;
  291|   360k|        }
  292|  41.5M|    } else if (ch == '%') {
  ------------------
  |  Branch (292:16): [True: 39.4k, False: 41.4M]
  ------------------
  293|  39.4k|        before_token = !include_ignorable;
  294|  39.4k|        in_token = include_ignorable;
  295|  39.4k|        state = st_in_comment;
  296|  41.4M|    } else {
  297|  41.4M|        before_token = false;
  298|  41.4M|        in_token = true;
  299|  41.4M|        inTop(ch);
  300|  41.4M|    }
  301|  76.6M|}
_ZN4qpdf9Tokenizer5inTopEc:
  305|  41.4M|{
  306|  41.4M|    switch (ch) {
  307|   176k|    case '(':
  ------------------
  |  Branch (307:5): [True: 176k, False: 41.2M]
  ------------------
  308|   176k|        string_depth = 1;
  309|   176k|        state = st_in_string;
  310|   176k|        return;
  311|       |
  312|   610k|    case '<':
  ------------------
  |  Branch (312:5): [True: 610k, False: 40.8M]
  ------------------
  313|   610k|        state = st_lt;
  314|   610k|        return;
  315|       |
  316|   309k|    case '>':
  ------------------
  |  Branch (316:5): [True: 309k, False: 41.1M]
  ------------------
  317|   309k|        state = st_gt;
  318|   309k|        return;
  319|       |
  320|   116k|    case (')'):
  ------------------
  |  Branch (320:5): [True: 116k, False: 41.3M]
  ------------------
  321|   116k|        type = tt::tt_bad;
  322|   116k|        QTC::TC("qpdf", "QPDFTokenizer bad )");
  323|   116k|        error_message = "unexpected )";
  324|   116k|        state = st_token_ready;
  325|   116k|        return;
  326|       |
  327|   272k|    case '[':
  ------------------
  |  Branch (327:5): [True: 272k, False: 41.1M]
  ------------------
  328|   272k|        type = tt::tt_array_open;
  329|   272k|        state = st_token_ready;
  330|   272k|        return;
  331|       |
  332|   209k|    case ']':
  ------------------
  |  Branch (332:5): [True: 209k, False: 41.2M]
  ------------------
  333|   209k|        type = tt::tt_array_close;
  334|   209k|        state = st_token_ready;
  335|   209k|        return;
  336|       |
  337|  1.61M|    case '{':
  ------------------
  |  Branch (337:5): [True: 1.61M, False: 39.8M]
  ------------------
  338|  1.61M|        type = tt::tt_brace_open;
  339|  1.61M|        state = st_token_ready;
  340|  1.61M|        return;
  341|       |
  342|  5.71k|    case '}':
  ------------------
  |  Branch (342:5): [True: 5.71k, False: 41.4M]
  ------------------
  343|  5.71k|        type = tt::tt_brace_close;
  344|  5.71k|        state = st_token_ready;
  345|  5.71k|        return;
  346|       |
  347|  2.66M|    case '/':
  ------------------
  |  Branch (347:5): [True: 2.66M, False: 38.8M]
  ------------------
  348|  2.66M|        state = st_name;
  349|  2.66M|        val += ch;
  350|  2.66M|        return;
  351|       |
  352|  1.37M|    case '0':
  ------------------
  |  Branch (352:5): [True: 1.37M, False: 40.0M]
  ------------------
  353|  2.28M|    case '1':
  ------------------
  |  Branch (353:5): [True: 907k, False: 40.5M]
  ------------------
  354|  2.60M|    case '2':
  ------------------
  |  Branch (354:5): [True: 315k, False: 41.1M]
  ------------------
  355|  2.78M|    case '3':
  ------------------
  |  Branch (355:5): [True: 179k, False: 41.2M]
  ------------------
  356|  3.03M|    case '4':
  ------------------
  |  Branch (356:5): [True: 256k, False: 41.2M]
  ------------------
  357|  3.26M|    case '5':
  ------------------
  |  Branch (357:5): [True: 226k, False: 41.2M]
  ------------------
  358|  3.43M|    case '6':
  ------------------
  |  Branch (358:5): [True: 174k, False: 41.2M]
  ------------------
  359|  3.56M|    case '7':
  ------------------
  |  Branch (359:5): [True: 122k, False: 41.3M]
  ------------------
  360|  3.79M|    case '8':
  ------------------
  |  Branch (360:5): [True: 231k, False: 41.2M]
  ------------------
  361|  3.85M|    case '9':
  ------------------
  |  Branch (361:5): [True: 59.3k, False: 41.4M]
  ------------------
  362|  3.85M|        state = st_number;
  363|  3.85M|        return;
  364|       |
  365|  4.80k|    case '+':
  ------------------
  |  Branch (365:5): [True: 4.80k, False: 41.4M]
  ------------------
  366|   138k|    case '-':
  ------------------
  |  Branch (366:5): [True: 133k, False: 41.3M]
  ------------------
  367|   138k|        state = st_sign;
  368|   138k|        return;
  369|       |
  370|  29.9k|    case '.':
  ------------------
  |  Branch (370:5): [True: 29.9k, False: 41.4M]
  ------------------
  371|  29.9k|        state = st_decimal;
  372|  29.9k|        return;
  373|       |
  374|  31.4M|    default:
  ------------------
  |  Branch (374:5): [True: 31.4M, False: 9.99M]
  ------------------
  375|  31.4M|        state = st_literal;
  376|  31.4M|        return;
  377|  41.4M|    }
  378|  41.4M|}
_ZN4qpdf9Tokenizer7inSpaceEc:
  382|   779k|{
  383|       |    // We only enter this state if include_ignorable is true.
  384|   779k|    if (!isSpace(ch)) {
  ------------------
  |  Branch (384:9): [True: 354k, False: 424k]
  ------------------
  385|   354k|        type = tt::tt_space;
  386|   354k|        in_token = false;
  387|   354k|        char_to_unread = ch;
  388|   354k|        state = st_token_ready;
  389|   354k|    }
  390|   779k|}
_ZN4qpdf9Tokenizer9inCommentEc:
  394|  7.13M|{
  395|  7.13M|    if ((ch == '\r') || (ch == '\n')) {
  ------------------
  |  Branch (395:9): [True: 9.43k, False: 7.12M]
  |  Branch (395:25): [True: 29.0k, False: 7.09M]
  ------------------
  396|  38.4k|        if (include_ignorable) {
  ------------------
  |  Branch (396:13): [True: 1.83k, False: 36.6k]
  ------------------
  397|  1.83k|            type = tt::tt_comment;
  398|  1.83k|            in_token = false;
  399|  1.83k|            char_to_unread = ch;
  400|  1.83k|            state = st_token_ready;
  401|  36.6k|        } else {
  402|  36.6k|            state = st_before_token;
  403|  36.6k|        }
  404|  38.4k|    }
  405|  7.13M|}
_ZN4qpdf9Tokenizer8inStringEc:
  409|   160M|{
  410|   160M|    switch (ch) {
  411|   157k|    case '\\':
  ------------------
  |  Branch (411:5): [True: 157k, False: 160M]
  ------------------
  412|   157k|        state = st_string_escape;
  413|   157k|        return;
  414|       |
  415|   168k|    case '(':
  ------------------
  |  Branch (415:5): [True: 168k, False: 160M]
  ------------------
  416|   168k|        val += ch;
  417|   168k|        ++string_depth;
  418|   168k|        return;
  419|       |
  420|   257k|    case ')':
  ------------------
  |  Branch (420:5): [True: 257k, False: 160M]
  ------------------
  421|   257k|        if (--string_depth == 0) {
  ------------------
  |  Branch (421:13): [True: 164k, False: 92.5k]
  ------------------
  422|   164k|            type = tt::tt_string;
  423|   164k|            state = st_token_ready;
  424|   164k|            return;
  425|   164k|        }
  426|       |
  427|  92.5k|        val += ch;
  428|  92.5k|        return;
  429|       |
  430|   266k|    case '\r':
  ------------------
  |  Branch (430:5): [True: 266k, False: 160M]
  ------------------
  431|       |        // CR by itself is converted to LF
  432|   266k|        val += '\n';
  433|   266k|        state = st_string_after_cr;
  434|   266k|        return;
  435|       |
  436|   669k|    case '\n':
  ------------------
  |  Branch (436:5): [True: 669k, False: 159M]
  ------------------
  437|   669k|        val += ch;
  438|   669k|        return;
  439|       |
  440|   159M|    default:
  ------------------
  |  Branch (440:5): [True: 159M, False: 1.52M]
  ------------------
  441|   159M|        val += ch;
  442|   159M|        return;
  443|   160M|    }
  444|   160M|}
_ZN4qpdf9Tokenizer6inNameEc:
  448|  80.6M|{
  449|  80.6M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (449:9): [True: 2.57M, False: 78.1M]
  ------------------
  450|       |        // A C-locale whitespace character or delimiter terminates token.  It is important to unread
  451|       |        // the whitespace character even though it is ignored since it may be the newline after a
  452|       |        // stream keyword.  Removing it here could make the stream-reading code break on some files,
  453|       |        // though not on any files in the test suite as of this
  454|       |        // writing.
  455|       |
  456|  2.57M|        type = bad ? tt::tt_bad : tt::tt_name;
  ------------------
  |  Branch (456:16): [True: 1.24k, False: 2.57M]
  ------------------
  457|  2.57M|        in_token = false;
  458|  2.57M|        char_to_unread = ch;
  459|  2.57M|        state = st_token_ready;
  460|  78.1M|    } else if (ch == '#') {
  ------------------
  |  Branch (460:16): [True: 1.86M, False: 76.2M]
  ------------------
  461|  1.86M|        char_code = 0;
  462|  1.86M|        state = st_name_hex1;
  463|  76.2M|    } else {
  464|  76.2M|        val += ch;
  465|  76.2M|    }
  466|  80.6M|}
_ZN4qpdf9Tokenizer10inNameHex1Ec:
  470|  1.86M|{
  471|  1.86M|    hex_char = ch;
  472|       |
  473|  1.86M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (473:48): [True: 24.3k, False: 1.84M]
  ------------------
  474|  24.3k|        char_code = int(hval) << 4;
  475|  24.3k|        state = st_name_hex2;
  476|  1.84M|    } else {
  477|  1.84M|        QTC::TC("qpdf", "QPDFTokenizer bad name 1");
  478|  1.84M|        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|  1.84M|        val += '\0';
  481|  1.84M|        state = st_name;
  482|  1.84M|        inName(ch);
  483|  1.84M|    }
  484|  1.86M|}
_ZN4qpdf9Tokenizer10inNameHex2Ec:
  488|  24.3k|{
  489|  24.3k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (489:48): [True: 11.3k, False: 13.0k]
  ------------------
  490|  11.3k|        char_code |= int(hval);
  491|  13.0k|    } else {
  492|  13.0k|        QTC::TC("qpdf", "QPDFTokenizer bad name 2");
  493|  13.0k|        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|  13.0k|        val += '\0';
  496|  13.0k|        val += hex_char;
  497|  13.0k|        state = st_name;
  498|  13.0k|        inName(ch);
  499|  13.0k|        return;
  500|  13.0k|    }
  501|  11.3k|    if (char_code == 0) {
  ------------------
  |  Branch (501:9): [True: 7.91k, False: 3.38k]
  ------------------
  502|  7.91k|        QTC::TC("qpdf", "QPDFTokenizer null in name");
  503|  7.91k|        error_message = "null character not allowed in name token";
  504|  7.91k|        val += "#00";
  505|  7.91k|        state = st_name;
  506|  7.91k|        bad = true;
  507|  7.91k|    } else {
  508|  3.38k|        val += char(char_code);
  509|  3.38k|        state = st_name;
  510|  3.38k|    }
  511|  11.3k|}
_ZN4qpdf9Tokenizer6inSignEc:
  515|   133k|{
  516|   133k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (516:9): [True: 124k, False: 8.26k]
  ------------------
  517|   124k|        state = st_number;
  518|   124k|    } else if (ch == '.') {
  ------------------
  |  Branch (518:16): [True: 958, False: 7.30k]
  ------------------
  519|    958|        state = st_decimal;
  520|  7.30k|    } else {
  521|  7.30k|        state = st_literal;
  522|  7.30k|        inLiteral(ch);
  523|  7.30k|    }
  524|   133k|}
_ZN4qpdf9Tokenizer9inDecimalEc:
  528|  26.9k|{
  529|  26.9k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (529:9): [True: 20.9k, False: 6.02k]
  ------------------
  530|  20.9k|        state = st_real;
  531|  20.9k|    } else {
  532|  6.02k|        state = st_literal;
  533|  6.02k|        inLiteral(ch);
  534|  6.02k|    }
  535|  26.9k|}
_ZN4qpdf9Tokenizer8inNumberEc:
  539|  7.23M|{
  540|  7.23M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (540:9): [True: 3.46M, False: 3.76M]
  ------------------
  541|  3.76M|    } else if (ch == '.') {
  ------------------
  |  Branch (541:16): [True: 264k, False: 3.50M]
  ------------------
  542|   264k|        state = st_real;
  543|  3.50M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (543:16): [True: 3.41M, False: 92.7k]
  ------------------
  544|  3.41M|        type = tt::tt_integer;
  545|  3.41M|        state = st_token_ready;
  546|  3.41M|        in_token = false;
  547|  3.41M|        char_to_unread = ch;
  548|  3.41M|    } else {
  549|  92.7k|        state = st_literal;
  550|  92.7k|    }
  551|  7.23M|}
_ZN4qpdf9Tokenizer6inRealEc:
  555|   894k|{
  556|   894k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (556:9): [True: 609k, False: 284k]
  ------------------
  557|   609k|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (557:16): [True: 275k, False: 9.02k]
  ------------------
  558|   275k|        type = tt::tt_real;
  559|   275k|        state = st_token_ready;
  560|   275k|        in_token = false;
  561|   275k|        char_to_unread = ch;
  562|   275k|    } else {
  563|  9.02k|        state = st_literal;
  564|  9.02k|    }
  565|   894k|}
_ZN4qpdf9Tokenizer14inStringEscapeEc:
  568|   157k|{
  569|   157k|    state = st_in_string;
  570|   157k|    switch (ch) {
  571|  16.0k|    case '0':
  ------------------
  |  Branch (571:5): [True: 16.0k, False: 141k]
  ------------------
  572|  17.1k|    case '1':
  ------------------
  |  Branch (572:5): [True: 1.09k, False: 156k]
  ------------------
  573|  27.8k|    case '2':
  ------------------
  |  Branch (573:5): [True: 10.6k, False: 147k]
  ------------------
  574|  38.7k|    case '3':
  ------------------
  |  Branch (574:5): [True: 10.9k, False: 146k]
  ------------------
  575|  39.4k|    case '4':
  ------------------
  |  Branch (575:5): [True: 635, False: 157k]
  ------------------
  576|  39.9k|    case '5':
  ------------------
  |  Branch (576:5): [True: 476, False: 157k]
  ------------------
  577|  40.3k|    case '6':
  ------------------
  |  Branch (577:5): [True: 409, False: 157k]
  ------------------
  578|  40.8k|    case '7':
  ------------------
  |  Branch (578:5): [True: 557, False: 157k]
  ------------------
  579|  40.8k|        state = st_char_code;
  580|  40.8k|        char_code = 0;
  581|  40.8k|        digit_count = 0;
  582|  40.8k|        inCharCode(ch);
  583|  40.8k|        return;
  584|       |
  585|  7.00k|    case 'n':
  ------------------
  |  Branch (585:5): [True: 7.00k, False: 150k]
  ------------------
  586|  7.00k|        val += '\n';
  587|  7.00k|        return;
  588|       |
  589|  2.21k|    case 'r':
  ------------------
  |  Branch (589:5): [True: 2.21k, False: 155k]
  ------------------
  590|  2.21k|        val += '\r';
  591|  2.21k|        return;
  592|       |
  593|  27.5k|    case 't':
  ------------------
  |  Branch (593:5): [True: 27.5k, False: 130k]
  ------------------
  594|  27.5k|        val += '\t';
  595|  27.5k|        return;
  596|       |
  597|    998|    case 'b':
  ------------------
  |  Branch (597:5): [True: 998, False: 156k]
  ------------------
  598|    998|        val += '\b';
  599|    998|        return;
  600|       |
  601|  18.3k|    case 'f':
  ------------------
  |  Branch (601:5): [True: 18.3k, False: 139k]
  ------------------
  602|  18.3k|        val += '\f';
  603|  18.3k|        return;
  604|       |
  605|    754|    case '\n':
  ------------------
  |  Branch (605:5): [True: 754, False: 157k]
  ------------------
  606|    754|        return;
  607|       |
  608|    532|    case '\r':
  ------------------
  |  Branch (608:5): [True: 532, False: 157k]
  ------------------
  609|    532|        state = st_string_after_cr;
  610|    532|        return;
  611|       |
  612|  59.5k|    default:
  ------------------
  |  Branch (612:5): [True: 59.5k, False: 98.2k]
  ------------------
  613|       |        // PDF spec says backslash is ignored before anything else
  614|  59.5k|        val += ch;
  615|  59.5k|        return;
  616|   157k|    }
  617|   157k|}
_ZN4qpdf9Tokenizer15inStringAfterCREc:
  621|   267k|{
  622|   267k|    state = st_in_string;
  623|   267k|    if (ch != '\n') {
  ------------------
  |  Branch (623:9): [True: 156k, False: 110k]
  ------------------
  624|   156k|        inString(ch);
  625|   156k|    }
  626|   267k|}
_ZN4qpdf9Tokenizer4inLtEc:
  630|   608k|{
  631|   608k|    if (ch == '<') {
  ------------------
  |  Branch (631:9): [True: 393k, False: 215k]
  ------------------
  632|   393k|        type = tt::tt_dict_open;
  633|   393k|        state = st_token_ready;
  634|   393k|        return;
  635|   393k|    }
  636|       |
  637|   215k|    state = st_in_hexstring;
  638|   215k|    inHexstring(ch);
  639|   215k|}
_ZN4qpdf9Tokenizer4inGtEc:
  643|   308k|{
  644|   308k|    if (ch == '>') {
  ------------------
  |  Branch (644:9): [True: 284k, False: 24.2k]
  ------------------
  645|   284k|        type = tt::tt_dict_close;
  646|   284k|        state = st_token_ready;
  647|   284k|    } else {
  648|  24.2k|        type = tt::tt_bad;
  649|  24.2k|        QTC::TC("qpdf", "QPDFTokenizer bad >");
  650|  24.2k|        error_message = "unexpected >";
  651|  24.2k|        in_token = false;
  652|  24.2k|        char_to_unread = ch;
  653|  24.2k|        state = st_token_ready;
  654|  24.2k|    }
  655|   308k|}
_ZN4qpdf9Tokenizer9inLiteralEc:
  659|   288M|{
  660|   288M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (660:9): [True: 17.1M, False: 271M]
  ------------------
  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|  17.1M|        in_token = false;
  667|  17.1M|        char_to_unread = ch;
  668|  17.1M|        state = st_token_ready;
  669|  17.1M|        type = (raw_val == "true") || (raw_val == "false")
  ------------------
  |  Branch (669:16): [True: 12.6k, False: 17.1M]
  |  Branch (669:39): [True: 2.87k, False: 17.1M]
  ------------------
  670|  17.1M|            ? tt::tt_bool
  671|  17.1M|            : (raw_val == "null" ? tt::tt_null : tt::tt_word);
  ------------------
  |  Branch (671:16): [True: 55.1k, False: 17.0M]
  ------------------
  672|  17.1M|    }
  673|   288M|}
_ZN4qpdf9Tokenizer11inHexstringEc:
  677|  8.79M|{
  678|  8.79M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (678:48): [True: 8.55M, False: 233k]
  ------------------
  679|  8.55M|        char_code = int(hval) << 4;
  680|  8.55M|        state = st_in_hexstring_2nd;
  681|       |
  682|  8.55M|    } else if (ch == '>') {
  ------------------
  |  Branch (682:16): [True: 171k, False: 61.6k]
  ------------------
  683|   171k|        type = tt::tt_string;
  684|   171k|        state = st_token_ready;
  685|       |
  686|   171k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (686:16): [True: 38.2k, False: 23.4k]
  ------------------
  687|       |        // ignore
  688|       |
  689|  38.2k|    } else {
  690|  23.4k|        type = tt::tt_bad;
  691|  23.4k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
  692|  23.4k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  693|  23.4k|        state = st_token_ready;
  694|  23.4k|    }
  695|  8.79M|}
_ZN4qpdf9Tokenizer14inHexstring2ndEc:
  699|  8.56M|{
  700|  8.56M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (700:48): [True: 8.53M, False: 26.7k]
  ------------------
  701|  8.53M|        val += char(char_code) | hval;
  702|  8.53M|        state = st_in_hexstring;
  703|       |
  704|  8.53M|    } else if (ch == '>') {
  ------------------
  |  Branch (704:16): [True: 6.72k, False: 20.0k]
  ------------------
  705|       |        // PDF spec says odd hexstrings have implicit trailing 0.
  706|  6.72k|        val += char(char_code);
  707|  6.72k|        type = tt::tt_string;
  708|  6.72k|        state = st_token_ready;
  709|       |
  710|  20.0k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (710:16): [True: 11.0k, False: 9.03k]
  ------------------
  711|       |        // ignore
  712|       |
  713|  11.0k|    } else {
  714|  9.03k|        type = tt::tt_bad;
  715|  9.03k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
  716|  9.03k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  717|  9.03k|        state = st_token_ready;
  718|  9.03k|    }
  719|  8.56M|}
_ZN4qpdf9Tokenizer10inCharCodeEc:
  723|   113k|{
  724|   113k|    bool handled = false;
  725|   113k|    if (('0' <= ch) && (ch <= '7')) {
  ------------------
  |  Branch (725:9): [True: 109k, False: 4.24k]
  |  Branch (725:24): [True: 104k, False: 5.15k]
  ------------------
  726|   104k|        char_code = 8 * char_code + (int(ch) - int('0'));
  727|   104k|        if (++(digit_count) < 3) {
  ------------------
  |  Branch (727:13): [True: 73.6k, False: 30.3k]
  ------------------
  728|  73.6k|            return;
  729|  73.6k|        }
  730|  30.3k|        handled = true;
  731|  30.3k|    }
  732|       |    // We've accumulated \ddd or we have \d or \dd followed by other than an octal digit. The PDF
  733|       |    // Spec says to ignore high-order overflow.
  734|  39.7k|    val += char(char_code % 256);
  735|  39.7k|    state = st_in_string;
  736|  39.7k|    if (!handled) {
  ------------------
  |  Branch (736:9): [True: 9.39k, False: 30.3k]
  ------------------
  737|  9.39k|        inString(ch);
  738|  9.39k|    }
  739|  39.7k|}
_ZN4qpdf9Tokenizer13inInlineImageEc:
  743|  18.5M|{
  744|  18.5M|    if ((raw_val.length() + 1) == inline_image_bytes) {
  ------------------
  |  Branch (744:9): [True: 2.69k, False: 18.5M]
  ------------------
  745|  2.69k|        QTC::TC("qpdf", "QPDFTokenizer found EI by byte count");
  746|  2.69k|        type = tt::tt_inline_image;
  747|  2.69k|        inline_image_bytes = 0;
  748|  2.69k|        state = st_token_ready;
  749|  2.69k|    }
  750|  18.5M|}
_ZN4qpdf9Tokenizer10presentEOFEv:
  760|  70.2k|{
  761|  70.2k|    switch (state) {
  762|  1.92k|    case st_name:
  ------------------
  |  Branch (762:5): [True: 1.92k, False: 68.3k]
  ------------------
  763|  2.12k|    case st_name_hex1:
  ------------------
  |  Branch (763:5): [True: 192, False: 70.0k]
  ------------------
  764|  2.28k|    case st_name_hex2:
  ------------------
  |  Branch (764:5): [True: 165, False: 70.1k]
  ------------------
  765|  8.95k|    case st_number:
  ------------------
  |  Branch (765:5): [True: 6.66k, False: 63.6k]
  ------------------
  766|  9.21k|    case st_real:
  ------------------
  |  Branch (766:5): [True: 256, False: 70.0k]
  ------------------
  767|  9.37k|    case st_sign:
  ------------------
  |  Branch (767:5): [True: 160, False: 70.1k]
  ------------------
  768|  9.48k|    case st_decimal:
  ------------------
  |  Branch (768:5): [True: 116, False: 70.1k]
  ------------------
  769|  23.1k|    case st_literal:
  ------------------
  |  Branch (769:5): [True: 13.7k, False: 56.5k]
  ------------------
  770|  23.1k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
  771|       |        // Push any delimiter to the state machine to finish off the final token.
  772|  23.1k|        presentCharacter('\f');
  773|  23.1k|        in_token = true;
  774|  23.1k|        break;
  775|       |
  776|      0|    case st_top:
  ------------------
  |  Branch (776:5): [True: 0, False: 70.2k]
  ------------------
  777|  36.8k|    case st_before_token:
  ------------------
  |  Branch (777:5): [True: 36.8k, False: 33.4k]
  ------------------
  778|  36.8k|        type = tt::tt_eof;
  779|  36.8k|        break;
  780|       |
  781|  5.31k|    case st_in_space:
  ------------------
  |  Branch (781:5): [True: 5.31k, False: 64.9k]
  ------------------
  782|  5.31k|        type = include_ignorable ? tt::tt_space : tt::tt_eof;
  ------------------
  |  Branch (782:16): [True: 5.31k, False: 0]
  ------------------
  783|  5.31k|        break;
  784|       |
  785|    965|    case st_in_comment:
  ------------------
  |  Branch (785:5): [True: 965, False: 69.3k]
  ------------------
  786|    965|        type = include_ignorable ? tt::tt_comment : tt::tt_bad;
  ------------------
  |  Branch (786:16): [True: 71, False: 894]
  ------------------
  787|    965|        break;
  788|       |
  789|      0|    case st_token_ready:
  ------------------
  |  Branch (789:5): [True: 0, False: 70.2k]
  ------------------
  790|      0|        break;
  791|       |
  792|  3.97k|    default:
  ------------------
  |  Branch (792:5): [True: 3.97k, False: 66.2k]
  ------------------
  793|  3.97k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
  794|  3.97k|        type = tt::tt_bad;
  795|  3.97k|        error_message = "EOF while reading token";
  796|  70.2k|    }
  797|  70.2k|    state = st_token_ready;
  798|  70.2k|}
_ZN13QPDFTokenizer17expectInlineImageER11InputSource:
  808|  1.31k|{
  809|  1.31k|    m->expectInlineImage(input);
  810|  1.31k|}
_ZN4qpdf9Tokenizer17expectInlineImageER11InputSource:
  814|  2.89k|{
  815|  2.89k|    if (state == st_token_ready) {
  ------------------
  |  Branch (815:9): [True: 1.58k, False: 1.31k]
  ------------------
  816|  1.58k|        reset();
  817|  1.58k|    } else if (state != st_before_token) {
  ------------------
  |  Branch (817:16): [True: 0, False: 1.31k]
  ------------------
  818|      0|        throw std::logic_error(
  819|      0|            "QPDFTokenizer::expectInlineImage called when tokenizer is in improper state");
  820|      0|    }
  821|  2.89k|    findEI(input);
  822|  2.89k|    before_token = false;
  823|  2.89k|    in_token = true;
  824|  2.89k|    state = st_inline_image;
  825|  2.89k|}
_ZN4qpdf9Tokenizer6findEIER11InputSource:
  829|  2.89k|{
  830|  2.89k|    qpdf_offset_t last_offset = input.getLastOffset();
  831|  2.89k|    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.89k|    bool okay = false;
  841|  2.89k|    bool first_try = true;
  842|  24.0k|    while (!okay) {
  ------------------
  |  Branch (842:12): [True: 21.9k, False: 2.17k]
  ------------------
  843|  21.9k|        QPDFWordTokenFinder f(input, "EI");
  844|  21.9k|        if (!input.findFirst("EI", input.tell(), 0, f)) {
  ------------------
  |  Branch (844:13): [True: 725, False: 21.2k]
  ------------------
  845|    725|            break;
  846|    725|        }
  847|  21.2k|        inline_image_bytes = QIntC::to_size(input.tell() - pos - 2);
  848|       |
  849|  21.2k|        Tokenizer check;
  850|  21.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|  54.9k|        for (int i = 0; i < 10; ++i) {
  ------------------
  |  Branch (856:25): [True: 52.7k, False: 2.17k]
  ------------------
  857|  52.7k|            check.nextToken(input, "checker");
  858|  52.7k|            auto typ = check.getType();
  859|  52.7k|            if (typ == tt::tt_eof) {
  ------------------
  |  Branch (859:17): [True: 0, False: 52.7k]
  ------------------
  860|      0|                okay = true;
  861|  52.7k|            } else if (typ == tt::tt_bad) {
  ------------------
  |  Branch (861:24): [True: 10.2k, False: 42.5k]
  ------------------
  862|  10.2k|                found_bad = true;
  863|  42.5k|            } else if (typ == tt::tt_word) {
  ------------------
  |  Branch (863:24): [True: 23.2k, False: 19.3k]
  ------------------
  864|       |                // The qpdf tokenizer lumps alphabetic and otherwise uncategorized characters into
  865|       |                // "words". We recognize strings of alphabetic characters as potential valid
  866|       |                // operators for purposes of telling whether we're in valid content or not. It's not
  867|       |                // perfect, but it should work more reliably than what we used to do, which was
  868|       |                // already good enough for the vast majority of files.
  869|  23.2k|                bool found_alpha = false;
  870|  23.2k|                bool found_non_printable = false;
  871|  23.2k|                bool found_other = false;
  872|   132k|                for (char ch: check.getValue()) {
  ------------------
  |  Branch (872:29): [True: 132k, False: 19.2k]
  ------------------
  873|   132k|                    if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '*')) {
  ------------------
  |  Branch (873:26): [True: 37.0k, False: 95.2k]
  |  Branch (873:39): [True: 26.2k, False: 10.8k]
  |  Branch (873:54): [True: 62.0k, False: 44.0k]
  |  Branch (873:67): [True: 49.0k, False: 12.9k]
  |  Branch (873:81): [True: 557, False: 56.4k]
  ------------------
  874|       |                        // Treat '*' as alpha since there are valid PDF operators that contain *
  875|       |                        // along with alphabetic characters.
  876|  75.8k|                        found_alpha = true;
  877|  75.8k|                    } else if (static_cast<signed char>(ch) < 32 && !isSpace(ch)) {
  ------------------
  |  Branch (877:32): [True: 4.03k, False: 52.4k]
  |  Branch (877:69): [True: 4.03k, False: 0]
  ------------------
  878|       |                        // Compare ch as a signed char so characters outside of 7-bit will be < 0.
  879|  4.03k|                        found_non_printable = true;
  880|  4.03k|                        break;
  881|  52.4k|                    } else {
  882|  52.4k|                        found_other = true;
  883|  52.4k|                    }
  884|   132k|                }
  885|  23.2k|                if (found_non_printable || (found_alpha && found_other)) {
  ------------------
  |  Branch (885:21): [True: 4.03k, False: 19.2k]
  |  Branch (885:45): [True: 18.3k, False: 820]
  |  Branch (885:60): [True: 4.78k, False: 13.6k]
  ------------------
  886|  8.81k|                    found_bad = true;
  887|  8.81k|                }
  888|  23.2k|            }
  889|  52.7k|            if (okay || found_bad) {
  ------------------
  |  Branch (889:17): [True: 0, False: 52.7k]
  |  Branch (889:25): [True: 19.0k, False: 33.7k]
  ------------------
  890|  19.0k|                break;
  891|  19.0k|            }
  892|  52.7k|        }
  893|  21.2k|        if (!found_bad) {
  ------------------
  |  Branch (893:13): [True: 2.17k, False: 19.0k]
  ------------------
  894|  2.17k|            okay = true;
  895|  2.17k|        }
  896|  21.2k|        if (!okay) {
  ------------------
  |  Branch (896:13): [True: 19.0k, False: 2.17k]
  ------------------
  897|  19.0k|            first_try = false;
  898|  19.0k|        }
  899|  21.2k|    }
  900|  2.89k|    if (okay && (!first_try)) {
  ------------------
  |  Branch (900:9): [True: 2.17k, False: 725]
  |  Branch (900:17): [True: 153, False: 2.01k]
  ------------------
  901|    153|        QTC::TC("qpdf", "QPDFTokenizer found EI after more than one try");
  902|    153|    }
  903|       |
  904|       |    input.seek(pos, SEEK_SET);
  905|  2.89k|    input.setLastOffset(last_offset);
  906|  2.89k|}
_ZN4qpdf9Tokenizer8getTokenERN13QPDFTokenizer5TokenERbRc:
  916|  5.90M|{
  917|  5.90M|    bool ready = (state == st_token_ready);
  918|  5.90M|    unread_char = !in_token && !before_token;
  ------------------
  |  Branch (918:19): [True: 3.57M, False: 2.33M]
  |  Branch (918:32): [True: 3.54M, False: 22.3k]
  ------------------
  919|  5.90M|    ch = char_to_unread;
  920|  5.90M|    if (ready) {
  ------------------
  |  Branch (920:9): [True: 5.90M, False: 0]
  ------------------
  921|  5.90M|        token = (!(type == tt::tt_name || type == tt::tt_string))
  ------------------
  |  Branch (921:20): [True: 336k, False: 5.56M]
  |  Branch (921:43): [True: 30.5k, False: 5.53M]
  ------------------
  922|  5.90M|            ? Token(type, raw_val, raw_val, error_message)
  923|  5.90M|            : Token(type, val, raw_val, error_message);
  924|       |
  925|  5.90M|        reset();
  926|  5.90M|    }
  927|  5.90M|    return ready;
  928|  5.90M|}
_ZN13QPDFTokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbm:
  945|  2.70M|{
  946|  2.70M|    return m->readToken(input, context, allow_bad, max_len);
  947|  2.70M|}
_ZN4qpdf9Tokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbm:
  958|  5.90M|{
  959|  5.90M|    nextToken(input, context, max_len);
  960|       |
  961|  5.90M|    Token token;
  962|  5.90M|    bool unread_char;
  963|  5.90M|    char char_to_unread;
  964|  5.90M|    getToken(token, unread_char, char_to_unread);
  965|       |
  966|  5.90M|    if (token.getType() == tt::tt_bad) {
  ------------------
  |  Branch (966:9): [True: 313k, False: 5.59M]
  ------------------
  967|   313k|        if (allow_bad) {
  ------------------
  |  Branch (967:13): [True: 313k, False: 0]
  ------------------
  968|   313k|            QTC::TC("qpdf", "QPDFTokenizer allowing bad token");
  969|   313k|        } 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|   313k|    }
  978|  5.90M|    return token;
  979|  5.90M|}
_ZN4qpdf9Tokenizer9nextTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
  983|  41.8M|{
  984|  41.8M|    if (state != st_inline_image) {
  ------------------
  |  Branch (984:9): [True: 41.8M, False: 2.89k]
  ------------------
  985|  41.8M|        reset();
  986|  41.8M|    }
  987|  41.8M|    qpdf_offset_t offset = input.fastTell();
  988|       |
  989|   701M|    while (state != st_token_ready) {
  ------------------
  |  Branch (989:12): [True: 659M, False: 41.8M]
  ------------------
  990|   659M|        char ch;
  991|   659M|        if (!input.fastRead(ch)) {
  ------------------
  |  Branch (991:13): [True: 70.2k, False: 659M]
  ------------------
  992|  70.2k|            presentEOF();
  993|       |
  994|  70.2k|            if ((type == tt::tt_eof) && (!allow_eof)) {
  ------------------
  |  Branch (994:17): [True: 36.8k, False: 33.4k]
  |  Branch (994:41): [True: 102, False: 36.7k]
  ------------------
  995|       |                // Nothing in the qpdf library calls readToken without allowEOF anymore, so this
  996|       |                // case is not exercised.
  997|    102|                type = tt::tt_bad;
  998|    102|                error_message = "unexpected EOF";
  999|    102|                offset = input.getLastOffset();
 1000|    102|            }
 1001|   659M|        } else {
 1002|   659M|            handleCharacter(ch);
 1003|   659M|            if (before_token) {
  ------------------
  |  Branch (1003:17): [True: 37.5M, False: 622M]
  ------------------
 1004|  37.5M|                ++offset;
 1005|  37.5M|            }
 1006|   659M|            if (in_token) {
  ------------------
  |  Branch (1006:17): [True: 598M, False: 61.2M]
  ------------------
 1007|   598M|                raw_val += ch;
 1008|   598M|            }
 1009|   659M|            if (max_len && (raw_val.length() >= max_len) && (state != st_token_ready)) {
  ------------------
  |  Branch (1009:17): [True: 55.1M, False: 604M]
  |  Branch (1009:28): [True: 14.7M, False: 40.3M]
  |  Branch (1009:61): [True: 14.7M, False: 10.2k]
  ------------------
 1010|       |                // terminate this token now
 1011|  14.7M|                QTC::TC("qpdf", "QPDFTokenizer block long token");
 1012|  14.7M|                type = tt::tt_bad;
 1013|  14.7M|                state = st_token_ready;
 1014|  14.7M|                error_message = "exceeded allowable length while reading token";
 1015|  14.7M|            }
 1016|   659M|        }
 1017|   659M|    }
 1018|       |
 1019|  41.8M|    input.fastUnread(!in_token && !before_token);
  ------------------
  |  Branch (1019:22): [True: 23.8M, False: 18.0M]
  |  Branch (1019:35): [True: 23.7M, False: 37.7k]
  ------------------
 1020|       |
 1021|  41.8M|    if (type != tt::tt_eof) {
  ------------------
  |  Branch (1021:9): [True: 41.8M, False: 36.7k]
  ------------------
 1022|  41.8M|        input.setLastOffset(offset);
 1023|  41.8M|    }
 1024|       |
 1025|  41.8M|    return error_message.empty();
 1026|  41.8M|}
QPDFTokenizer.cc:_ZL12is_delimiterc:
   25|   373M|{
   26|   373M|    return (
   27|   373M|        ch == ' ' || ch == '\n' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (27:9): [True: 4.31M, False: 368M]
  |  Branch (27:22): [True: 1.12M, False: 367M]
  |  Branch (27:36): [True: 1.67M, False: 366M]
  |  Branch (27:49): [True: 129k, False: 365M]
  |  Branch (27:62): [True: 127k, False: 365M]
  |  Branch (27:75): [True: 14.2k, False: 365M]
  |  Branch (27:88): [True: 9.75k, False: 365M]
  ------------------
   28|   365M|        ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch == '\t' || ch == '\r' ||
  ------------------
  |  Branch (28:9): [True: 281k, False: 365M]
  |  Branch (28:22): [True: 107k, False: 365M]
  |  Branch (28:35): [True: 165k, False: 365M]
  |  Branch (28:48): [True: 124k, False: 365M]
  |  Branch (28:61): [True: 16.6k, False: 365M]
  |  Branch (28:74): [True: 15.7k, False: 365M]
  |  Branch (28:88): [True: 313k, False: 364M]
  ------------------
   29|   364M|        ch == '\v' || ch == '\f' || ch == 0);
  ------------------
  |  Branch (29:9): [True: 39.9k, False: 364M]
  |  Branch (29:23): [True: 108k, False: 364M]
  |  Branch (29:37): [True: 14.8M, False: 349M]
  ------------------
   30|   373M|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderC2ER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   38|  21.9k|            is(is),
   39|  21.9k|            str(str)
   40|  21.9k|        {
   41|  21.9k|        }
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinder5checkEv:
   53|   120k|{
   54|       |    // Find a word token matching the given string, preceded by a delimiter, and followed by a
   55|       |    // delimiter or EOF.
   56|   120k|    Tokenizer tokenizer;
   57|   120k|    tokenizer.nextToken(is, "finder", str.size() + 2);
   58|   120k|    qpdf_offset_t pos = is.tell();
   59|   120k|    if (tokenizer.getType() != tt::tt_word || tokenizer.getValue() != str) {
  ------------------
  |  Branch (59:9): [True: 97.6k, False: 23.1k]
  |  Branch (59:47): [True: 1.92k, False: 21.2k]
  ------------------
   60|  99.5k|        QTC::TC("qpdf", "QPDFTokenizer finder found wrong word");
   61|  99.5k|        return false;
   62|  99.5k|    }
   63|  21.2k|    qpdf_offset_t token_start = is.getLastOffset();
   64|  21.2k|    char next;
   65|  21.2k|    bool next_okay = false;
   66|  21.2k|    if (is.read(&next, 1) == 0) {
  ------------------
  |  Branch (66:9): [True: 11, False: 21.1k]
  ------------------
   67|     11|        QTC::TC("qpdf", "QPDFTokenizer inline image at EOF");
   68|     11|        next_okay = true;
   69|  21.1k|    } else {
   70|  21.1k|        next_okay = is_delimiter(next);
   71|  21.1k|    }
   72|  21.2k|    is.seek(pos, SEEK_SET);
   73|  21.2k|    if (!next_okay) {
  ------------------
  |  Branch (73:9): [True: 0, False: 21.2k]
  ------------------
   74|      0|        return false;
   75|      0|    }
   76|  21.2k|    if (token_start == 0) {
  ------------------
  |  Branch (76:9): [True: 0, False: 21.2k]
  ------------------
   77|       |        // Can't actually happen...we never start the search at the beginning of the input.
   78|      0|        return false;
   79|      0|    }
   80|  21.2k|    return true;
   81|  21.2k|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderD2Ev:
   42|  21.9k|        ~QPDFWordTokenFinder() override = default;

_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEEb:
   39|  32.2k|{
   40|  32.2k|    if (sparse) {
  ------------------
  |  Branch (40:9): [True: 359, False: 31.9k]
  ------------------
   41|    359|        sp = std::make_unique<Sparse>();
   42|  55.8k|        for (auto& item: v) {
  ------------------
  |  Branch (42:24): [True: 55.8k, False: 359]
  ------------------
   43|  55.8k|            if (item.raw_type_code() != ::ot_null || item.indirect()) {
  ------------------
  |  Branch (43:17): [True: 14.3k, False: 41.4k]
  |  Branch (43:54): [True: 204, False: 41.2k]
  ------------------
   44|  14.5k|                sp->elements[sp->size] = std::move(item);
   45|  14.5k|            }
   46|  55.8k|            ++sp->size;
   47|  55.8k|        }
   48|  31.9k|    } else {
   49|  31.9k|        elements = std::move(v);
   50|  31.9k|    }
   51|  32.2k|}
_ZNK4qpdf5Array5arrayEv:
   55|  58.1k|{
   56|  58.1k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (56:14): [True: 58.1k, False: 0]
  ------------------
   57|  58.1k|        return a;
   58|  58.1k|    }
   59|       |
   60|      0|    throw std::runtime_error("Expected an array but found a non-array object");
   61|      0|    return nullptr; // unreachable
   62|  58.1k|}
_ZN4qpdf5ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   65|  4.66k|    BaseHandle(QPDFObject::create<QPDF_Array>(items))
   66|  4.66k|{
   67|  4.66k|}
_ZN4qpdf5ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   70|  7.20k|    BaseHandle(QPDFObject::create<QPDF_Array>(std::move(items)))
   71|  7.20k|{
   72|  7.20k|}
_ZN4qpdf5Array5emptyEv:
   76|    848|{
   77|    848|    return Array(std::vector<QPDFObjectHandle>());
   78|    848|}
_ZN4qpdf5Array5beginEv:
   82|   166k|{
   83|   166k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (83:14): [True: 88.9k, False: 77.5k]
  ------------------
   84|  88.9k|        if (!a->sp) {
  ------------------
  |  Branch (84:13): [True: 88.6k, False: 311]
  ------------------
   85|  88.6k|            return a->elements.begin();
   86|  88.6k|        }
   87|    311|        if (!sp_elements) {
  ------------------
  |  Branch (87:13): [True: 311, False: 0]
  ------------------
   88|    311|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
   89|    311|        }
   90|    311|        return sp_elements->begin();
   91|  88.9k|    }
   92|  77.5k|    return {};
   93|   166k|}
_ZN4qpdf5Array3endEv:
   97|   166k|{
   98|   166k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (98:14): [True: 88.9k, False: 77.5k]
  ------------------
   99|  88.9k|        if (!a->sp) {
  ------------------
  |  Branch (99:13): [True: 88.6k, False: 311]
  ------------------
  100|  88.6k|            return a->elements.end();
  101|  88.6k|        }
  102|    311|        if (!sp_elements) {
  ------------------
  |  Branch (102:13): [True: 0, False: 311]
  ------------------
  103|      0|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
  104|      0|        }
  105|    311|        return sp_elements->end();
  106|  88.9k|    }
  107|  77.5k|    return {};
  108|   166k|}
_ZNK4qpdf5Array4sizeEv:
  178|   266k|{
  179|   266k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (179:14): [True: 219k, False: 47.4k]
  ------------------
  180|   219k|        return a->sp ? a->sp->size : a->elements.size();
  ------------------
  |  Branch (180:16): [True: 20.1k, False: 198k]
  ------------------
  181|   219k|    }
  182|  47.4k|    return 0;
  183|   266k|}
_ZNK4qpdf5ArrayixEm:
  187|   719k|{
  188|   719k|    static const QPDFObjectHandle null_obj;
  189|   719k|    auto a = as<QPDF_Array>();
  190|   719k|    if (!a) {
  ------------------
  |  Branch (190:9): [True: 1.32k, False: 718k]
  ------------------
  191|  1.32k|        return null_obj;
  192|  1.32k|    }
  193|   718k|    if (a->sp) {
  ------------------
  |  Branch (193:9): [True: 29.3k, False: 688k]
  ------------------
  194|  29.3k|        auto const& iter = a->sp->elements.find(n);
  195|  29.3k|        return iter == a->sp->elements.end() ? null_obj : iter->second;
  ------------------
  |  Branch (195:16): [True: 19.4k, False: 9.85k]
  ------------------
  196|  29.3k|    }
  197|   688k|    return n >= a->elements.size() ? null_obj : a->elements[n];
  ------------------
  |  Branch (197:12): [True: 1.44k, False: 687k]
  ------------------
  198|   718k|}
_ZNK4qpdf5ArrayixEi:
  202|   620k|{
  203|   620k|    static const QPDFObjectHandle null_obj;
  204|   620k|    if (n < 0) {
  ------------------
  |  Branch (204:9): [True: 2.10k, False: 618k]
  ------------------
  205|  2.10k|        return null_obj;
  206|  2.10k|    }
  207|   618k|    return (*this)[static_cast<size_t>(n)];
  208|   620k|}
_ZNK4qpdf5Array3getEm:
  212|     67|{
  213|     67|    if (n >= size()) {
  ------------------
  |  Branch (213:9): [True: 0, False: 67]
  ------------------
  214|      0|        return {};
  215|      0|    }
  216|     67|    auto a = array();
  217|     67|    if (!a->sp) {
  ------------------
  |  Branch (217:9): [True: 67, False: 0]
  ------------------
  218|     67|        return a->elements[n];
  219|     67|    }
  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|     67|}
_ZNK4qpdf5Array3getEi:
  226|     67|{
  227|     67|    if (n < 0) {
  ------------------
  |  Branch (227:9): [True: 0, False: 67]
  ------------------
  228|      0|        return {};
  229|      0|    }
  230|     67|    return get(to_s(n));
  231|     67|}
_ZNK4qpdf5Array11getAsVectorEv:
  235|  8.71k|{
  236|  8.71k|    auto a = array();
  237|  8.71k|    if (a->sp) {
  ------------------
  |  Branch (237:9): [True: 318, False: 8.39k]
  ------------------
  238|    318|        std::vector<QPDFObjectHandle> v;
  239|    318|        v.reserve(size());
  240|  3.15k|        for (auto const& item: a->sp->elements) {
  ------------------
  |  Branch (240:30): [True: 3.15k, False: 318]
  ------------------
  241|  3.15k|            v.resize(item.first, null_oh);
  242|  3.15k|            v.emplace_back(item.second);
  243|  3.15k|        }
  244|    318|        v.resize(size(), null_oh);
  245|    318|        return v;
  246|  8.39k|    } else {
  247|  8.39k|        return a->elements;
  248|  8.39k|    }
  249|  8.71k|}
_ZN4qpdf5Array3setEmRK16QPDFObjectHandle:
  253|     30|{
  254|     30|    if (at >= size()) {
  ------------------
  |  Branch (254:9): [True: 0, False: 30]
  ------------------
  255|      0|        return false;
  256|      0|    }
  257|     30|    auto a = array();
  258|     30|    checkOwnership(oh);
  259|     30|    if (a->sp) {
  ------------------
  |  Branch (259:9): [True: 0, False: 30]
  ------------------
  260|      0|        a->sp->elements[at] = oh;
  261|     30|    } else {
  262|     30|        a->elements[at] = oh;
  263|     30|    }
  264|     30|    return true;
  265|     30|}
_ZN4qpdf5Array3setEiRK16QPDFObjectHandle:
  269|     30|{
  270|     30|    if (at < 0) {
  ------------------
  |  Branch (270:9): [True: 0, False: 30]
  ------------------
  271|      0|        return false;
  272|      0|    }
  273|     30|    return set(to_s(at), oh);
  274|     30|}
_ZN4qpdf5Array6insertEmRK16QPDFObjectHandle:
  290|  11.0k|{
  291|  11.0k|    auto a = array();
  292|  11.0k|    size_t sz = size();
  293|  11.0k|    if (at > sz) {
  ------------------
  |  Branch (293:9): [True: 0, False: 11.0k]
  ------------------
  294|      0|        return false;
  295|      0|    }
  296|  11.0k|    checkOwnership(item);
  297|  11.0k|    if (at == sz) {
  ------------------
  |  Branch (297:9): [True: 11.0k, False: 0]
  ------------------
  298|       |        // As special case, also allow insert beyond the end
  299|  11.0k|        push_back(item);
  300|  11.0k|        return true;
  301|  11.0k|    }
  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|  11.0k|{
  325|  11.0k|    if (at_i < 0) {
  ------------------
  |  Branch (325:9): [True: 0, False: 11.0k]
  ------------------
  326|      0|        return false;
  327|      0|    }
  328|  11.0k|    return insert(to_s(at_i), item);
  329|  11.0k|}
_ZN4qpdf5Array9push_backERK16QPDFObjectHandle:
  333|  32.3k|{
  334|  32.3k|    auto a = array();
  335|  32.3k|    checkOwnership(item);
  336|  32.3k|    if (a->sp) {
  ------------------
  |  Branch (336:9): [True: 138, False: 32.1k]
  ------------------
  337|    138|        a->sp->elements[(a->sp->size)++] = item;
  338|  32.1k|    } else {
  339|  32.1k|        a->elements.emplace_back(item);
  340|  32.1k|    }
  341|  32.3k|}
_ZN4qpdf5Array5eraseEm:
  345|  5.98k|{
  346|  5.98k|    auto a = array();
  347|  5.98k|    if (at >= size()) {
  ------------------
  |  Branch (347:9): [True: 0, False: 5.98k]
  ------------------
  348|      0|        return false;
  349|      0|    }
  350|  5.98k|    if (!a->sp) {
  ------------------
  |  Branch (350:9): [True: 5.98k, False: 0]
  ------------------
  351|  5.98k|        a->elements.erase(a->elements.cbegin() + to_i(at));
  352|  5.98k|        return true;
  353|  5.98k|    }
  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.98k|}
_ZN4qpdf5Array5eraseEi:
  373|  5.98k|{
  374|  5.98k|    if (at_i < 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 5.98k]
  ------------------
  375|      0|        return false;
  376|      0|    }
  377|  5.98k|    return erase(to_s(at_i));
  378|  5.98k|}
_ZNK16QPDFObjectHandle14getArrayNItemsEv:
  382|   264k|{
  383|   264k|    auto s = size();
  384|   264k|    if (s > 1 || isArray()) {
  ------------------
  |  Branch (384:9): [True: 263k, False: 798]
  |  Branch (384:18): [True: 798, False: 0]
  ------------------
  385|   264k|        return to_i(s);
  386|   264k|    }
  387|      0|    typeWarning("array", "treating as empty");
  388|      0|    return 0;
  389|   264k|}
_ZNK16QPDFObjectHandle12getArrayItemEi:
  393|   272k|{
  394|   272k|    if (auto array = Array(*this)) {
  ------------------
  |  Branch (394:14): [True: 272k, False: 0]
  ------------------
  395|   272k|        if (auto result = array[n]) {
  ------------------
  |  Branch (395:18): [True: 253k, False: 19.2k]
  ------------------
  396|   253k|            return result;
  397|   253k|        }
  398|  19.2k|        if (n >= 0 && std::cmp_less(n, array.size())) {
  ------------------
  |  Branch (398:13): [True: 19.2k, False: 0]
  |  Branch (398:23): [True: 19.2k, False: 0]
  ------------------
  399|       |            // sparse array null
  400|  19.2k|            return newNull();
  401|  19.2k|        }
  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|   272k|}
_ZNK16QPDFObjectHandle11isRectangleEv:
  412|  59.4k|{
  413|  59.4k|    Array array(*this);
  414|   155k|    for (auto const& oh: array) {
  ------------------
  |  Branch (414:24): [True: 155k, False: 58.2k]
  ------------------
  415|   155k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (415:13): [True: 1.21k, False: 154k]
  ------------------
  416|  1.21k|            return false;
  417|  1.21k|        }
  418|   155k|    }
  419|  58.2k|    return array.size() == 4;
  420|  59.4k|}
_ZNK16QPDFObjectHandle8isMatrixEv:
  424|  6.63k|{
  425|  6.63k|    Array array(*this);
  426|  6.63k|    for (auto const& oh: array) {
  ------------------
  |  Branch (426:24): [True: 2.06k, False: 6.59k]
  ------------------
  427|  2.06k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (427:13): [True: 43, False: 2.01k]
  ------------------
  428|     43|            return false;
  429|     43|        }
  430|  2.06k|    }
  431|  6.59k|    return array.size() == 6;
  432|  6.63k|}
_ZNK16QPDFObjectHandle19getArrayAsRectangleEv:
  436|  24.7k|{
  437|  24.7k|    Array array(*this);
  438|  24.7k|    if (array.size() != 4) {
  ------------------
  |  Branch (438:9): [True: 1.17k, False: 23.5k]
  ------------------
  439|  1.17k|        return {};
  440|  1.17k|    }
  441|  23.5k|    std::array<double, 4> items;
  442|   117k|    for (size_t i = 0; i < 4; ++i) {
  ------------------
  |  Branch (442:24): [True: 94.1k, False: 23.4k]
  ------------------
  443|  94.1k|        if (!array[i].getValueAsNumber(items[i])) {
  ------------------
  |  Branch (443:13): [True: 145, False: 94.0k]
  ------------------
  444|    145|            return {};
  445|    145|        }
  446|  94.1k|    }
  447|  23.4k|    return {
  448|  23.4k|        std::min(items[0], items[2]),
  449|  23.4k|        std::min(items[1], items[3]),
  450|  23.4k|        std::max(items[0], items[2]),
  451|  23.4k|        std::max(items[1], items[3])};
  452|  23.5k|}
_ZNK16QPDFObjectHandle16getArrayAsMatrixEv:
  456|    316|{
  457|    316|    Array array(*this);
  458|    316|    if (array.size() != 6) {
  ------------------
  |  Branch (458:9): [True: 0, False: 316]
  ------------------
  459|      0|        return {};
  460|      0|    }
  461|    316|    std::array<double, 6> items;
  462|  2.21k|    for (size_t i = 0; i < 6; ++i) {
  ------------------
  |  Branch (462:24): [True: 1.89k, False: 316]
  ------------------
  463|  1.89k|        if (!array[i].getValueAsNumber(items[i])) {
  ------------------
  |  Branch (463:13): [True: 0, False: 1.89k]
  ------------------
  464|      0|            return {};
  465|      0|        }
  466|  1.89k|    }
  467|    316|    return {items[0], items[1], items[2], items[3], items[4], items[5]};
  468|    316|}
_ZNK16QPDFObjectHandle16getArrayAsVectorEv:
  472|  8.40k|{
  473|  8.40k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (473:14): [True: 8.40k, False: 0]
  ------------------
  474|  8.40k|        return array.getAsVector();
  475|  8.40k|    }
  476|      0|    typeWarning("array", "treating as empty");
  477|      0|    QTC::TC("qpdf", "QPDFObjectHandle array treating as empty vector");
  478|      0|    return {};
  479|  8.40k|}
_ZN16QPDFObjectHandle10appendItemERKS_:
  526|  15.2k|{
  527|  15.2k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (527:14): [True: 15.2k, False: 0]
  ------------------
  528|  15.2k|        array.push_back(item);
  529|  15.2k|    } else {
  530|      0|        typeWarning("array", "ignoring attempt to append item");
  531|      0|        QTC::TC("qpdf", "QPDFObjectHandle array ignoring append item");
  532|      0|    }
  533|  15.2k|}
_ZNK4qpdf10BaseHandle4sizeEv:
  566|   303k|{
  567|   303k|    switch (resolved_type_code()) {
  568|   279k|    case ::ot_array:
  ------------------
  |  Branch (568:5): [True: 279k, False: 24.9k]
  ------------------
  569|   279k|        return as<QPDF_Array>()->size();
  570|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (570:5): [True: 0, False: 303k]
  ------------------
  571|      0|    case ::ot_reserved:
  ------------------
  |  Branch (571:5): [True: 0, False: 303k]
  ------------------
  572|  9.61k|    case ::ot_null:
  ------------------
  |  Branch (572:5): [True: 9.61k, False: 294k]
  ------------------
  573|  9.61k|    case ::ot_destroyed:
  ------------------
  |  Branch (573:5): [True: 0, False: 303k]
  ------------------
  574|  9.61k|    case ::ot_unresolved:
  ------------------
  |  Branch (574:5): [True: 0, False: 303k]
  ------------------
  575|  9.61k|    case ::ot_reference:
  ------------------
  |  Branch (575:5): [True: 0, False: 303k]
  ------------------
  576|  9.61k|        return 0;
  577|    239|    case ::ot_boolean:
  ------------------
  |  Branch (577:5): [True: 239, False: 303k]
  ------------------
  578|  1.52k|    case ::ot_integer:
  ------------------
  |  Branch (578:5): [True: 1.28k, False: 302k]
  ------------------
  579|  1.92k|    case ::ot_real:
  ------------------
  |  Branch (579:5): [True: 396, False: 303k]
  ------------------
  580|  1.94k|    case ::ot_string:
  ------------------
  |  Branch (580:5): [True: 23, False: 303k]
  ------------------
  581|  14.5k|    case ::ot_name:
  ------------------
  |  Branch (581:5): [True: 12.6k, False: 291k]
  ------------------
  582|  15.1k|    case ::ot_dictionary:
  ------------------
  |  Branch (582:5): [True: 528, False: 303k]
  ------------------
  583|  15.3k|    case ::ot_stream:
  ------------------
  |  Branch (583:5): [True: 200, False: 303k]
  ------------------
  584|  15.3k|    case ::ot_inlineimage:
  ------------------
  |  Branch (584:5): [True: 0, False: 303k]
  ------------------
  585|  15.3k|    case ::ot_operator:
  ------------------
  |  Branch (585:5): [True: 0, False: 303k]
  ------------------
  586|  15.3k|        return 1;
  587|      0|    default:
  ------------------
  |  Branch (587:5): [True: 0, False: 303k]
  ------------------
  588|      0|        throw std::logic_error("Unexpected type code in size"); // unreachable
  589|      0|        return 0;                                               // unreachable
  590|   303k|    }
  591|   303k|}
_ZNK4qpdf10BaseHandleixEm:
  595|  1.99k|{
  596|  1.99k|    if (resolved_type_code() == ::ot_array) {
  ------------------
  |  Branch (596:9): [True: 1.99k, False: 0]
  ------------------
  597|  1.99k|        return Array(obj)[n];
  598|  1.99k|    }
  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|  1.99k|{
  608|  1.99k|    if (n < 0) {
  ------------------
  |  Branch (608:9): [True: 0, False: 1.99k]
  ------------------
  609|      0|        return {};
  610|      0|    }
  611|  1.99k|    return (*this)[static_cast<size_t>(n)];
  612|  1.99k|}
QPDF_Array.cc:_ZL4to_si:
   15|  17.1k|{
   16|  17.1k|    return static_cast<size_t>(n);
   17|  17.1k|}
_ZNK4qpdf5Array14checkOwnershipERK16QPDFObjectHandle:
   27|  43.3k|{
   28|  43.3k|    if (!item) {
  ------------------
  |  Branch (28:9): [True: 0, False: 43.3k]
  ------------------
   29|      0|        throw std::logic_error("Attempting to add an uninitialized object to a QPDF_Array.");
   30|      0|    }
   31|  43.3k|    if (qpdf() && item.qpdf() && qpdf() != item.qpdf()) {
  ------------------
  |  Branch (31:9): [True: 677, False: 42.7k]
  |  Branch (31:19): [True: 591, False: 86]
  |  Branch (31:34): [True: 0, False: 591]
  ------------------
   32|      0|        throw std::logic_error(
   33|      0|            "Attempting to add an object from a different QPDF. Use "
   34|      0|            "QPDF::copyForeignObject to add objects from another file.");
   35|      0|    }
   36|  43.3k|}
QPDF_Array.cc:_ZL4to_im:
   21|   270k|{
   22|   270k|    return static_cast<int>(n);
   23|   270k|}

_ZNK4qpdf14BaseDictionary4dictEv:
   12|  10.5k|{
   13|  10.5k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (13:14): [True: 10.5k, False: 0]
  ------------------
   14|  10.5k|        return d;
   15|  10.5k|    }
   16|      0|    throw std::runtime_error("Expected a dictionary but found a non-dictionary object");
   17|      0|    return nullptr; // unreachable
   18|  10.5k|}
_ZNK4qpdf10BaseHandleixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   22|  1.96M|{
   23|  1.96M|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (23:14): [True: 1.91M, False: 41.7k]
  ------------------
   24|  1.91M|        auto it = d->items.find(key);
   25|  1.91M|        if (it != d->items.end()) {
  ------------------
  |  Branch (25:13): [True: 1.28M, False: 633k]
  ------------------
   26|  1.28M|            return it->second;
   27|  1.28M|        }
   28|  1.91M|    }
   29|   675k|    static const QPDFObjectHandle null_obj;
   30|   675k|    return null_obj;
   31|  1.96M|}
_ZNK4qpdf10BaseHandle8containsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   63|   186k|{
   64|   186k|    return !(*this)[key].null();
   65|   186k|}
_ZN4qpdf14BaseDictionary7getKeysEv:
   99|  10.5k|{
  100|  10.5k|    std::set<std::string> result;
  101|  39.2k|    for (auto& iter: dict()->items) {
  ------------------
  |  Branch (101:20): [True: 39.2k, False: 10.5k]
  ------------------
  102|  39.2k|        if (!iter.second.null()) {
  ------------------
  |  Branch (102:13): [True: 35.9k, False: 3.33k]
  ------------------
  103|  35.9k|            result.insert(iter.first);
  104|  35.9k|        }
  105|  39.2k|    }
  106|  10.5k|    return result;
  107|  10.5k|}
_ZN4qpdf10BaseHandle5eraseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  117|  22.5k|{
  118|       |    // no-op if key does not exist
  119|  22.5k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (119:14): [True: 22.5k, False: 0]
  ------------------
  120|  22.5k|        return d->items.erase(key);
  121|  22.5k|    }
  122|      0|    return 0;
  123|  22.5k|}
_ZN4qpdf10BaseHandle7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  140|   197k|{
  141|   197k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (141:14): [True: 196k, False: 222]
  ------------------
  142|   196k|        if (value.null() && !value.indirect()) {
  ------------------
  |  Branch (142:13): [True: 48.6k, False: 148k]
  |  Branch (142:29): [True: 44.9k, False: 3.70k]
  ------------------
  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.9k|            d->items.erase(key);
  147|   151k|        } else {
  148|       |            // add or replace value
  149|   151k|            d->items[key] = value;
  150|   151k|        }
  151|   196k|        return true;
  152|   196k|    }
  153|    222|    return false;
  154|   197k|}
_ZN4qpdf14BaseDictionary7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  172|   190k|{
  173|   190k|    if (!BaseHandle::replace(key, value)) {
  ------------------
  |  Branch (173:9): [True: 0, False: 190k]
  ------------------
  174|      0|        (void)dict();
  175|      0|    }
  176|   190k|}
_ZN4qpdf10DictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  179|  44.5k|    BaseDictionary(std::move(dict))
  180|  44.5k|{
  181|  44.5k|}
_ZN4qpdf10DictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  184|   260k|    BaseDictionary(obj)
  185|   260k|{
  186|   260k|}
_ZN4qpdf10Dictionary5emptyEv:
  190|  17.5k|{
  191|  17.5k|    return Dictionary(std::map<std::string, QPDFObjectHandle>());
  192|  17.5k|}
_ZNK16QPDFObjectHandle14checkOwnershipERKS_:
  196|   161k|{
  197|   161k|    auto qpdf = getOwningQPDF();
  198|   161k|    auto item_qpdf = item.getOwningQPDF();
  199|   161k|    if (qpdf && item_qpdf && qpdf != item_qpdf) {
  ------------------
  |  Branch (199:9): [True: 116k, False: 45.8k]
  |  Branch (199:17): [True: 31.8k, False: 84.2k]
  |  Branch (199:30): [True: 0, False: 31.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|   161k|}
_ZNK16QPDFObjectHandle6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  208|   131k|{
  209|   131k|    if (Dictionary dict = *this) {
  ------------------
  |  Branch (209:20): [True: 130k, False: 269]
  ------------------
  210|   130k|        return dict.contains(key);
  211|   130k|    } else {
  212|    269|        typeWarning("dictionary", "returning false for a key containment request");
  213|    269|        QTC::TC("qpdf", "QPDFObjectHandle dictionary false for hasKey");
  214|    269|        return false;
  215|    269|    }
  216|   131k|}
_ZNK16QPDFObjectHandle6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  220|   739k|{
  221|   739k|    if (auto result = get(key)) {
  ------------------
  |  Branch (221:14): [True: 453k, False: 286k]
  ------------------
  222|   453k|        return result;
  223|   453k|    }
  224|   286k|    if (isDictionary()) {
  ------------------
  |  Branch (224:9): [True: 286k, False: 305]
  ------------------
  225|   286k|        static auto constexpr msg = " -> dictionary key $VD"sv;
  226|   286k|        return QPDF_Null::create(obj, msg, key);
  227|   286k|    }
  228|    305|    typeWarning("dictionary", "returning null for attempted key retrieval");
  229|    305|    static auto constexpr msg = " -> null returned from getting key $VD from non-Dictionary"sv;
  230|    305|    return QPDF_Null::create(obj, msg, "");
  231|   286k|}
_ZNK16QPDFObjectHandle12getKeyIfDictERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  235|  20.5k|{
  236|  20.5k|    return isNull() ? newNull() : getKey(key);
  ------------------
  |  Branch (236:12): [True: 234, False: 20.2k]
  ------------------
  237|  20.5k|}
_ZNK16QPDFObjectHandle7getKeysEv:
  241|  10.6k|{
  242|  10.6k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (242:14): [True: 10.5k, False: 85]
  ------------------
  243|  10.5k|        return dict.getKeys();
  244|  10.5k|    }
  245|     85|    typeWarning("dictionary", "treating as empty");
  246|     85|    QTC::TC("qpdf", "QPDFObjectHandle dictionary empty set for getKeys");
  247|     85|    return {};
  248|  10.6k|}
_ZN16QPDFObjectHandle10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  263|   170k|{
  264|   170k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (264:14): [True: 161k, False: 8.62k]
  ------------------
  265|   161k|        checkOwnership(value);
  266|   161k|        dict.replace(key, value);
  267|   161k|        return;
  268|   161k|    }
  269|  8.62k|    typeWarning("dictionary", "ignoring key replacement request");
  270|  8.62k|}
_ZN16QPDFObjectHandle19replaceKeyAndGetNewERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  274|  8.88k|{
  275|  8.88k|    replaceKey(key, value);
  276|  8.88k|    return value;
  277|  8.88k|}
_ZN16QPDFObjectHandle9removeKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  289|  17.2k|{
  290|  17.2k|    if (erase(key) || isDictionary()) {
  ------------------
  |  Branch (290:9): [True: 8.00k, False: 9.26k]
  |  Branch (290:23): [True: 9.26k, False: 0]
  ------------------
  291|  17.2k|        return;
  292|  17.2k|    }
  293|      0|    typeWarning("dictionary", "ignoring key removal request");
  294|      0|}

_ZN4QPDF3Doc7Objects7StreamsC2ERNS0_6CommonE:
  126|  21.7k|    Common(common),
  127|  21.7k|    copier_(std::make_shared<Copier>(*this))
  128|  21.7k|{
  129|  21.7k|}
_ZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  225|  38.8k|{
  226|  38.8k|    if (filter_factories_registered) [[unlikely]] {
  ------------------
  |  Branch (226:9): [True: 0, False: 38.8k]
  ------------------
  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|  38.8k|    if (name == "/FlateDecode") {
  ------------------
  |  Branch (235:9): [True: 5.03k, False: 33.8k]
  ------------------
  236|  5.03k|        return SF_FlateLzwDecode::flate_factory;
  237|  5.03k|    }
  238|  33.8k|    if (name == "/Crypt") {
  ------------------
  |  Branch (238:9): [True: 2.39k, False: 31.4k]
  ------------------
  239|  2.39k|        return []() { return std::make_shared<SF_Crypt>(); };
  240|  2.39k|    }
  241|  31.4k|    if (name == "/LZWDecode") {
  ------------------
  |  Branch (241:9): [True: 218, False: 31.2k]
  ------------------
  242|    218|        return SF_FlateLzwDecode::lzw_factory;
  243|    218|    }
  244|  31.2k|    if (name == "/RunLengthDecode") {
  ------------------
  |  Branch (244:9): [True: 43, False: 31.1k]
  ------------------
  245|     43|        return SF_RunLengthDecode::factory;
  246|     43|    }
  247|  31.1k|    if (name == "/DCTDecode") {
  ------------------
  |  Branch (247:9): [True: 264, False: 30.8k]
  ------------------
  248|    264|        return SF_DCTDecode::factory;
  249|    264|    }
  250|  30.8k|    if (name == "/ASCII85Decode") {
  ------------------
  |  Branch (250:9): [True: 3.35k, False: 27.5k]
  ------------------
  251|  3.35k|        return SF_ASCII85Decode::factory;
  252|  3.35k|    }
  253|  27.5k|    if (name == "/ASCIIHexDecode") {
  ------------------
  |  Branch (253:9): [True: 60, False: 27.4k]
  ------------------
  254|     60|        return SF_ASCIIHexDecode::factory;
  255|     60|    }
  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|  27.4k|    if (name == "/Fl") {
  ------------------
  |  Branch (260:9): [True: 13.0k, False: 14.4k]
  ------------------
  261|  13.0k|        return SF_FlateLzwDecode::flate_factory;
  262|  13.0k|    }
  263|  14.4k|    if (name == "/AHx") {
  ------------------
  |  Branch (263:9): [True: 523, False: 13.9k]
  ------------------
  264|    523|        return SF_ASCIIHexDecode::factory;
  265|    523|    }
  266|  13.9k|    if (name == "/A85") {
  ------------------
  |  Branch (266:9): [True: 118, False: 13.8k]
  ------------------
  267|    118|        return SF_ASCII85Decode::factory;
  268|    118|    }
  269|  13.8k|    if (name == "/LZW") {
  ------------------
  |  Branch (269:9): [True: 3.58k, False: 10.2k]
  ------------------
  270|  3.58k|        return SF_FlateLzwDecode::lzw_factory;
  271|  3.58k|    }
  272|  10.2k|    if (name == "/RL") {
  ------------------
  |  Branch (272:9): [True: 9.80k, False: 414]
  ------------------
  273|  9.80k|        return SF_RunLengthDecode::factory;
  274|  9.80k|    }
  275|    414|    if (name == "/DCT") {
  ------------------
  |  Branch (275:9): [True: 55, False: 359]
  ------------------
  276|     55|        return SF_DCTDecode::factory;
  277|     55|    }
  278|    359|    return nullptr;
  279|    414|}
_ZN4qpdf6StreamC2ER4QPDF10QPDFObjGen16QPDFObjectHandlexm:
  283|  40.9k|    BaseHandle(QPDFObject::create<QPDF_Stream>(&qpdf, og, std::move(stream_dict), length))
  284|  40.9k|{
  285|  40.9k|    auto descr = std::make_shared<QPDFObject::Description>(
  286|  40.9k|        qpdf.getFilename() + ", stream object " + og.unparse(' '));
  287|  40.9k|    obj->setDescription(&qpdf, descr, offset);
  288|  40.9k|    setDictDescription();
  289|  40.9k|}
_ZN4qpdf6Stream4copyEv:
  293|    452|{
  294|    452|    Stream result = qpdf()->newStream();
  295|    452|    result.stream()->stream_dict = getDict().copy();
  296|    452|    copy_data_to(result);
  297|    452|    return result;
  298|    452|}
_ZN4qpdf6Stream12copy_data_toERS0_:
  302|    450|{
  303|    450|    qpdf_expect(dest);
  ------------------
  |  |   13|    450|#define qpdf_expect assert
  ------------------
  |  Branch (303:5): [True: 450, False: 0]
  ------------------
  304|    450|    auto s = stream();
  305|    450|    auto& d_streams = dest.qpdf()->doc().objects().streams();
  306|       |
  307|    450|    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|    450|    if (qpdf()->doc().config().immediate_copy_from() && !s->stream_data) {
  ------------------
  |  Branch (311:9): [True: 0, False: 450]
  |  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|    450|    if (s->stream_data) {
  ------------------
  |  Branch (318:9): [True: 11, False: 439]
  ------------------
  319|     11|        dest.replaceStreamData(s->stream_data, dict["/Filter"], dict["/DecodeParms"]);
  320|    439|    } else {
  321|    439|        d_streams.copier()->register_copy(dest, *this, s->stream_provider.get());
  322|    439|        dest.replaceStreamData(d_streams.copier(), dict["/Filter"], dict["/DecodeParms"]);
  323|    439|    }
  324|    450|}
_ZN4qpdf6Stream18setDictDescriptionEv:
  451|  44.6k|{
  452|  44.6k|    auto s = stream();
  453|  44.6k|    if (!s->stream_dict.hasObjectDescription()) {
  ------------------
  |  Branch (453:9): [True: 17.5k, False: 27.0k]
  ------------------
  454|  17.5k|        s->stream_dict.setObjectDescription(
  455|  17.5k|            obj->getQPDF(), obj->getDescription() + " -> stream dictionary");
  456|  17.5k|    }
  457|  44.6k|}
_ZN4qpdf6Stream13getStreamDataE26qpdf_stream_decode_level_e:
  461|  16.1k|{
  462|  16.1k|    std::string result;
  463|  16.1k|    pl::String buf(result);
  464|  16.1k|    bool filtered;
  465|  16.1k|    pipeStreamData(&buf, &filtered, 0, decode_level, false, false);
  466|  16.1k|    if (!filtered) {
  ------------------
  |  Branch (466:9): [True: 1.96k, False: 14.2k]
  ------------------
  467|  1.96k|        throw QPDFExc(
  468|  1.96k|            qpdf_e_unsupported,
  469|  1.96k|            qpdf()->getFilename(),
  470|  1.96k|            "",
  471|  1.96k|            offset(),
  472|  1.96k|            "getStreamData called on unfilterable stream");
  473|  1.96k|    }
  474|  14.2k|    return result;
  475|  16.1k|}
_ZNK4qpdf6Stream14isRootMetadataEv:
  495|  21.1k|{
  496|  21.1k|    if (!stream()->stream_dict.isDictionaryOfType("/Metadata", "/XML")) {
  ------------------
  |  Branch (496:9): [True: 21.1k, False: 25]
  ------------------
  497|  21.1k|        return false;
  498|  21.1k|    }
  499|     25|    return qpdf()->getRoot()["/Metadata"].isSameObjectAs(obj);
  500|  21.1k|}
_ZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEE:
  506|  36.7k|{
  507|  36.7k|    auto s = stream();
  508|       |    // Check filters
  509|       |
  510|  36.7k|    auto const& filter_obj = s->stream_dict["/Filter"];
  511|       |
  512|  36.7k|    if (filter_obj.null()) {
  ------------------
  |  Branch (512:9): [True: 22.1k, False: 14.5k]
  ------------------
  513|       |        // No filters
  514|  22.1k|        return true;
  515|  22.1k|    }
  516|  14.5k|    if (filter_obj.size() > global::Limits::max_stream_filters()) {
  ------------------
  |  Branch (516:9): [True: 28, False: 14.5k]
  ------------------
  517|     28|        global::Limits::error();
  518|     28|        warn(
  519|     28|            "limits error(max-stream-filters): too many filters for stream; treating stream as "
  520|     28|            "not filterable");
  521|     28|        return false;
  522|     28|    }
  523|  14.5k|    if (filter_obj.isName()) {
  ------------------
  |  Branch (523:9): [True: 10.1k, False: 4.35k]
  ------------------
  524|       |        // One filter
  525|  10.1k|        auto ff = s->filter_factory(filter_obj.getName());
  526|  10.1k|        if (!ff) {
  ------------------
  |  Branch (526:13): [True: 156, False: 10.0k]
  ------------------
  527|    156|            return false;
  528|    156|        }
  529|  10.0k|        filters.emplace_back(ff());
  530|  10.0k|    } else if (Array array = filter_obj) {
  ------------------
  |  Branch (530:22): [True: 4.33k, False: 18]
  ------------------
  531|       |        // Potentially multiple filters
  532|  28.6k|        for (Name item: array) {
  ------------------
  |  Branch (532:23): [True: 28.6k, False: 4.10k]
  ------------------
  533|  28.6k|            if (!item) {
  ------------------
  |  Branch (533:17): [True: 25, False: 28.6k]
  ------------------
  534|     25|                warn("stream filter type is not name or array");
  535|     25|                return false;
  536|     25|            }
  537|  28.6k|            auto ff = s->filter_factory(item);
  538|  28.6k|            if (!ff) {
  ------------------
  |  Branch (538:17): [True: 203, False: 28.4k]
  ------------------
  539|    203|                filters.clear();
  540|    203|                return false;
  541|    203|            }
  542|  28.4k|            filters.emplace_back(ff());
  543|  28.4k|        }
  544|  4.33k|    } else {
  545|     18|        warn("stream filter type is not name or array");
  546|     18|        return false;
  547|     18|    }
  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|  14.1k|    auto decode_obj = s->stream_dict.getKey("/DecodeParms");
  553|       |
  554|  14.1k|    auto can_filter = // linebreak
  555|  14.1k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  14.1k|        if (!filter.setDecodeParms(d_obj) ||
  557|  14.1k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  558|  14.1k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  559|  14.1k|            return false;
  560|  14.1k|        }
  561|  14.1k|        return true;
  562|  14.1k|    };
  563|       |
  564|  14.1k|    auto decode_array = decode_obj.as_array(strict);
  565|  14.1k|    if (!decode_array || decode_array.size() == 0) {
  ------------------
  |  Branch (565:9): [True: 14.0k, False: 83]
  |  Branch (565:26): [True: 10, False: 73]
  ------------------
  566|  14.0k|        if (decode_array) {
  ------------------
  |  Branch (566:13): [True: 10, False: 14.0k]
  ------------------
  567|     10|            decode_obj = QPDFObjectHandle::newNull();
  568|     10|        }
  569|       |
  570|  37.2k|        for (auto& filter: filters) {
  ------------------
  |  Branch (570:26): [True: 37.2k, False: 13.8k]
  ------------------
  571|  37.2k|            if (!can_filter(decode_level, *filter, decode_obj)) {
  ------------------
  |  Branch (571:17): [True: 273, False: 36.9k]
  ------------------
  572|    273|                return false;
  573|    273|            }
  574|  37.2k|        }
  575|  14.0k|    } 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|     73|        if (!filters.empty() && QIntC::to_size(decode_array.size()) != filters.size()) {
  ------------------
  |  Branch (578:13): [True: 67, False: 6]
  |  Branch (578:13): [True: 21, False: 52]
  |  Branch (578:33): [True: 21, False: 46]
  ------------------
  579|     21|            warn("stream /DecodeParms length is inconsistent with filters");
  580|     21|            return false;
  581|     21|        }
  582|       |
  583|     52|        int i = -1;
  584|     67|        for (auto& filter: filters) {
  ------------------
  |  Branch (584:26): [True: 67, False: 42]
  ------------------
  585|     67|            auto d_obj = decode_array.get(++i);
  586|     67|            if (!can_filter(decode_level, *filter, d_obj)) {
  ------------------
  |  Branch (586:17): [True: 10, False: 57]
  ------------------
  587|     10|                return false;
  588|     10|            }
  589|     67|        }
  590|     52|    }
  591|       |
  592|  13.8k|    return true;
  593|  14.1k|}
_ZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebb:
  603|  36.7k|{
  604|  36.7k|    auto s = stream();
  605|  36.7k|    std::vector<std::shared_ptr<QPDFStreamFilter>> filters;
  606|  36.7k|    bool ignored;
  607|  36.7k|    if (!filterp) {
  ------------------
  |  Branch (607:9): [True: 0, False: 36.7k]
  ------------------
  608|      0|        filterp = &ignored;
  609|      0|    }
  610|  36.7k|    bool& filter = *filterp;
  611|       |
  612|  36.7k|    const bool empty_stream = !s->stream_provider && !s->stream_data && s->length == 0;
  ------------------
  |  Branch (612:31): [True: 32.7k, False: 3.99k]
  |  Branch (612:54): [True: 20.8k, False: 11.9k]
  |  Branch (612:73): [True: 3.62k, False: 17.1k]
  ------------------
  613|  36.7k|    const bool empty_stream_data = s->stream_data && s->stream_data->getSize() == 0;
  ------------------
  |  Branch (613:36): [True: 11.9k, False: 24.7k]
  |  Branch (613:54): [True: 366, False: 11.5k]
  ------------------
  614|  36.7k|    const bool empty = empty_stream || empty_stream_data;
  ------------------
  |  Branch (614:24): [True: 3.62k, False: 33.0k]
  |  Branch (614:40): [True: 366, False: 32.7k]
  ------------------
  615|       |
  616|  36.7k|    if (empty_stream || empty_stream_data) {
  ------------------
  |  Branch (616:9): [True: 3.62k, False: 33.0k]
  |  Branch (616:25): [True: 366, False: 32.7k]
  ------------------
  617|  3.99k|        filter = true;
  618|  3.99k|    }
  619|       |
  620|  36.7k|    filter = empty || encode_flags || decode_level != qpdf_dl_none;
  ------------------
  |  Branch (620:14): [True: 3.99k, False: 32.7k]
  |  Branch (620:23): [True: 0, False: 32.7k]
  |  Branch (620:39): [True: 32.7k, False: 0]
  ------------------
  621|  36.7k|    if (filter) {
  ------------------
  |  Branch (621:9): [True: 36.7k, False: 0]
  ------------------
  622|  36.7k|        filter = filterable(decode_level, filters);
  623|  36.7k|    }
  624|       |
  625|  36.7k|    if (!pipeline) {
  ------------------
  |  Branch (625:9): [True: 0, False: 36.7k]
  ------------------
  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|  36.7k|    std::vector<std::unique_ptr<Pipeline>> to_delete;
  635|       |
  636|  36.7k|    ContentNormalizer normalizer;
  637|  36.7k|    if (filter) {
  ------------------
  |  Branch (637:9): [True: 35.9k, False: 736]
  ------------------
  638|  35.9k|        if (encode_flags & qpdf_ef_compress) {
  ------------------
  |  Branch (638:13): [True: 0, False: 35.9k]
  ------------------
  639|      0|            auto new_pipeline =
  640|      0|                std::make_unique<Pl_Flate>("compress stream", pipeline, Pl_Flate::a_deflate);
  641|      0|            pipeline = new_pipeline.get();
  642|      0|            to_delete.push_back(std::move(new_pipeline));
  643|      0|        }
  644|       |
  645|  35.9k|        if (encode_flags & qpdf_ef_normalize) {
  ------------------
  |  Branch (645:13): [True: 0, False: 35.9k]
  ------------------
  646|      0|            auto new_pipeline =
  647|      0|                std::make_unique<Pl_QPDFTokenizer>("normalizer", &normalizer, pipeline);
  648|      0|            pipeline = new_pipeline.get();
  649|      0|            to_delete.push_back(std::move(new_pipeline));
  650|      0|        }
  651|       |
  652|  35.9k|        for (auto iter = s->token_filters.rbegin(); iter != s->token_filters.rend(); ++iter) {
  ------------------
  |  Branch (652:53): [True: 0, False: 35.9k]
  ------------------
  653|      0|            auto new_pipeline =
  654|      0|                std::make_unique<Pl_QPDFTokenizer>("token filter", (*iter).get(), pipeline);
  655|      0|            pipeline = new_pipeline.get();
  656|      0|            to_delete.push_back(std::move(new_pipeline));
  657|      0|        }
  658|       |
  659|  73.0k|        for (auto f_iter = filters.rbegin(); f_iter != filters.rend(); ++f_iter) {
  ------------------
  |  Branch (659:46): [True: 37.0k, False: 35.9k]
  ------------------
  660|  37.0k|            if (auto decode_pipeline = (*f_iter)->getDecodePipeline(pipeline)) {
  ------------------
  |  Branch (660:22): [True: 34.8k, False: 2.18k]
  ------------------
  661|  34.8k|                pipeline = decode_pipeline;
  662|  34.8k|            }
  663|  37.0k|            auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
  664|  37.0k|            if (flate) {
  ------------------
  |  Branch (664:17): [True: 17.9k, False: 19.0k]
  ------------------
  665|  17.9k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });
  666|  17.9k|            }
  667|  37.0k|        }
  668|  35.9k|    }
  669|       |
  670|  36.7k|    if (s->stream_data.get()) {
  ------------------
  |  Branch (670:9): [True: 11.9k, False: 24.7k]
  ------------------
  671|  11.9k|        QTC::TC("qpdf", "QPDF_Stream pipe replaced stream data");
  672|  11.9k|        pipeline->write(s->stream_data->getBuffer(), s->stream_data->getSize());
  673|  11.9k|        pipeline->finish();
  674|  24.7k|    } else if (s->stream_provider.get()) {
  ------------------
  |  Branch (674:16): [True: 3.99k, False: 20.8k]
  ------------------
  675|  3.99k|        Pl_Count count("stream provider count", pipeline);
  676|  3.99k|        if (s->stream_provider->supportsRetry()) {
  ------------------
  |  Branch (676:13): [True: 0, False: 3.99k]
  ------------------
  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|  3.99k|        } else {
  683|  3.99k|            s->stream_provider->provideStreamData(obj->getObjGen(), &count);
  684|  3.99k|        }
  685|  3.99k|        qpdf_offset_t actual_length = count.getCount();
  686|  3.99k|        if (auto desired_length = Length()) {
  ------------------
  |  Branch (686:18): [True: 0, False: 3.99k]
  ------------------
  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|  3.99k|        } else {
  696|  3.99k|            Length(actual_length);
  697|  3.99k|        }
  698|  20.8k|    } else {
  699|  20.8k|        if (offset() == 0) {
  ------------------
  |  Branch (699:13): [True: 0, False: 20.8k]
  ------------------
  700|      0|            throw std::logic_error("pipeStreamData called for stream with no data");
  701|      0|        }
  702|  20.8k|        if (!Streams::pipeStreamData(
  ------------------
  |  Branch (702:13): [True: 2.16k, False: 18.6k]
  ------------------
  703|  20.8k|                qpdf(),
  704|  20.8k|                id_gen(),
  705|  20.8k|                offset(),
  706|  20.8k|                s->length,
  707|  20.8k|                s->stream_dict,
  708|  20.8k|                isRootMetadata(),
  709|  20.8k|                pipeline,
  710|  20.8k|                suppress_warnings,
  711|  20.8k|                will_retry)) {
  712|  2.16k|            filter = false;
  713|  2.16k|            return false;
  714|  2.16k|        }
  715|  20.8k|    }
  716|       |
  717|  34.5k|    if (filter && !suppress_warnings && normalizer.anyBadTokens()) {
  ------------------
  |  Branch (717:9): [True: 33.0k, False: 1.48k]
  |  Branch (717:19): [True: 33.0k, False: 0]
  |  Branch (717:41): [True: 0, False: 33.0k]
  ------------------
  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|  34.5k|    return true;
  733|  36.7k|}
_ZN4qpdf6Stream17replaceStreamDataEONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERK16QPDFObjectHandleSB_:
  738|  17.4k|{
  739|  17.4k|    auto s = stream();
  740|  17.4k|    s->stream_data = std::make_shared<Buffer>(std::move(data));
  741|  17.4k|    s->stream_provider = nullptr;
  742|  17.4k|    replaceFilterData(filter, decode_parms, s->stream_data->getSize());
  743|  17.4k|}
_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|  4.42k|{
  763|  4.42k|    auto s = stream();
  764|  4.42k|    s->stream_provider = provider;
  765|  4.42k|    s->stream_data = nullptr;
  766|  4.42k|    replaceFilterData(filter, decode_parms, 0);
  767|  4.42k|}
_ZN4qpdf6Stream17replaceFilterDataERK16QPDFObjectHandleS3_m:
  772|  21.8k|{
  773|  21.8k|    auto s = stream();
  774|  21.8k|    if (filter) {
  ------------------
  |  Branch (774:9): [True: 12.4k, False: 9.44k]
  ------------------
  775|  12.4k|        s->stream_dict.replaceKey("/Filter", filter);
  776|  12.4k|    }
  777|  21.8k|    if (decode_parms) {
  ------------------
  |  Branch (777:9): [True: 12.0k, False: 9.84k]
  ------------------
  778|  12.0k|        s->stream_dict.replaceKey("/DecodeParms", decode_parms);
  779|  12.0k|    }
  780|  21.8k|    if (length == 0) {
  ------------------
  |  Branch (780:9): [True: 4.84k, False: 17.0k]
  ------------------
  781|  4.84k|        s->stream_dict.removeKey("/Length");
  782|  17.0k|    } else {
  783|  17.0k|        Length(length);
  784|  17.0k|    }
  785|  21.8k|}
_ZN4qpdf6Stream4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  789|  3.62k|{
  790|  3.62k|    qpdf()->warn(qpdf_e_damaged_pdf, "", offset(), message);
  791|  3.62k|}
_ZNK16QPDFObjectHandle7getDictEv:
  795|  39.1k|{
  796|  39.1k|    return as_stream(error).getDict();
  797|  39.1k|}
_ZN16QPDFObjectHandle13getStreamDataE26qpdf_stream_decode_level_e:
  831|  6.75k|{
  832|  6.75k|    return std::make_shared<Buffer>(as_stream(error).getStreamData(level));
  833|  6.75k|}
_ZN16QPDFObjectHandle14pipeStreamDataEP8Pipelinei26qpdf_stream_decode_level_ebb:
  861|  20.5k|{
  862|  20.5k|    bool filtering_attempted;
  863|  20.5k|    as_stream(error).pipeStreamData(
  864|  20.5k|        p, &filtering_attempted, encode_flags, decode_level, suppress_warnings, will_retry);
  865|  20.5k|    return filtering_attempted;
  866|  20.5k|}
_ZN16QPDFObjectHandle17replaceStreamDataERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_SA_:
  897|  9.39k|{
  898|  9.39k|    std::string s(data);
  899|  9.39k|    as_stream(error).replaceStreamData(std::move(s), filter, decode_parms);
  900|  9.39k|}
_ZN16QPDFObjectHandle17replaceStreamDataENSt3__110shared_ptrINS_18StreamDataProviderEEERKS_S5_:
  907|  3.99k|{
  908|  3.99k|    as_stream(error).replaceStreamData(provider, filter, decode_parms);
  909|  3.99k|}
_ZN4QPDF3Doc7Objects7Streams6Copier13register_copyERN4qpdf6StreamES6_b:
  109|    439|    {
  110|    439|        qpdf_expect(source);
  ------------------
  |  |   13|    439|#define qpdf_expect assert
  ------------------
  |  Branch (110:9): [True: 439, False: 0]
  ------------------
  111|    439|        qpdf_expect(dest);
  ------------------
  |  |   13|    439|#define qpdf_expect assert
  ------------------
  |  Branch (111:9): [True: 439, False: 0]
  ------------------
  112|    439|        if (provider) {
  ------------------
  |  Branch (112:13): [True: 0, False: 439]
  ------------------
  113|      0|            copied_streams.insert_or_assign(dest, source);
  114|    439|        } else {
  115|    439|            copied_data.insert_or_assign(dest, Data(source, dest.getDict()));
  116|    439|        }
  117|    439|    }
_ZN4QPDF3Doc7Objects7Streams6Copier4DataC2ERN4qpdf6StreamERKNS5_10DictionaryE:
   38|    439|            encp(source.qpdf()->m->encp),
   39|    439|            file(source.qpdf()->m->file),
   40|    439|            source_og(source.id_gen()),
   41|    439|            offset(source.offset()),
   42|    439|            length(source.getLength()),
   43|    439|            dest_dict(dest_dict),
   44|    439|            is_root_metadata(source.isRootMetadata())
   45|    439|        {
   46|    439|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEEENK3$_0clIS1_S5_16QPDFObjectHandleEEbT_RT0_RT1_:
  555|  37.3k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  37.3k|        if (!filter.setDecodeParms(d_obj) ||
  ------------------
  |  Branch (556:13): [True: 265, False: 37.0k]
  |  Branch (556:13): [True: 283, False: 37.0k]
  ------------------
  557|  37.0k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  ------------------
  |  Branch (557:14): [True: 35.4k, False: 1.64k]
  |  Branch (557:39): [True: 20, False: 35.4k]
  ------------------
  558|  37.0k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  ------------------
  |  Branch (558:14): [True: 0, False: 37.0k]
  |  Branch (558:47): [True: 0, False: 0]
  ------------------
  559|    283|            return false;
  560|    283|        }
  561|  37.0k|        return true;
  562|  37.3k|    };
_ZN4QPDF3Doc7Objects7Streams6CopierC2ERS2_:
   67|  21.7k|        QPDFObjectHandle::StreamDataProvider(true),
   68|  21.7k|        streams(streams)
   69|  21.7k|    {
   70|  21.7k|    }
_ZN4QPDF3Doc7Objects7Streams6CopierD2Ev:
   64|  21.7k|    ~Copier() final = default;
QPDF_Stream.cc:_ZZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clEv:
  239|  2.39k|        return []() { return std::make_shared<SF_Crypt>(); };
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_CryptC2Ev:
  136|  2.39k|        SF_Crypt() = default;
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt14setDecodeParmsE16QPDFObjectHandle:
  141|  2.24k|        {
  142|       |            // we only validate here - processing happens in decryptStream
  143|  2.24k|            if (Dictionary dict = decode_parms) {
  ------------------
  |  Branch (143:28): [True: 1.42k, False: 828]
  ------------------
  144|  5.23k|                for (auto const& [key, value]: dict) {
  ------------------
  |  Branch (144:46): [True: 5.23k, False: 1.32k]
  ------------------
  145|  5.23k|                    if (key == "/Type" &&
  ------------------
  |  Branch (145:25): [True: 967, False: 4.26k]
  |  Branch (145:25): [True: 923, False: 4.30k]
  ------------------
  146|    967|                        (value.null() || Name(value) == "/CryptFilterDecodeParms")) {
  ------------------
  |  Branch (146:26): [True: 167, False: 800]
  |  Branch (146:42): [True: 756, False: 44]
  ------------------
  147|    923|                        continue;
  148|    923|                    }
  149|  4.30k|                    if (key == "/Name") {
  ------------------
  |  Branch (149:25): [True: 742, False: 3.56k]
  ------------------
  150|    742|                        continue;
  151|    742|                    }
  152|  3.56k|                    if (!value.null()) {
  ------------------
  |  Branch (152:25): [True: 95, False: 3.47k]
  ------------------
  153|     95|                        return false;
  154|     95|                    }
  155|  3.56k|                }
  156|  1.32k|                return true;
  157|  1.42k|            }
  158|    828|            return decode_parms.null();
  159|  2.24k|        }
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt17getDecodePipelineEP8Pipeline:
  163|  2.14k|        {
  164|       |            // Not used -- handled by pipeStreamData
  165|  2.14k|            return nullptr;
  166|  2.14k|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebbENK3$_0clEPKci:
  665|  3.53k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });

_ZN11QPDF_String9writeJSONEiRN4JSON6WriterE:
   18|   114k|{
   19|   114k|    if (json_version == 1) {
  ------------------
  |  Branch (19:9): [True: 0, False: 114k]
  ------------------
   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|   114k|    if (util::is_utf16(val)) {
  ------------------
  |  Branch (34:9): [True: 8.43k, False: 105k]
  ------------------
   35|  8.43k|        p << "\"u:" << JSON::Writer::encode_string(QUtil::utf16_to_utf8(val)) << "\"";
   36|  8.43k|        return;
   37|  8.43k|    }
   38|       |    // See if we can unambiguously represent as Unicode.
   39|   105k|    if (util::is_explicit_utf8(val)) {
  ------------------
  |  Branch (39:9): [True: 1.42k, False: 104k]
  ------------------
   40|  1.42k|        p << "\"u:" << JSON::Writer::encode_string(val.substr(3)) << "\"";
   41|  1.42k|        return;
   42|  1.42k|    }
   43|   104k|    if (!useHexString()) {
  ------------------
  |  Branch (43:9): [True: 64.1k, False: 40.1k]
  ------------------
   44|  64.1k|        auto candidate = QUtil::pdf_doc_to_utf8(val);
   45|  64.1k|        std::string test;
   46|  64.1k|        if (QUtil::utf8_to_pdf_doc(candidate, test, '?') && test == val) {
  ------------------
  |  Branch (46:13): [True: 64.1k, False: 0]
  |  Branch (46:61): [True: 55.1k, False: 9.03k]
  ------------------
   47|       |            // This is a PDF-doc string that can be losslessly encoded as Unicode.
   48|  55.1k|            p << "\"u:" << JSON::Writer::encode_string(candidate) << "\"";
   49|  55.1k|            return;
   50|  55.1k|        }
   51|  64.1k|    }
   52|  49.1k|    p << "\"b:" << QUtil::hex_encode(val) << "\"";
   53|  49.1k|}
_ZNK11QPDF_String12useHexStringEv:
   57|   161k|{
   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|   161k|    unsigned int non_ascii = 0;
   62|  51.6M|    for (auto const ch: val) {
  ------------------
  |  Branch (62:23): [True: 51.6M, False: 137k]
  ------------------
   63|  51.6M|        if (ch > 126) {
  ------------------
  |  Branch (63:13): [True: 20.8k, False: 51.6M]
  ------------------
   64|  20.8k|            ++non_ascii;
   65|  51.6M|        } else if (ch >= 32) {
  ------------------
  |  Branch (65:20): [True: 32.2M, False: 19.4M]
  ------------------
   66|  32.2M|            continue;
   67|  32.2M|        } else if (ch < 0 || ch >= 24) {
  ------------------
  |  Branch (67:20): [True: 3.46M, False: 15.9M]
  |  Branch (67:30): [True: 13.9k, False: 15.9M]
  ------------------
   68|  3.48M|            ++non_ascii;
   69|  15.9M|        } else if (!(ch == '\n' || ch == '\r' || ch == '\t' || ch == '\b' || ch == '\f')) {
  ------------------
  |  Branch (69:22): [True: 111k, False: 15.8M]
  |  Branch (69:36): [True: 1.64k, False: 15.8M]
  |  Branch (69:50): [True: 112k, False: 15.7M]
  |  Branch (69:64): [True: 15.6M, False: 111k]
  |  Branch (69:78): [True: 87.3k, False: 24.0k]
  ------------------
   70|  24.0k|            return true;
   71|  24.0k|        }
   72|  51.6M|    }
   73|   137k|    return 5 * non_ascii > val.length();
   74|   161k|}
_ZN11QPDF_String7unparseEb:
   78|  57.6k|{
   79|  57.6k|    bool use_hexstring = force_binary || useHexString();
  ------------------
  |  Branch (79:26): [True: 0, False: 57.6k]
  |  Branch (79:42): [True: 15.7k, False: 41.9k]
  ------------------
   80|  57.6k|    std::string result;
   81|  57.6k|    if (use_hexstring) {
  ------------------
  |  Branch (81:9): [True: 15.7k, False: 41.9k]
  ------------------
   82|  15.7k|        static auto constexpr hexchars = "0123456789abcdef";
   83|  15.7k|        result.reserve(2 * val.length() + 2);
   84|  15.7k|        result += '<';
   85|  40.7M|        for (const char c: val) {
  ------------------
  |  Branch (85:26): [True: 40.7M, False: 15.7k]
  ------------------
   86|  40.7M|            result += hexchars[static_cast<unsigned char>(c) >> 4];
   87|  40.7M|            result += hexchars[c & 0x0f];
   88|  40.7M|        }
   89|  15.7k|        result += '>';
   90|  41.9k|    } else {
   91|  41.9k|        result += "(";
   92|  29.7M|        for (unsigned int i = 0; i < val.length(); ++i) {
  ------------------
  |  Branch (92:34): [True: 29.6M, False: 41.9k]
  ------------------
   93|  29.6M|            char ch = val.at(i);
   94|  29.6M|            switch (ch) {
   95|  64.4k|            case '\n':
  ------------------
  |  Branch (95:13): [True: 64.4k, False: 29.6M]
  ------------------
   96|  64.4k|                result += "\\n";
   97|  64.4k|                break;
   98|       |
   99|    741|            case '\r':
  ------------------
  |  Branch (99:13): [True: 741, False: 29.6M]
  ------------------
  100|    741|                result += "\\r";
  101|    741|                break;
  102|       |
  103|  77.9k|            case '\t':
  ------------------
  |  Branch (103:13): [True: 77.9k, False: 29.5M]
  ------------------
  104|  77.9k|                result += "\\t";
  105|  77.9k|                break;
  106|       |
  107|  7.22M|            case '\b':
  ------------------
  |  Branch (107:13): [True: 7.22M, False: 22.4M]
  ------------------
  108|  7.22M|                result += "\\b";
  109|  7.22M|                break;
  110|       |
  111|  61.4k|            case '\f':
  ------------------
  |  Branch (111:13): [True: 61.4k, False: 29.6M]
  ------------------
  112|  61.4k|                result += "\\f";
  113|  61.4k|                break;
  114|       |
  115|  7.34k|            case '(':
  ------------------
  |  Branch (115:13): [True: 7.34k, False: 29.6M]
  ------------------
  116|  7.34k|                result += "\\(";
  117|  7.34k|                break;
  118|       |
  119|  7.21k|            case ')':
  ------------------
  |  Branch (119:13): [True: 7.21k, False: 29.6M]
  ------------------
  120|  7.21k|                result += "\\)";
  121|  7.21k|                break;
  122|       |
  123|  3.87k|            case '\\':
  ------------------
  |  Branch (123:13): [True: 3.87k, False: 29.6M]
  ------------------
  124|  3.87k|                result += "\\\\";
  125|  3.87k|                break;
  126|       |
  127|  22.2M|            default:
  ------------------
  |  Branch (127:13): [True: 22.2M, False: 7.44M]
  ------------------
  128|  22.2M|                if (is_iso_latin1_printable(ch)) {
  ------------------
  |  Branch (128:21): [True: 22.1M, False: 62.5k]
  ------------------
  129|  22.1M|                    result += val.at(i);
  130|  22.1M|                } else {
  131|  62.5k|                    result += "\\" +
  132|  62.5k|                        QUtil::int_to_string_base(
  133|  62.5k|                                  static_cast<int>(static_cast<unsigned char>(ch)), 8, 3);
  134|  62.5k|                }
  135|  22.2M|                break;
  136|  29.6M|            }
  137|  29.6M|        }
  138|  41.9k|        result += ")";
  139|  41.9k|    }
  140|       |
  141|  57.6k|    return result;
  142|  57.6k|}
QPDF_String.cc:_ZL23is_iso_latin1_printablec:
   12|  22.2M|{
   13|  22.2M|    return (ch >= 32 && ch <= 126) || static_cast<unsigned char>(ch) >= 160;
  ------------------
  |  Branch (13:13): [True: 22.0M, False: 157k]
  |  Branch (13:25): [True: 22.0M, False: 514]
  |  Branch (13:39): [True: 95.6k, False: 62.5k]
  ------------------
   14|  22.2M|}

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

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

_ZN4QPDF3Doc5Pages5cacheEv:
   53|  18.8k|{
   54|       |    // Note that pushInheritedAttributesToPage may also be used to initialize m->all_pages.
   55|  18.8k|    if (all_pages.empty() && !invalid_page_found) {
  ------------------
  |  Branch (55:9): [True: 14.8k, False: 4.00k]
  |  Branch (55:30): [True: 14.0k, False: 800]
  ------------------
   56|  14.0k|        ever_called_get_all_pages_ = true;
   57|  14.0k|        auto root = qpdf.getRoot();
   58|  14.0k|        QPDFObjGen::set visited;
   59|  14.0k|        QPDFObjGen::set seen;
   60|  14.0k|        QPDFObjectHandle pages = root.getKey("/Pages");
   61|  14.0k|        bool warned = false;
   62|  14.0k|        bool changed_pages = false;
   63|  15.3k|        while (pages.isDictionary() && pages.hasKey("/Parent")) {
  ------------------
  |  Branch (63:16): [True: 10.5k, False: 4.71k]
  |  Branch (63:16): [True: 1.43k, False: 13.8k]
  |  Branch (63:40): [True: 1.43k, False: 9.15k]
  ------------------
   64|  1.43k|            if (!seen.add(pages)) {
  ------------------
  |  Branch (64:17): [True: 212, False: 1.22k]
  ------------------
   65|       |                // loop -- will be detected again and reported later
   66|    212|                break;
   67|    212|            }
   68|       |            // Files have been found in the wild where /Pages in the catalog points to the first
   69|       |            // page. Try to work around this and similar cases with this heuristic.
   70|  1.22k|            if (!warned) {
  ------------------
  |  Branch (70:17): [True: 767, False: 456]
  ------------------
   71|    767|                root.warn(
   72|    767|                    "document page tree root (root -> /Pages) doesn't point"
   73|    767|                    " to the root of the page tree; attempting to correct");
   74|    767|                warned = true;
   75|    767|            }
   76|  1.22k|            changed_pages = true;
   77|  1.22k|            pages = pages.getKey("/Parent");
   78|  1.22k|        }
   79|  14.0k|        if (changed_pages) {
  ------------------
  |  Branch (79:13): [True: 766, False: 13.3k]
  ------------------
   80|    766|            root.replaceKey("/Pages", pages);
   81|    766|        }
   82|  14.0k|        seen.clear();
   83|  14.0k|        if (!pages.hasKey("/Kids")) {
  ------------------
  |  Branch (83:13): [True: 148, False: 13.9k]
  ------------------
   84|       |            // Ensure we actually found a /Pages object.
   85|    148|            throw QPDFExc(
   86|    148|                qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array");
   87|    148|        }
   88|  13.9k|        try {
   89|  13.9k|            getAllPagesInternal(pages, 0, visited, seen, false, false);
   90|  13.9k|        } catch (...) {
   91|     78|            all_pages.clear();
   92|     78|            invalid_page_found = false;
   93|     78|            throw;
   94|     78|        }
   95|  9.26k|        if (invalid_page_found) {
  ------------------
  |  Branch (95:13): [True: 4.80k, False: 4.46k]
  ------------------
   96|  4.80k|            flattenPagesTree();
   97|  4.80k|            invalid_page_found = false;
   98|  4.80k|        }
   99|  9.26k|    }
  100|  14.0k|    return all_pages;
  101|  18.8k|}
_ZN4QPDF3Doc5Pages19getAllPagesInternalE16QPDFObjectHandlejRN10QPDFObjGen3setES5_bb:
  111|  11.5k|{
  112|  11.5k|    static uint32_t constexpr max_level = 100;
  113|  11.5k|    if (++level > max_level) {
  ------------------
  |  Branch (113:9): [True: 0, False: 11.5k]
  ------------------
  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|  11.5k|    if (!visited.add(cur_node)) {
  ------------------
  |  Branch (121:9): [True: 17, False: 11.5k]
  ------------------
  122|     17|        throw QPDFExc(
  123|     17|            qpdf_e_pages,
  124|     17|            m->file->getName(),
  125|     17|            "object " + cur_node.getObjGen().unparse(' '),
  126|     17|            0,
  127|     17|            "Loop detected in /Pages structure (getAllPages)");
  128|     17|    }
  129|  11.5k|    if (!cur_node.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (129:9): [True: 8.97k, False: 2.52k]
  ------------------
  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|  8.97k|        cur_node.warn("/Type key should be /Pages but is not; overriding");
  134|  8.97k|        cur_node.replaceKey("/Type", Name("/Pages"));
  135|  8.97k|    }
  136|  11.5k|    if (!media_box) {
  ------------------
  |  Branch (136:9): [True: 11.4k, False: 81]
  ------------------
  137|  11.4k|        media_box = cur_node.getKey("/MediaBox").isRectangle();
  138|  11.4k|        QTC::TC("qpdf", "QPDF inherit mediabox", media_box ? 0 : 1);
  ------------------
  |  Branch (138:50): [True: 1.32k, False: 10.1k]
  ------------------
  139|  11.4k|    }
  140|  11.5k|    if (!resources) {
  ------------------
  |  Branch (140:9): [True: 11.2k, False: 254]
  ------------------
  141|  11.2k|        resources = cur_node.getKey("/Resources").isDictionary();
  142|  11.2k|    }
  143|  11.5k|    auto kids = cur_node.getKey("/Kids");
  144|  11.5k|    if (!visited.add(kids)) {
  ------------------
  |  Branch (144:9): [True: 20, False: 11.4k]
  ------------------
  145|     20|        throw QPDFExc(
  146|     20|            qpdf_e_pages,
  147|     20|            m->file->getName(),
  148|     20|            "object " + cur_node.getObjGen().unparse(' '),
  149|     20|            0,
  150|     20|            "Loop detected in /Pages structure (getAllPages)");
  151|     20|    }
  152|  11.4k|    int i = -1;
  153|  67.5k|    for (auto& kid: kids.as_array()) {
  ------------------
  |  Branch (153:19): [True: 67.5k, False: 11.4k]
  ------------------
  154|  67.5k|        ++i;
  155|  67.5k|        int errors = 0;
  156|       |
  157|  67.5k|        if (!kid.isDictionary()) {
  ------------------
  |  Branch (157:13): [True: 39.9k, False: 27.6k]
  ------------------
  158|  39.9k|            kid.warn("Pages tree includes non-dictionary object; ignoring");
  159|  39.9k|            invalid_page_found = true;
  160|  39.9k|            continue;
  161|  39.9k|        }
  162|  27.6k|        if (!kid.isIndirect()) {
  ------------------
  |  Branch (162:13): [True: 1.97k, False: 25.7k]
  ------------------
  163|  1.97k|            cur_node.warn(
  164|  1.97k|                "kid " + std::to_string(i) + " (from 0) is direct; converting to indirect");
  165|  1.97k|            kid = qpdf.makeIndirectObject(kid);
  166|  1.97k|            ++errors;
  167|  1.97k|        }
  168|  27.6k|        if (kid.hasKey("/Kids")) {
  ------------------
  |  Branch (168:13): [True: 2.17k, False: 25.5k]
  ------------------
  169|  2.17k|            getAllPagesInternal(kid, level, visited, seen, media_box, resources);
  170|  25.5k|        } else {
  171|  25.5k|            if (!media_box && !kid.getKey("/MediaBox").isRectangle()) {
  ------------------
  |  Branch (171:17): [True: 20.9k, False: 4.56k]
  |  Branch (171:17): [True: 8.32k, False: 17.1k]
  |  Branch (171:31): [True: 8.32k, False: 12.6k]
  ------------------
  172|  8.32k|                kid.warn(
  173|  8.32k|                    "kid " + std::to_string(i) +
  174|  8.32k|                    " (from 0) MediaBox is undefined; setting to letter / ANSI A");
  175|  8.32k|                kid.replaceKey(
  176|  8.32k|                    "/MediaBox",
  177|  8.32k|                    QPDFObjectHandle::newArray(QPDFObjectHandle::Rectangle(0, 0, 612, 792)));
  178|  8.32k|                ++errors;
  179|  8.32k|            }
  180|  25.5k|            if (!resources) {
  ------------------
  |  Branch (180:17): [True: 19.8k, False: 5.63k]
  ------------------
  181|  19.8k|                auto res = kid.getKey("/Resources");
  182|       |
  183|  19.8k|                if (!res.isDictionary()) {
  ------------------
  |  Branch (183:21): [True: 7.92k, False: 11.9k]
  ------------------
  184|  7.92k|                    ++errors;
  185|  7.92k|                    kid.warn(
  186|  7.92k|                        "kid " + std::to_string(i) +
  187|  7.92k|                        " (from 0) Resources is missing or invalid; repairing");
  188|  7.92k|                    kid.replaceKey("/Resources", QPDFObjectHandle::newDictionary());
  189|  7.92k|                }
  190|  19.8k|            }
  191|  25.5k|            auto annots = kid.getKey("/Annots");
  192|  25.5k|            if (!annots.null()) {
  ------------------
  |  Branch (192:17): [True: 4.86k, False: 20.6k]
  ------------------
  193|  4.86k|                if (!annots.isArray()) {
  ------------------
  |  Branch (193:21): [True: 97, False: 4.76k]
  ------------------
  194|     97|                    kid.warn(
  195|     97|                        "kid " + std::to_string(i) + " (from 0) Annots is not an array; removing");
  196|     97|                    kid.removeKey("/Annots");
  197|     97|                    ++errors;
  198|  4.76k|                } else {
  199|  4.76k|                    QPDFObjGen::set seen_annots;
  200|  83.9k|                    for (auto& annot: annots.as_array()) {
  ------------------
  |  Branch (200:37): [True: 83.9k, False: 4.76k]
  ------------------
  201|  83.9k|                        if (!seen_annots.add(annot)) {
  ------------------
  |  Branch (201:29): [True: 2.98k, False: 80.9k]
  ------------------
  202|  2.98k|                            kid.warn(
  203|  2.98k|                                "kid " + std::to_string(i) +
  204|  2.98k|                                " (from 0) Annots has duplicate entry for annotation " +
  205|  2.98k|                                annot.id_gen().unparse(' '));
  206|  2.98k|                            ++errors;
  207|  2.98k|                        }
  208|  83.9k|                    }
  209|  4.76k|                }
  210|  4.86k|            }
  211|       |
  212|  25.5k|            if (!seen.add(kid)) {
  ------------------
  |  Branch (212:17): [True: 8.78k, False: 16.7k]
  ------------------
  213|       |                // Make a copy of the page. This does the same as shallowCopyPage in
  214|       |                // QPDFPageObjectHelper.
  215|  8.78k|                if (!m->reconstructed_xref) {
  ------------------
  |  Branch (215:21): [True: 7.47k, False: 1.30k]
  ------------------
  216|  7.47k|                    cur_node.warn(
  217|  7.47k|                        "kid " + std::to_string(i) +
  218|  7.47k|                        " (from 0) appears more than once in the pages tree;"
  219|  7.47k|                        " creating a new page object as a copy");
  220|       |                    // This needs to be fixed. shallowCopy does not necessarily produce a valid
  221|       |                    // page.
  222|  7.47k|                    kid = qpdf.makeIndirectObject(QPDFObjectHandle(kid).shallowCopy());
  223|  7.47k|                    seen.add(kid);
  224|  7.47k|                } else {
  225|  1.30k|                    cur_node.warn(
  226|  1.30k|                        "kid " + std::to_string(i) +
  227|  1.30k|                        " (from 0) appears more than once in the pages tree; ignoring duplicate");
  228|  1.30k|                    invalid_page_found = true;
  229|  1.30k|                    kid = QPDFObjectHandle::newNull();
  230|  1.30k|                    continue;
  231|  1.30k|                }
  232|  7.47k|                if (!kid.getKey("/Parent").isSameObjectAs(cur_node)) {
  ------------------
  |  Branch (232:21): [True: 7.46k, False: 15]
  ------------------
  233|       |                    // Consider fixing and adding an information message.
  234|  7.46k|                    ++errors;
  235|  7.46k|                }
  236|  7.47k|            }
  237|  24.1k|            if (!kid.isDictionaryOfType("/Page")) {
  ------------------
  |  Branch (237:17): [True: 7.49k, False: 16.7k]
  ------------------
  238|  7.49k|                kid.warn("/Type key should be /Page but is not; overriding");
  239|  7.49k|                kid.replaceKey("/Type", Name("/Page"));
  240|  7.49k|                ++errors;
  241|  7.49k|            }
  242|  24.1k|            if (m->reconstructed_xref && errors > 2) {
  ------------------
  |  Branch (242:17): [True: 15.5k, False: 8.69k]
  |  Branch (242:42): [True: 1.07k, False: 14.4k]
  ------------------
  243|  1.07k|                cur_node.warn(
  244|  1.07k|                    "kid " + std::to_string(i) + " (from 0) has too many errors; ignoring page");
  245|  1.07k|                invalid_page_found = true;
  246|  1.07k|                kid = QPDFObjectHandle::newNull();
  247|  1.07k|                continue;
  248|  1.07k|            }
  249|  23.1k|            all_pages.emplace_back(kid);
  250|  23.1k|        }
  251|  27.6k|    }
  252|  11.4k|}
_ZN4QPDF3Doc5Pages16flattenPagesTreeEv:
  274|  4.80k|{
  275|       |    // If not already done, flatten the /Pages structure and initialize pageobj_to_pages_pos.
  276|       |
  277|  4.80k|    if (!pageobj_to_pages_pos.empty()) {
  ------------------
  |  Branch (277:9): [True: 0, False: 4.80k]
  ------------------
  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|  4.80k|    pushInheritedAttributesToPage(true, true);
  284|       |
  285|  4.80k|    QPDFObjectHandle pages = qpdf.getRoot().getKey("/Pages");
  286|       |
  287|  4.80k|    size_t const len = all_pages.size();
  288|  21.0k|    for (size_t pos = 0; pos < len; ++pos) {
  ------------------
  |  Branch (288:26): [True: 16.2k, False: 4.80k]
  ------------------
  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|  16.2k|        insertPageobjToPage(all_pages.at(pos), toI(pos), true);
  293|  16.2k|        all_pages.at(pos).replaceKey("/Parent", pages);
  294|  16.2k|    }
  295|       |
  296|  4.80k|    pages.replaceKey("/Kids", Array(all_pages));
  297|       |    // /Count has not changed
  298|  4.80k|    if (pages.getKey("/Count").getUIntValue() != len) {
  ------------------
  |  Branch (298:9): [True: 3.78k, False: 1.01k]
  ------------------
  299|  3.78k|        if (invalid_page_found && pages.getKey("/Count").getUIntValue() > len) {
  ------------------
  |  Branch (299:13): [True: 3.78k, False: 0]
  |  Branch (299:13): [True: 3.74k, False: 40]
  |  Branch (299:35): [True: 3.74k, False: 40]
  ------------------
  300|  3.74k|            pages.replaceKey("/Count", Integer(len));
  301|  3.74k|        } else {
  302|     40|            throw std::runtime_error("/Count is wrong after flattening pages tree");
  303|     40|        }
  304|  3.78k|    }
  305|  4.80k|}
_ZN4QPDF3Doc5Pages29pushInheritedAttributesToPageEbb:
  316|  4.80k|{
  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|  4.80k|    if (pushed_inherited_attributes_to_pages && !warn_skipped_keys) {
  ------------------
  |  Branch (321:9): [True: 0, False: 4.80k]
  |  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|  4.80k|    (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|  4.80k|    std::map<std::string, std::vector<QPDFObjectHandle>> key_ancestors;
  332|  4.80k|    pushInheritedAttributesToPageInternal(
  333|  4.80k|        m->trailer.getKey("/Root").getKey("/Pages"),
  334|  4.80k|        key_ancestors,
  335|  4.80k|        allow_changes,
  336|  4.80k|        warn_skipped_keys);
  337|  4.80k|    util::assertion(
  338|  4.80k|        key_ancestors.empty(),
  339|  4.80k|        "key_ancestors not empty after pushing inherited attributes to pages");
  340|  4.80k|    pushed_inherited_attributes_to_pages = true;
  341|  4.80k|    ever_pushed_inherited_attributes_to_pages_ = true;
  342|  4.80k|}
_ZN4QPDF3Doc5Pages37pushInheritedAttributesToPageInternalE16QPDFObjectHandleRNSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_6vectorIS2_NS8_IS2_EEEENS3_4lessISA_EENS8_INS3_4pairIKSA_SD_EEEEEEbb:
  350|  6.67k|{
  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|  6.67k|    std::set<std::string> inheritable_keys;
  356|  26.8k|    for (auto const& key: cur_pages.getKeys()) {
  ------------------
  |  Branch (356:25): [True: 26.8k, False: 6.67k]
  ------------------
  357|  26.8k|        if (key == "/MediaBox" || key == "/CropBox" || key == "/Resources" || key == "/Rotate") {
  ------------------
  |  Branch (357:13): [True: 1.05k, False: 25.7k]
  |  Branch (357:35): [True: 74, False: 25.6k]
  |  Branch (357:56): [True: 784, False: 24.9k]
  |  Branch (357:79): [True: 119, False: 24.7k]
  ------------------
  358|  2.02k|            if (!allow_changes) {
  ------------------
  |  Branch (358:17): [True: 0, False: 2.02k]
  ------------------
  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.02k|            inheritable_keys.insert(key);
  370|  2.02k|            auto oh = cur_pages[key];
  371|  2.02k|            QTC::TC("qpdf", "QPDF opt direct pages resource", oh.indirect() ? 0 : 1);
  ------------------
  |  Branch (371:63): [True: 401, False: 1.62k]
  ------------------
  372|  2.02k|            if (!oh.indirect()) {
  ------------------
  |  Branch (372:17): [True: 1.62k, False: 401]
  ------------------
  373|  1.62k|                if (!oh.isScalar()) {
  ------------------
  |  Branch (373:21): [True: 632, False: 996]
  ------------------
  374|       |                    // Replace shared direct object non-scalar resources with indirect objects to
  375|       |                    // avoid copying large structures around.
  376|    632|                    cur_pages.replaceKey(key, qpdf.makeIndirectObject(oh));
  377|    632|                    oh = cur_pages[key];
  378|    996|                } else {
  379|       |                    // It's okay to copy scalars.
  380|    996|                }
  381|  1.62k|            }
  382|  2.02k|            key_ancestors[key].emplace_back(oh);
  383|  2.02k|            if (key_ancestors[key].size() > 1) {
  ------------------
  |  Branch (383:17): [True: 199, False: 1.83k]
  ------------------
  384|    199|            }
  385|       |            // Remove this resource from this node.  It will be reattached at the page level.
  386|  2.02k|            cur_pages.erase(key);
  387|  24.7k|        } else if (!(key == "/Type" || key == "/Parent" || key == "/Kids" || key == "/Count")) {
  ------------------
  |  Branch (387:22): [True: 6.65k, False: 18.1k]
  |  Branch (387:40): [True: 450, False: 17.6k]
  |  Branch (387:60): [True: 6.67k, False: 11.0k]
  |  Branch (387:78): [True: 4.37k, False: 6.63k]
  ------------------
  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.63k|            if (warn_skipped_keys && cur_pages.contains("/Parent")) {
  ------------------
  |  Branch (390:17): [True: 6.63k, False: 0]
  |  Branch (390:17): [True: 508, False: 6.12k]
  |  Branch (390:38): [True: 508, False: 6.12k]
  ------------------
  391|    508|                warn(
  392|    508|                    qpdf_e_pages,
  393|    508|                    "Pages object: object " + cur_pages.id_gen().unparse(' '),
  394|    508|                    cur_pages.offset(),
  395|    508|                    ("Unknown key " + key +
  396|    508|                     " in /Pages object is being discarded as a result of flattening the /Pages "
  397|    508|                     "tree"));
  398|    508|            }
  399|  6.63k|        }
  400|  26.8k|    }
  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|  56.2k|    for (auto& kid: Array(cur_pages["/Kids"])) {
  ------------------
  |  Branch (405:19): [True: 56.2k, False: 6.67k]
  ------------------
  406|  56.2k|        if (kid.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (406:13): [True: 1.87k, False: 54.3k]
  ------------------
  407|  1.87k|            pushInheritedAttributesToPageInternal(
  408|  1.87k|                kid, key_ancestors, allow_changes, warn_skipped_keys);
  409|  54.3k|        } else {
  410|       |            // Add all available inheritable attributes not present in this object to this object.
  411|  54.3k|            for (auto const& [key, values]: key_ancestors) {
  ------------------
  |  Branch (411:43): [True: 14.5k, False: 54.3k]
  ------------------
  412|  14.5k|                if (!kid.contains(key)) {
  ------------------
  |  Branch (412:21): [True: 11.4k, False: 3.10k]
  ------------------
  413|  11.4k|                    kid.replaceKey(key, values.back());
  414|  11.4k|                } else {
  415|  3.10k|                    QTC::TC("qpdf", "QPDF opt page resource hides ancestor");
  416|  3.10k|                }
  417|  14.5k|            }
  418|  54.3k|        }
  419|  56.2k|    }
  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|  6.67k|    if (!inheritable_keys.empty()) {
  ------------------
  |  Branch (425:9): [True: 1.60k, False: 5.07k]
  ------------------
  426|  1.83k|        for (auto const& key: inheritable_keys) {
  ------------------
  |  Branch (426:29): [True: 1.83k, False: 1.60k]
  ------------------
  427|  1.83k|            key_ancestors[key].pop_back();
  428|  1.83k|            if (key_ancestors[key].empty()) {
  ------------------
  |  Branch (428:17): [True: 1.64k, False: 196]
  ------------------
  429|  1.64k|                key_ancestors.erase(key);
  430|  1.64k|            }
  431|  1.83k|        }
  432|  5.07k|    } else {
  433|  5.07k|        QTC::TC("qpdf", "QPDF opt no inheritable keys");
  434|  5.07k|    }
  435|  6.67k|}
_ZN4QPDF3Doc5Pages19insertPageobjToPageERK16QPDFObjectHandleib:
  439|  16.2k|{
  440|  16.2k|    QPDFObjGen og(obj.getObjGen());
  441|  16.2k|    if (check_duplicate) {
  ------------------
  |  Branch (441:9): [True: 16.2k, False: 0]
  ------------------
  442|  16.2k|        if (!pageobj_to_pages_pos.insert(std::make_pair(og, pos)).second) {
  ------------------
  |  Branch (442:13): [True: 0, False: 16.2k]
  ------------------
  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|  16.2k|    } else {
  452|      0|        pageobj_to_pages_pos[og] = pos;
  453|      0|    }
  454|  16.2k|}
_ZN22QPDFPageDocumentHelperC2ER4QPDF:
  584|  10.4k|    QPDFDocumentHelper(qpdf)
  585|  10.4k|{
  586|  10.4k|}
_ZN22QPDFPageDocumentHelper11getAllPagesEv:
  601|  10.1k|{
  602|  10.1k|    auto& pp = qpdf.doc().pages();
  603|  10.1k|    return {pp.begin(), pp.end()};
  604|  10.1k|}
_ZN22QPDFPageDocumentHelper18flattenAnnotationsEii:
  641|  7.73k|{
  642|  7.73k|    qpdf.doc().pages().flatten_annotations(required_flags, forbidden_flags);
  643|  7.73k|}
_ZN4QPDF3Doc5Pages19flatten_annotationsEii:
  647|  7.73k|{
  648|  7.73k|    auto& afdh = qpdf.doc().acroform();
  649|  7.73k|    if (afdh.getNeedAppearances()) {
  ------------------
  |  Branch (649:9): [True: 0, False: 7.73k]
  ------------------
  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|  21.2k|    for (QPDFPageObjectHelper ph: all()) {
  ------------------
  |  Branch (656:33): [True: 21.2k, False: 7.73k]
  ------------------
  657|  21.2k|        QPDFObjectHandle resources = ph.getAttribute("/Resources", true);
  658|  21.2k|        if (!resources.isDictionary()) {
  ------------------
  |  Branch (658:13): [True: 788, False: 20.4k]
  ------------------
  659|       |            // As of #1521, this should be impossible unless a user inserted an invalid page.
  660|    788|            resources = ph.getObjectHandle().replaceKeyAndGetNew("/Resources", Dictionary::empty());
  661|    788|        }
  662|  21.2k|        flatten_annotations_for_page(ph, resources, afdh, required_flags, forbidden_flags);
  663|  21.2k|    }
  664|  7.73k|    if (!afdh.getNeedAppearances()) {
  ------------------
  |  Branch (664:9): [True: 7.70k, False: 31]
  ------------------
  665|  7.70k|        qpdf.getRoot().removeKey("/AcroForm");
  666|  7.70k|    }
  667|  7.73k|}
_ZN4QPDF3Doc5Pages28flatten_annotations_for_pageER20QPDFPageObjectHelperR16QPDFObjectHandleRN4qpdf4impl8AcroFormEii:
  676|  21.2k|{
  677|  21.2k|    bool need_appearances = afdh.getNeedAppearances();
  678|  21.2k|    std::vector<QPDFAnnotationObjectHelper> annots = page.getAnnotations();
  679|  21.2k|    std::vector<QPDFObjectHandle> new_annots;
  680|  21.2k|    std::string new_content;
  681|  21.2k|    int rotate = 0;
  682|  21.2k|    QPDFObjectHandle rotate_obj = page.getObjectHandle().getKey("/Rotate");
  683|  21.2k|    if (rotate_obj.isInteger() && rotate_obj.getIntValue()) {
  ------------------
  |  Branch (683:9): [True: 919, False: 20.2k]
  |  Branch (683:35): [True: 160, False: 759]
  ------------------
  684|    160|        rotate = rotate_obj.getIntValueAsInt();
  685|    160|    }
  686|  21.2k|    int next_fx = 1;
  687|  21.2k|    for (auto& aoh: annots) {
  ------------------
  |  Branch (687:19): [True: 16.1k, False: 21.2k]
  ------------------
  688|  16.1k|        QPDFObjectHandle as = aoh.getAppearanceStream("/N");
  689|  16.1k|        bool is_widget = (aoh.getSubtype() == "/Widget");
  690|  16.1k|        bool process = true;
  691|  16.1k|        if (need_appearances && is_widget) {
  ------------------
  |  Branch (691:13): [True: 0, False: 16.1k]
  |  Branch (691:33): [True: 0, False: 0]
  ------------------
  692|      0|            process = false;
  693|      0|        }
  694|  16.1k|        if (process && as.isStream()) {
  ------------------
  |  Branch (694:13): [True: 16.0k, False: 6]
  |  Branch (694:24): [True: 10.0k, False: 6.04k]
  ------------------
  695|  10.0k|            if (is_widget) {
  ------------------
  |  Branch (695:17): [True: 9.06k, False: 982]
  ------------------
  696|  9.06k|                QPDFFormFieldObjectHelper ff = afdh.getFieldForAnnotation(aoh);
  697|  9.06k|                QPDFObjectHandle as_resources = as.getDict().getKey("/Resources");
  698|  9.06k|                if (as_resources.isIndirect()) {
  ------------------
  |  Branch (698:21): [True: 569, False: 8.49k]
  ------------------
  699|    569|                    ;
  700|    569|                    as.getDict().replaceKey("/Resources", as_resources.shallowCopy());
  701|    569|                    as_resources = as.getDict().getKey("/Resources");
  702|    569|                }
  703|  9.06k|                as_resources.mergeResources(ff.getDefaultResources());
  704|  9.06k|            } else {
  705|    982|                QTC::TC("qpdf", "QPDFPageDocumentHelper non-widget annotation");
  706|    982|            }
  707|  10.0k|            std::string name = resources.getUniqueResourceName("/Fxo", next_fx);
  708|  10.0k|            std::string content =
  709|  10.0k|                aoh.getPageContentForAppearance(name, rotate, required_flags, forbidden_flags);
  710|  10.0k|            if (!content.empty()) {
  ------------------
  |  Branch (710:17): [True: 6.59k, False: 3.45k]
  ------------------
  711|  6.59k|                resources.mergeResources(Dictionary({{"/XObject", Dictionary({{name, as}})}}));
  712|  6.59k|                resources.getKey("/XObject").replaceKey(name, as);
  713|  6.59k|                ++next_fx;
  714|  6.59k|            }
  715|  10.0k|            new_content += content;
  716|  10.0k|        } else if (process && !aoh.getAppearanceDictionary().null()) {
  ------------------
  |  Branch (716:20): [True: 6.04k, False: 6]
  |  Branch (716:20): [True: 1.61k, False: 4.43k]
  |  Branch (716:31): [True: 1.61k, False: 4.43k]
  ------------------
  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|  4.43k|        } else {
  723|  4.43k|            new_annots.push_back(aoh.getObjectHandle());
  724|  4.43k|        }
  725|  16.1k|    }
  726|  21.2k|    if (new_annots.size() != annots.size()) {
  ------------------
  |  Branch (726:9): [True: 2.85k, False: 18.3k]
  ------------------
  727|  2.85k|        QPDFObjectHandle page_oh = page.getObjectHandle();
  728|  2.85k|        if (new_annots.empty()) {
  ------------------
  |  Branch (728:13): [True: 2.39k, False: 451]
  ------------------
  729|  2.39k|            page_oh.removeKey("/Annots");
  730|  2.39k|        } else {
  731|    451|            QPDFObjectHandle old_annots = page_oh.getKey("/Annots");
  732|    451|            QPDFObjectHandle new_annots_oh = QPDFObjectHandle::newArray(new_annots);
  733|    451|            if (old_annots.isIndirect()) {
  ------------------
  |  Branch (733:17): [True: 84, False: 367]
  ------------------
  734|     84|                qpdf.replaceObject(old_annots.getObjGen(), new_annots_oh);
  735|    367|            } else {
  736|    367|                page_oh.replaceKey("/Annots", new_annots_oh);
  737|    367|            }
  738|    451|        }
  739|  2.85k|        page.addPageContents(qpdf.newStream("q\n"), true);
  740|  2.85k|        page.addPageContents(qpdf.newStream("\nQ\n" + new_content), false);
  741|  2.85k|    }
  742|  21.2k|}

_ZN5QUtil18int_to_string_baseExii:
  343|  62.5k|{
  344|  62.5k|    return int_to_string_base_internal(num, base, length);
  345|  62.5k|}
_ZN5QUtil16double_to_stringEdib:
  355|   118k|{
  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|   118k|    if (decimal_places <= 0) {
  ------------------
  |  Branch (359:9): [True: 78.5k, False: 39.5k]
  ------------------
  360|  78.5k|        decimal_places = 6;
  361|  78.5k|    }
  362|   118k|    std::ostringstream buf;
  363|   118k|    buf.imbue(std::locale::classic());
  364|   118k|    buf << std::setprecision(decimal_places) << std::fixed << num;
  365|   118k|    std::string result = buf.str();
  366|   118k|    if (trim_trailing_zeroes) {
  ------------------
  |  Branch (366:9): [True: 118k, False: 0]
  ------------------
  367|   706k|        while ((result.length() > 1) && (result.back() == '0')) {
  ------------------
  |  Branch (367:16): [True: 706k, False: 0]
  |  Branch (367:41): [True: 588k, False: 118k]
  ------------------
  368|   588k|            result.pop_back();
  369|   588k|        }
  370|   118k|        if ((result.length() > 1) && (result.back() == '.')) {
  ------------------
  |  Branch (370:13): [True: 118k, False: 0]
  |  Branch (370:38): [True: 86.0k, False: 32.1k]
  ------------------
  371|  86.0k|            result.pop_back();
  372|  86.0k|        }
  373|   118k|    }
  374|   118k|    return result;
  375|   118k|}
_ZN5QUtil12string_to_llEPKc:
  379|  2.80M|{
  380|  2.80M|    errno = 0;
  381|       |#ifdef _MSC_VER
  382|       |    long long result = _strtoi64(str, 0, 10);
  383|       |#else
  384|  2.80M|    long long result = strtoll(str, nullptr, 10);
  385|  2.80M|#endif
  386|  2.80M|    if (errno == ERANGE) {
  ------------------
  |  Branch (386:9): [True: 1.13k, False: 2.80M]
  ------------------
  387|  1.13k|        throw std::range_error(
  388|  1.13k|            std::string("overflow/underflow converting ") + str + " to 64-bit integer");
  389|  1.13k|    }
  390|  2.80M|    return result;
  391|  2.80M|}
_ZN5QUtil13string_to_intEPKc:
  395|   698k|{
  396|       |    // QIntC::to_int does range checking
  397|   698k|    return QIntC::to_int(string_to_ll(str));
  398|   698k|}
_ZN5QUtil21unsigned_char_pointerERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  447|   175k|{
  448|   175k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str.c_str()));
  449|   175k|}
_ZN5QUtil21unsigned_char_pointerEPKc:
  453|  5.61k|{
  454|  5.61k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str));
  455|  5.61k|}
_ZN5QUtil16make_unique_cstrERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  717|  5.61k|{
  718|  5.61k|    auto result = std::make_unique<char[]>(str.length() + 1);
  719|       |    // Use memcpy in case string contains nulls
  720|  5.61k|    result.get()[str.length()] = '\0';
  721|  5.61k|    memcpy(result.get(), str.c_str(), str.length());
  722|  5.61k|    return result;
  723|  5.61k|}
_ZN5QUtil10hex_encodeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  727|  49.1k|{
  728|  49.1k|    static auto constexpr hexchars = "0123456789abcdef";
  729|  49.1k|    std::string result;
  730|  49.1k|    result.reserve(2 * input.length());
  731|  15.1M|    for (const char c: input) {
  ------------------
  |  Branch (731:22): [True: 15.1M, False: 49.1k]
  ------------------
  732|  15.1M|        result += hexchars[static_cast<unsigned char>(c) >> 4];
  733|  15.1M|        result += hexchars[c & 0x0f];
  734|  15.1M|    }
  735|  49.1k|    return result;
  736|  49.1k|}
_ZN5QUtil7get_envERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPS6_:
  812|      1|{
  813|       |    // This was basically ripped out of wxWindows.
  814|       |#ifdef _WIN32
  815|       |# ifdef NO_GET_ENVIRONMENT
  816|       |    return false;
  817|       |# else
  818|       |    // first get the size of the buffer
  819|       |    DWORD len = ::GetEnvironmentVariable(var.c_str(), NULL, 0);
  820|       |    if (len == 0) {
  821|       |        // this means that there is no such variable
  822|       |        return false;
  823|       |    }
  824|       |
  825|       |    if (value) {
  826|       |        auto t = QUtil::make_shared_array<char>(len + 1);
  827|       |        ::GetEnvironmentVariable(var.c_str(), t.get(), len);
  828|       |        *value = t.get();
  829|       |    }
  830|       |
  831|       |    return true;
  832|       |# endif
  833|       |#else
  834|      1|    char* p = getenv(var.c_str());
  835|      1|    if (p == nullptr) {
  ------------------
  |  Branch (835:9): [True: 1, False: 0]
  ------------------
  836|      1|        return false;
  837|      1|    }
  838|      0|    if (value) {
  ------------------
  |  Branch (838:9): [True: 0, False: 0]
  ------------------
  839|      0|        *value = p;
  840|      0|    }
  841|       |
  842|      0|    return true;
  843|      1|#endif
  844|      1|}
_ZN5QUtil6toUTF8Em:
 1004|   300M|{
 1005|   300M|    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|   300M|    if (uval > 0x7fffffff) {
  ------------------
  |  Branch (1014:9): [True: 0, False: 300M]
  ------------------
 1015|      0|        throw std::runtime_error("bounds error in QUtil::toUTF8");
 1016|   300M|    } else if (uval < 128) {
  ------------------
  |  Branch (1016:16): [True: 133M, False: 167M]
  ------------------
 1017|   133M|        result += static_cast<char>(uval);
 1018|   167M|    } else {
 1019|   167M|        unsigned char bytes[7];
 1020|   167M|        bytes[6] = '\0';
 1021|   167M|        unsigned char* cur_byte = &bytes[5];
 1022|       |
 1023|       |        // maximum value that will fit in the current number of bytes
 1024|   167M|        unsigned char maxval = 0x3f; // six bits
 1025|       |
 1026|   461M|        while (uval > QIntC::to_ulong(maxval)) {
  ------------------
  |  Branch (1026:16): [True: 294M, False: 167M]
  ------------------
 1027|       |            // Assign low six bits plus 10000000 to lowest unused byte position, then shift
 1028|   294M|            *cur_byte = static_cast<unsigned char>(0x80 + (uval & 0x3f));
 1029|   294M|            uval >>= 6;
 1030|       |            // Maximum that will fit in high byte now shrinks by one bit
 1031|   294M|            maxval = static_cast<unsigned char>(maxval >> 1);
 1032|       |            // Slide to the left one byte
 1033|   294M|            if (cur_byte <= bytes) {
  ------------------
  |  Branch (1033:17): [True: 0, False: 294M]
  ------------------
 1034|      0|                throw std::logic_error("QUtil::toUTF8: overflow error");
 1035|      0|            }
 1036|   294M|            --cur_byte;
 1037|   294M|        }
 1038|       |        // If maxval is k bits long, the high (7 - k) bits of the resulting byte must be high.
 1039|   167M|        *cur_byte = static_cast<unsigned char>(QIntC::to_ulong(0xff - (1 + (maxval << 1))) + uval);
 1040|       |
 1041|   167M|        result += reinterpret_cast<char*>(cur_byte);
 1042|   167M|    }
 1043|       |
 1044|   300M|    return result;
 1045|   300M|}
_ZN5QUtil7toUTF16Em:
 1049|   490k|{
 1050|   490k|    std::string result;
 1051|   490k|    if ((uval >= 0xd800) && (uval <= 0xdfff)) {
  ------------------
  |  Branch (1051:9): [True: 13.8k, False: 476k]
  |  Branch (1051:29): [True: 608, False: 13.2k]
  ------------------
 1052|    608|        result = "\xff\xfd";
 1053|   490k|    } else if (uval <= 0xffff) {
  ------------------
  |  Branch (1053:16): [True: 489k, False: 873]
  ------------------
 1054|   489k|        char out[2];
 1055|   489k|        out[0] = static_cast<char>((uval & 0xff00) >> 8);
 1056|   489k|        out[1] = static_cast<char>(uval & 0xff);
 1057|   489k|        result = std::string(out, 2);
 1058|   489k|    } else if (uval <= 0x10ffff) {
  ------------------
  |  Branch (1058:16): [True: 431, False: 442]
  ------------------
 1059|    431|        char out[4];
 1060|    431|        uval -= 0x10000;
 1061|    431|        unsigned short high = static_cast<unsigned short>(((uval & 0xffc00) >> 10) + 0xd800);
 1062|    431|        unsigned short low = static_cast<unsigned short>((uval & 0x3ff) + 0xdc00);
 1063|    431|        out[0] = static_cast<char>((high & 0xff00) >> 8);
 1064|    431|        out[1] = static_cast<char>(high & 0xff);
 1065|    431|        out[2] = static_cast<char>((low & 0xff00) >> 8);
 1066|    431|        out[3] = static_cast<char>(low & 0xff);
 1067|    431|        result = std::string(out, 4);
 1068|    442|    } else {
 1069|    442|        result = "\xff\xfd";
 1070|    442|    }
 1071|       |
 1072|   490k|    return result;
 1073|   490k|}
_ZN5QUtil21getRandomDataProviderEv:
 1126|    463|{
 1127|    463|    return getRandomDataProviderProvider()->getProvider();
 1128|    463|}
_ZN5QUtil25initializeWithRandomBytesEPhm:
 1132|    463|{
 1133|    463|    getRandomDataProvider()->provideRandomData(data, len);
 1134|    463|}
_ZN5QUtil23get_next_utf8_codepointERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERmRb:
 1479|  51.4M|{
 1480|  51.4M|    auto o_pos = pos;
 1481|  51.4M|    size_t len = utf8_val.length();
 1482|  51.4M|    unsigned char ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1483|  51.4M|    error = false;
 1484|  51.4M|    if (ch < 128) {
  ------------------
  |  Branch (1484:9): [True: 18.6M, False: 32.7M]
  ------------------
 1485|  18.6M|        return static_cast<unsigned long>(ch);
 1486|  18.6M|    }
 1487|       |
 1488|  32.7M|    size_t bytes_needed = 0;
 1489|  32.7M|    unsigned bit_check = 0x40;
 1490|  32.7M|    unsigned char to_clear = 0x80;
 1491|  80.5M|    while (ch & bit_check) {
  ------------------
  |  Branch (1491:12): [True: 47.7M, False: 32.7M]
  ------------------
 1492|  47.7M|        ++bytes_needed;
 1493|  47.7M|        to_clear = static_cast<unsigned char>(to_clear | bit_check);
 1494|  47.7M|        bit_check >>= 1;
 1495|  47.7M|    }
 1496|  32.7M|    if (((bytes_needed > 5) || (bytes_needed < 1)) || ((pos + bytes_needed) > len)) {
  ------------------
  |  Branch (1496:10): [True: 83.4k, False: 32.6M]
  |  Branch (1496:32): [True: 2.71M, False: 29.9M]
  |  Branch (1496:55): [True: 111, False: 29.9M]
  ------------------
 1497|  2.79M|        error = true;
 1498|  2.79M|        return 0xfffd;
 1499|  2.79M|    }
 1500|       |
 1501|  29.9M|    auto codepoint = static_cast<unsigned long>(ch & ~to_clear);
 1502|  61.0M|    while (bytes_needed > 0) {
  ------------------
  |  Branch (1502:12): [True: 43.5M, False: 17.5M]
  ------------------
 1503|  43.5M|        --bytes_needed;
 1504|  43.5M|        ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1505|  43.5M|        if ((ch & 0xc0) != 0x80) {
  ------------------
  |  Branch (1505:13): [True: 12.3M, False: 31.1M]
  ------------------
 1506|  12.3M|            --pos;
 1507|  12.3M|            error = true;
 1508|  12.3M|            return 0xfffd;
 1509|  12.3M|        }
 1510|  31.1M|        codepoint <<= 6;
 1511|  31.1M|        codepoint += (ch & 0x3f);
 1512|  31.1M|    }
 1513|  17.5M|    unsigned long lower_bound = 0;
 1514|  17.5M|    switch (pos - o_pos) {
 1515|  4.03M|    case 2:
  ------------------
  |  Branch (1515:5): [True: 4.03M, False: 13.5M]
  ------------------
 1516|  4.03M|        lower_bound = 1 << 7;
 1517|  4.03M|        break;
 1518|  13.5M|    case 3:
  ------------------
  |  Branch (1518:5): [True: 13.5M, False: 4.03M]
  ------------------
 1519|  13.5M|        lower_bound = 1 << 11;
 1520|  13.5M|        break;
 1521|  1.15k|    case 4:
  ------------------
  |  Branch (1521:5): [True: 1.15k, False: 17.5M]
  ------------------
 1522|  1.15k|        lower_bound = 1 << 16;
 1523|  1.15k|        break;
 1524|  1.23k|    case 5:
  ------------------
  |  Branch (1524:5): [True: 1.23k, False: 17.5M]
  ------------------
 1525|  1.23k|        lower_bound = 1 << 12;
 1526|  1.23k|        break;
 1527|    448|    case 6:
  ------------------
  |  Branch (1527:5): [True: 448, False: 17.5M]
  ------------------
 1528|    448|        lower_bound = 1 << 26;
 1529|    448|        break;
 1530|      0|    default:
  ------------------
  |  Branch (1530:5): [True: 0, False: 17.5M]
  ------------------
 1531|      0|        lower_bound = 0;
 1532|  17.5M|    }
 1533|       |
 1534|  17.5M|    if (lower_bound > 0 && codepoint < lower_bound) {
  ------------------
  |  Branch (1534:9): [True: 17.5M, False: 0]
  |  Branch (1534:28): [True: 358, False: 17.5M]
  ------------------
 1535|       |        // Too many bytes were used, but return whatever character was encoded.
 1536|    358|        error = true;
 1537|    358|    }
 1538|  17.5M|    return codepoint;
 1539|  17.5M|}
_ZN5QUtil13utf8_to_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1637|    503|{
 1638|    503|    return transcode_utf8(utf8, e_utf16, 0);
 1639|    503|}
_ZN5QUtil13utf8_to_asciiERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1643|  27.4k|{
 1644|  27.4k|    return transcode_utf8(utf8, e_ascii, unknown_char);
 1645|  27.4k|}
_ZN5QUtil16utf8_to_win_ansiERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1649|    494|{
 1650|    494|    return transcode_utf8(utf8, e_winansi, unknown_char);
 1651|    494|}
_ZN5QUtil17utf8_to_mac_romanERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1655|     47|{
 1656|     47|    return transcode_utf8(utf8, e_macroman, unknown_char);
 1657|     47|}
_ZN5QUtil15utf8_to_pdf_docERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_c:
 1685|  65.4k|{
 1686|  65.4k|    return transcode_utf8(utf8, pdfdoc, e_pdfdoc, unknown_char);
 1687|  65.4k|}
_ZN5QUtil8is_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1691|  45.3k|{
 1692|  45.3k|    return util::is_utf16(val);
 1693|  45.3k|}
_ZN5QUtil13utf16_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1703|  45.3k|{
 1704|  45.3k|    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|  45.3k|    unsigned long codepoint = 0L;
 1709|  45.3k|    size_t len = val.length();
 1710|  45.3k|    size_t start = 0;
 1711|  45.3k|    bool is_le = false;
 1712|  45.3k|    if (is_utf16(val)) {
  ------------------
  |  Branch (1712:9): [True: 45.3k, False: 0]
  ------------------
 1713|  45.3k|        if (static_cast<unsigned char>(val.at(0)) == 0xff) {
  ------------------
  |  Branch (1713:13): [True: 1.08k, False: 44.2k]
  ------------------
 1714|  1.08k|            is_le = true;
 1715|  1.08k|        }
 1716|  45.3k|        start += 2;
 1717|  45.3k|    }
 1718|       |    // If the string has an odd number of bytes, the last byte is ignored.
 1719|  64.9M|    for (size_t i = start; i + 1 < len; i += 2) {
  ------------------
  |  Branch (1719:28): [True: 64.8M, False: 45.3k]
  ------------------
 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|  64.8M|        auto msb = is_le ? i + 1 : i;
  ------------------
  |  Branch (1724:20): [True: 219k, False: 64.6M]
  ------------------
 1725|  64.8M|        auto lsb = is_le ? i : i + 1;
  ------------------
  |  Branch (1725:20): [True: 219k, False: 64.6M]
  ------------------
 1726|  64.8M|        unsigned short bits = QIntC::to_ushort(
 1727|  64.8M|            (static_cast<unsigned char>(val.at(msb)) << 8) +
 1728|  64.8M|            static_cast<unsigned char>(val.at(lsb)));
 1729|  64.8M|        if ((bits & 0xFC00) == 0xD800) {
  ------------------
  |  Branch (1729:13): [True: 4.60k, False: 64.8M]
  ------------------
 1730|  4.60k|            codepoint = 0x10000U + ((bits & 0x3FFU) << 10U);
 1731|  4.60k|            continue;
 1732|  64.8M|        } else if ((bits & 0xFC00) == 0xDC00) {
  ------------------
  |  Branch (1732:20): [True: 68.6k, False: 64.7M]
  ------------------
 1733|  68.6k|            if (codepoint != 0) {
  ------------------
  |  Branch (1733:17): [True: 685, False: 68.0k]
  ------------------
 1734|    685|                QTC::TC("qpdf", "QUtil non-trivial UTF-16");
 1735|    685|            }
 1736|  68.6k|            codepoint += bits & 0x3FF;
 1737|  64.7M|        } else {
 1738|  64.7M|            codepoint = bits;
 1739|  64.7M|        }
 1740|       |
 1741|  64.8M|        result += QUtil::toUTF8(codepoint);
 1742|  64.8M|        codepoint = 0;
 1743|  64.8M|    }
 1744|  45.3k|    return result;
 1745|  45.3k|}
_ZN5QUtil15pdf_doc_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1781|   482k|{
 1782|   482k|    std::string result;
 1783|   482k|    size_t len = val.length();
 1784|   228M|    for (unsigned int i = 0; i < len; ++i) {
  ------------------
  |  Branch (1784:30): [True: 228M, False: 482k]
  ------------------
 1785|   228M|        unsigned char ch = static_cast<unsigned char>(val.at(i));
 1786|   228M|        unsigned short ch_short = ch;
 1787|   228M|        if ((ch >= 127) && (ch <= 160)) {
  ------------------
  |  Branch (1787:13): [True: 102M, False: 126M]
  |  Branch (1787:28): [True: 63.7M, False: 38.5M]
  ------------------
 1788|  63.7M|            ch_short = pdf_doc_to_unicode[ch - 127];
 1789|   164M|        } else if ((ch >= 24) && (ch <= 31)) {
  ------------------
  |  Branch (1789:20): [True: 132M, False: 31.8M]
  |  Branch (1789:34): [True: 877k, False: 131M]
  ------------------
 1790|   877k|            ch_short = pdf_doc_low_to_unicode[ch - 24];
 1791|   163M|        } else if (ch == 173) {
  ------------------
  |  Branch (1791:20): [True: 123k, False: 163M]
  ------------------
 1792|   123k|            ch_short = 0xfffd;
 1793|   123k|        }
 1794|   228M|        result += QUtil::toUTF8(ch_short);
 1795|   228M|    }
 1796|   482k|    return result;
 1797|   482k|}
QUtil.cc:_ZL29getRandomDataProviderProviderv:
 1112|    463|{
 1113|       |    // Thread-safe static initializer
 1114|    463|    static RandomDataProviderProvider rdpp;
 1115|    463|    return &rdpp;
 1116|    463|}
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|    463|{
 1101|    463|    return this->current_provider;
 1102|    463|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE10encoding_ec:
 1629|  28.4k|{
 1630|  28.4k|    std::string result;
 1631|  28.4k|    transcode_utf8(utf8_val, result, encoding, unknown);
 1632|  28.4k|    return result;
 1633|  28.4k|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERS5_10encoding_ec:
 1543|  93.9k|{
 1544|  93.9k|    bool okay = true;
 1545|  93.9k|    result.clear();
 1546|  93.9k|    size_t len = utf8_val.length();
 1547|  93.9k|    switch (encoding) {
 1548|    503|    case e_utf16:
  ------------------
  |  Branch (1548:5): [True: 503, False: 93.4k]
  ------------------
 1549|    503|        result += "\xfe\xff";
 1550|    503|        break;
 1551|  65.4k|    case e_pdfdoc:
  ------------------
  |  Branch (1551:5): [True: 65.4k, False: 28.4k]
  ------------------
 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|  65.4k|        if ((len >= 4) && (utf8_val[0] == '\xc3')) {
  ------------------
  |  Branch (1558:13): [True: 27.4k, False: 38.0k]
  |  Branch (1558:27): [True: 997, False: 26.4k]
  ------------------
 1559|    997|            static std::string fe_ff("\xbe\xc3\xbf");
 1560|    997|            static std::string ff_fe("\xbf\xc3\xbe");
 1561|    997|            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|    997|            if ((utf8_val.compare(1, 3, fe_ff) == 0) || (utf8_val.compare(1, 3, ff_fe) == 0) ||
  ------------------
  |  Branch (1564:17): [True: 0, False: 997]
  |  Branch (1564:57): [True: 0, False: 997]
  ------------------
 1565|    997|                (utf8_val.compare(1, 5, ef_bb_bf) == 0)) {
  ------------------
  |  Branch (1565:17): [True: 0, False: 997]
  ------------------
 1566|      0|                result += unknown;
 1567|      0|                okay = false;
 1568|      0|            }
 1569|    997|        }
 1570|  65.4k|        break;
 1571|  27.9k|    default:
  ------------------
  |  Branch (1571:5): [True: 27.9k, False: 65.9k]
  ------------------
 1572|  27.9k|        break;
 1573|  93.9k|    }
 1574|  93.9k|    size_t pos = 0;
 1575|  51.5M|    while (pos < len) {
  ------------------
  |  Branch (1575:12): [True: 51.4M, False: 93.9k]
  ------------------
 1576|  51.4M|        bool error = false;
 1577|  51.4M|        unsigned long codepoint = QUtil::get_next_utf8_codepoint(utf8_val, pos, error);
 1578|  51.4M|        if (error) {
  ------------------
  |  Branch (1578:13): [True: 15.1M, False: 36.2M]
  ------------------
 1579|  15.1M|            okay = false;
 1580|  15.1M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1580:17): [True: 6.19M, False: 8.98M]
  ------------------
 1581|  6.19M|                result += "\xff\xfd";
 1582|  8.98M|            } else {
 1583|  8.98M|                result.append(1, unknown);
 1584|  8.98M|            }
 1585|  36.2M|        } else if (codepoint < 128) {
  ------------------
  |  Branch (1585:20): [True: 18.6M, False: 17.5M]
  ------------------
 1586|  18.6M|            char ch = static_cast<char>(codepoint);
 1587|  18.6M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1587:17): [True: 370k, False: 18.2M]
  ------------------
 1588|   370k|                result += QUtil::toUTF16(QIntC::to_ulong(ch));
 1589|  18.2M|            } else if ((encoding == e_pdfdoc) && (((ch >= 0x18) && (ch <= 0x1f)) || (ch == 127))) {
  ------------------
  |  Branch (1589:24): [True: 15.4M, False: 2.83M]
  |  Branch (1589:52): [True: 8.11M, False: 7.34M]
  |  Branch (1589:68): [True: 2.53k, False: 8.11M]
  |  Branch (1589:85): [True: 3.63k, False: 15.4M]
  ------------------
 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|  6.16k|                okay = false;
 1594|  6.16k|                result.append(1, unknown);
 1595|  18.2M|            } else {
 1596|  18.2M|                result.append(1, ch);
 1597|  18.2M|            }
 1598|  18.6M|        } else if (encoding == e_utf16) {
  ------------------
  |  Branch (1598:20): [True: 119k, False: 17.4M]
  ------------------
 1599|   119k|            result += QUtil::toUTF16(codepoint);
 1600|  17.4M|        } else if ((codepoint == 0xad) && (encoding == e_pdfdoc)) {
  ------------------
  |  Branch (1600:20): [True: 449, False: 17.4M]
  |  Branch (1600:43): [True: 203, False: 246]
  ------------------
 1601|       |            // PDFDocEncoding omits 0x00ad (soft hyphen).
 1602|    203|            okay = false;
 1603|    203|            result.append(1, unknown);
 1604|  17.4M|        } else if (
 1605|  17.4M|            (codepoint > 160) && (codepoint < 256) &&
  ------------------
  |  Branch (1605:13): [True: 17.4M, False: 234]
  |  Branch (1605:34): [True: 3.94M, False: 13.4M]
  ------------------
 1606|  3.94M|            ((encoding == e_winansi) || (encoding == e_pdfdoc))) {
  ------------------
  |  Branch (1606:14): [True: 545, False: 3.94M]
  |  Branch (1606:41): [True: 126k, False: 3.82M]
  ------------------
 1607|   126k|            result.append(1, static_cast<char>(codepoint & 0xff));
 1608|  17.3M|        } else {
 1609|  17.3M|            unsigned char ch = '\0';
 1610|  17.3M|            if (encoding == e_winansi) {
  ------------------
  |  Branch (1610:17): [True: 1.37k, False: 17.3M]
  ------------------
 1611|  1.37k|                ch = encode_winansi(codepoint);
 1612|  17.3M|            } else if (encoding == e_macroman) {
  ------------------
  |  Branch (1612:24): [True: 608, False: 17.3M]
  ------------------
 1613|    608|                ch = encode_macroman(codepoint);
 1614|  17.3M|            } else if (encoding == e_pdfdoc) {
  ------------------
  |  Branch (1614:24): [True: 5.61M, False: 11.7M]
  ------------------
 1615|  5.61M|                ch = encode_pdfdoc(codepoint);
 1616|  5.61M|            }
 1617|  17.3M|            if (ch == '\0') {
  ------------------
  |  Branch (1617:17): [True: 11.8M, False: 5.50M]
  ------------------
 1618|  11.8M|                okay = false;
 1619|  11.8M|                ch = static_cast<unsigned char>(unknown);
 1620|  11.8M|            }
 1621|  17.3M|            result.append(1, static_cast<char>(ch));
 1622|  17.3M|        }
 1623|  51.4M|    }
 1624|  93.9k|    return okay;
 1625|  93.9k|}
QUtil.cc:_ZL14encode_winansim:
 1449|  1.37k|{
 1450|  1.37k|    auto i = unicode_to_win_ansi.find(codepoint);
 1451|  1.37k|    if (i != unicode_to_win_ansi.end()) {
  ------------------
  |  Branch (1451:9): [True: 619, False: 758]
  ------------------
 1452|    619|        return i->second;
 1453|    619|    }
 1454|    758|    return '\0';
 1455|  1.37k|}
QUtil.cc:_ZL15encode_macromanm:
 1459|    608|{
 1460|    608|    auto i = unicode_to_mac_roman.find(codepoint);
 1461|    608|    if (i != unicode_to_mac_roman.end()) {
  ------------------
  |  Branch (1461:9): [True: 378, False: 230]
  ------------------
 1462|    378|        return i->second;
 1463|    378|    }
 1464|    230|    return '\0';
 1465|    608|}
QUtil.cc:_ZL13encode_pdfdocm:
 1469|  5.61M|{
 1470|  5.61M|    auto i = unicode_to_pdf_doc.find(codepoint);
 1471|  5.61M|    if (i != unicode_to_pdf_doc.end()) {
  ------------------
  |  Branch (1471:9): [True: 5.49M, False: 111k]
  ------------------
 1472|  5.49M|        return i->second;
 1473|  5.49M|    }
 1474|   111k|    return '\0';
 1475|  5.61M|}
QUtil.cc:_ZL27int_to_string_base_internalIxENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEET_ii:
  300|  62.5k|{
  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|  62.5k|    if (!((base == 8) || (base == 10) || (base == 16))) {
  ------------------
  |  Branch (304:11): [True: 62.5k, 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|  62.5k|    std::string cvt;
  308|  62.5k|    if (base == 10) {
  ------------------
  |  Branch (308:9): [True: 0, False: 62.5k]
  ------------------
  309|       |        // Use the more efficient std::to_string when possible
  310|      0|        cvt = std::to_string(num);
  311|  62.5k|    } else {
  312|  62.5k|        std::ostringstream buf;
  313|  62.5k|        buf.imbue(std::locale::classic());
  314|  62.5k|        buf << std::setbase(base) << std::nouppercase << num;
  315|  62.5k|        cvt = buf.str();
  316|  62.5k|    }
  317|  62.5k|    std::string result;
  318|  62.5k|    int str_length = QIntC::to_int(cvt.length());
  319|  62.5k|    if ((length > 0) && (str_length < length)) {
  ------------------
  |  Branch (319:9): [True: 62.5k, False: 0]
  |  Branch (319:25): [True: 5.67k, False: 56.8k]
  ------------------
  320|  5.67k|        result.append(QIntC::to_size(length - str_length), '0');
  321|  5.67k|    }
  322|  62.5k|    result += cvt;
  323|  62.5k|    if ((length < 0) && (str_length < -length)) {
  ------------------
  |  Branch (323:9): [True: 0, False: 62.5k]
  |  Branch (323:25): [True: 0, False: 0]
  ------------------
  324|      0|        result.append(QIntC::to_size(-length - str_length), ' ');
  325|      0|    }
  326|  62.5k|    return result;
  327|  62.5k|}

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

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

_ZN17SF_FlateLzwDecode14setDecodeParmsE16QPDFObjectHandle:
   13|  21.4k|{
   14|  21.4k|    if (decode_parms.null()) {
  ------------------
  |  Branch (14:9): [True: 17.5k, False: 3.94k]
  ------------------
   15|  17.5k|        return true;
   16|  17.5k|    }
   17|       |
   18|  3.94k|    auto memory_limit = Pl_Flate::memory_limit();
   19|       |
   20|  3.94k|    std::set<std::string> keys = decode_parms.getKeys();
   21|  9.05k|    for (auto const& key: keys) {
  ------------------
  |  Branch (21:25): [True: 9.05k, False: 3.80k]
  ------------------
   22|  9.05k|        QPDFObjectHandle value = decode_parms.getKey(key);
   23|  9.05k|        if (key == "/Predictor") {
  ------------------
  |  Branch (23:13): [True: 2.44k, False: 6.60k]
  ------------------
   24|  2.44k|            if (value.isInteger()) {
  ------------------
  |  Branch (24:17): [True: 2.43k, False: 14]
  ------------------
   25|  2.43k|                predictor = value.getIntValueAsInt();
   26|  2.43k|                if (!(predictor == 1 || predictor == 2 || (predictor >= 10 && predictor <= 15))) {
  ------------------
  |  Branch (26:23): [True: 68, False: 2.36k]
  |  Branch (26:41): [True: 822, False: 1.54k]
  |  Branch (26:60): [True: 1.50k, False: 43]
  |  Branch (26:79): [True: 1.48k, False: 15]
  ------------------
   27|     58|                    return false;
   28|     58|                }
   29|  2.43k|            } else {
   30|     14|                return false;
   31|     14|            }
   32|  6.60k|        } else if (key == "/Columns" || key == "/Colors" || key == "/BitsPerComponent") {
  ------------------
  |  Branch (32:20): [True: 1.20k, False: 5.40k]
  |  Branch (32:41): [True: 368, False: 5.03k]
  |  Branch (32:61): [True: 494, False: 4.54k]
  ------------------
   33|  2.06k|            if (value.isInteger()) {
  ------------------
  |  Branch (33:17): [True: 2.05k, False: 10]
  ------------------
   34|  2.05k|                int val = value.getIntValueAsInt();
   35|  2.05k|                if (memory_limit && static_cast<unsigned int>(val) > memory_limit) {
  ------------------
  |  Branch (35:21): [True: 2.05k, False: 1]
  |  Branch (35:37): [True: 17, False: 2.03k]
  ------------------
   36|     17|                    QPDFLogger::defaultLogger()->warn(
   37|     17|                        "SF_FlateLzwDecode parameter exceeds PL_Flate memory limit\n");
   38|     17|                    return false;
   39|     17|                }
   40|  2.03k|                if (key == "/Columns") {
  ------------------
  |  Branch (40:21): [True: 1.17k, False: 861]
  ------------------
   41|  1.17k|                    columns = val;
   42|  1.17k|                } else if (key == "/Colors") {
  ------------------
  |  Branch (42:28): [True: 367, False: 494]
  ------------------
   43|    367|                    colors = val;
   44|    494|                } else if (key == "/BitsPerComponent") {
  ------------------
  |  Branch (44:28): [True: 493, False: 1]
  ------------------
   45|    493|                    bits_per_component = val;
   46|    493|                }
   47|  2.03k|            } else {
   48|     10|                return false;
   49|     10|            }
   50|  4.54k|        } else if (lzw && (key == "/EarlyChange")) {
  ------------------
  |  Branch (50:20): [True: 4.07k, False: 464]
  |  Branch (50:27): [True: 212, False: 3.86k]
  ------------------
   51|    212|            if (value.isInteger()) {
  ------------------
  |  Branch (51:17): [True: 207, False: 5]
  ------------------
   52|    207|                int earlychange = value.getIntValueAsInt();
   53|    207|                early_code_change = (earlychange == 1);
   54|    207|                if (!(earlychange == 0 || earlychange == 1)) {
  ------------------
  |  Branch (54:23): [True: 98, False: 109]
  |  Branch (54:43): [True: 67, False: 42]
  ------------------
   55|     42|                    return false;
   56|     42|                }
   57|    207|            } else {
   58|      5|                return false;
   59|      5|            }
   60|    212|        }
   61|  9.05k|    }
   62|       |
   63|  3.80k|    if (predictor > 1 && columns == 0) {
  ------------------
  |  Branch (63:9): [True: 2.30k, False: 1.49k]
  |  Branch (63:26): [True: 6, False: 2.30k]
  ------------------
   64|      6|        return false;
   65|      6|    }
   66|       |
   67|  3.79k|    return true;
   68|  3.80k|}
_ZN17SF_FlateLzwDecode17getDecodePipelineEP8Pipeline:
   72|  21.3k|{
   73|  21.3k|    std::unique_ptr<Pipeline> pipeline;
   74|  21.3k|    if (predictor >= 10 && predictor <= 15) {
  ------------------
  |  Branch (74:9): [True: 1.47k, False: 19.8k]
  |  Branch (74:28): [True: 1.47k, False: 0]
  ------------------
   75|  1.47k|        QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter");
   76|  1.47k|        pipeline = std::make_unique<Pl_PNGFilter>(
   77|  1.47k|            "png decode",
   78|  1.47k|            next,
   79|  1.47k|            Pl_PNGFilter::a_decode,
   80|  1.47k|            QIntC::to_uint(columns),
   81|  1.47k|            QIntC::to_uint(colors),
   82|  1.47k|            QIntC::to_uint(bits_per_component));
   83|  1.47k|        next = pipeline.get();
   84|  1.47k|        pipelines.push_back(std::move(pipeline));
   85|  19.8k|    } else if (predictor == 2) {
  ------------------
  |  Branch (85:16): [True: 816, False: 19.0k]
  ------------------
   86|    816|        QTC::TC("qpdf", "SF_FlateLzwDecode TIFF predictor");
   87|    816|        pipeline = std::make_unique<Pl_TIFFPredictor>(
   88|    816|            "tiff decode",
   89|    816|            next,
   90|    816|            Pl_TIFFPredictor::a_decode,
   91|    816|            QIntC::to_uint(columns),
   92|    816|            QIntC::to_uint(colors),
   93|    816|            QIntC::to_uint(bits_per_component));
   94|    816|        next = pipeline.get();
   95|    816|        pipelines.push_back(std::move(pipeline));
   96|    816|    }
   97|       |
   98|  21.3k|    if (lzw) {
  ------------------
  |  Branch (98:9): [True: 3.35k, False: 17.9k]
  ------------------
   99|  3.35k|        pipeline = std::make_unique<Pl_LZWDecoder>("lzw decode", next, early_code_change);
  100|  17.9k|    } else {
  101|  17.9k|        pipeline = std::make_unique<Pl_Flate>("stream inflate", next, Pl_Flate::a_inflate);
  102|  17.9k|    }
  103|  21.3k|    next = pipeline.get();
  104|  21.3k|    pipelines.push_back(std::move(pipeline));
  105|  21.3k|    return next;
  106|  21.3k|}

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

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

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

_ZN4qpdf4impl8AcroFormC2ERN4QPDF3DocE:
   38|  15.6k|            Common(doc)
   39|  15.6k|        {
   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|  15.6k|            validate();
   44|  15.6k|        }
_ZN4qpdf4impl8FormNodeC2ERK16QPDFObjectHandle:
  352|   141k|            BaseDictionary(oh)
  353|   141k|        {
  354|   141k|        }
_ZNK4qpdf4impl8FormNode2APEv:
  372|  11.9k|        {
  373|  11.9k|            return {get("/AP")};
  374|  11.9k|        }
_ZN4qpdf4impl8FormNode6ParentEv:
  386|  74.7k|        {
  387|  74.7k|            return {get("/Parent")};
  388|  74.7k|        }
_ZNK4qpdf4impl8FormNode4KidsEv:
  400|  32.2k|        {
  401|  32.2k|            return {get("/Kids")};
  402|  32.2k|        }
_ZNK4qpdf4impl8FormNode2FTEb:
  470|  34.6k|        {
  471|  34.6k|            return inheritable_value<Name>("/FT");
  472|  34.6k|        }
_ZNK4qpdf4impl8FormNode1TEv:
  480|  62.2k|        {
  481|  62.2k|            return {get("/T")};
  482|  62.2k|        }
_ZNK4qpdf4impl8FormNode5fieldEv:
  660|  14.0k|        {
  661|  14.0k|            return T() || Kids() || FT();
  ------------------
  |  Branch (661:20): [True: 9.58k, False: 4.48k]
  |  Branch (661:27): [True: 807, False: 3.67k]
  |  Branch (661:37): [True: 1.49k, False: 2.18k]
  ------------------
  662|  14.0k|        }
_ZNK4qpdf4impl8FormNode6widgetEv:
  680|  14.0k|        {
  681|  14.0k|            return !Kids() && (contains("/Subtype") || contains("/Rect") || contains("/AP"));
  ------------------
  |  Branch (681:20): [True: 10.9k, False: 3.11k]
  |  Branch (681:32): [True: 7.91k, False: 3.04k]
  |  Branch (681:56): [True: 284, False: 2.76k]
  |  Branch (681:77): [True: 355, False: 2.40k]
  ------------------
  682|  14.0k|        }
_ZNK4qpdf4impl8FormNode13from_AcroFormERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  767|  15.3k|        {
  768|  15.3k|            return {qpdf() ? qpdf()->getRoot()["/AcroForm"][name] : null_oh};
  ------------------
  |  Branch (768:21): [True: 14.2k, False: 1.04k]
  ------------------
  769|  15.3k|        }
_ZN26QPDFAcroFormDocumentHelper7MembersC2ER4QPDF:
  790|  15.6k|        AcroForm(qpdf.doc())
  791|  15.6k|    {
  792|  15.6k|    }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_4NameEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  34.6k|        {
  449|  34.6k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 30.3k, False: 4.36k]
  ------------------
  450|  30.3k|                return {v};
  451|  30.3k|            }
  452|  4.36k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 4.36k, False: 0]
  ------------------
  453|  34.6k|        }
_ZN4qpdf4impl8AcroFormD2Ev:
   35|  15.6k|        ~AcroForm() = default;
_ZN4qpdf4impl8FormNodeC2ERKS1_:
  345|  25.7k|        FormNode(FormNode const&) = default;
_ZN4qpdf4impl8FormNodeaSEOS1_:
  348|  48.2k|        FormNode& operator=(FormNode&&) = default;
_ZNK4qpdf4impl8FormNode17inheritable_valueI16QPDFObjectHandleEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  5.28k|        {
  449|  5.28k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 1.53k, False: 3.74k]
  ------------------
  450|  1.53k|                return {v};
  451|  1.53k|            }
  452|  3.74k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 3.74k, False: 0]
  ------------------
  453|  5.28k|        }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_6StringEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  15.5k|        {
  449|  15.5k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 7.45k, False: 8.12k]
  ------------------
  450|  7.45k|                return {v};
  451|  7.45k|            }
  452|  8.12k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 8.12k, False: 0]
  ------------------
  453|  15.5k|        }
_ZNK4qpdf4impl8FormNode1VI16QPDFObjectHandleEET_b:
  564|    647|        {
  565|    647|            return inheritable_value<T>("/V", inherit);
  566|    647|        }
_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.11k, False: 1.00k]
  ------------------
  450|  1.11k|                return {v};
  451|  1.11k|            }
  452|  1.00k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 1.00k, False: 0]
  ------------------
  453|  2.11k|        }

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

_ZNK4qpdf2is12OffsetBuffer7getNameEv:
   48|   927k|        {
   49|   927k|            return description;
   50|   927k|        }
_ZN4qpdf2is12OffsetBuffer4tellEv:
   54|  96.9M|        {
   55|  96.9M|            return pos + global_offset;
   56|  96.9M|        }
_ZN4qpdf2is12OffsetBuffer8unreadChEc:
   70|  16.9k|        {
   71|  16.9k|            if (pos > 0) {
  ------------------
  |  Branch (71:17): [True: 16.9k, False: 0]
  ------------------
   72|  16.9k|                --pos;
   73|  16.9k|            }
   74|  16.9k|        }
_ZN4qpdf2is12OffsetBufferD2Ev:
   42|  99.1k|        ~OffsetBuffer() final = default;
_ZN4qpdf2is12OffsetBufferC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_17basic_string_viewIcS5_EEx:
   21|  99.1k|            description(description),
   22|  99.1k|            view_(view),
   23|  99.1k|            global_offset(global_offset)
   24|  99.1k|        {
   25|  99.1k|            if (global_offset < 0) {
  ------------------
  |  Branch (25:17): [True: 33, False: 99.1k]
  ------------------
   26|     33|                throw std::logic_error("is::OffsetBuffer constructed with negative offset");
   27|     33|            }
   28|  99.1k|            last_offset = global_offset;
   29|  99.1k|        }
_ZN11InputSource4readERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   87|  33.7k|{
   88|  33.7k|    if (at >= 0) {
  ------------------
  |  Branch (88:9): [True: 20.7k, False: 12.9k]
  ------------------
   89|       |        seek(at, SEEK_SET);
   90|  20.7k|    }
   91|  33.7k|    str.resize(count);
   92|  33.7k|    str.resize(read(str.data(), count));
   93|  33.7k|    return str.size();
   94|  33.7k|}
_ZN11InputSource4readEmx:
   98|  20.7k|{
   99|  20.7k|    std::string result(count, '\0');
  100|  20.7k|    (void)read(result, count, at);
  101|  20.7k|    return result;
  102|  20.7k|}
_ZN11InputSource10loadBufferEv:
  106|  5.23M|{
  107|  5.23M|    buf_idx = 0;
  108|  5.23M|    buf_len = qpdf_offset_t(read(buffer, buf_size));
  109|       |    // NB read sets last_offset
  110|  5.23M|    buf_start = last_offset;
  111|  5.23M|}
_ZN11InputSource8fastTellEv:
  115|  46.6M|{
  116|  46.6M|    if (buf_len == 0) {
  ------------------
  |  Branch (116:9): [True: 108k, False: 46.5M]
  ------------------
  117|   108k|        loadBuffer();
  118|  46.5M|    } else {
  119|  46.5M|        auto curr = tell();
  120|  46.5M|        if (curr < buf_start || curr >= (buf_start + buf_len)) {
  ------------------
  |  Branch (120:13): [True: 59.4k, False: 46.4M]
  |  Branch (120:33): [True: 5.07M, False: 41.4M]
  ------------------
  121|  5.13M|            loadBuffer();
  122|  41.4M|        } else {
  123|  41.4M|            last_offset = curr;
  124|  41.4M|            buf_idx = curr - buf_start;
  125|  41.4M|        }
  126|  46.5M|    }
  127|  46.6M|    return last_offset;
  128|  46.6M|}
_ZN11InputSource8fastReadERc:
  132|   664M|{
  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|   664M|    if (buf_idx < buf_len) {
  ------------------
  |  Branch (135:9): [True: 659M, False: 4.86M]
  ------------------
  136|   659M|        ch = buffer[buf_idx];
  137|   659M|        ++(buf_idx);
  138|   659M|        ++(last_offset);
  139|   659M|        return true;
  140|       |
  141|   659M|    } else if (buf_len == 0) {
  ------------------
  |  Branch (141:16): [True: 70.2k, False: 4.79M]
  ------------------
  142|  70.2k|        return false;
  143|  4.79M|    } else {
  144|       |        seek(buf_start + buf_len, SEEK_SET);
  145|  4.79M|        fastTell();
  146|  4.79M|        return fastRead(ch);
  147|  4.79M|    }
  148|   664M|}
_ZN11InputSource10fastUnreadEb:
  152|  41.8M|{
  153|  41.8M|    last_offset -= back ? 1 : 0;
  ------------------
  |  Branch (153:20): [True: 23.7M, False: 18.0M]
  ------------------
  154|       |    seek(last_offset, SEEK_SET);
  155|  41.8M|}

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

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

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

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

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

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

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

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

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

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

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

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

_ZNK4qpdf10BaseHandle13raw_type_codeEv:
  933|  69.9M|    {
  934|  69.9M|        return obj ? static_cast<qpdf_object_type_e>(obj->value.index()) : ::ot_uninitialized;
  ------------------
  |  Branch (934:16): [True: 69.9M, False: 0]
  ------------------
  935|  69.9M|    }
_ZNK4qpdf10BaseHandle4qpdfEv:
  927|   607k|    {
  928|   607k|        return obj ? obj->qpdf : nullptr;
  ------------------
  |  Branch (928:16): [True: 606k, False: 1.04k]
  ------------------
  929|   607k|    }
_ZNK4qpdf10BaseHandle6offsetEv:
  921|  48.0k|    {
  922|  48.0k|        return obj ? obj->parsed_offset : -1;
  ------------------
  |  Branch (922:16): [True: 48.0k, False: 0]
  ------------------
  923|  48.0k|    }
_ZNK4qpdf10BaseHandle9type_codeEv:
  951|  20.4M|    {
  952|  20.4M|        if (!obj) {
  ------------------
  |  Branch (952:13): [True: 165k, False: 20.2M]
  ------------------
  953|   165k|            return ::ot_uninitialized;
  954|   165k|        }
  955|  20.2M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (955:13): [True: 226k, False: 20.0M]
  ------------------
  956|   226k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  957|   226k|        }
  958|  20.0M|        if (raw_type_code() == ::ot_reference) {
  ------------------
  |  Branch (958:13): [True: 0, False: 20.0M]
  ------------------
  959|      0|            return std::get<QPDF_Reference>(obj->value).obj->getTypeCode();
  960|      0|        }
  961|  20.0M|        return raw_type_code();
  962|  20.0M|    }
_ZNK4qpdf10BaseHandle8indirectEv:
  860|  4.57M|    {
  861|  4.57M|        return obj ? obj->og.isIndirect() : false;
  ------------------
  |  Branch (861:16): [True: 4.57M, False: 2.91k]
  ------------------
  862|  4.57M|    }
_ZNK4qpdf10BaseHandle4nullEv:
  907|  1.19M|    {
  908|  1.19M|        return !obj || type_code() == ::ot_null;
  ------------------
  |  Branch (908:16): [True: 131k, False: 1.06M]
  |  Branch (908:24): [True: 256k, False: 803k]
  ------------------
  909|  1.19M|    }
_ZN4qpdf5ArrayC2ERK16QPDFObjectHandle:
   57|   597k|            BaseHandle(oh.resolved_type_code() == ::ot_array ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (57:24): [True: 520k, False: 76.8k]
  ------------------
   58|   597k|        {
   59|   597k|        }
_ZNK4qpdf10BaseHandle18resolved_type_codeEv:
  939|  3.17M|    {
  940|  3.17M|        if (!obj) {
  ------------------
  |  Branch (940:13): [True: 116k, False: 3.05M]
  ------------------
  941|   116k|            return ::ot_uninitialized;
  942|   116k|        }
  943|  3.05M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (943:13): [True: 1.87k, False: 3.05M]
  ------------------
  944|  1.87k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  945|  1.87k|        }
  946|  3.05M|        return raw_type_code();
  947|  3.05M|    }
_ZN4qpdf10BaseHandleC2ERK16QPDFObjectHandle:
  788|  2.06M|        obj(oh.obj)
  789|  2.06M|    {
  790|  2.06M|    }
_ZN4qpdf10DictionaryC2ERK16QPDFObjectHandle:
  268|   426k|            BaseDictionary(oh)
  269|   426k|        {
  270|   426k|        }
_ZN4qpdf14BaseDictionaryC2ERK16QPDFObjectHandle:
  238|   568k|            BaseHandle(oh.resolved_type_code() == ::ot_dictionary ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (238:24): [True: 486k, False: 82.1k]
  ------------------
  239|   568k|        {
  240|   568k|        }
_ZN4qpdf14BaseDictionary5beginEv:
  141|  80.3k|        {
  142|  80.3k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (142:22): [True: 53.3k, False: 27.0k]
  ------------------
  143|  53.3k|                return d->items.begin();
  144|  53.3k|            }
  145|  27.0k|            return {};
  146|  80.3k|        }
_ZNK4qpdf10BaseHandle2asI15QPDF_DictionaryEEPT_v:
  770|  2.35M|    {
  771|  2.35M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 47.8k, False: 2.30M]
  ------------------
  772|  47.8k|            return nullptr;
  773|  47.8k|        }
  774|  2.30M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 2.25M, False: 48.3k]
  ------------------
  775|  2.25M|            return &std::get<T>(obj->value);
  776|  2.25M|        }
  777|  48.3k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 179, False: 48.2k]
  ------------------
  778|    179|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|    179|        }
  780|  48.2k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 48.2k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  48.2k|        return nullptr;
  785|  48.2k|    }
_ZN4qpdf14BaseDictionary3endEv:
  150|  80.3k|        {
  151|  80.3k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (151:22): [True: 53.3k, False: 27.0k]
  ------------------
  152|  53.3k|                return d->items.end();
  153|  53.3k|            }
  154|  27.0k|            return {};
  155|  80.3k|        }
_ZNK4qpdf10BaseHandle6id_genEv:
  854|  1.26M|    {
  855|  1.26M|        return obj ? obj->og : QPDFObjGen();
  ------------------
  |  Branch (855:16): [True: 1.26M, False: 0]
  ------------------
  856|  1.26M|    }
_ZNK4qpdf6Stream7getDictEv:
  554|   109k|        {
  555|   109k|            return {stream()->stream_dict};
  556|   109k|        }
_ZNK4qpdf6Stream6streamEv:
  697|   297k|        {
  698|   297k|            if (auto s = as<QPDF_Stream>()) {
  ------------------
  |  Branch (698:22): [True: 297k, False: 0]
  ------------------
  699|   297k|                if (auto ptr = s->m.get()) {
  ------------------
  |  Branch (699:26): [True: 297k, False: 4]
  ------------------
  700|   297k|                    return ptr;
  701|   297k|                }
  702|      4|                throw std::logic_error("QPDF_Stream: unexpected nullptr");
  703|   297k|            }
  704|      0|            throw std::runtime_error("operation for stream attempted on non-stream object");
  705|      0|            return nullptr; // unreachable
  706|   297k|        }
_ZNK4qpdf10BaseHandle2asI11QPDF_StreamEEPT_v:
  770|   297k|    {
  771|   297k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 297k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   297k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 297k, False: 0]
  ------------------
  775|   297k|            return &std::get<T>(obj->value);
  776|   297k|        }
  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|   465k|            BaseHandle(oh.type_code() == ::ot_integer ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (319:24): [True: 148k, False: 317k]
  ------------------
  320|   465k|        {
  321|   465k|        }
_ZNK4qpdf7IntegercvbEv:
  330|   241k|        {
  331|   241k|            return obj != nullptr;
  332|   241k|        }
_ZN4qpdfeqERKNS_4NameENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  473|   270k|        {
  474|   270k|            return lhs && lhs.value() == rhs;
  ------------------
  |  Branch (474:20): [True: 206k, False: 63.7k]
  |  Branch (474:27): [True: 121k, False: 84.7k]
  ------------------
  475|   270k|        }
_ZN4qpdf4NameC2ERK16QPDFObjectHandle:
  449|   358k|            BaseHandle(oh.type_code() == ::ot_name ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (449:24): [True: 243k, False: 115k]
  ------------------
  450|   358k|        {
  451|   358k|        }
_ZNK4qpdf10BaseHandle2ohEv:
  805|   176k|    {
  806|   176k|        return {obj};
  807|   176k|    }
_ZN10QPDFObject6createI9QPDF_NullJEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|   629k|{
  989|   629k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   629k|}
_ZNK4qpdf7Integer5valueITkNSt3__18integralEiEET_v:
  361|  42.0k|        {
  362|  42.0k|            try {
  363|  42.0k|                return static_cast<T>(*this);
  364|  42.0k|            } catch (std::underflow_error&) {
  365|     73|                if constexpr (std::is_same_v<T, int>) {
  366|     73|                    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|     73|                return std::numeric_limits<T>::min();
  377|    116|            } catch (std::overflow_error&) {
  378|    116|                if constexpr (std::is_same_v<T, int>) {
  379|    116|                    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|    116|                return std::numeric_limits<T>::max();
  388|    116|            }
  389|  42.0k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEiEEv:
  339|  50.1k|        {
  340|  50.1k|            auto v = value();
  341|       |
  342|  50.1k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 117, False: 49.9k]
  ------------------
  343|    117|                throw std::overflow_error("Integer conversion overflow");
  344|    117|            }
  345|  49.9k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 73, False: 49.9k]
  ------------------
  346|     73|                throw std::underflow_error("Integer conversion underflow");
  347|     73|            }
  348|  49.9k|            return static_cast<T>(v);
  349|  49.9k|        }
_ZN4qpdf5ArrayaSERKS0_:
   36|  5.56k|        {
   37|  5.56k|            if (obj != other.obj) {
  ------------------
  |  Branch (37:17): [True: 5.56k, False: 0]
  ------------------
   38|  5.56k|                obj = other.obj;
   39|  5.56k|            }
   40|  5.56k|            return *this;
   41|  5.56k|        }
_ZN4qpdf5ArrayC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
   47|  97.8k|            BaseHandle(obj)
   48|  97.8k|        {
   49|  97.8k|        }
_ZN4qpdf5ArrayC2EONSt3__110shared_ptrI10QPDFObjectEE:
   52|  38.0k|            BaseHandle(std::move(obj))
   53|  38.0k|        {
   54|  38.0k|        }
_ZN4qpdf5ArrayaSERK16QPDFObjectHandle:
   63|  30.7k|        {
   64|  30.7k|            assign(::ot_array, oh);
   65|  30.7k|            return *this;
   66|  30.7k|        }
_ZN4qpdf5ArrayC2EO16QPDFObjectHandle:
   69|    491|            BaseHandle(oh.resolved_type_code() == ::ot_array ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (69:24): [True: 10, False: 481]
  ------------------
   70|    491|        {
   71|    491|        }
_ZN4qpdf14BaseDictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  220|  44.5k|            BaseHandle(QPDFObject::create<QPDF_Dictionary>(std::move(dict)))
  221|  44.5k|        {
  222|  44.5k|        }
_ZN4qpdf14BaseDictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  225|   260k|            BaseHandle(obj)
  226|   260k|        {
  227|   260k|        }
_ZN4qpdf14BaseDictionaryC2EO16QPDFObjectHandle:
  243|  10.5k|            BaseHandle(
  244|  10.5k|                oh.resolved_type_code() == ::ot_dictionary ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (244:17): [True: 9.33k, False: 1.17k]
  ------------------
  245|  10.5k|        {
  246|  10.5k|        }
_ZN4qpdf10DictionaryaSERK16QPDFObjectHandle:
  274|  26.6k|        {
  275|  26.6k|            assign(::ot_dictionary, oh);
  276|  26.6k|            return *this;
  277|  26.6k|        }
_ZN4qpdf10DictionaryC2EO16QPDFObjectHandle:
  280|  10.5k|            BaseDictionary(std::move(oh))
  281|  10.5k|        {
  282|  10.5k|        }
_ZN4qpdf10DictionaryaSEO16QPDFObjectHandle:
  286|    370|        {
  287|    370|            assign(::ot_dictionary, std::move(oh));
  288|    370|            return *this;
  289|    370|        }
_ZNKR4qpdf4NamecvNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEv:
  461|  39.4k|        {
  462|  39.4k|            return value();
  463|  39.4k|        }
_ZN4qpdf4NullC2Ev:
  483|      2|            BaseHandle(QPDFObject::create<QPDF_Null>())
  484|      2|        {
  485|      2|        }
_ZN4qpdf4Null4tempEv:
  496|  52.7k|        {
  497|  52.7k|            return temp_.oh();
  498|  52.7k|        }
_ZN4qpdf4Null7if_nullE16QPDFObjectHandle:
  503|  9.70k|        {
  504|  9.70k|            return oh ? std::move(oh) : Null::temp();
  ------------------
  |  Branch (504:20): [True: 6.21k, False: 3.49k]
  ------------------
  505|  9.70k|        }
_ZN4qpdf6StreamC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  515|   110k|            BaseHandle(obj)
  516|   110k|        {
  517|   110k|        }
_ZN4qpdf6StreamC2EONSt3__110shared_ptrI10QPDFObjectEE:
  520|   146k|            BaseHandle(std::move(obj))
  521|   146k|        {
  522|   146k|        }
_ZN4qpdf6StreamC2EO16QPDFObjectHandle:
  537|  36.5k|            BaseHandle(oh.type_code() == ::ot_stream ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (537:24): [True: 9.79k, False: 26.7k]
  ------------------
  538|  36.5k|        {
  539|  36.5k|        }
_ZNK4qpdf6Stream6LengthEv:
  563|  3.37k|        {
  564|  3.37k|            return {getDict()["/Length"]};
  565|  3.37k|        }
_ZNK4qpdf6Stream7SubtypeEv:
  592|  8.02k|        {
  593|  8.02k|            return {getDict()["/Subtype"]};
  594|  8.02k|        }
_ZNK4qpdf6Stream4TypeEv:
  601|  22.7k|        {
  602|  22.7k|            return {getDict()["/Type"]};
  603|  22.7k|        }
_ZNK4qpdf6Stream9getLengthEv:
  624|    439|        {
  625|    439|            return stream()->length;
  626|    439|        }
_ZN4qpdf6Stream11replaceDictERK16QPDFObjectHandle:
  681|  3.70k|        {
  682|  3.70k|            auto s = stream();
  683|  3.70k|            s->stream_dict = new_dict;
  684|  3.70k|            setDictDescription();
  685|  3.70k|        }
_ZN4qpdf6StringC2ERK16QPDFObjectHandle:
  732|  79.3k|            BaseHandle(oh.type_code() == ::ot_string ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (732:24): [True: 61.3k, False: 18.0k]
  ------------------
  733|  79.3k|        {
  734|  79.3k|        }
_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|   148k|    {
  800|   148k|        return obj;
  801|   148k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eRKS0_:
  838|  57.4k|    {
  839|  57.4k|        if (obj != other.obj) {
  ------------------
  |  Branch (839:13): [True: 21.9k, False: 35.4k]
  ------------------
  840|  21.9k|            obj = other.resolved_type_code() == required ? other.obj : nullptr;
  ------------------
  |  Branch (840:19): [True: 20.6k, False: 1.33k]
  ------------------
  841|  21.9k|        }
  842|  57.4k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eOS0_:
  846|    370|    {
  847|    370|        if (obj != other.obj) {
  ------------------
  |  Branch (847:13): [True: 340, False: 30]
  ------------------
  848|    340|            obj = other.resolved_type_code() == required ? std::move(other.obj) : nullptr;
  ------------------
  |  Branch (848:19): [True: 340, False: 0]
  ------------------
  849|    340|        }
  850|    370|    }
_ZNK4qpdf10BaseHandle21no_ci_stop_damaged_ifEbRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  877|  3.70k|    {
  878|  3.70k|        if (condition) {
  ------------------
  |  Branch (878:13): [True: 0, False: 3.70k]
  ------------------
  879|      0|            throw std::runtime_error(message);
  880|      0|        }
  881|  3.70k|    }
_ZNK4qpdf10BaseHandle13no_ci_warn_ifEbRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  885|  7.96k|    {
  886|  7.96k|        if (condition) {
  ------------------
  |  Branch (886:13): [True: 0, False: 7.96k]
  ------------------
  887|      0|            warn(warning);
  888|      0|        }
  889|  7.96k|    }
_ZNK4qpdf10BaseHandle3getERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  901|  1.04M|    {
  902|  1.04M|        return (*this)[key];
  903|  1.04M|    }
_ZN9QPDF_Null6createENSt3__110shared_ptrI10QPDFObjectEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
  974|   286k|{
  975|   286k|    auto n = QPDFObject::create<QPDF_Null>();
  976|   286k|    n->setChildDescription(parent->getQPDF(), parent, static_descr, var_descr);
  977|   286k|    return n;
  978|   286k|}
_ZNK16QPDFObjectHandle8as_arrayEN4qpdf5typedE:
 1006|   133k|{
 1007|   133k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1007:9): [True: 0, False: 133k]
  ------------------
 1008|      0|        assertType("array", false);
 1009|      0|    }
 1010|   133k|    if (options & qpdf::any_flag || type_code() == ::ot_array ||
  ------------------
  |  Branch (1010:9): [True: 65.2k, False: 68.6k]
  |  Branch (1010:37): [True: 30.5k, False: 38.0k]
  ------------------
 1011|  95.8k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1011:10): [True: 0, False: 38.0k]
  |  Branch (1011:38): [True: 0, False: 0]
  ------------------
 1012|  95.8k|        return qpdf::Array(obj);
 1013|  95.8k|    }
 1014|  38.0k|    return qpdf::Array(std::shared_ptr<QPDFObject>());
 1015|   133k|}
_ZNK16QPDFObjectHandle13as_dictionaryEN4qpdf5typedE:
 1019|   260k|{
 1020|   260k|    if (options & qpdf::any_flag || type_code() == ::ot_dictionary ||
  ------------------
  |  Branch (1020:9): [True: 42.0k, False: 217k]
  |  Branch (1020:37): [True: 199k, False: 18.7k]
  ------------------
 1021|   241k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1021:10): [True: 0, False: 18.7k]
  |  Branch (1021:38): [True: 0, False: 0]
  ------------------
 1022|   241k|        return qpdf::Dictionary(obj);
 1023|   241k|    }
 1024|  18.7k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1024:9): [True: 0, False: 18.7k]
  ------------------
 1025|      0|        assertType("dictionary", false);
 1026|      0|    }
 1027|  18.7k|    return qpdf::Dictionary(std::shared_ptr<QPDFObject>());
 1028|   260k|}
_ZNK16QPDFObjectHandle9as_streamEN4qpdf5typedE:
 1032|   260k|{
 1033|   260k|    if (options & qpdf::any_flag || type_code() == ::ot_stream ||
  ------------------
  |  Branch (1033:9): [True: 0, False: 260k]
  |  Branch (1033:37): [True: 114k, False: 146k]
  ------------------
 1034|   146k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1034:10): [True: 0, False: 146k]
  |  Branch (1034:38): [True: 0, False: 0]
  ------------------
 1035|   110k|        return qpdf::Stream(obj);
 1036|   110k|    }
 1037|   150k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1037:9): [True: 0, False: 150k]
  ------------------
 1038|      0|        assertType("stream", false);
 1039|      0|    }
 1040|   150k|    return qpdf::Stream(std::shared_ptr<QPDFObject>());
 1041|   260k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  14.2k|{
  989|  14.2k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  14.2k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   241k|{
  989|   241k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   241k|}
_ZN4qpdf10BaseHandleC2EO16QPDFObjectHandle:
  793|   464k|        obj(std::move(oh.obj))
  794|   464k|    {
  795|   464k|    }
_ZN4qpdf10DictionaryC2Ev:
  256|  25.2k|        Dictionary() = default;
_ZN4qpdf14BaseDictionaryC2Ev:
  212|  25.2k|        BaseDictionary() = default;
_ZN4qpdf10DictionaryC2ERKS0_:
  262|  59.7k|        Dictionary(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryC2ERKS0_:
  232|  85.5k|        BaseDictionary(BaseDictionary const&) = default;
_ZN4qpdf10DictionaryaSEOS0_:
  265|  6.26k|        Dictionary& operator=(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryaSEOS0_:
  235|  54.5k|        BaseDictionary& operator=(BaseDictionary&&) = default;
_ZN4qpdf6StreamaSEOS0_:
  528|  4.15k|        Stream& operator=(Stream&&) = default;
_ZN10QPDFObject6createI9QPDF_BoolJRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  1.07k|{
  989|  1.07k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.07k|}
_ZN10QPDFObject6createI12QPDF_IntegerJRxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  1.04M|{
  989|  1.04M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.04M|}
_ZN10QPDFObject6createI9QPDF_RealJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  49.6k|{
  989|  49.6k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  49.6k|}
_ZN10QPDFObject6createI11QPDF_StringJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   142k|{
  989|   142k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   142k|}
_ZN10QPDFObject6createI9QPDF_NameJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   208k|{
  989|   208k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   208k|}
_ZN10QPDFObject6createI10QPDF_ArrayJS1_EEENSt3__110shared_ptrIS_EEDpOT0_:
  988|    376|{
  989|    376|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    376|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEbEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  32.2k|{
  989|  32.2k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  32.2k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  49.3k|{
  989|  49.3k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  49.3k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_BoolEEPT_v:
  770|  2.52k|    {
  771|  2.52k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 2.52k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  2.52k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 2.52k, False: 0]
  ------------------
  775|  2.52k|            return &std::get<T>(obj->value);
  776|  2.52k|        }
  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|   148k|    {
  771|   148k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 950, False: 148k]
  ------------------
  772|    950|            return nullptr;
  773|    950|        }
  774|   148k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 148k, False: 0]
  ------------------
  775|   148k|            return &std::get<T>(obj->value);
  776|   148k|        }
  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|  60.8k|        {
  340|  60.8k|            auto v = value();
  341|       |
  342|  60.8k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 60.8k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  60.8k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 0, False: 60.8k]
  ------------------
  346|      0|                throw std::underflow_error("Integer conversion underflow");
  347|      0|            }
  348|  60.8k|            return static_cast<T>(v);
  349|  60.8k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEyEET_v:
  361|  20.4k|        {
  362|  20.4k|            try {
  363|  20.4k|                return static_cast<T>(*this);
  364|  20.4k|            } 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|    107|                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|    107|                    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|    107|                return std::numeric_limits<T>::min();
  377|    107|            } 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|  20.4k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEyEEv:
  339|  20.4k|        {
  340|  20.4k|            auto v = value();
  341|       |
  342|  20.4k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 20.4k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  20.4k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 107, False: 20.3k]
  ------------------
  346|    107|                throw std::underflow_error("Integer conversion underflow");
  347|    107|            }
  348|  20.3k|            return static_cast<T>(v);
  349|  20.4k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEjEET_v:
  361|  6.42k|        {
  362|  6.42k|            try {
  363|  6.42k|                return static_cast<T>(*this);
  364|  6.42k|            } 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|     94|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|     94|                    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|     94|                return std::numeric_limits<T>::min();
  377|     94|            } 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|     85|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|     85|                    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|     85|                return std::numeric_limits<T>::max();
  388|     85|            }
  389|  6.42k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEjEEv:
  339|  6.42k|        {
  340|  6.42k|            auto v = value();
  341|       |
  342|  6.42k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 85, False: 6.33k]
  ------------------
  343|     85|                throw std::overflow_error("Integer conversion overflow");
  344|     85|            }
  345|  6.33k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 94, False: 6.24k]
  ------------------
  346|     94|                throw std::underflow_error("Integer conversion underflow");
  347|     94|            }
  348|  6.24k|            return static_cast<T>(v);
  349|  6.33k|        }
_ZNK4qpdf10BaseHandle2asI9QPDF_RealEEPT_v:
  770|  80.2k|    {
  771|  80.2k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 80.2k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  80.2k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 80.2k, False: 0]
  ------------------
  775|  80.2k|            return &std::get<T>(obj->value);
  776|  80.2k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZN10QPDFObject6createI9QPDF_NameJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  1.44M|{
  989|  1.44M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.44M|}
_ZN10QPDFObject6createI9QPDF_NameJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  34.6k|{
  989|  34.6k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  34.6k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_NameEEPT_v:
  770|   274k|    {
  771|   274k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 274k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   274k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 272k, False: 1.72k]
  ------------------
  775|   272k|            return &std::get<T>(obj->value);
  776|   272k|        }
  777|  1.72k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 1, False: 1.72k]
  ------------------
  778|      1|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      1|        }
  780|  1.72k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 1.72k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  1.72k|        return nullptr;
  785|  1.72k|    }
_ZN10QPDFObject6createI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   336k|{
  989|   336k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   336k|}
_ZN10QPDFObject6createI11QPDF_StringJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    503|{
  989|    503|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    503|}
_ZNK4qpdf10BaseHandle2asI11QPDF_StringEEPT_v:
  770|   461k|    {
  771|   461k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 461k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   461k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 461k, False: 0]
  ------------------
  775|   461k|            return &std::get<T>(obj->value);
  776|   461k|        }
  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|  14.2M|    {
  771|  14.2M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 14.2M]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  14.2M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 14.2M, False: 0]
  ------------------
  775|  14.2M|            return &std::get<T>(obj->value);
  776|  14.2M|        }
  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|   218k|{
  989|   218k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   218k|}
_ZN10QPDFObject6createI9QPDF_RealJRdRiRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  48.1k|{
  989|  48.1k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  48.1k|}
_ZN9QPDF_RealC2Edib:
  981|  48.1k|    val(QUtil::double_to_string(value, decimal_places, trim_trailing_zeroes))
  982|  48.1k|{
  983|  48.1k|}
_ZN10QPDFObject6createI13QPDF_OperatorJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  14.8M|{
  989|  14.8M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  14.8M|}
_ZN10QPDFObject6createI10QPDF_ArrayJRKNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  22.8k|{
  989|  22.8k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  22.8k|}
_ZN15QPDF_DictionaryC2EONSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
  967|   241k|    items(std::move(items))
  968|   241k|{
  969|   241k|}
_ZN10QPDFObject6createI9QPDF_BoolJbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  14.0k|{
  989|  14.0k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  14.0k|}
_ZN10QPDFObject6createI12QPDF_IntegerJxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|   392k|{
  989|   392k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   392k|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   130k|{
  989|   130k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   130k|}
_ZNK4qpdf10BaseHandle2asI10QPDF_ArrayEEPT_v:
  770|  1.65M|    {
  771|  1.65M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 129k, False: 1.52M]
  ------------------
  772|   129k|            return nullptr;
  773|   129k|        }
  774|  1.52M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 1.45M, False: 74.1k]
  ------------------
  775|  1.45M|            return &std::get<T>(obj->value);
  776|  1.45M|        }
  777|  74.1k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 74.1k]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|  74.1k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 74.1k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  74.1k|        return nullptr;
  785|  74.1k|    }
_ZN4qpdf6Stream6LengthITkNSt3__18integralExEEvT_:
  582|  3.37k|        {
  583|  3.37k|            qpdf_expect(val >= 0);
  ------------------
  |  |   13|  3.37k|#define qpdf_expect assert
  ------------------
  |  Branch (583:13): [True: 3.37k, False: 0]
  ------------------
  584|  3.37k|            getDict().replace("/Length", Integer(val));
  585|  3.37k|        }
_ZN4qpdf6Stream6LengthITkNSt3__18integralEmEEvT_:
  582|  17.0k|        {
  583|  17.0k|            qpdf_expect(val >= 0);
  ------------------
  |  |   13|  17.0k|#define qpdf_expect assert
  ------------------
  |  Branch (583:13): [True: 17.0k, False: 0]
  ------------------
  584|  17.0k|            getDict().replace("/Length", Integer(val));
  585|  17.0k|        }
_ZN4qpdf7IntegerC2ITkNSt3__18integralEmEET_:
  307|  20.7k|            Integer(static_cast<long long>(value))
  308|  20.7k|        {
  309|       |            if constexpr (std::cmp_greater(
  310|       |                              std::numeric_limits<decltype(value)>::max(),
  311|  20.7k|                              std::numeric_limits<long long>::max())) {
  312|  20.7k|                if (std::cmp_greater(value, std::numeric_limits<long long>::max())) {
  ------------------
  |  Branch (312:21): [True: 0, False: 20.7k]
  ------------------
  313|      0|                    throw std::overflow_error("overflow constructing Integer");
  314|      0|                }
  315|  20.7k|            }
  316|  20.7k|        }
_ZN4qpdf10DictionaryC2EOS0_:
  264|  2.27k|        Dictionary(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryC2EOS0_:
  234|  2.27k|        BaseDictionary(BaseDictionary&&) = default;
_ZN4qpdf10DictionaryaSERKS0_:
  263|  6.50k|        Dictionary& operator=(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryaSERKS0_:
  233|  6.50k|        BaseDictionary& operator=(BaseDictionary const&) = default;
_ZN4qpdf5ArrayC2Ev:
   21|  5.56k|        Array() = default;

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

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

_ZNK4qpdf9Tokenizer7getTypeEv:
   64|  22.6M|        {
   65|  22.6M|            return this->type;
   66|  22.6M|        }
_ZNK4qpdf9Tokenizer8getValueEv:
   69|  20.7M|        {
   70|  20.7M|            return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string)
  ------------------
  |  Branch (70:21): [True: 2.23M, False: 18.4M]
  |  Branch (70:61): [True: 312k, False: 18.1M]
  ------------------
   71|  20.7M|                ? this->val
   72|  20.7M|                : this->raw_val;
   73|  20.7M|        }
_ZNK4qpdf9Tokenizer15getErrorMessageEv:
   81|  50.8k|        {
   82|  50.8k|            return this->error_message;
   83|  50.8k|        }

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

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

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

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

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

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

_ZN4qpdf4util17internal_error_ifIRA28_KcEEvbOT_:
   36|  7.70M|    {
   37|  7.70M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 7.70M]
  ------------------
   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|  7.70M|    }
_ZN4qpdf4util9assertionIRA44_KcEEvbOT_:
   27|   106k|    {
   28|   106k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 106k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   106k|    }
_ZN4qpdf4util15hex_decode_charEc:
   99|  49.9M|    {
  100|  49.9M|        return digit <= '9' && digit >= '0'
  ------------------
  |  Branch (100:16): [True: 42.2M, False: 7.71M]
  |  Branch (100:32): [True: 40.2M, False: 1.91M]
  ------------------
  101|  49.9M|            ? char(digit - '0')
  102|  49.9M|            : (digit >= 'a' ? char(digit - 'a' + 10)
  ------------------
  |  Branch (102:16): [True: 7.38M, False: 2.23M]
  ------------------
  103|  9.62M|                            : (digit >= 'A' ? char(digit - 'A' + 10) : '\20'));
  ------------------
  |  Branch (103:32): [True: 139k, False: 2.09M]
  ------------------
  104|  49.9M|    }
_ZN4qpdf4util8is_spaceEc:
  114|  51.1M|    {
  115|  51.1M|        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v';
  ------------------
  |  Branch (115:16): [True: 7.06M, False: 44.0M]
  |  Branch (115:29): [True: 1.02M, False: 43.0M]
  |  Branch (115:43): [True: 163k, False: 42.8M]
  |  Branch (115:57): [True: 714k, False: 42.1M]
  |  Branch (115:71): [True: 108k, False: 42.0M]
  |  Branch (115:85): [True: 57.8k, False: 41.9M]
  ------------------
  116|  51.1M|    }
_ZN4qpdf4util8is_digitEc:
  120|  8.57M|    {
  121|  8.57M|        return (ch >= '0' && ch <= '9');
  ------------------
  |  Branch (121:17): [True: 4.72M, False: 3.85M]
  |  Branch (121:30): [True: 4.43M, False: 289k]
  ------------------
  122|  8.57M|    }
_ZN4qpdf4util15hex_encode_charEc:
  127|   120M|    {
  128|   120M|        static auto constexpr hexchars = "0123456789abcdef";
  129|   120M|        return {'#', hexchars[static_cast<unsigned char>(c) >> 4], hexchars[c & 0x0f]};
  130|   120M|    }
_ZN4qpdf4util8is_utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  149|   616k|    {
  150|   616k|        return str.starts_with("\xfe\xff") || str.starts_with("\xff\xfe");
  ------------------
  |  Branch (150:16): [True: 88.4k, False: 528k]
  |  Branch (150:47): [True: 2.17k, False: 525k]
  ------------------
  151|   616k|    }
_ZN4qpdf4util16is_explicit_utf8ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  155|   525k|    {
  156|       |        // QPDF_String.cc knows that this is a 3-byte sequence.
  157|   525k|        return str.starts_with("\xef\xbb\xbf");
  158|   525k|    }
_ZN4qpdf4util9assertionIRA83_KcEEvbOT_:
   27|  89.5k|    {
   28|  89.5k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 89.5k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  89.5k|    }
_ZN4qpdf4util9assertionINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   27|   244k|    {
   28|   244k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 244k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   244k|    }
_ZN4qpdf4util9assertionIRA54_KcEEvbOT_:
   27|  99.7k|    {
   28|  99.7k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 99.7k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  99.7k|    }
_ZN4qpdf4util9assertionIRA57_KcEEvbOT_:
   27|  3.37k|    {
   28|  3.37k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.37k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.37k|    }
_ZN4qpdf4util9assertionIRA51_KcEEvbOT_:
   27|  1.13k|    {
   28|  1.13k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 1.13k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  1.13k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralElQsr3stdE8integralIT_EEEbT0_:
   63|  21.7k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  21.7k|                          std::numeric_limits<T>::min())) {
   67|  21.7k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 21.7k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  21.7k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|  21.7k|                          std::numeric_limits<T>::max())) {
   74|  21.7k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 21.7k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|  21.7k|        }
   78|  21.7k|        return true;
   79|  21.7k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEiQsr3stdE8integralIT_EEEbT0_:
   63|  21.7k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  21.7k|                          std::numeric_limits<T>::min())) {
   67|  21.7k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 21.7k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  21.7k|        }
   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|  21.7k|        return true;
   79|  21.7k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEyQsr3stdE8integralIT_EEEbT0_:
   63|  91.5k|    {
   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|  91.5k|                          std::numeric_limits<T>::max())) {
   74|  91.5k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 91.5k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|  91.5k|        }
   78|  91.5k|        return true;
   79|  91.5k|    }
_ZN4qpdf4util9assertionIRA45_KcEEvbOT_:
   27|   690k|    {
   28|   690k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 690k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   690k|    }
_ZN4qpdf4util9assertionIRA53_KcEEvbOT_:
   27|  3.35k|    {
   28|  3.35k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.35k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.35k|    }
_ZN4qpdf4util9assertionIRA35_KcEEvbOT_:
   27|  4.84k|    {
   28|  4.84k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 4.84k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  4.84k|    }
_ZN4qpdf4util17internal_error_ifIRA34_KcEEvbOT_:
   36|  29.2M|    {
   37|  29.2M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 3, False: 29.2M]
  ------------------
   38|      3|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   39|      3|                                       .append(
   40|      3|                                           "\nThis is a qpdf bug. Please report at "
   41|      3|                                           "https://github.com/qpdf/qpdf/issues"));
   42|      3|        }
   43|  29.2M|    }
_ZN4qpdf4util9assertionIRA68_KcEEvbOT_:
   27|  4.66k|    {
   28|  4.66k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 4.66k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  4.66k|    }
_ZN4qpdf4util9assertionIRA65_KcEEvbOT_:
   27|  2.09k|    {
   28|  2.09k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.09k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.09k|    }
_ZN4qpdf4util9assertionIRA49_KcEEvbOT_:
   27|  5.56k|    {
   28|  5.56k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 5.56k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  5.56k|    }
_ZN4qpdf4util9assertionIRA43_KcEEvbOT_:
   27|  9.52k|    {
   28|  9.52k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 9.52k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  9.52k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA51_KcEEvbOT_:
   48|  1.66M|    {
   49|  1.66M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 25, False: 1.66M]
  ------------------
   50|     25|            throw std::runtime_error(std::forward<T>(msg));
   51|     25|        }
   52|  1.66M|    }
_ZN4qpdf4util9assertionIRA50_KcEEvbOT_:
   27|   353k|    {
   28|   353k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 353k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   353k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA23_KcEEvbOT_:
   48|   655k|    {
   49|   655k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 8, False: 655k]
  ------------------
   50|      8|            throw std::runtime_error(std::forward<T>(msg));
   51|      8|        }
   52|   655k|    }
_ZN4qpdf4util9assertionIRA52_KcEEvbOT_:
   27|  49.4M|    {
   28|  49.4M|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 49.4M]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  49.4M|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA44_KcEEvbOT_:
   48|  3.95k|    {
   49|  3.95k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 43, False: 3.90k]
  ------------------
   50|     43|            throw std::runtime_error(std::forward<T>(msg));
   51|     43|        }
   52|  3.95k|    }
_ZN4qpdf4util9assertionIRA58_KcEEvbOT_:
   27|    462|    {
   28|    462|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 462]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    462|    }
_ZN4qpdf4util9assertionIRA48_KcEEvbOT_:
   27|  21.8k|    {
   28|  21.8k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 21.8k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  21.8k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA73_KcEEvbOT_:
   48|     20|    {
   49|     20|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 20]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|     20|    }
_ZN4qpdf4util9assertionIRA46_KcEEvbOT_:
   27|  1.18k|    {
   28|  1.18k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 1.18k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  1.18k|    }
_ZN4qpdf4util17no_ci_rt_error_ifINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   48|  7.36k|    {
   49|  7.36k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 7.36k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  7.36k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA69_KcEEvbOT_:
   48|  19.3k|    {
   49|  19.3k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 17, False: 19.3k]
  ------------------
   50|     17|            throw std::runtime_error(std::forward<T>(msg));
   51|     17|        }
   52|  19.3k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA59_KcEEvbOT_:
   48|  73.9k|    {
   49|  73.9k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 73.9k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  73.9k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA42_KcEEvbOT_:
   48|  3.68k|    {
   49|  3.68k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 3.68k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  3.68k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA49_KcEEvbOT_:
   48|  2.28k|    {
   49|  2.28k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 6, False: 2.27k]
  ------------------
   50|      6|            throw std::runtime_error(std::forward<T>(msg));
   51|      6|        }
   52|  2.28k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA88_KcEEvbOT_:
   48|  1.45k|    {
   49|  1.45k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.45k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.45k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA45_KcEEvbOT_:
   48|  1.45k|    {
   49|  1.45k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.45k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.45k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA32_KcEEvbOT_:
   48|  1.45k|    {
   49|  1.45k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 7, False: 1.44k]
  ------------------
   50|      7|            throw std::runtime_error(std::forward<T>(msg));
   51|      7|        }
   52|  1.45k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA35_KcEEvbOT_:
   48|  2.70k|    {
   49|  2.70k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 13, False: 2.69k]
  ------------------
   50|     13|            throw std::runtime_error(std::forward<T>(msg));
   51|     13|        }
   52|  2.70k|    }
_ZN4qpdf4util9assertionIRA47_KcEEvbOT_:
   27|   172k|    {
   28|   172k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 172k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   172k|    }
_ZN4qpdf4util9assertionIRA56_KcEEvbOT_:
   27|    816|    {
   28|    816|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 816]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    816|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA53_KcEEvbOT_:
   48|    816|    {
   49|    816|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 813]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|    816|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA92_KcEEvbOT_:
   48|    804|    {
   49|    804|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 804]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|    804|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA36_KcEEvbOT_:
   48|    804|    {
   49|    804|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 5, False: 799]
  ------------------
   50|      5|            throw std::runtime_error(std::forward<T>(msg));
   51|      5|        }
   52|    804|    }

BitStream.cc:_ZL9read_bitsRPKhRmS2_m:
   21|   783k|{
   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|   783k|    if (bits_wanted > bits_available) {
  ------------------
  |  Branch (29:9): [True: 0, False: 783k]
  ------------------
   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|   783k|    if (bits_wanted > 32) {
  ------------------
  |  Branch (34:9): [True: 40, False: 783k]
  ------------------
   35|     40|        throw std::out_of_range("read_bits: too many bits requested");
   36|     40|    }
   37|       |
   38|   783k|    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|  3.72M|    while (bits_wanted > 0) {
  ------------------
  |  Branch (44:12): [True: 2.94M, False: 783k]
  ------------------
   45|       |        // Grab bits from the first byte clearing anything before
   46|       |        // bit_offset.
   47|  2.94M|        unsigned char byte = static_cast<unsigned char>(*p & ((1U << (bit_offset + 1U)) - 1U));
   48|       |
   49|       |        // There are bit_offset + 1 bits available in the first byte.
   50|  2.94M|        size_t to_copy = std::min(bits_wanted, bit_offset + 1);
   51|  2.94M|        size_t leftover = (bit_offset + 1) - to_copy;
   52|       |
   53|       |# ifdef BITS_TESTING
   54|       |        QTC::TC("libtests", "bits bit_offset", ((bit_offset == 0) ? 0 : (bit_offset == 7) ? 1 : 2));
   55|       |        QTC::TC("libtests", "bits leftover", (leftover > 0) ? 1 : 0);
   56|       |# endif
   57|       |
   58|       |        // Right shift so that all the bits we want are right justified.
   59|  2.94M|        byte = static_cast<unsigned char>(byte >> leftover);
   60|       |
   61|       |        // Copy the bits into result
   62|  2.94M|        result <<= to_copy;
   63|  2.94M|        result |= byte;
   64|       |
   65|       |        // Update pointers
   66|  2.94M|        if (leftover) {
  ------------------
  |  Branch (66:13): [True: 399k, False: 2.54M]
  ------------------
   67|   399k|            bit_offset = leftover - 1;
   68|  2.54M|        } else {
   69|  2.54M|            bit_offset = 7;
   70|  2.54M|            ++p;
   71|  2.54M|        }
   72|  2.94M|        bits_wanted -= to_copy;
   73|  2.94M|        bits_available -= to_copy;
   74|       |
   75|       |# ifdef BITS_TESTING
   76|       |        QTC::TC("libtests", "bits iterations", ((bits_wanted > 8) ? 0 : (bits_wanted > 0) ? 1 : 2));
   77|       |# endif
   78|  2.94M|    }
   79|       |
   80|   783k|    return result;
   81|   783k|}
BitWriter.cc:_ZL10write_bitsRhRmymP8Pipeline:
   88|   784k|{
   89|   784k|    if (bits > 32) {
  ------------------
  |  Branch (89:9): [True: 0, False: 784k]
  ------------------
   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|  3.72M|    while (bits > 0) {
  ------------------
  |  Branch (99:12): [True: 2.94M, False: 784k]
  ------------------
  100|  2.94M|        size_t bits_to_write = std::min(bits, bit_offset + 1);
  101|  2.94M|        unsigned char newval = static_cast<unsigned char>(
  102|  2.94M|            (val >> (bits - bits_to_write)) & ((1U << bits_to_write) - 1));
  103|  2.94M|        size_t bits_left_in_ch = bit_offset + 1 - bits_to_write;
  104|  2.94M|        newval = static_cast<unsigned char>(newval << bits_left_in_ch);
  105|  2.94M|        ch |= newval;
  106|  2.94M|        if (bits_left_in_ch == 0) {
  ------------------
  |  Branch (106:13): [True: 2.54M, False: 399k]
  ------------------
  107|       |# ifdef BITS_TESTING
  108|       |            QTC::TC("libtests", "bits write pipeline");
  109|       |# endif
  110|  2.54M|            pipeline->write(&ch, 1);
  111|  2.54M|            bit_offset = 7;
  112|  2.54M|            ch = 0;
  113|  2.54M|        } else {
  114|       |# ifdef BITS_TESTING
  115|       |            QTC::TC("libtests", "bits write leftover");
  116|       |# endif
  117|   399k|            bit_offset -= bits_to_write;
  118|   399k|        }
  119|  2.94M|        bits -= bits_to_write;
  120|       |# ifdef BITS_TESTING
  121|       |        QTC::TC("libtests", "bits write iterations", ((bits > 8) ? 0 : (bits > 0) ? 1 : 2));
  122|       |# endif
  123|  2.94M|    }
  124|   784k|}

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

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

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

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

sph_sha224:
  173|  61.9k|{
  174|  61.9k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  61.9k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  61.9k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|  61.9k|        unsigned current;
  176|  61.9k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|  61.9k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   95|  61.9k|#define SPH_BLEN     64U
  ------------------
  |  Branch (181:13): [True: 3.98k, False: 57.9k]
  ------------------
  182|  3.98k|                SPH_XCAT(HASH, _short)(cc, data, len);
  ------------------
  |  |   85|  3.98k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  3.98k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  183|  3.98k|                return;
  184|  3.98k|        }
  185|  57.9k|        sc = cc;
  186|  57.9k|#if SPH_64
  187|  57.9k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  57.9k|#define SPH_BLEN     64U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|  57.9k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 57.9k]
  ------------------
  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|  57.9k|        orig_len = len;
  206|  4.20M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   95|  4.20M|#define SPH_BLEN     64U
  ------------------
  |  Branch (206:16): [True: 4.14M, False: 57.9k]
  ------------------
  207|  4.14M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  647|  4.14M|#define RFUN   sha2_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  4.14M|#define SPH_VAL   sc->val
  ------------------
  208|  4.14M|                len -= SPH_BLEN;
  ------------------
  |  |   95|  4.14M|#define SPH_BLEN     64U
  ------------------
  209|  4.14M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   95|  4.14M|#define SPH_BLEN     64U
  ------------------
  210|  4.14M|        }
  211|  57.9k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 57.9k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|  57.9k|#if SPH_64
  214|  57.9k|        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|  57.9k|}
sha2.c:sha224_short:
  131|  3.98k|{
  132|  3.98k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  3.98k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  3.98k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  133|  3.98k|        unsigned current;
  134|       |
  135|  3.98k|        sc = cc;
  136|  3.98k|#if SPH_64
  137|  3.98k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  3.98k|#define SPH_BLEN     64U
  ------------------
  138|       |#else
  139|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  140|       |#endif
  141|  7.96k|        while (len > 0) {
  ------------------
  |  Branch (141:16): [True: 3.98k, False: 3.98k]
  ------------------
  142|  3.98k|                unsigned clen;
  143|       |#if !SPH_64
  144|       |                sph_u32 clow, clow2;
  145|       |#endif
  146|       |
  147|  3.98k|                clen = SPH_BLEN - current;
  ------------------
  |  |   95|  3.98k|#define SPH_BLEN     64U
  ------------------
  148|  3.98k|                if (clen > len)
  ------------------
  |  Branch (148:21): [True: 3.98k, False: 0]
  ------------------
  149|  3.98k|                        clen = (unsigned)len;
  150|  3.98k|                memcpy(sc->buf + current, data, clen);
  151|  3.98k|                data = (const unsigned char *)data + clen;
  152|  3.98k|                current += clen;
  153|  3.98k|                len -= clen;
  154|  3.98k|                if (current == SPH_BLEN) {
  ------------------
  |  |   95|  3.98k|#define SPH_BLEN     64U
  ------------------
  |  Branch (154:21): [True: 0, False: 3.98k]
  ------------------
  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.98k|#if SPH_64
  159|  3.98k|                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.98k|        }
  168|  3.98k|}
sha2.c:sha224_close:
  345|  60.5k|{
  346|  60.5k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|  60.5k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  60.5k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|  60.5k|}
sha2.c:sha224_addbits_and_close:
  242|  60.5k|{
  243|  60.5k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  60.5k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  60.5k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|  60.5k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|  60.5k|        sc = cc;
  250|  60.5k|#if SPH_64
  251|  60.5k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  60.5k|#define SPH_BLEN     64U
  ------------------
  252|       |#else
  253|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  254|       |#endif
  255|       |#ifdef PW01
  256|       |        sc->buf[current ++] = (0x100 | (ub & 0xFF)) >> (8 - n);
  257|       |#else
  258|  60.5k|        {
  259|  60.5k|                unsigned z;
  260|       |
  261|  60.5k|                z = 0x80U >> n;
  262|  60.5k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|  60.5k|        }
  264|  60.5k|#endif
  265|  60.5k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|  60.5k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  60.5k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  60.5k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 1.34k, False: 59.2k]
  ------------------
  266|  1.34k|                memset(sc->buf + current, 0, SPH_BLEN - current);
  ------------------
  |  |   95|  1.34k|#define SPH_BLEN     64U
  ------------------
  267|  1.34k|                RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|  1.34k|#define RFUN   sha2_round
  ------------------
                              RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  1.34k|#define SPH_VAL   sc->val
  ------------------
  268|  1.34k|                memset(sc->buf, 0, SPH_MAXPAD);
  ------------------
  |  |  110|  1.34k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  1.34k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  1.34k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  269|  59.2k|        } else {
  270|  59.2k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|  59.2k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  59.2k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  59.2k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  271|  59.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|  60.5k|#if SPH_64
  303|  60.5k|#ifdef BE32
  304|  60.5k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  ------------------
  |  |  110|  60.5k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  60.5k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  60.5k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  305|  60.5k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|  60.5k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|  60.5k|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  ------------------
  ------------------
  306|       |#else
  307|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  308|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  309|       |#endif
  310|       |#else
  311|       |        low = sc->count_low;
  312|       |        high = SPH_T32((sc->count_high << 3) | (low >> 29));
  313|       |        low = SPH_T32(low << 3) + (sph_u32)n;
  314|       |#ifdef BE32
  315|       |        sph_enc32be(sc->buf + SPH_MAXPAD, high);
  316|       |        sph_enc32be(sc->buf + SPH_MAXPAD + SPH_WLEN, low);
  317|       |#else
  318|       |        sph_enc32le(sc->buf + SPH_MAXPAD, low);
  319|       |        sph_enc32le(sc->buf + SPH_MAXPAD + SPH_WLEN, high);
  320|       |#endif
  321|       |#endif
  322|  60.5k|#endif
  323|  60.5k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|  60.5k|#define RFUN   sha2_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  60.5k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   545k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 484k, False: 60.5k]
  ------------------
  330|       |#if defined BE64
  331|       |                sph_enc64be((unsigned char *)dst + 8 * u, sc->val[u]);
  332|       |#elif defined LE64
  333|       |                sph_enc64le((unsigned char *)dst + 8 * u, sc->val[u]);
  334|       |#elif defined BE32
  335|       |                sph_enc32be((unsigned char *)dst + 4 * u, sc->val[u]);
  336|       |#else
  337|       |                sph_enc32le((unsigned char *)dst + 4 * u, sc->val[u]);
  338|       |#endif
  339|   484k|        }
  340|  60.5k|#endif
  341|  60.5k|}
sph_sha384:
  173|   112k|{
  174|   112k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|   112k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|   112k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|   112k|        unsigned current;
  176|   112k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|   112k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   92|   112k|#define SPH_BLEN    128U
  ------------------
  |  Branch (181:13): [True: 0, False: 112k]
  ------------------
  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|   112k|        sc = cc;
  186|   112k|#if SPH_64
  187|   112k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|   112k|#define SPH_BLEN    128U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|   112k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 112k]
  ------------------
  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|   112k|        orig_len = len;
  206|  4.15M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   92|  4.15M|#define SPH_BLEN    128U
  ------------------
  |  Branch (206:16): [True: 4.04M, False: 112k]
  ------------------
  207|  4.04M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  202|  4.04M|#define RFUN   sha3_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  4.04M|#define SPH_VAL   sc->val
  ------------------
  208|  4.04M|                len -= SPH_BLEN;
  ------------------
  |  |   92|  4.04M|#define SPH_BLEN    128U
  ------------------
  209|  4.04M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   92|  4.04M|#define SPH_BLEN    128U
  ------------------
  210|  4.04M|        }
  211|   112k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 112k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|   112k|#if SPH_64
  214|   112k|        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|   112k|}
sha2big.c:sha384_close:
  345|   112k|{
  346|   112k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|   112k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|   112k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|   112k|}
sha2big.c:sha384_addbits_and_close:
  242|   112k|{
  243|   112k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|   112k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|   112k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|   112k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|   112k|        sc = cc;
  250|   112k|#if SPH_64
  251|   112k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|   112k|#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|   112k|        {
  259|   112k|                unsigned z;
  260|       |
  261|   112k|                z = 0x80U >> n;
  262|   112k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|   112k|        }
  264|   112k|#endif
  265|   112k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|   112k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|   112k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|   112k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 0, False: 112k]
  ------------------
  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|   112k|        } else {
  270|   112k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|   112k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|   112k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|   112k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  271|   112k|        }
  272|   112k|#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|   112k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD, sc->count >> 61);
  ------------------
  |  |  110|   112k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|   112k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|   112k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  284|   112k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |  110|   112k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|   112k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|   112k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
                      sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |   93|   112k|#define SPH_WLEN      8U
  ------------------
  285|   112k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|   112k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|   112k|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  ------------------
  ------------------
  286|   112k|#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|   112k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  202|   112k|#define RFUN   sha3_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|   112k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   899k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 787k, False: 112k]
  ------------------
  330|   787k|#if defined BE64
  331|   787k|                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|   787k|        }
  340|   112k|#endif
  341|   112k|}

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

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

inflate_fast:
   50|  37.2k|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
   51|  37.2k|    struct inflate_state FAR *state;
   52|  37.2k|    z_const unsigned char FAR *in;      /* local strm->next_in */
   53|  37.2k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
   54|  37.2k|    unsigned char FAR *out;     /* local strm->next_out */
   55|  37.2k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
   56|  37.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|  37.2k|    unsigned wsize;             /* window size or zero if not using window */
   61|  37.2k|    unsigned whave;             /* valid bytes in the window */
   62|  37.2k|    unsigned wnext;             /* window write index */
   63|  37.2k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
   64|  37.2k|    unsigned long hold;         /* local strm->hold */
   65|  37.2k|    unsigned bits;              /* local strm->bits */
   66|  37.2k|    code const FAR *lcode;      /* local strm->lencode */
   67|  37.2k|    code const FAR *dcode;      /* local strm->distcode */
   68|  37.2k|    unsigned lmask;             /* mask for first level of length codes */
   69|  37.2k|    unsigned dmask;             /* mask for first level of distance codes */
   70|  37.2k|    code const *here;           /* retrieved table entry */
   71|  37.2k|    unsigned op;                /* code bits, operation, extra bits, or */
   72|       |                                /*  window position, window bytes to copy */
   73|  37.2k|    unsigned len;               /* match length, unused bytes */
   74|  37.2k|    unsigned dist;              /* match distance */
   75|  37.2k|    unsigned char FAR *from;    /* where to copy match from */
   76|       |
   77|       |    /* copy state to local variables */
   78|  37.2k|    state = (struct inflate_state FAR *)strm->state;
   79|  37.2k|    in = strm->next_in;
   80|  37.2k|    last = in + (strm->avail_in - 5);
   81|  37.2k|    out = strm->next_out;
   82|  37.2k|    beg = out - (start - strm->avail_out);
   83|  37.2k|    end = out + (strm->avail_out - 257);
   84|       |#ifdef INFLATE_STRICT
   85|       |    dmax = state->dmax;
   86|       |#endif
   87|  37.2k|    wsize = state->wsize;
   88|  37.2k|    whave = state->whave;
   89|  37.2k|    wnext = state->wnext;
   90|  37.2k|    window = state->window;
   91|  37.2k|    hold = state->hold;
   92|  37.2k|    bits = state->bits;
   93|  37.2k|    lcode = state->lencode;
   94|  37.2k|    dcode = state->distcode;
   95|  37.2k|    lmask = (1U << state->lenbits) - 1;
   96|  37.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|  2.94M|    do {
  101|  2.94M|        if (bits < 15) {
  ------------------
  |  Branch (101:13): [True: 1.50M, False: 1.44M]
  ------------------
  102|  1.50M|            hold += (unsigned long)(*in++) << bits;
  103|  1.50M|            bits += 8;
  104|  1.50M|            hold += (unsigned long)(*in++) << bits;
  105|  1.50M|            bits += 8;
  106|  1.50M|        }
  107|  2.94M|        here = lcode + (hold & lmask);
  108|  3.26M|      dolen:
  109|  3.26M|        op = (unsigned)(here->bits);
  110|  3.26M|        hold >>= op;
  111|  3.26M|        bits -= op;
  112|  3.26M|        op = (unsigned)(here->op);
  113|  3.26M|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (113:13): [True: 1.73M, False: 1.53M]
  ------------------
  114|  1.73M|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  115|  1.73M|                    "inflate:         literal '%c'\n" :
  116|  1.73M|                    "inflate:         literal 0x%02x\n", here->val));
  117|  1.73M|            *out++ = (unsigned char)(here->val);
  118|  1.73M|        }
  119|  1.53M|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (119:18): [True: 1.20M, False: 330k]
  ------------------
  120|  1.20M|            len = (unsigned)(here->val);
  121|  1.20M|            op &= 15;                           /* number of extra bits */
  122|  1.20M|            if (op) {
  ------------------
  |  Branch (122:17): [True: 274k, False: 931k]
  ------------------
  123|   274k|                if (bits < op) {
  ------------------
  |  Branch (123:21): [True: 4.68k, False: 269k]
  ------------------
  124|  4.68k|                    hold += (unsigned long)(*in++) << bits;
  125|  4.68k|                    bits += 8;
  126|  4.68k|                }
  127|   274k|                len += (unsigned)hold & ((1U << op) - 1);
  128|   274k|                hold >>= op;
  129|   274k|                bits -= op;
  130|   274k|            }
  131|  1.20M|            Tracevv((stderr, "inflate:         length %u\n", len));
  132|  1.20M|            if (bits < 15) {
  ------------------
  |  Branch (132:17): [True: 283k, False: 922k]
  ------------------
  133|   283k|                hold += (unsigned long)(*in++) << bits;
  134|   283k|                bits += 8;
  135|   283k|                hold += (unsigned long)(*in++) << bits;
  136|   283k|                bits += 8;
  137|   283k|            }
  138|  1.20M|            here = dcode + (hold & dmask);
  139|  1.25M|          dodist:
  140|  1.25M|            op = (unsigned)(here->bits);
  141|  1.25M|            hold >>= op;
  142|  1.25M|            bits -= op;
  143|  1.25M|            op = (unsigned)(here->op);
  144|  1.25M|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (144:17): [True: 1.20M, False: 49.7k]
  ------------------
  145|  1.20M|                dist = (unsigned)(here->val);
  146|  1.20M|                op &= 15;                       /* number of extra bits */
  147|  1.20M|                if (bits < op) {
  ------------------
  |  Branch (147:21): [True: 1.50k, False: 1.20M]
  ------------------
  148|  1.50k|                    hold += (unsigned long)(*in++) << bits;
  149|  1.50k|                    bits += 8;
  150|  1.50k|                    if (bits < op) {
  ------------------
  |  Branch (150:25): [True: 0, False: 1.50k]
  ------------------
  151|      0|                        hold += (unsigned long)(*in++) << bits;
  152|      0|                        bits += 8;
  153|      0|                    }
  154|  1.50k|                }
  155|  1.20M|                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.20M|                hold >>= op;
  165|  1.20M|                bits -= op;
  166|  1.20M|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  167|  1.20M|                op = (unsigned)(out - beg);     /* max distance in output */
  168|  1.20M|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (168:21): [True: 49.5k, False: 1.15M]
  ------------------
  169|  49.5k|                    op = dist - op;             /* distance back in window */
  170|  49.5k|                    if (op > whave) {
  ------------------
  |  Branch (170:25): [True: 185, False: 49.3k]
  ------------------
  171|    185|                        if (state->sane) {
  ------------------
  |  Branch (171:29): [True: 185, False: 0]
  ------------------
  172|    185|                            strm->msg = (z_const char *)
  173|    185|                                "invalid distance too far back";
  174|    185|                            state->mode = BAD;
  175|    185|                            break;
  176|    185|                        }
  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|    185|                    }
  197|  49.3k|                    from = window;
  198|  49.3k|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (198:25): [True: 7.97k, False: 41.3k]
  ------------------
  199|  7.97k|                        from += wsize - op;
  200|  7.97k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (200:29): [True: 977, False: 6.99k]
  ------------------
  201|    977|                            len -= op;
  202|   125k|                            do {
  203|   125k|                                *out++ = *from++;
  204|   125k|                            } while (--op);
  ------------------
  |  Branch (204:38): [True: 124k, False: 977]
  ------------------
  205|    977|                            from = out - dist;  /* rest from output */
  206|    977|                        }
  207|  7.97k|                    }
  208|  41.3k|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (208:30): [True: 578, False: 40.8k]
  ------------------
  209|    578|                        from += wsize + wnext - op;
  210|    578|                        op -= wnext;
  211|    578|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (211:29): [True: 99, False: 479]
  ------------------
  212|     99|                            len -= op;
  213|  4.62k|                            do {
  214|  4.62k|                                *out++ = *from++;
  215|  4.62k|                            } while (--op);
  ------------------
  |  Branch (215:38): [True: 4.52k, False: 99]
  ------------------
  216|     99|                            from = window;
  217|     99|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (217:33): [True: 51, False: 48]
  ------------------
  218|     51|                                op = wnext;
  219|     51|                                len -= op;
  220|  1.35k|                                do {
  221|  1.35k|                                    *out++ = *from++;
  222|  1.35k|                                } while (--op);
  ------------------
  |  Branch (222:42): [True: 1.30k, False: 51]
  ------------------
  223|     51|                                from = out - dist;      /* rest from output */
  224|     51|                            }
  225|     99|                        }
  226|    578|                    }
  227|  40.8k|                    else {                      /* contiguous in window */
  228|  40.8k|                        from += wnext - op;
  229|  40.8k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (229:29): [True: 10.9k, False: 29.8k]
  ------------------
  230|  10.9k|                            len -= op;
  231|   488k|                            do {
  232|   488k|                                *out++ = *from++;
  233|   488k|                            } while (--op);
  ------------------
  |  Branch (233:38): [True: 478k, False: 10.9k]
  ------------------
  234|  10.9k|                            from = out - dist;  /* rest from output */
  235|  10.9k|                        }
  236|  40.8k|                    }
  237|   792k|                    while (len > 2) {
  ------------------
  |  Branch (237:28): [True: 743k, False: 49.3k]
  ------------------
  238|   743k|                        *out++ = *from++;
  239|   743k|                        *out++ = *from++;
  240|   743k|                        *out++ = *from++;
  241|   743k|                        len -= 3;
  242|   743k|                    }
  243|  49.3k|                    if (len) {
  ------------------
  |  Branch (243:25): [True: 17.3k, False: 31.9k]
  ------------------
  244|  17.3k|                        *out++ = *from++;
  245|  17.3k|                        if (len > 1)
  ------------------
  |  Branch (245:29): [True: 12.2k, False: 5.14k]
  ------------------
  246|  12.2k|                            *out++ = *from++;
  247|  17.3k|                    }
  248|  49.3k|                }
  249|  1.15M|                else {
  250|  1.15M|                    from = out - dist;          /* copy direct from output */
  251|  39.9M|                    do {                        /* minimum length is three */
  252|  39.9M|                        *out++ = *from++;
  253|  39.9M|                        *out++ = *from++;
  254|  39.9M|                        *out++ = *from++;
  255|  39.9M|                        len -= 3;
  256|  39.9M|                    } while (len > 2);
  ------------------
  |  Branch (256:30): [True: 38.7M, False: 1.15M]
  ------------------
  257|  1.15M|                    if (len) {
  ------------------
  |  Branch (257:25): [True: 382k, False: 773k]
  ------------------
  258|   382k|                        *out++ = *from++;
  259|   382k|                        if (len > 1)
  ------------------
  |  Branch (259:29): [True: 211k, False: 170k]
  ------------------
  260|   211k|                            *out++ = *from++;
  261|   382k|                    }
  262|  1.15M|                }
  263|  1.20M|            }
  264|  49.7k|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (264:22): [True: 49.6k, False: 21]
  ------------------
  265|  49.6k|                here = dcode + here->val + (hold & ((1U << op) - 1));
  266|  49.6k|                goto dodist;
  267|  49.6k|            }
  268|     21|            else {
  269|     21|                strm->msg = (z_const char *)"invalid distance code";
  270|     21|                state->mode = BAD;
  271|     21|                break;
  272|     21|            }
  273|  1.25M|        }
  274|   330k|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (274:18): [True: 325k, False: 5.18k]
  ------------------
  275|   325k|            here = lcode + here->val + (hold & ((1U << op) - 1));
  276|   325k|            goto dolen;
  277|   325k|        }
  278|  5.18k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (278:18): [True: 5.16k, False: 19]
  ------------------
  279|  5.16k|            Tracevv((stderr, "inflate:         end of block\n"));
  280|  5.16k|            state->mode = TYPE;
  281|  5.16k|            break;
  282|  5.16k|        }
  283|     19|        else {
  284|     19|            strm->msg = (z_const char *)"invalid literal/length code";
  285|     19|            state->mode = BAD;
  286|     19|            break;
  287|     19|        }
  288|  3.26M|    } while (in < last && out < end);
  ------------------
  |  Branch (288:14): [True: 2.90M, False: 30.8k]
  |  Branch (288:27): [True: 2.90M, False: 1.04k]
  ------------------
  289|       |
  290|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  291|  37.2k|    len = bits >> 3;
  292|  37.2k|    in -= len;
  293|  37.2k|    bits -= len << 3;
  294|  37.2k|    hold &= (1U << bits) - 1;
  295|       |
  296|       |    /* update state and return */
  297|  37.2k|    strm->next_in = in;
  298|  37.2k|    strm->next_out = out;
  299|  37.2k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (299:33): [True: 18.5k, False: 18.7k]
  ------------------
  300|  37.2k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (300:34): [True: 36.1k, False: 1.05k]
  ------------------
  301|  36.1k|                                 257 + (end - out) : 257 - (out - end));
  302|  37.2k|    state->hold = hold;
  303|  37.2k|    state->bits = bits;
  304|  37.2k|    return;
  305|  37.2k|}

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

inflate_table:
   48|  16.4k|                                unsigned FAR *bits, unsigned short FAR *work) {
   49|  16.4k|    unsigned len;               /* a code's length in bits */
   50|  16.4k|    unsigned sym;               /* index of code symbols */
   51|  16.4k|    unsigned min, max;          /* minimum and maximum code lengths */
   52|  16.4k|    unsigned root;              /* number of index bits for root table */
   53|  16.4k|    unsigned curr;              /* number of index bits for current table */
   54|  16.4k|    unsigned drop;              /* code bits to drop for sub-table */
   55|  16.4k|    int left;                   /* number of prefix codes available */
   56|  16.4k|    unsigned used;              /* code entries in table used */
   57|  16.4k|    unsigned huff;              /* Huffman code */
   58|  16.4k|    unsigned incr;              /* for incrementing code, index */
   59|  16.4k|    unsigned fill;              /* index for replicating entries */
   60|  16.4k|    unsigned low;               /* low bits for current root entry */
   61|  16.4k|    unsigned mask;              /* mask for low root bits */
   62|  16.4k|    code here;                  /* table entry for duplication */
   63|  16.4k|    code FAR *next;             /* next available space in table */
   64|  16.4k|    const unsigned short FAR *base = NULL;  /* base value table to use */
   65|  16.4k|    const unsigned short FAR *extra = NULL; /* extra bits table to use */
   66|  16.4k|    unsigned match = 0;         /* use base and extra for symbol >= match */
   67|  16.4k|    unsigned short count[MAXBITS+1];    /* number of codes of each length */
   68|  16.4k|    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
   69|  16.4k|    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
   70|  16.4k|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   71|  16.4k|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   72|  16.4k|    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
   73|  16.4k|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   74|  16.4k|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 68, 193};
   75|  16.4k|    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
   76|  16.4k|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   77|  16.4k|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   78|  16.4k|        8193, 12289, 16385, 24577, 0, 0};
   79|  16.4k|    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
   80|  16.4k|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   81|  16.4k|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   82|  16.4k|        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|   279k|    for (len = 0; len <= MAXBITS; len++)
  ------------------
  |  |   23|   279k|#define MAXBITS 15
  ------------------
  |  Branch (116:19): [True: 263k, False: 16.4k]
  ------------------
  117|   263k|        count[len] = 0;
  118|  1.73M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (118:19): [True: 1.72M, False: 16.4k]
  ------------------
  119|  1.72M|        count[lens[sym]]++;
  120|       |
  121|       |    /* bound code lengths, force root to be within code lengths */
  122|  16.4k|    root = *bits;
  123|   169k|    for (max = MAXBITS; max >= 1; max--)
  ------------------
  |  |   23|  16.4k|#define MAXBITS 15
  ------------------
  |  Branch (123:25): [True: 169k, False: 24]
  ------------------
  124|   169k|        if (count[max] != 0) break;
  ------------------
  |  Branch (124:13): [True: 16.4k, False: 153k]
  ------------------
  125|  16.4k|    if (root > max) root = max;
  ------------------
  |  Branch (125:9): [True: 11.2k, False: 5.17k]
  ------------------
  126|  16.4k|    if (max == 0) {                     /* no symbols to code at all */
  ------------------
  |  Branch (126:9): [True: 24, False: 16.4k]
  ------------------
  127|     24|        here.op = (unsigned char)64;    /* invalid code marker */
  128|     24|        here.bits = (unsigned char)1;
  129|     24|        here.val = (unsigned short)0;
  130|     24|        *(*table)++ = here;             /* make a table to force an error */
  131|     24|        *(*table)++ = here;
  132|     24|        *bits = 1;
  133|     24|        return 0;     /* no symbols, but wait for decoding to report error */
  134|     24|    }
  135|  32.6k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (135:19): [True: 32.5k, False: 189]
  ------------------
  136|  32.5k|        if (count[min] != 0) break;
  ------------------
  |  Branch (136:13): [True: 16.2k, False: 16.2k]
  ------------------
  137|  16.4k|    if (root < min) root = min;
  ------------------
  |  Branch (137:9): [True: 9, False: 16.4k]
  ------------------
  138|       |
  139|       |    /* check for an over-subscribed or incomplete set of lengths */
  140|  16.4k|    left = 1;
  141|   261k|    for (len = 1; len <= MAXBITS; len++) {
  ------------------
  |  |   23|   261k|#define MAXBITS 15
  ------------------
  |  Branch (141:19): [True: 245k, False: 16.3k]
  ------------------
  142|   245k|        left <<= 1;
  143|   245k|        left -= count[len];
  144|   245k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (144:13): [True: 107, False: 245k]
  ------------------
  145|   245k|    }
  146|  16.3k|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (146:9): [True: 96, False: 16.2k]
  |  Branch (146:22): [True: 31, False: 65]
  |  Branch (146:39): [True: 54, False: 11]
  ------------------
  147|     85|        return -1;                      /* incomplete set */
  148|       |
  149|       |    /* generate offsets into symbol table for each length for sorting */
  150|  16.2k|    offs[1] = 0;
  151|   243k|    for (len = 1; len < MAXBITS; len++)
  ------------------
  |  |   23|   243k|#define MAXBITS 15
  ------------------
  |  Branch (151:19): [True: 227k, False: 16.2k]
  ------------------
  152|   227k|        offs[len + 1] = offs[len] + count[len];
  153|       |
  154|       |    /* sort symbols by length, by symbol order within each length */
  155|  1.71M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (155:19): [True: 1.70M, False: 16.2k]
  ------------------
  156|  1.70M|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
  ------------------
  |  Branch (156:13): [True: 522k, False: 1.18M]
  ------------------
  157|       |
  158|       |    /*
  159|       |       Create and fill in decoding tables.  In this loop, the table being
  160|       |       filled is at next and has curr index bits.  The code being used is huff
  161|       |       with length len.  That code is converted to an index by dropping drop
  162|       |       bits off of the bottom.  For codes where len is less than drop + curr,
  163|       |       those top drop + curr - len bits are incremented through all values to
  164|       |       fill the table with replicated entries.
  165|       |
  166|       |       root is the number of index bits for the root table.  When len exceeds
  167|       |       root, sub-tables are created pointed to by the root entry with an index
  168|       |       of the low root bits of huff.  This is saved in low to check for when a
  169|       |       new sub-table should be started.  drop is zero when the root table is
  170|       |       being filled, and drop is root when sub-tables are being filled.
  171|       |
  172|       |       When a new sub-table is needed, it is necessary to look ahead in the
  173|       |       code lengths to determine what size sub-table is needed.  The length
  174|       |       counts are used for this, and so count[] is decremented as codes are
  175|       |       entered in the tables.
  176|       |
  177|       |       used keeps track of how many table entries have been allocated from the
  178|       |       provided *table space.  It is checked for LENS and DIST tables against
  179|       |       the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
  180|       |       the initial root table size constants.  See the comments in inftrees.h
  181|       |       for more information.
  182|       |
  183|       |       sym increments through all symbols, and the loop terminates when
  184|       |       all codes of length max, i.e. all codes, have been processed.  This
  185|       |       routine permits incomplete codes, so another loop after this one fills
  186|       |       in the rest of the decoding tables with invalid code markers.
  187|       |     */
  188|       |
  189|       |    /* set up for code type */
  190|  16.2k|    switch (type) {
  ------------------
  |  Branch (190:13): [True: 16.2k, False: 0]
  ------------------
  191|  5.78k|    case CODES:
  ------------------
  |  Branch (191:5): [True: 5.78k, False: 10.4k]
  ------------------
  192|  5.78k|        match = 20;
  193|  5.78k|        break;
  194|  5.25k|    case LENS:
  ------------------
  |  Branch (194:5): [True: 5.25k, False: 10.9k]
  ------------------
  195|  5.25k|        base = lbase;
  196|  5.25k|        extra = lext;
  197|  5.25k|        match = 257;
  198|  5.25k|        break;
  199|  5.20k|    case DISTS:
  ------------------
  |  Branch (199:5): [True: 5.20k, False: 11.0k]
  ------------------
  200|  5.20k|        base = dbase;
  201|  5.20k|        extra = dext;
  202|  16.2k|    }
  203|       |
  204|       |    /* initialize state for loop */
  205|  16.2k|    huff = 0;                   /* starting code */
  206|  16.2k|    sym = 0;                    /* starting code symbol */
  207|  16.2k|    len = min;                  /* starting code length */
  208|  16.2k|    next = *table;              /* current table to fill in */
  209|  16.2k|    curr = root;                /* current table index bits */
  210|  16.2k|    drop = 0;                   /* current bits to drop from code for index */
  211|  16.2k|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  212|  16.2k|    used = 1U << root;          /* use root table entries */
  213|  16.2k|    mask = used - 1;            /* mask for comparing low */
  214|       |
  215|       |    /* check available table space */
  216|  16.2k|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   50|  5.25k|#  define ENOUGH_LENS 852
  ------------------
  |  Branch (216:10): [True: 5.25k, False: 10.9k]
  |  Branch (216:26): [True: 0, False: 5.25k]
  ------------------
  217|  16.2k|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   51|  5.20k|#  define ENOUGH_DISTS 592
  ------------------
  |  Branch (217:10): [True: 5.20k, False: 11.0k]
  |  Branch (217:27): [True: 0, False: 5.20k]
  ------------------
  218|      0|        return 1;
  219|       |
  220|       |    /* process all codes and make table entries */
  221|   522k|    for (;;) {
  222|       |        /* create table entry */
  223|   522k|        here.bits = (unsigned char)(len - drop);
  224|   522k|        if (work[sym] + 1U < match) {
  ------------------
  |  Branch (224:13): [True: 423k, False: 99.1k]
  ------------------
  225|   423k|            here.op = (unsigned char)0;
  226|   423k|            here.val = work[sym];
  227|   423k|        }
  228|  99.1k|        else if (work[sym] >= match) {
  ------------------
  |  Branch (228:18): [True: 93.9k, False: 5.25k]
  ------------------
  229|  93.9k|            here.op = (unsigned char)(extra[work[sym] - match]);
  230|  93.9k|            here.val = base[work[sym] - match];
  231|  93.9k|        }
  232|  5.25k|        else {
  233|  5.25k|            here.op = (unsigned char)(32 + 64);         /* end of block */
  234|  5.25k|            here.val = 0;
  235|  5.25k|        }
  236|       |
  237|       |        /* replicate for those indices with low len bits equal to huff */
  238|   522k|        incr = 1U << (len - drop);
  239|   522k|        fill = 1U << curr;
  240|   522k|        min = fill;                 /* save offset to next table */
  241|  1.79M|        do {
  242|  1.79M|            fill -= incr;
  243|  1.79M|            next[(huff >> drop) + fill] = here;
  244|  1.79M|        } while (fill != 0);
  ------------------
  |  Branch (244:18): [True: 1.27M, False: 522k]
  ------------------
  245|       |
  246|       |        /* backwards increment the len-bit code huff */
  247|   522k|        incr = 1U << (len - 1);
  248|  1.02M|        while (huff & incr)
  ------------------
  |  Branch (248:16): [True: 506k, False: 522k]
  ------------------
  249|   506k|            incr >>= 1;
  250|   522k|        if (incr != 0) {
  ------------------
  |  Branch (250:13): [True: 506k, False: 16.2k]
  ------------------
  251|   506k|            huff &= incr - 1;
  252|   506k|            huff += incr;
  253|   506k|        }
  254|  16.2k|        else
  255|  16.2k|            huff = 0;
  256|       |
  257|       |        /* go to next symbol, update count, len */
  258|   522k|        sym++;
  259|   522k|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (259:13): [True: 71.2k, False: 451k]
  ------------------
  260|  71.2k|            if (len == max) break;
  ------------------
  |  Branch (260:17): [True: 16.2k, False: 54.9k]
  ------------------
  261|  54.9k|            len = lens[work[sym]];
  262|  54.9k|        }
  263|       |
  264|       |        /* create new sub-table if needed */
  265|   506k|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (265:13): [True: 110k, False: 396k]
  |  Branch (265:27): [True: 42.8k, False: 67.2k]
  ------------------
  266|       |            /* if first time, transition to sub-tables */
  267|  42.8k|            if (drop == 0)
  ------------------
  |  Branch (267:17): [True: 3.32k, False: 39.5k]
  ------------------
  268|  3.32k|                drop = root;
  269|       |
  270|       |            /* increment past last table */
  271|  42.8k|            next += min;            /* here min is 1 << curr */
  272|       |
  273|       |            /* determine length of next table */
  274|  42.8k|            curr = len - drop;
  275|  42.8k|            left = (int)(1 << curr);
  276|  46.0k|            while (curr + drop < max) {
  ------------------
  |  Branch (276:20): [True: 26.2k, False: 19.8k]
  ------------------
  277|  26.2k|                left -= count[curr + drop];
  278|  26.2k|                if (left <= 0) break;
  ------------------
  |  Branch (278:21): [True: 23.0k, False: 3.19k]
  ------------------
  279|  3.19k|                curr++;
  280|  3.19k|                left <<= 1;
  281|  3.19k|            }
  282|       |
  283|       |            /* check for enough space */
  284|  42.8k|            used += 1U << curr;
  285|  42.8k|            if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   50|  40.3k|#  define ENOUGH_LENS 852
  ------------------
  |  Branch (285:18): [True: 40.3k, False: 2.56k]
  |  Branch (285:34): [True: 0, False: 40.3k]
  ------------------
  286|  42.8k|                (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   51|  2.56k|#  define ENOUGH_DISTS 592
  ------------------
  |  Branch (286:18): [True: 2.56k, False: 40.3k]
  |  Branch (286:35): [True: 0, False: 2.56k]
  ------------------
  287|      0|                return 1;
  288|       |
  289|       |            /* point entry in root table to sub-table */
  290|  42.8k|            low = huff & mask;
  291|  42.8k|            (*table)[low].op = (unsigned char)curr;
  292|  42.8k|            (*table)[low].bits = (unsigned char)root;
  293|  42.8k|            (*table)[low].val = (unsigned short)(next - *table);
  294|  42.8k|        }
  295|   506k|    }
  296|       |
  297|       |    /* fill in remaining table entry if code is incomplete (guaranteed to have
  298|       |       at most one remaining entry, since if the code is incomplete, the
  299|       |       maximum code length that was allowed to get this far is one bit) */
  300|  16.2k|    if (huff != 0) {
  ------------------
  |  Branch (300:9): [True: 11, False: 16.2k]
  ------------------
  301|     11|        here.op = (unsigned char)64;            /* invalid code marker */
  302|     11|        here.bits = (unsigned char)(len - drop);
  303|     11|        here.val = (unsigned short)0;
  304|     11|        next[huff] = here;
  305|     11|    }
  306|       |
  307|       |    /* set return parameters */
  308|  16.2k|    *table += used;
  309|  16.2k|    *bits = root;
  310|  16.2k|    return 0;
  311|  16.2k|}
inflate_fixed:
  364|  6.18k|void inflate_fixed(struct inflate_state FAR *state) {
  365|       |#ifdef BUILDFIXED
  366|       |    z_once(&built, buildtables);
  367|       |#endif /* BUILDFIXED */
  368|  6.18k|    state->lencode = lenfix;
  369|  6.18k|    state->lenbits = 9;
  370|  6.18k|    state->distcode = distfix;
  371|  6.18k|    state->distbits = 5;
  372|  6.18k|}

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

