jpeg_abort:
   33|    345|{
   34|    345|  int pool;
   35|       |
   36|       |  /* Do nothing if called on a not-initialized or destroyed JPEG object. */
   37|    345|  if (cinfo->mem == NULL)
  ------------------
  |  Branch (37:7): [True: 0, False: 345]
  ------------------
   38|      0|    return;
   39|       |
   40|       |  /* Releasing pools in reverse order might help avoid fragmentation
   41|       |   * with some (brain-damaged) malloc libraries.
   42|       |   */
   43|    690|  for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  885|    345|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  883|    690|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (43:35): [True: 345, False: 345]
  ------------------
   44|    345|    (*cinfo->mem->free_pool) (cinfo, pool);
   45|    345|  }
   46|       |
   47|       |  /* Reset overall state for possible reuse of object */
   48|    345|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (48:7): [True: 345, False: 0]
  ------------------
   49|    345|    cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|    345|#define DSTATE_START     200    /* after create_decompress */
  ------------------
   50|       |    /* Try to keep application from accessing now-deleted marker list.
   51|       |     * A bit kludgy to do it here, but this is the most central place.
   52|       |     */
   53|    345|    ((j_decompress_ptr)cinfo)->marker_list = NULL;
   54|    345|    ((j_decompress_ptr)cinfo)->master->marker_list_end = NULL;
   55|    345|  } else {
   56|      0|    cinfo->global_state = CSTATE_START;
  ------------------
  |  |   44|      0|#define CSTATE_START     100    /* after create_compress */
  ------------------
   57|      0|  }
   58|    345|}
jpeg_destroy:
   74|  1.09k|{
   75|       |  /* We need only tell the memory manager to release everything. */
   76|       |  /* NB: mem pointer is NULL if memory mgr failed to initialize. */
   77|  1.09k|  if (cinfo->mem != NULL)
  ------------------
  |  Branch (77:7): [True: 1.09k, False: 0]
  ------------------
   78|  1.09k|    (*cinfo->mem->self_destruct) (cinfo);
   79|  1.09k|  cinfo->mem = NULL;            /* be safe if jpeg_destroy is called twice */
   80|  1.09k|  cinfo->global_state = 0;      /* mark it destroyed */
   81|  1.09k|}
jpeg_alloc_quant_table:
   91|  1.25k|{
   92|  1.25k|  JQUANT_TBL *tbl;
   93|       |
   94|  1.25k|  tbl = (JQUANT_TBL *)
   95|  1.25k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JQUANT_TBL));
  ------------------
  |  |  883|  1.25k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
   96|  1.25k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  206|  1.25k|#define FALSE   0               /* values of boolean */
  ------------------
   97|  1.25k|  return tbl;
   98|  1.25k|}
jpeg_alloc_huff_table:
  103|  2.69k|{
  104|  2.69k|  JHUFF_TBL *tbl;
  105|       |
  106|  2.69k|  tbl = (JHUFF_TBL *)
  107|  2.69k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JHUFF_TBL));
  ------------------
  |  |  883|  2.69k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  108|  2.69k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  206|  2.69k|#define FALSE   0               /* values of boolean */
  ------------------
  109|  2.69k|  return tbl;
  110|  2.69k|}

jpeg_CreateDecompress:
   37|  1.09k|{
   38|  1.09k|  int i;
   39|       |
   40|       |  /* Guard against version mismatches between library and caller. */
   41|  1.09k|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   42|  1.09k|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|  1.09k|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (42:7): [True: 0, False: 1.09k]
  ------------------
   43|      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)))
  ------------------
   44|  1.09k|  if (structsize != sizeof(struct jpeg_decompress_struct))
  ------------------
  |  Branch (44:7): [True: 0, False: 1.09k]
  ------------------
   45|      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)))
  ------------------
   46|  1.09k|             (int)sizeof(struct jpeg_decompress_struct), (int)structsize);
   47|       |
   48|       |  /* For debugging purposes, we zero the whole master structure.
   49|       |   * But the application has already set the err pointer, and may have set
   50|       |   * client_data, so we have to save and restore those fields.
   51|       |   * Note: if application hasn't set client_data, tools like Purify may
   52|       |   * complain here.
   53|       |   */
   54|  1.09k|  {
   55|  1.09k|    struct jpeg_error_mgr *err = cinfo->err;
   56|  1.09k|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   57|  1.09k|    memset(cinfo, 0, sizeof(struct jpeg_decompress_struct));
   58|  1.09k|    cinfo->err = err;
   59|  1.09k|    cinfo->client_data = client_data;
   60|  1.09k|  }
   61|  1.09k|  cinfo->is_decompressor = TRUE;
  ------------------
  |  |  209|  1.09k|#define TRUE    1
  ------------------
   62|       |
   63|       |  /* Initialize a memory manager instance for this object */
   64|  1.09k|  jinit_memory_mgr((j_common_ptr)cinfo);
   65|       |
   66|       |  /* Zero out pointers to permanent structures. */
   67|  1.09k|  cinfo->progress = NULL;
   68|  1.09k|  cinfo->src = NULL;
   69|       |
   70|  5.46k|  for (i = 0; i < NUM_QUANT_TBLS; i++)
  ------------------
  |  |   68|  5.46k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (70:15): [True: 4.36k, False: 1.09k]
  ------------------
   71|  4.36k|    cinfo->quant_tbl_ptrs[i] = NULL;
   72|       |
   73|  5.46k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  5.46k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (73:15): [True: 4.36k, False: 1.09k]
  ------------------
   74|  4.36k|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   75|  4.36k|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   76|  4.36k|  }
   77|       |
   78|       |  /* Initialize marker processor so application can override methods
   79|       |   * for COM, APPn markers before calling jpeg_read_header.
   80|       |   */
   81|  1.09k|  cinfo->marker_list = NULL;
   82|  1.09k|  jinit_marker_reader(cinfo);
   83|       |
   84|       |  /* And initialize the overall input controller. */
   85|  1.09k|  jinit_input_controller(cinfo);
   86|       |
   87|  1.09k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  |   34|  1.09k|#define BITS_IN_JSAMPLE  8
  ------------------
   88|       |
   89|       |  /* OK, I'm ready */
   90|  1.09k|  cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|  1.09k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
   91|       |
   92|       |  /* The master struct is used to store extension parameters, so we allocate it
   93|       |   * here.
   94|       |   */
   95|  1.09k|  cinfo->master = (struct jpeg_decomp_master *)
   96|  1.09k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  883|  1.09k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
   97|  1.09k|                                sizeof(my_decomp_master));
   98|  1.09k|  memset(cinfo->master, 0, sizeof(my_decomp_master));
   99|  1.09k|}
jpeg_destroy_decompress:
  108|  1.09k|{
  109|  1.09k|  jpeg_destroy((j_common_ptr)cinfo); /* use common routine */
  110|  1.09k|}
jpeg_read_header:
  264|  1.09k|{
  265|  1.09k|  int retcode;
  266|       |
  267|  1.09k|  if (cinfo->global_state != DSTATE_START &&
  ------------------
  |  |   48|  2.18k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (267:7): [True: 0, False: 1.09k]
  ------------------
  268|  1.09k|      cinfo->global_state != DSTATE_INHEADER)
  ------------------
  |  |   49|      0|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (268:7): [True: 0, False: 0]
  ------------------
  269|      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)))
  ------------------
  270|       |
  271|  1.09k|  retcode = jpeg_consume_input(cinfo);
  272|       |
  273|  1.09k|  switch (retcode) {
  ------------------
  |  Branch (273:11): [True: 539, False: 553]
  ------------------
  274|    551|  case JPEG_REACHED_SOS:
  ------------------
  |  | 1106|    551|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (274:3): [True: 551, False: 541]
  ------------------
  275|    551|    retcode = JPEG_HEADER_OK;
  ------------------
  |  | 1061|    551|#define JPEG_HEADER_OK           1 /* Found valid image datastream */
  ------------------
  276|    551|    break;
  277|      2|  case JPEG_REACHED_EOI:
  ------------------
  |  | 1107|      2|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (277:3): [True: 2, False: 1.09k]
  ------------------
  278|      2|    if (require_image)          /* Complain if application wanted an image */
  ------------------
  |  Branch (278:9): [True: 2, False: 0]
  ------------------
  279|      2|      ERREXIT(cinfo, JERR_NO_IMAGE);
  ------------------
  |  |  240|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  280|       |    /* Reset to start state; it would be safer to require the application to
  281|       |     * call jpeg_abort, but we can't change it now for compatibility reasons.
  282|       |     * A side effect is to free any temporary memory (there shouldn't be any).
  283|       |     */
  284|      2|    jpeg_abort((j_common_ptr)cinfo); /* sets state = DSTATE_START */
  285|      2|    retcode = JPEG_HEADER_TABLES_ONLY;
  ------------------
  |  | 1062|      2|#define JPEG_HEADER_TABLES_ONLY  2 /* Found valid table-specs-only datastream */
  ------------------
  286|      2|    break;
  287|      0|  case JPEG_SUSPENDED:
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (287:3): [True: 0, False: 1.09k]
  ------------------
  288|       |    /* no work */
  289|      0|    break;
  290|  1.09k|  }
  291|       |
  292|    551|  return retcode;
  293|  1.09k|}
jpeg_consume_input:
  310|  1.09k|{
  311|  1.09k|  int retcode = JPEG_SUSPENDED;
  ------------------
  |  | 1060|  1.09k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  312|       |
  313|       |  /* NB: every possible DSTATE value should be listed in this switch */
  314|  1.09k|  switch (cinfo->global_state) {
  315|  1.09k|  case DSTATE_START:
  ------------------
  |  |   48|  1.09k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (315:3): [True: 1.09k, False: 0]
  ------------------
  316|       |    /* Start-of-datastream actions: reset appropriate modules */
  317|  1.09k|    (*cinfo->inputctl->reset_input_controller) (cinfo);
  318|       |    /* Initialize application's data source module */
  319|  1.09k|    (*cinfo->src->init_source) (cinfo);
  320|  1.09k|    cinfo->global_state = DSTATE_INHEADER;
  ------------------
  |  |   49|  1.09k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  321|       |    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|  1.09k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  322|  1.09k|  case DSTATE_INHEADER:
  ------------------
  |  |   49|  1.09k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (322:3): [True: 0, False: 1.09k]
  ------------------
  323|  1.09k|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  324|  1.09k|    if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
  ------------------
  |  | 1106|  1.09k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (324:9): [True: 551, False: 541]
  ------------------
  325|       |      /* Set up default parameters based on header data */
  326|    551|      default_decompress_parms(cinfo);
  327|       |      /* Set global state: ready for start_decompress */
  328|    551|      cinfo->global_state = DSTATE_READY;
  ------------------
  |  |   50|    551|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  329|    551|    }
  330|  1.09k|    break;
  331|      0|  case DSTATE_READY:
  ------------------
  |  |   50|      0|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (331:3): [True: 0, False: 1.09k]
  ------------------
  332|       |    /* Can't advance past first SOS until start_decompress is called */
  333|      0|    retcode = JPEG_REACHED_SOS;
  ------------------
  |  | 1106|      0|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  334|      0|    break;
  335|      0|  case DSTATE_PRELOAD:
  ------------------
  |  |   51|      0|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (335:3): [True: 0, False: 1.09k]
  ------------------
  336|      0|  case DSTATE_PRESCAN:
  ------------------
  |  |   52|      0|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (336:3): [True: 0, False: 1.09k]
  ------------------
  337|      0|  case DSTATE_SCANNING:
  ------------------
  |  |   53|      0|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (337:3): [True: 0, False: 1.09k]
  ------------------
  338|      0|  case DSTATE_RAW_OK:
  ------------------
  |  |   54|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (338:3): [True: 0, False: 1.09k]
  ------------------
  339|      0|  case DSTATE_BUFIMAGE:
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (339:3): [True: 0, False: 1.09k]
  ------------------
  340|      0|  case DSTATE_BUFPOST:
  ------------------
  |  |   56|      0|#define DSTATE_BUFPOST   208    /* looking for SOS/EOI in jpeg_finish_output */
  ------------------
  |  Branch (340:3): [True: 0, False: 1.09k]
  ------------------
  341|      0|  case DSTATE_STOPPING:
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (341:3): [True: 0, False: 1.09k]
  ------------------
  342|      0|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  343|      0|    break;
  344|      0|  default:
  ------------------
  |  Branch (344:3): [True: 0, False: 1.09k]
  ------------------
  345|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  346|  1.09k|  }
  347|    553|  return retcode;
  348|  1.09k|}
jpeg_finish_decompress:
  392|    423|{
  393|    423|  if ((cinfo->global_state == DSTATE_SCANNING ||
  ------------------
  |  |   53|    846|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (393:8): [True: 423, False: 0]
  ------------------
  394|    423|       cinfo->global_state == DSTATE_RAW_OK) && !cinfo->buffered_image) {
  ------------------
  |  |   54|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (394:8): [True: 0, False: 0]
  |  Branch (394:49): [True: 423, False: 0]
  ------------------
  395|       |    /* Terminate final pass of non-buffered mode */
  396|    423|    if (cinfo->output_scanline < cinfo->output_height)
  ------------------
  |  Branch (396:9): [True: 0, False: 423]
  ------------------
  397|      0|      ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  398|    423|    (*cinfo->master->finish_output_pass) (cinfo);
  399|    423|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|    423|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  400|    423|  } else if (cinfo->global_state == DSTATE_BUFIMAGE) {
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (400:14): [True: 0, False: 0]
  ------------------
  401|       |    /* Finishing after a buffered-image operation */
  402|      0|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  403|      0|  } else if (cinfo->global_state != DSTATE_STOPPING) {
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (403:14): [True: 0, False: 0]
  ------------------
  404|       |    /* STOPPING = repeat call after a suspension, anything else is error */
  405|      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)))
  ------------------
  406|      0|  }
  407|       |  /* Read until EOI */
  408|    846|  while (!cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (408:10): [True: 423, False: 423]
  ------------------
  409|    423|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1060|    423|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (409:9): [True: 0, False: 423]
  ------------------
  410|      0|      return FALSE;             /* Suspend, come back later */
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  411|    423|  }
  412|       |  /* Do final cleanup */
  413|    423|  (*cinfo->src->term_source) (cinfo);
  414|       |  /* We can use jpeg_abort to release memory and reset global_state */
  415|    423|  jpeg_abort((j_common_ptr)cinfo);
  416|    423|  return TRUE;
  ------------------
  |  |  209|    423|#define TRUE    1
  ------------------
  417|    423|}
jdapimin.c:default_decompress_parms:
  131|    551|{
  132|       |  /* Guess the input colorspace, and set output colorspace accordingly. */
  133|       |  /* (Wish JPEG committee had provided a real way to specify this...) */
  134|       |  /* Note application may override our guesses. */
  135|    551|  switch (cinfo->num_components) {
  136|    171|  case 1:
  ------------------
  |  Branch (136:3): [True: 171, False: 380]
  ------------------
  137|    171|    cinfo->jpeg_color_space = JCS_GRAYSCALE;
  138|    171|    cinfo->out_color_space = JCS_GRAYSCALE;
  139|    171|    break;
  140|       |
  141|    160|  case 3:
  ------------------
  |  Branch (141:3): [True: 160, False: 391]
  ------------------
  142|    160|    if (cinfo->saw_JFIF_marker) {
  ------------------
  |  Branch (142:9): [True: 158, False: 2]
  ------------------
  143|    158|      cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
  144|    158|    } else if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (144:16): [True: 0, False: 2]
  ------------------
  145|      0|      switch (cinfo->Adobe_transform) {
  146|      0|      case 0:
  ------------------
  |  Branch (146:7): [True: 0, False: 0]
  ------------------
  147|      0|        cinfo->jpeg_color_space = JCS_RGB;
  148|      0|        break;
  149|      0|      case 1:
  ------------------
  |  Branch (149:7): [True: 0, False: 0]
  ------------------
  150|      0|        cinfo->jpeg_color_space = JCS_YCbCr;
  151|      0|        break;
  152|      0|      default:
  ------------------
  |  Branch (152:7): [True: 0, False: 0]
  ------------------
  153|      0|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  287|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  154|      0|        cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  155|      0|        break;
  156|      0|      }
  157|      2|    } else {
  158|       |      /* Saw no special markers, try to guess from the component IDs */
  159|      2|      int cid0 = cinfo->comp_info[0].component_id;
  160|      2|      int cid1 = cinfo->comp_info[1].component_id;
  161|      2|      int cid2 = cinfo->comp_info[2].component_id;
  162|       |
  163|      2|      if (cid0 == 1 && cid1 == 2 && cid2 == 3) {
  ------------------
  |  Branch (163:11): [True: 2, False: 0]
  |  Branch (163:24): [True: 2, False: 0]
  |  Branch (163:37): [True: 2, False: 0]
  ------------------
  164|      2|        if (cinfo->master->lossless)
  ------------------
  |  Branch (164:13): [True: 0, False: 2]
  ------------------
  165|      0|          cinfo->jpeg_color_space = JCS_RGB; /* assume RGB w/out marker */
  166|      2|        else
  167|      2|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
  168|      2|      } else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
  ------------------
  |  Branch (168:18): [True: 0, False: 0]
  |  Branch (168:32): [True: 0, False: 0]
  |  Branch (168:46): [True: 0, False: 0]
  ------------------
  169|      0|        cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
  170|      0|      else {
  171|      0|        TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
  ------------------
  |  |  309|      0|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|      0|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  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)); )
  ------------------
  172|      0|        if (cinfo->master->lossless)
  ------------------
  |  Branch (172:13): [True: 0, False: 0]
  ------------------
  173|      0|          cinfo->jpeg_color_space = JCS_RGB; /* assume it's RGB */
  174|      0|        else
  175|      0|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  176|      0|      }
  177|      2|    }
  178|       |    /* Always guess RGB is proper output colorspace. */
  179|    160|    cinfo->out_color_space = JCS_RGB;
  180|    160|    break;
  181|       |
  182|    220|  case 4:
  ------------------
  |  Branch (182:3): [True: 220, False: 331]
  ------------------
  183|    220|    if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (183:9): [True: 206, False: 14]
  ------------------
  184|    206|      switch (cinfo->Adobe_transform) {
  185|    206|      case 0:
  ------------------
  |  Branch (185:7): [True: 206, False: 0]
  ------------------
  186|    206|        cinfo->jpeg_color_space = JCS_CMYK;
  187|    206|        break;
  188|      0|      case 2:
  ------------------
  |  Branch (188:7): [True: 0, False: 206]
  ------------------
  189|      0|        cinfo->jpeg_color_space = JCS_YCCK;
  190|      0|        break;
  191|      0|      default:
  ------------------
  |  Branch (191:7): [True: 0, False: 206]
  ------------------
  192|      0|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  287|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  193|      0|        cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
  194|      0|        break;
  195|    206|      }
  196|    206|    } else {
  197|       |      /* No special markers, assume straight CMYK. */
  198|     14|      cinfo->jpeg_color_space = JCS_CMYK;
  199|     14|    }
  200|    220|    cinfo->out_color_space = JCS_CMYK;
  201|    220|    break;
  202|       |
  203|      0|  default:
  ------------------
  |  Branch (203:3): [True: 0, False: 551]
  ------------------
  204|      0|    cinfo->jpeg_color_space = JCS_UNKNOWN;
  205|      0|    cinfo->out_color_space = JCS_UNKNOWN;
  206|      0|    break;
  207|    551|  }
  208|       |
  209|       |  /* Set defaults for other decompression parameters. */
  210|    551|  cinfo->scale_num = 1;         /* 1:1 scaling */
  211|    551|  cinfo->scale_denom = 1;
  212|    551|  cinfo->output_gamma = 1.0;
  213|    551|  cinfo->buffered_image = FALSE;
  ------------------
  |  |  206|    551|#define FALSE   0               /* values of boolean */
  ------------------
  214|    551|  cinfo->raw_data_out = FALSE;
  ------------------
  |  |  206|    551|#define FALSE   0               /* values of boolean */
  ------------------
  215|    551|  cinfo->dct_method = JDCT_DEFAULT;
  ------------------
  |  |  297|    551|#define JDCT_DEFAULT  JDCT_ISLOW
  ------------------
  216|    551|  cinfo->do_fancy_upsampling = TRUE;
  ------------------
  |  |  209|    551|#define TRUE    1
  ------------------
  217|    551|  cinfo->do_block_smoothing = TRUE;
  ------------------
  |  |  209|    551|#define TRUE    1
  ------------------
  218|    551|  cinfo->quantize_colors = FALSE;
  ------------------
  |  |  206|    551|#define FALSE   0               /* values of boolean */
  ------------------
  219|       |  /* We set these in case application only sets quantize_colors. */
  220|    551|  cinfo->dither_mode = JDITHER_FS;
  221|    551|#ifdef QUANT_2PASS_SUPPORTED
  222|    551|  cinfo->two_pass_quantize = TRUE;
  ------------------
  |  |  209|    551|#define TRUE    1
  ------------------
  223|       |#else
  224|       |  cinfo->two_pass_quantize = FALSE;
  225|       |#endif
  226|    551|  cinfo->desired_number_of_colors = 256;
  227|    551|  cinfo->colormap = NULL;
  228|       |  /* Initialize for no mode change in buffered-image mode. */
  229|    551|  cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  206|    551|#define FALSE   0               /* values of boolean */
  ------------------
  230|    551|  cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  206|    551|#define FALSE   0               /* values of boolean */
  ------------------
  231|    551|  cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  206|    551|#define FALSE   0               /* values of boolean */
  ------------------
  232|    551|}

jpeg_start_decompress:
   53|    550|{
   54|    550|  if (cinfo->global_state == DSTATE_READY) {
  ------------------
  |  |   50|    550|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (54:7): [True: 550, False: 0]
  ------------------
   55|       |    /* First call: initialize master control, select active modules */
   56|    550|    jinit_master_decompress(cinfo);
   57|    550|    if (cinfo->buffered_image) {
  ------------------
  |  Branch (57:9): [True: 0, False: 550]
  ------------------
   58|       |      /* No more work here; expecting jpeg_start_output next */
   59|      0|      cinfo->global_state = DSTATE_BUFIMAGE;
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
   60|      0|      return TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
   61|      0|    }
   62|    550|    cinfo->global_state = DSTATE_PRELOAD;
  ------------------
  |  |   51|    550|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
   63|    550|  }
   64|    550|  if (cinfo->global_state == DSTATE_PRELOAD) {
  ------------------
  |  |   51|    550|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (64:7): [True: 529, False: 21]
  ------------------
   65|       |    /* If file has multiple scans, absorb them all into the coef buffer */
   66|    529|    if (cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (66:9): [True: 1, False: 528]
  ------------------
   67|      1|#ifdef D_MULTISCAN_FILES_SUPPORTED
   68|     11|      for (;;) {
   69|     11|        int retcode;
   70|       |        /* Call progress monitor hook if present */
   71|     11|        if (cinfo->progress != NULL)
  ------------------
  |  Branch (71:13): [True: 11, False: 0]
  ------------------
   72|     11|          (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
   73|       |        /* Absorb some more input */
   74|     11|        retcode = (*cinfo->inputctl->consume_input) (cinfo);
   75|     11|        if (retcode == JPEG_SUSPENDED)
  ------------------
  |  | 1060|     11|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (75:13): [True: 0, False: 11]
  ------------------
   76|      0|          return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
   77|     11|        if (retcode == JPEG_REACHED_EOI)
  ------------------
  |  | 1107|     11|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (77:13): [True: 0, False: 11]
  ------------------
   78|      0|          break;
   79|       |        /* Advance progress counter if appropriate */
   80|     11|        if (cinfo->progress != NULL &&
  ------------------
  |  Branch (80:13): [True: 10, False: 1]
  ------------------
   81|     11|            (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1108|     20|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
                          (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1106|      2|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (81:14): [True: 8, False: 2]
  |  Branch (81:47): [True: 1, False: 1]
  ------------------
   82|      9|          if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
  ------------------
  |  Branch (82:15): [True: 0, False: 9]
  ------------------
   83|       |            /* jdmaster underestimated number of scans; ratchet up one scan */
   84|      0|            cinfo->progress->pass_limit += (long)cinfo->total_iMCU_rows;
   85|      0|          }
   86|      9|        }
   87|     11|      }
   88|       |#else
   89|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
   90|       |#endif /* D_MULTISCAN_FILES_SUPPORTED */
   91|      1|    }
   92|    529|    cinfo->output_scan_number = cinfo->input_scan_number;
   93|    529|  } else if (cinfo->global_state != DSTATE_PRESCAN)
  ------------------
  |  |   52|     21|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (93:14): [True: 0, False: 21]
  ------------------
   94|      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)))
  ------------------
   95|       |  /* Perform any dummy output passes, and set up for the final pass */
   96|    550|  return output_pass_setup(cinfo);
   97|    550|}
jpeg_read_scanlines:
  313|  22.1k|{
  314|  22.1k|#if BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED)
  315|  22.1k|  JDIMENSION row_ctr;
  316|       |
  317|  22.1k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   34|  22.1k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (317:7): [True: 0, False: 22.1k]
  ------------------
  318|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  319|       |
  320|  22.1k|  if (cinfo->global_state != DSTATE_SCANNING)
  ------------------
  |  |   53|  22.1k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (320:7): [True: 0, False: 22.1k]
  ------------------
  321|      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)))
  ------------------
  322|  22.1k|  if (cinfo->output_scanline >= cinfo->output_height) {
  ------------------
  |  Branch (322:7): [True: 0, False: 22.1k]
  ------------------
  323|      0|    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
  ------------------
  |  |  283|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  324|      0|    return 0;
  325|      0|  }
  326|       |
  327|       |  /* Call progress monitor hook if present */
  328|  22.1k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (328:7): [True: 22.1k, False: 0]
  ------------------
  329|  22.1k|    cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  330|  22.1k|    cinfo->progress->pass_limit = (long)cinfo->output_height;
  331|  22.1k|    (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  332|  22.1k|  }
  333|       |
  334|       |  /* Process some data */
  335|  22.1k|  row_ctr = 0;
  336|  22.1k|  (*cinfo->main->_process_data) (cinfo, scanlines, &row_ctr, max_lines);
  ------------------
  |  |  254|  22.1k|#define _process_data  process_data
  ------------------
  337|  22.1k|  cinfo->output_scanline += row_ctr;
  338|  22.1k|  return row_ctr;
  339|       |#else
  340|       |  ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  341|       |  return 0;
  342|       |#endif
  343|  22.1k|}
jdapistd.c:output_pass_setup:
  110|    528|{
  111|    528|  if (cinfo->global_state != DSTATE_PRESCAN) {
  ------------------
  |  |   52|    528|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (111:7): [True: 528, False: 0]
  ------------------
  112|       |    /* First call: do pass setup */
  113|    528|    (*cinfo->master->prepare_for_output_pass) (cinfo);
  114|    528|    cinfo->output_scanline = 0;
  115|    528|    cinfo->global_state = DSTATE_PRESCAN;
  ------------------
  |  |   52|    528|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  116|    528|  }
  117|       |  /* Loop over any required dummy passes */
  118|    528|  while (cinfo->master->is_dummy_pass) {
  ------------------
  |  Branch (118:10): [True: 0, False: 528]
  ------------------
  119|      0|#ifdef QUANT_2PASS_SUPPORTED
  120|       |    /* Crank through the dummy pass */
  121|      0|    while (cinfo->output_scanline < cinfo->output_height) {
  ------------------
  |  Branch (121:12): [True: 0, False: 0]
  ------------------
  122|      0|      JDIMENSION last_scanline;
  123|       |      /* Call progress monitor hook if present */
  124|      0|      if (cinfo->progress != NULL) {
  ------------------
  |  Branch (124:11): [True: 0, False: 0]
  ------------------
  125|      0|        cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  126|      0|        cinfo->progress->pass_limit = (long)cinfo->output_height;
  127|      0|        (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  128|      0|      }
  129|       |      /* Process some data */
  130|      0|      last_scanline = cinfo->output_scanline;
  131|      0|#ifdef D_LOSSLESS_SUPPORTED
  132|      0|      if (cinfo->data_precision == 16)
  ------------------
  |  Branch (132:11): [True: 0, False: 0]
  ------------------
  133|      0|        (*cinfo->main->process_data_16) (cinfo, (J16SAMPARRAY)NULL,
  134|      0|                                         &cinfo->output_scanline,
  135|      0|                                         (JDIMENSION)0);
  136|      0|      else
  137|      0|#endif
  138|      0|      if (cinfo->data_precision == 12)
  ------------------
  |  Branch (138:11): [True: 0, False: 0]
  ------------------
  139|      0|        (*cinfo->main->process_data_12) (cinfo, (J12SAMPARRAY)NULL,
  140|      0|                                         &cinfo->output_scanline,
  141|      0|                                         (JDIMENSION)0);
  142|      0|      else
  143|      0|        (*cinfo->main->process_data) (cinfo, (JSAMPARRAY)NULL,
  144|      0|                                      &cinfo->output_scanline, (JDIMENSION)0);
  145|      0|      if (cinfo->output_scanline == last_scanline)
  ------------------
  |  Branch (145:11): [True: 0, False: 0]
  ------------------
  146|      0|        return FALSE;           /* No progress made, must suspend */
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  147|      0|    }
  148|       |    /* Finish up dummy pass, and set up for another one */
  149|      0|    (*cinfo->master->finish_output_pass) (cinfo);
  150|      0|    (*cinfo->master->prepare_for_output_pass) (cinfo);
  151|      0|    cinfo->output_scanline = 0;
  152|       |#else
  153|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  154|       |#endif /* QUANT_2PASS_SUPPORTED */
  155|      0|  }
  156|       |  /* Ready for application to drive output pass through
  157|       |   * _jpeg_read_scanlines or _jpeg_read_raw_data.
  158|       |   */
  159|    528|  cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
  ------------------
  |  |   54|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
                cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
  ------------------
  |  |   53|  1.05k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (159:25): [True: 0, False: 528]
  ------------------
  160|    528|  return TRUE;
  ------------------
  |  |  209|    528|#define TRUE    1
  ------------------
  161|    528|}

jinit_arith_decoder:
  751|     52|{
  752|     52|  arith_entropy_ptr entropy;
  753|     52|  int i;
  754|       |
  755|     52|  entropy = (arith_entropy_ptr)
  756|     52|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|     52|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  757|     52|                                sizeof(arith_entropy_decoder));
  758|     52|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  759|     52|  entropy->pub.start_pass = start_pass;
  760|       |
  761|       |  /* Mark tables unallocated */
  762|    884|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|    884|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (762:15): [True: 832, False: 52]
  ------------------
  763|    832|    entropy->dc_stats[i] = NULL;
  764|    832|    entropy->ac_stats[i] = NULL;
  765|    832|  }
  766|       |
  767|       |  /* Initialize index for fixed probability estimation */
  768|     52|  entropy->fixed_bin[0] = 113;
  769|       |
  770|     52|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (770:7): [True: 0, False: 52]
  ------------------
  771|       |    /* Create progression status table */
  772|      0|    int *coef_bit_ptr, ci;
  773|      0|    cinfo->coef_bits = (int (*)[DCTSIZE2])
  774|      0|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  775|      0|                                  cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  776|      0|                                  sizeof(int));
  777|      0|    coef_bit_ptr = &cinfo->coef_bits[0][0];
  778|      0|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (778:18): [True: 0, False: 0]
  ------------------
  779|      0|      for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (779:19): [True: 0, False: 0]
  ------------------
  780|      0|        *coef_bit_ptr++ = -1;
  781|      0|  }
  782|     52|}
jdarith.c:start_pass:
  633|     52|{
  634|     52|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  635|     52|  int ci, tbl;
  636|     52|  jpeg_component_info *compptr;
  637|       |
  638|     52|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (638:7): [True: 0, False: 52]
  ------------------
  639|       |    /* Validate progressive scan parameters */
  640|      0|    if (cinfo->Ss == 0) {
  ------------------
  |  Branch (640:9): [True: 0, False: 0]
  ------------------
  641|      0|      if (cinfo->Se != 0)
  ------------------
  |  Branch (641:11): [True: 0, False: 0]
  ------------------
  642|      0|        goto bad;
  643|      0|    } else {
  644|       |      /* need not check Ss/Se < 0 since they came from unsigned bytes */
  645|      0|      if (cinfo->Se < cinfo->Ss || cinfo->Se > DCTSIZE2 - 1)
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (645:11): [True: 0, False: 0]
  |  Branch (645:36): [True: 0, False: 0]
  ------------------
  646|      0|        goto bad;
  647|       |      /* AC scans may have only one component */
  648|      0|      if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (648:11): [True: 0, False: 0]
  ------------------
  649|      0|        goto bad;
  650|      0|    }
  651|      0|    if (cinfo->Ah != 0) {
  ------------------
  |  Branch (651:9): [True: 0, False: 0]
  ------------------
  652|       |      /* Successive approximation refinement scan: must have Al = Ah-1. */
  653|      0|      if (cinfo->Ah - 1 != cinfo->Al)
  ------------------
  |  Branch (653:11): [True: 0, False: 0]
  ------------------
  654|      0|        goto bad;
  655|      0|    }
  656|      0|    if (cinfo->Al > 13) {       /* need not check for < 0 */
  ------------------
  |  Branch (656:9): [True: 0, False: 0]
  ------------------
  657|      0|bad:
  658|      0|      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      0|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      0|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  659|      0|               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  660|      0|    }
  661|       |    /* Update progression status, and verify that scan order is legal.
  662|       |     * Note that inter-scan inconsistencies are treated as warnings
  663|       |     * not fatal errors ... not clear if this is right way to behave.
  664|       |     */
  665|      0|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (665:18): [True: 0, False: 0]
  ------------------
  666|      0|      int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
  667|      0|      int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  668|      0|      int *prev_coef_bit_ptr =
  669|      0|        &cinfo->coef_bits[cindex + cinfo->num_components][0];
  670|      0|      if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (670:11): [True: 0, False: 0]
  |  Branch (670:24): [True: 0, False: 0]
  ------------------
  671|      0|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  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))
  ------------------
  672|      0|      for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  447|      0|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (447:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  445|      0|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (445:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (672:39): [True: 0, False: 0]
  ------------------
  673|      0|        if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (673:13): [True: 0, False: 0]
  ------------------
  674|      0|          prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  675|      0|        else
  676|      0|          prev_coef_bit_ptr[coefi] = 0;
  677|      0|      }
  678|      0|      for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (678:31): [True: 0, False: 0]
  ------------------
  679|      0|        int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (679:24): [True: 0, False: 0]
  ------------------
  680|      0|        if (cinfo->Ah != expected)
  ------------------
  |  Branch (680:13): [True: 0, False: 0]
  ------------------
  681|      0|          WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  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))
  ------------------
  682|      0|        coef_bit_ptr[coefi] = cinfo->Al;
  683|      0|      }
  684|      0|    }
  685|       |    /* Select MCU decoding routine */
  686|      0|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (686:9): [True: 0, False: 0]
  ------------------
  687|      0|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (687:11): [True: 0, False: 0]
  ------------------
  688|      0|        entropy->pub.decode_mcu = decode_mcu_DC_first;
  689|      0|      else
  690|      0|        entropy->pub.decode_mcu = decode_mcu_AC_first;
  691|      0|    } else {
  692|      0|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (692:11): [True: 0, False: 0]
  ------------------
  693|      0|        entropy->pub.decode_mcu = decode_mcu_DC_refine;
  694|      0|      else
  695|      0|        entropy->pub.decode_mcu = decode_mcu_AC_refine;
  696|      0|    }
  697|     52|  } else {
  698|       |    /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
  699|       |     * This ought to be an error condition, but we make it a warning.
  700|       |     */
  701|     52|    if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|     52|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (701:9): [True: 0, False: 52]
  |  Branch (701:27): [True: 0, False: 52]
  ------------------
  702|     52|        cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (702:9): [True: 1, False: 51]
  |  Branch (702:27): [True: 0, False: 51]
  ------------------
  703|      1|      WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      1|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  704|       |    /* Select MCU decoding routine */
  705|     52|    entropy->pub.decode_mcu = decode_mcu;
  706|     52|  }
  707|       |
  708|       |  /* Allocate & initialize requested statistics areas */
  709|    256|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (709:16): [True: 204, False: 52]
  ------------------
  710|    204|    compptr = cinfo->cur_comp_info[ci];
  711|    204|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (711:9): [True: 204, False: 0]
  |  Branch (711:38): [True: 0, False: 0]
  |  Branch (711:56): [True: 0, False: 0]
  ------------------
  712|    204|      tbl = compptr->dc_tbl_no;
  713|    204|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|    204|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (713:11): [True: 0, False: 204]
  |  Branch (713:22): [True: 0, False: 204]
  ------------------
  714|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  715|    204|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (715:11): [True: 52, False: 152]
  ------------------
  716|     52|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  717|     52|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  884|     52|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|     52|#define DC_STAT_BINS  64
  ------------------
  718|    204|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|    204|#define DC_STAT_BINS  64
  ------------------
  719|       |      /* Initialize DC predictions to 0 */
  720|    204|      entropy->last_dc_val[ci] = 0;
  721|    204|      entropy->dc_context[ci] = 0;
  722|    204|    }
  723|    204|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (723:9): [True: 204, False: 0]
  |  Branch (723:37): [True: 0, False: 0]
  ------------------
  724|    204|      tbl = compptr->ac_tbl_no;
  725|    204|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|    204|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (725:11): [True: 0, False: 204]
  |  Branch (725:22): [True: 0, False: 204]
  ------------------
  726|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  727|    204|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (727:11): [True: 52, False: 152]
  ------------------
  728|     52|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  729|     52|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  884|     52|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|     52|#define AC_STAT_BINS  256
  ------------------
  730|    204|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|    204|#define AC_STAT_BINS  256
  ------------------
  731|    204|    }
  732|    204|  }
  733|       |
  734|       |  /* Initialize arithmetic decoding variables */
  735|     52|  entropy->c = 0;
  736|     52|  entropy->a = 0;
  737|     52|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  738|     52|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|     52|#define FALSE   0               /* values of boolean */
  ------------------
  739|       |
  740|       |  /* Initialize restart counter */
  741|     52|  entropy->restarts_to_go = cinfo->restart_interval;
  742|     52|}
jdarith.c:arith_decode:
  116|  72.0k|{
  117|  72.0k|  register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  118|  72.0k|  register unsigned char nl, nm;
  119|  72.0k|  register JLONG qe, temp;
  120|  72.0k|  register int sv, data;
  121|       |
  122|       |  /* Renormalization & data input per section D.2.6 */
  123|   123k|  while (e->a < 0x8000L) {
  ------------------
  |  Branch (123:10): [True: 51.0k, False: 72.0k]
  ------------------
  124|  51.0k|    if (--e->ct < 0) {
  ------------------
  |  Branch (124:9): [True: 6.49k, False: 44.5k]
  ------------------
  125|       |      /* Need to fetch next data byte */
  126|  6.49k|      if (cinfo->unread_marker)
  ------------------
  |  Branch (126:11): [True: 1.28k, False: 5.21k]
  ------------------
  127|  1.28k|        data = 0;               /* stuff zero data */
  128|  5.21k|      else {
  129|  5.21k|        data = get_byte(cinfo); /* read next input byte */
  130|  5.21k|        if (data == 0xFF) {     /* zero stuff or marker code */
  ------------------
  |  Branch (130:13): [True: 41, False: 5.16k]
  ------------------
  131|     48|          do data = get_byte(cinfo);
  132|     48|          while (data == 0xFF); /* swallow extra 0xFF bytes */
  ------------------
  |  Branch (132:18): [True: 7, False: 41]
  ------------------
  133|     41|          if (data == 0)
  ------------------
  |  Branch (133:15): [True: 8, False: 33]
  ------------------
  134|      8|            data = 0xFF;        /* discard stuffed zero byte */
  135|     33|          else {
  136|       |            /* Note: Different from the Huffman decoder, hitting
  137|       |             * a marker while processing the compressed data
  138|       |             * segment is legal in arithmetic coding.
  139|       |             * The convention is to supply zero data
  140|       |             * then until decoding is complete.
  141|       |             */
  142|     33|            cinfo->unread_marker = data;
  143|     33|            data = 0;
  144|     33|          }
  145|     41|        }
  146|  5.21k|      }
  147|  6.49k|      e->c = (e->c << 8) | data; /* insert data into C register */
  148|  6.49k|      if ((e->ct += 8) < 0)      /* update bit shift counter */
  ------------------
  |  Branch (148:11): [True: 102, False: 6.39k]
  ------------------
  149|       |        /* Need more initial bytes */
  150|    102|        if (++e->ct == 0)
  ------------------
  |  Branch (150:13): [True: 51, False: 51]
  ------------------
  151|       |          /* Got 2 initial bytes -> re-init A and exit loop */
  152|     51|          e->a = 0x8000L; /* => e->a = 0x10000L after loop exit */
  153|  6.49k|    }
  154|  51.0k|    e->a <<= 1;
  155|  51.0k|  }
  156|       |
  157|       |  /* Fetch values from our compact representation of Table D.2:
  158|       |   * Qe values and probability estimation state machine
  159|       |   */
  160|  72.0k|  sv = *st;
  161|  72.0k|  qe = jpeg_aritab[sv & 0x7F];  /* => Qe_Value */
  162|  72.0k|  nl = qe & 0xFF;  qe >>= 8;    /* Next_Index_LPS + Switch_MPS */
  163|  72.0k|  nm = qe & 0xFF;  qe >>= 8;    /* Next_Index_MPS */
  164|       |
  165|       |  /* Decode & estimation procedures per sections D.2.4 & D.2.5 */
  166|  72.0k|  temp = e->a - qe;
  167|  72.0k|  e->a = temp;
  168|  72.0k|  temp <<= e->ct;
  169|  72.0k|  if (e->c >= temp) {
  ------------------
  |  Branch (169:7): [True: 19.4k, False: 52.6k]
  ------------------
  170|  19.4k|    e->c -= temp;
  171|       |    /* Conditional LPS (less probable symbol) exchange */
  172|  19.4k|    if (e->a < qe) {
  ------------------
  |  Branch (172:9): [True: 4.87k, False: 14.6k]
  ------------------
  173|  4.87k|      e->a = qe;
  174|  4.87k|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  175|  14.6k|    } else {
  176|  14.6k|      e->a = qe;
  177|  14.6k|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  178|  14.6k|      sv ^= 0x80;               /* Exchange LPS/MPS */
  179|  14.6k|    }
  180|  52.6k|  } else if (e->a < 0x8000L) {
  ------------------
  |  Branch (180:14): [True: 18.8k, False: 33.7k]
  ------------------
  181|       |    /* Conditional MPS (more probable symbol) exchange */
  182|  18.8k|    if (e->a < qe) {
  ------------------
  |  Branch (182:9): [True: 3.36k, False: 15.4k]
  ------------------
  183|  3.36k|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  184|  3.36k|      sv ^= 0x80;               /* Exchange LPS/MPS */
  185|  15.4k|    } else {
  186|  15.4k|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  187|  15.4k|    }
  188|  18.8k|  }
  189|       |
  190|  72.0k|  return sv >> 7;
  191|  72.0k|}
jdarith.c:get_byte:
   76|  5.25k|{
   77|  5.25k|  struct jpeg_source_mgr *src = cinfo->src;
   78|       |
   79|  5.25k|  if (src->bytes_in_buffer == 0)
  ------------------
  |  Branch (79:7): [True: 1, False: 5.25k]
  ------------------
   80|      1|    if (!(*src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (80:9): [True: 0, False: 1]
  ------------------
   81|      0|      ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   82|  5.25k|  src->bytes_in_buffer--;
   83|  5.25k|  return *src->next_input_byte++;
   84|  5.25k|}
jdarith.c:decode_mcu:
  506|  1.59k|{
  507|  1.59k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  508|  1.59k|  jpeg_component_info *compptr;
  509|  1.59k|  JBLOCKROW block;
  510|  1.59k|  unsigned char *st;
  511|  1.59k|  int blkn, ci, tbl, sign, k;
  512|  1.59k|  int v, m;
  513|       |
  514|       |  /* Process restart marker if needed */
  515|  1.59k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (515:7): [True: 0, False: 1.59k]
  ------------------
  516|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (516:9): [True: 0, False: 0]
  ------------------
  517|      0|      process_restart(cinfo);
  518|      0|    entropy->restarts_to_go--;
  519|      0|  }
  520|       |
  521|  1.59k|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  |  Branch (521:7): [True: 0, False: 1.59k]
  ------------------
  522|       |
  523|       |  /* Outer loop handles each block in the MCU */
  524|       |
  525|  7.99k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (525:18): [True: 6.39k, False: 1.59k]
  ------------------
  526|  6.39k|    block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (526:13): [True: 6.39k, False: 0]
  ------------------
  527|  6.39k|    ci = cinfo->MCU_membership[blkn];
  528|  6.39k|    compptr = cinfo->cur_comp_info[ci];
  529|       |
  530|       |    /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */
  531|       |
  532|  6.39k|    tbl = compptr->dc_tbl_no;
  533|       |
  534|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  535|  6.39k|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  536|       |
  537|       |    /* Figure F.19: Decode_DC_DIFF */
  538|  6.39k|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (538:9): [True: 2.98k, False: 3.41k]
  ------------------
  539|  2.98k|      entropy->dc_context[ci] = 0;
  540|  3.41k|    else {
  541|       |      /* Figure F.21: Decoding nonzero value v */
  542|       |      /* Figure F.22: Decoding the sign of v */
  543|  3.41k|      sign = arith_decode(cinfo, st + 1);
  544|  3.41k|      st += 2;  st += sign;
  545|       |      /* Figure F.23: Decoding the magnitude category of v */
  546|  3.41k|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (546:11): [True: 1.71k, False: 1.70k]
  ------------------
  547|  1.71k|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  548|  3.40k|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (548:16): [True: 1.69k, False: 1.71k]
  ------------------
  549|  1.69k|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (549:15): [True: 0, False: 1.69k]
  ------------------
  550|      0|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  551|      0|            entropy->ct = -1;                   /* magnitude overflow */
  552|      0|            return TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  553|      0|          }
  554|  1.69k|          st += 1;
  555|  1.69k|        }
  556|  1.71k|      }
  557|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  558|  3.41k|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (558:11): [True: 0, False: 3.41k]
  ------------------
  559|      0|        entropy->dc_context[ci] = 0;               /* zero diff category */
  560|  3.41k|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (560:16): [True: 1.50k, False: 1.91k]
  ------------------
  561|  1.50k|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  562|  1.91k|      else
  563|  1.91k|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  564|  3.41k|      v = m;
  565|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  566|  3.41k|      st += 14;
  567|  5.10k|      while (m >>= 1)
  ------------------
  |  Branch (567:14): [True: 1.69k, False: 3.41k]
  ------------------
  568|  1.69k|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (568:13): [True: 842, False: 851]
  ------------------
  569|  3.41k|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (569:20): [True: 1.70k, False: 1.70k]
  ------------------
  570|  3.41k|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  571|  3.41k|    }
  572|       |
  573|  6.39k|    if (block)
  ------------------
  |  Branch (573:9): [True: 6.39k, False: 0]
  ------------------
  574|  6.39k|      (*block)[0] = (JCOEF)entropy->last_dc_val[ci];
  575|       |
  576|       |    /* Sections F.2.4.2 & F.1.4.4.2: Decoding of AC coefficients */
  577|       |
  578|  6.39k|    tbl = compptr->ac_tbl_no;
  579|       |
  580|       |    /* Figure F.20: Decode_AC_coefficients */
  581|  13.1k|    for (k = 1; k <= DCTSIZE2 - 1; k++) {
  ------------------
  |  |   67|  13.1k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (581:17): [True: 13.1k, False: 1]
  ------------------
  582|  13.1k|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  583|  13.1k|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (583:11): [True: 6.39k, False: 6.72k]
  ------------------
  584|  16.3k|      while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (584:14): [True: 9.58k, False: 6.72k]
  ------------------
  585|  9.58k|        st += 3;  k++;
  586|  9.58k|        if (k > DCTSIZE2 - 1) {
  ------------------
  |  |   67|  9.58k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (586:13): [True: 0, False: 9.58k]
  ------------------
  587|      0|          WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  588|      0|          entropy->ct = -1;                     /* spectral overflow */
  589|      0|          return TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  590|      0|        }
  591|  9.58k|      }
  592|       |      /* Figure F.21: Decoding nonzero value v */
  593|       |      /* Figure F.22: Decoding the sign of v */
  594|  6.72k|      sign = arith_decode(cinfo, entropy->fixed_bin);
  595|  6.72k|      st += 2;
  596|       |      /* Figure F.23: Decoding the magnitude category of v */
  597|  6.72k|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (597:11): [True: 2.80k, False: 3.92k]
  ------------------
  598|  2.80k|        if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (598:13): [True: 1.69k, False: 1.11k]
  ------------------
  599|  1.69k|          m <<= 1;
  600|  1.69k|          st = entropy->ac_stats[tbl] +
  601|  1.69k|               (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (601:17): [True: 1.23k, False: 453]
  ------------------
  602|  4.03k|          while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (602:18): [True: 2.34k, False: 1.69k]
  ------------------
  603|  2.34k|            if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (603:17): [True: 0, False: 2.34k]
  ------------------
  604|      0|              WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  605|      0|              entropy->ct = -1;                 /* magnitude overflow */
  606|      0|              return TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  607|      0|            }
  608|  2.34k|            st += 1;
  609|  2.34k|          }
  610|  1.69k|        }
  611|  2.80k|      }
  612|  6.72k|      v = m;
  613|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  614|  6.72k|      st += 14;
  615|  10.7k|      while (m >>= 1)
  ------------------
  |  Branch (615:14): [True: 4.03k, False: 6.72k]
  ------------------
  616|  4.03k|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (616:13): [True: 2.39k, False: 1.64k]
  ------------------
  617|  6.72k|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (617:20): [True: 2.78k, False: 3.94k]
  ------------------
  618|  6.72k|      if (block)
  ------------------
  |  Branch (618:11): [True: 6.72k, False: 1]
  ------------------
  619|  6.72k|        (*block)[jpeg_natural_order[k]] = (JCOEF)v;
  620|  6.72k|    }
  621|  6.39k|  }
  622|       |
  623|  1.59k|  return TRUE;
  ------------------
  |  |  209|  1.59k|#define TRUE    1
  ------------------
  624|  1.59k|}

jdcoefct.c:start_input_pass:
   47|    530|{
   48|    530|  cinfo->input_iMCU_row = 0;
   49|    530|  start_iMCU_row(cinfo);
   50|    530|}
jdcoefct.c:start_output_pass:
   59|    528|{
   60|    528|#ifdef BLOCK_SMOOTHING_SUPPORTED
   61|    528|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   62|       |
   63|       |  /* If multipass, check to see whether to use block smoothing on this pass */
   64|    528|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (64:7): [True: 0, False: 528]
  ------------------
   65|      0|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (65:9): [True: 0, False: 0]
  |  Branch (65:38): [True: 0, False: 0]
  ------------------
   66|      0|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  141|      0|#define _decompress_data  decompress_data_12
  ------------------
   67|      0|    else
   68|      0|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  141|      0|#define _decompress_data  decompress_data_12
  ------------------
   69|      0|  }
   70|    528|#endif
   71|    528|  cinfo->output_iMCU_row = 0;
   72|    528|}
jdcoefct.c:consume_data:
  194|     10|{
  195|     10|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  196|     10|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  197|     10|  int blkn, ci, xindex, yindex, yoffset;
  198|     10|  JDIMENSION start_col;
  199|     10|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  200|     10|  JBLOCKROW buffer_ptr;
  201|     10|  jpeg_component_info *compptr;
  202|       |
  203|       |  /* Align the virtual buffers for the components used in this scan. */
  204|     30|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (204:16): [True: 20, False: 10]
  ------------------
  205|     20|    compptr = cinfo->cur_comp_info[ci];
  206|     20|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  207|     20|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  208|     20|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  209|     20|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  209|     20|#define TRUE    1
  ------------------
  210|       |    /* Note: entropy decoder expects buffer to be zeroed,
  211|       |     * but this is handled automatically by the memory manager
  212|       |     * because we requested a pre-zeroed array.
  213|       |     */
  214|     20|  }
  215|       |
  216|       |  /* Loop to process one whole iMCU row */
  217|     25|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (217:41): [True: 15, False: 10]
  ------------------
  218|     15|       yoffset++) {
  219|    138|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (219:39): [True: 123, False: 15]
  ------------------
  220|    123|         MCU_col_num++) {
  221|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  222|    123|      blkn = 0;                 /* index of current DCT block within MCU */
  223|    296|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (223:20): [True: 173, False: 123]
  ------------------
  224|    173|        compptr = cinfo->cur_comp_info[ci];
  225|    173|        start_col = MCU_col_num * compptr->MCU_width;
  226|    371|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (226:26): [True: 198, False: 173]
  ------------------
  227|    198|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  228|    446|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (228:28): [True: 248, False: 198]
  ------------------
  229|    248|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  230|    248|          }
  231|    198|        }
  232|    173|      }
  233|    123|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (233:11): [True: 123, False: 0]
  ------------------
  234|    123|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  235|       |      /* Try to fetch the MCU. */
  236|    123|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (236:11): [True: 0, False: 123]
  ------------------
  237|       |        /* Suspension forced; update state counters and exit */
  238|      0|        coef->MCU_vert_offset = yoffset;
  239|      0|        coef->MCU_ctr = MCU_col_num;
  240|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  241|      0|      }
  242|    123|    }
  243|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  244|     15|    coef->MCU_ctr = 0;
  245|     15|  }
  246|       |  /* Completed the iMCU row, advance counters for next one */
  247|     10|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (247:7): [True: 8, False: 2]
  ------------------
  248|      8|    start_iMCU_row(cinfo);
  249|      8|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1108|      8|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  250|      8|  }
  251|       |  /* Completed the scan */
  252|      2|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  253|      2|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1109|      2|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  254|     10|}
jdcoefct.c:decompress_onepass:
   87|  2.53k|{
   88|  2.53k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   89|  2.53k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   90|  2.53k|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   91|  2.53k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   92|  2.53k|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   93|  2.53k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  113|  2.53k|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
   94|  2.53k|  JDIMENSION start_col, output_col;
   95|  2.53k|  jpeg_component_info *compptr;
   96|  2.53k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  145|  2.53k|#define _inverse_DCT_method_ptr  inverse_DCT_12_method_ptr
  ------------------
   97|       |
   98|       |  /* Loop to process as much as one whole iMCU row */
   99|  5.07k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (99:41): [True: 2.53k, False: 2.53k]
  ------------------
  100|  2.53k|       yoffset++) {
  101|  14.3k|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (101:39): [True: 11.8k, False: 2.53k]
  ------------------
  102|  11.8k|         MCU_col_num++) {
  103|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  104|  11.8k|      jzero_far((void *)coef->MCU_buffer[0],
  105|  11.8k|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  106|  11.8k|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (106:11): [True: 11.8k, False: 0]
  ------------------
  107|  11.8k|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  108|  11.8k|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (108:11): [True: 0, False: 11.8k]
  ------------------
  109|       |        /* Suspension forced; update state counters and exit */
  110|      0|        coef->MCU_vert_offset = yoffset;
  111|      0|        coef->MCU_ctr = MCU_col_num;
  112|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  113|      0|      }
  114|       |
  115|       |      /* Only perform the IDCT on blocks that are contained within the desired
  116|       |       * cropping region.
  117|       |       */
  118|  11.8k|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (118:11): [True: 11.7k, False: 105]
  ------------------
  119|  11.8k|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (119:11): [True: 11.7k, False: 0]
  ------------------
  120|       |        /* Determine where data should go in output_buf and do the IDCT thing.
  121|       |         * We skip dummy blocks at the right and bottom edges (but blkn gets
  122|       |         * incremented past them!).  Note the inner loop relies on having
  123|       |         * allocated the MCU_buffer[] blocks sequentially.
  124|       |         */
  125|  11.7k|        blkn = 0;               /* index of current DCT block within MCU */
  126|  42.6k|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (126:22): [True: 30.9k, False: 11.7k]
  ------------------
  127|  30.9k|          compptr = cinfo->cur_comp_info[ci];
  128|       |          /* Don't bother to IDCT an uninteresting component. */
  129|  30.9k|          if (!compptr->component_needed) {
  ------------------
  |  Branch (129:15): [True: 0, False: 30.9k]
  ------------------
  130|      0|            blkn += compptr->MCU_blocks;
  131|      0|            continue;
  132|      0|          }
  133|  30.9k|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  146|  30.9k|#define _inverse_DCT  inverse_DCT_12
  ------------------
  134|  30.9k|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (134:26): [True: 24.5k, False: 6.43k]
  ------------------
  135|  24.5k|                         compptr->MCU_width : compptr->last_col_width;
  136|  30.9k|          output_ptr = output_buf[compptr->component_index] +
  137|  30.9k|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  30.9k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  138|  30.9k|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  139|  30.9k|                      compptr->MCU_sample_width;
  140|  63.0k|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (140:28): [True: 32.0k, False: 30.9k]
  ------------------
  141|  32.0k|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (141:17): [True: 26.5k, False: 5.51k]
  ------------------
  142|  32.0k|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (142:17): [True: 5.51k, False: 0]
  ------------------
  143|  32.0k|              output_col = start_col;
  144|  65.5k|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (144:32): [True: 33.4k, False: 32.0k]
  ------------------
  145|  33.4k|                (*inverse_DCT) (cinfo, compptr,
  146|  33.4k|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  147|  33.4k|                                output_ptr, output_col);
  148|  33.4k|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  33.4k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  149|  33.4k|              }
  150|  32.0k|            }
  151|  32.0k|            blkn += compptr->MCU_width;
  152|  32.0k|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  32.0k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  153|  32.0k|          }
  154|  30.9k|        }
  155|  11.7k|      }
  156|  11.8k|    }
  157|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  158|  2.53k|    coef->MCU_ctr = 0;
  159|  2.53k|  }
  160|       |  /* Completed the iMCU row, advance counters for next one */
  161|  2.53k|  cinfo->output_iMCU_row++;
  162|  2.53k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (162:7): [True: 2.00k, False: 528]
  ------------------
  163|  2.00k|    start_iMCU_row(cinfo);
  164|  2.00k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1108|  2.00k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  165|  2.00k|  }
  166|       |  /* Completed the scan */
  167|    528|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  168|    528|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1109|    528|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  169|  2.53k|}
jinit_d_coef_controller:
  818|    550|{
  819|    550|  my_coef_ptr coef;
  820|       |
  821|    550|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   34|    550|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (821:7): [True: 0, False: 550]
  ------------------
  822|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  823|       |
  824|    550|  coef = (my_coef_ptr)
  825|    550|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    550|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  826|    550|                                sizeof(my_coef_controller));
  827|    550|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  828|    550|  coef->pub.start_input_pass = start_input_pass;
  829|    550|  coef->pub.start_output_pass = start_output_pass;
  830|    550|#ifdef BLOCK_SMOOTHING_SUPPORTED
  831|    550|  coef->coef_bits_latch = NULL;
  832|    550|#endif
  833|       |
  834|       |  /* Create the coefficient buffer. */
  835|    550|  if (need_full_buffer) {
  ------------------
  |  Branch (835:7): [True: 1, False: 549]
  ------------------
  836|      1|#ifdef D_MULTISCAN_FILES_SUPPORTED
  837|       |    /* Allocate a full-image virtual array for each component, */
  838|       |    /* padded to a multiple of samp_factor DCT blocks in each direction. */
  839|       |    /* Note we ask for a pre-zeroed array. */
  840|      1|    int ci, access_rows;
  841|      1|    jpeg_component_info *compptr;
  842|       |
  843|      4|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (843:46): [True: 3, False: 1]
  ------------------
  844|      3|         ci++, compptr++) {
  845|      3|      access_rows = compptr->v_samp_factor;
  846|      3|#ifdef BLOCK_SMOOTHING_SUPPORTED
  847|       |      /* If block smoothing could be used, need a bigger window */
  848|      3|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (848:11): [True: 3, False: 0]
  ------------------
  849|      3|        access_rows *= 5;
  850|      3|#endif
  851|      3|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  852|      3|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  884|      3|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  209|      3|#define TRUE    1
  ------------------
  853|      3|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  854|      3|                               (long)compptr->h_samp_factor),
  855|      3|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  856|      3|                               (long)compptr->v_samp_factor),
  857|      3|         (JDIMENSION)access_rows);
  858|      3|    }
  859|      1|    coef->pub.consume_data = consume_data;
  860|      1|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  256|      1|#define _decompress_data  decompress_data
  ------------------
  861|      1|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  862|       |#else
  863|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  864|       |#endif
  865|    549|  } else {
  866|       |    /* We only need a single-MCU buffer. */
  867|    549|    JBLOCKROW buffer;
  868|    549|    int i;
  869|       |
  870|    549|    buffer = (JBLOCKROW)
  871|    549|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    549|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  872|    549|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|    549|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  873|  6.03k|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|  6.03k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (873:17): [True: 5.49k, False: 549]
  ------------------
  874|  5.49k|      coef->MCU_buffer[i] = buffer + i;
  875|  5.49k|    }
  876|    549|    coef->pub.consume_data = dummy_consume_data;
  877|    549|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  256|    549|#define _decompress_data  decompress_data
  ------------------
  878|    549|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  879|    549|  }
  880|       |
  881|       |  /* Allocate the workspace buffer */
  882|    550|  coef->workspace = (JCOEF *)
  883|    550|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    550|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  884|    550|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|    550|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  885|    550|}

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

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

jdcolor.c:start_pass_dcolor:
  747|    528|{
  748|       |  /* no work needed */
  749|    528|}
jdcolor.c:grayscale_convert:
  440|  7.85k|{
  441|  7.85k|  _jcopy_sample_rows(input_buf[0], (int)input_row, output_buf, 0, num_rows,
  ------------------
  |  |  180|  7.85k|#define _jcopy_sample_rows  j12copy_sample_rows
  ------------------
  442|  7.85k|                     cinfo->output_width);
  443|  7.85k|}
jdcolor.c:ycc_rgb_convert:
  264|  5.33k|{
  265|  5.33k|  switch (cinfo->out_color_space) {
  266|      0|  case JCS_EXT_RGB:
  ------------------
  |  Branch (266:3): [True: 0, False: 5.33k]
  ------------------
  267|      0|    ycc_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
  268|      0|                                num_rows);
  269|      0|    break;
  270|      0|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (270:3): [True: 0, False: 5.33k]
  ------------------
  271|      0|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (271:3): [True: 0, False: 5.33k]
  ------------------
  272|      0|    ycc_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
  273|      0|                                 num_rows);
  274|      0|    break;
  275|      0|  case JCS_EXT_BGR:
  ------------------
  |  Branch (275:3): [True: 0, False: 5.33k]
  ------------------
  276|      0|    ycc_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
  277|      0|                                num_rows);
  278|      0|    break;
  279|      0|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (279:3): [True: 0, False: 5.33k]
  ------------------
  280|      0|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (280:3): [True: 0, False: 5.33k]
  ------------------
  281|      0|    ycc_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
  282|      0|                                 num_rows);
  283|      0|    break;
  284|      0|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (284:3): [True: 0, False: 5.33k]
  ------------------
  285|      0|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (285:3): [True: 0, False: 5.33k]
  ------------------
  286|      0|    ycc_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
  287|      0|                                 num_rows);
  288|      0|    break;
  289|      0|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (289:3): [True: 0, False: 5.33k]
  ------------------
  290|      0|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (290:3): [True: 0, False: 5.33k]
  ------------------
  291|      0|    ycc_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
  292|      0|                                 num_rows);
  293|      0|    break;
  294|  5.33k|  default:
  ------------------
  |  Branch (294:3): [True: 5.33k, False: 0]
  ------------------
  295|  5.33k|    ycc_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
  296|  5.33k|                             num_rows);
  297|  5.33k|    break;
  298|  5.33k|  }
  299|  5.33k|}
jdcolor.c:build_ycc_rgb_table:
  216|    160|{
  217|    160|#if BITS_IN_JSAMPLE != 16
  218|    160|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  219|    160|  int i;
  220|    160|  JLONG x;
  221|    160|  SHIFT_TEMPS
  222|       |
  223|    160|  cconvert->Cr_r_tab = (int *)
  224|    160|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    160|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  225|    160|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  109|    160|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   59|    160|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  226|    160|  cconvert->Cb_b_tab = (int *)
  227|    160|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    160|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  228|    160|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  109|    160|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   59|    160|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  229|    160|  cconvert->Cr_g_tab = (JLONG *)
  230|    160|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    160|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  231|    160|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  109|    160|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   59|    160|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  232|    160|  cconvert->Cb_g_tab = (JLONG *)
  233|    160|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    160|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  234|    160|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  109|    160|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   59|    160|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  235|       |
  236|  41.1k|  for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  110|    160|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|    160|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
                for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  109|  41.1k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   59|  41.1k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  |  Branch (236:36): [True: 40.9k, False: 160]
  ------------------
  237|       |    /* i is the actual input pixel value, in the range 0.._MAXJSAMPLE */
  238|       |    /* The Cb or Cr value we are thinking of is x = i - _CENTERJSAMPLE */
  239|       |    /* Cr=>R value is nearest int to 1.40200 * x */
  240|  40.9k|    cconvert->Cr_r_tab[i] = (int)
  241|  40.9k|                    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  474|  40.9k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  242|       |    /* Cb=>B value is nearest int to 1.77200 * x */
  243|  40.9k|    cconvert->Cb_b_tab[i] = (int)
  244|  40.9k|                    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  474|  40.9k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  245|       |    /* Cr=>G value is scaled-up -0.71414 * x */
  246|  40.9k|    cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
  ------------------
  |  |   82|  40.9k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   80|  40.9k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  247|       |    /* Cb=>G value is scaled-up -0.34414 * x */
  248|       |    /* We also add in ONE_HALF so that need not do it in inner loop */
  249|  40.9k|    cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   82|  40.9k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   80|  40.9k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   81|  40.9k|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   80|  40.9k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  250|  40.9k|  }
  251|       |#else
  252|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  253|       |#endif
  254|    160|}
jdcolor.c:null_convert:
  379|  8.87k|{
  380|  8.87k|  register _JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
  381|  8.87k|  register JDIMENSION col;
  382|  8.87k|  register int num_components = cinfo->num_components;
  383|  8.87k|  JDIMENSION num_cols = cinfo->output_width;
  384|  8.87k|  int ci;
  385|       |
  386|  8.87k|  if (num_components == 3) {
  ------------------
  |  Branch (386:7): [True: 0, False: 8.87k]
  ------------------
  387|      0|    while (--num_rows >= 0) {
  ------------------
  |  Branch (387:12): [True: 0, False: 0]
  ------------------
  388|      0|      inptr0 = input_buf[0][input_row];
  389|      0|      inptr1 = input_buf[1][input_row];
  390|      0|      inptr2 = input_buf[2][input_row];
  391|      0|      input_row++;
  392|      0|      outptr = *output_buf++;
  393|      0|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (393:21): [True: 0, False: 0]
  ------------------
  394|      0|        *outptr++ = inptr0[col];
  395|      0|        *outptr++ = inptr1[col];
  396|      0|        *outptr++ = inptr2[col];
  397|      0|      }
  398|      0|    }
  399|  8.87k|  } else if (num_components == 4) {
  ------------------
  |  Branch (399:14): [True: 8.87k, False: 0]
  ------------------
  400|  17.7k|    while (--num_rows >= 0) {
  ------------------
  |  Branch (400:12): [True: 8.87k, False: 8.87k]
  ------------------
  401|  8.87k|      inptr0 = input_buf[0][input_row];
  402|  8.87k|      inptr1 = input_buf[1][input_row];
  403|  8.87k|      inptr2 = input_buf[2][input_row];
  404|  8.87k|      inptr3 = input_buf[3][input_row];
  405|  8.87k|      input_row++;
  406|  8.87k|      outptr = *output_buf++;
  407|   364k|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (407:21): [True: 355k, False: 8.87k]
  ------------------
  408|   355k|        *outptr++ = inptr0[col];
  409|   355k|        *outptr++ = inptr1[col];
  410|   355k|        *outptr++ = inptr2[col];
  411|   355k|        *outptr++ = inptr3[col];
  412|   355k|      }
  413|  8.87k|    }
  414|  8.87k|  } else {
  415|      0|    while (--num_rows >= 0) {
  ------------------
  |  Branch (415:12): [True: 0, False: 0]
  ------------------
  416|      0|      for (ci = 0; ci < num_components; ci++) {
  ------------------
  |  Branch (416:20): [True: 0, False: 0]
  ------------------
  417|      0|        inptr = input_buf[ci][input_row];
  418|      0|        outptr = *output_buf;
  419|      0|        for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (419:23): [True: 0, False: 0]
  ------------------
  420|      0|          outptr[ci] = inptr[col];
  421|      0|          outptr += num_components;
  422|      0|        }
  423|      0|      }
  424|      0|      output_buf++;
  425|      0|      input_row++;
  426|      0|    }
  427|      0|  }
  428|  8.87k|}
jinit_color_deconverter:
  758|    550|{
  759|    550|  my_cconvert_ptr cconvert;
  760|    550|  int ci;
  761|       |
  762|    550|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   34|    550|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (762:7): [True: 0, False: 550]
  ------------------
  763|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  764|       |
  765|    550|  cconvert = (my_cconvert_ptr)
  766|    550|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    550|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  767|    550|                                sizeof(my_color_deconverter));
  768|    550|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  769|    550|  cconvert->pub.start_pass = start_pass_dcolor;
  770|       |
  771|       |  /* Make sure num_components agrees with jpeg_color_space */
  772|    550|  switch (cinfo->jpeg_color_space) {
  773|    171|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (773:3): [True: 171, False: 379]
  ------------------
  774|    171|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (774:9): [True: 0, False: 171]
  ------------------
  775|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  776|    171|    break;
  777|       |
  778|      0|  case JCS_RGB:
  ------------------
  |  Branch (778:3): [True: 0, False: 550]
  ------------------
  779|    160|  case JCS_YCbCr:
  ------------------
  |  Branch (779:3): [True: 160, False: 390]
  ------------------
  780|    160|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (780:9): [True: 0, False: 160]
  ------------------
  781|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  782|    160|    break;
  783|       |
  784|    219|  case JCS_CMYK:
  ------------------
  |  Branch (784:3): [True: 219, False: 331]
  ------------------
  785|    219|  case JCS_YCCK:
  ------------------
  |  Branch (785:3): [True: 0, False: 550]
  ------------------
  786|    219|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (786:9): [True: 0, False: 219]
  ------------------
  787|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  788|    219|    break;
  789|       |
  790|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (790:3): [True: 0, False: 550]
  ------------------
  791|      0|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (791:9): [True: 0, False: 0]
  ------------------
  792|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  793|      0|    break;
  794|    550|  }
  795|       |
  796|       |  /* Set out_color_components and conversion method based on requested space.
  797|       |   * Also clear the component_needed flags for any unused components,
  798|       |   * so that earlier pipeline stages can avoid useless computation.
  799|       |   * NOTE: We do not allow any lossy color conversion algorithms in lossless
  800|       |   * mode.
  801|       |   */
  802|       |
  803|    550|  switch (cinfo->out_color_space) {
  804|    171|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (804:3): [True: 171, False: 379]
  ------------------
  805|    171|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (805:9): [True: 0, False: 171]
  ------------------
  806|    171|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (806:9): [True: 0, False: 0]
  ------------------
  807|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  808|    171|    cinfo->out_color_components = 1;
  809|    171|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (809:9): [True: 171, False: 0]
  ------------------
  810|    171|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (810:9): [True: 0, False: 0]
  ------------------
  811|    171|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  265|    171|#define _color_convert  color_convert
  ------------------
  812|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  813|    171|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (813:20): [True: 0, False: 171]
  ------------------
  814|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  815|    171|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (815:16): [True: 0, False: 0]
  ------------------
  816|      0|      cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  817|      0|      build_rgb_y_table(cinfo);
  818|      0|    } else
  819|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  820|    171|    break;
  821|       |
  822|    160|  case JCS_RGB:
  ------------------
  |  Branch (822:3): [True: 160, False: 390]
  ------------------
  823|    160|  case JCS_EXT_RGB:
  ------------------
  |  Branch (823:3): [True: 0, False: 550]
  ------------------
  824|    160|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (824:3): [True: 0, False: 550]
  ------------------
  825|    160|  case JCS_EXT_BGR:
  ------------------
  |  Branch (825:3): [True: 0, False: 550]
  ------------------
  826|    160|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (826:3): [True: 0, False: 550]
  ------------------
  827|    160|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (827:3): [True: 0, False: 550]
  ------------------
  828|    160|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (828:3): [True: 0, False: 550]
  ------------------
  829|    160|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (829:3): [True: 0, False: 550]
  ------------------
  830|    160|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (830:3): [True: 0, False: 550]
  ------------------
  831|    160|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (831:3): [True: 0, False: 550]
  ------------------
  832|    160|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (832:3): [True: 0, False: 550]
  ------------------
  833|    160|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (833:9): [True: 0, False: 160]
  |  Branch (833:36): [True: 0, False: 0]
  ------------------
  834|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  835|    160|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  836|    160|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (836:9): [True: 160, False: 0]
  ------------------
  837|    160|#ifdef WITH_SIMD
  838|    160|      if (jsimd_can_ycc_rgb())
  ------------------
  |  Branch (838:11): [True: 0, False: 160]
  ------------------
  839|      0|        cconvert->pub._color_convert = jsimd_ycc_rgb_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  840|    160|      else
  841|    160|#endif
  842|    160|      {
  843|    160|        cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  265|    160|#define _color_convert  color_convert
  ------------------
  844|    160|        build_ycc_rgb_table(cinfo);
  845|    160|      }
  846|    160|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (846:16): [True: 0, False: 0]
  ------------------
  847|      0|      cconvert->pub._color_convert = gray_rgb_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  848|      0|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (848:16): [True: 0, False: 0]
  ------------------
  849|      0|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (849:11): [True: 0, False: 0]
  ------------------
  850|      0|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (850:11): [True: 0, False: 0]
  ------------------
  851|      0|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (851:11): [True: 0, False: 0]
  ------------------
  852|      0|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (852:11): [True: 0, False: 0]
  ------------------
  853|      0|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  854|      0|      else
  855|      0|        cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  856|      0|    } else
  857|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  858|    160|    break;
  859|       |
  860|      0|  case JCS_RGB565:
  ------------------
  |  Branch (860:3): [True: 0, False: 550]
  ------------------
  861|      0|    if (cinfo->master->lossless)
  ------------------
  |  Branch (861:9): [True: 0, False: 0]
  ------------------
  862|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  863|      0|    cinfo->out_color_components = 3;
  864|      0|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (864:9): [True: 0, False: 0]
  ------------------
  865|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (865:11): [True: 0, False: 0]
  ------------------
  866|      0|#ifdef WITH_SIMD
  867|      0|        if (jsimd_can_ycc_rgb565())
  ------------------
  |  Branch (867:13): [True: 0, False: 0]
  ------------------
  868|      0|          cconvert->pub._color_convert = jsimd_ycc_rgb565_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  869|      0|        else
  870|      0|#endif
  871|      0|        {
  872|      0|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  873|      0|          build_ycc_rgb_table(cinfo);
  874|      0|        }
  875|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (875:18): [True: 0, False: 0]
  ------------------
  876|      0|        cconvert->pub._color_convert = gray_rgb565_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  877|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (877:18): [True: 0, False: 0]
  ------------------
  878|      0|        cconvert->pub._color_convert = rgb_rgb565_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  879|      0|      } else
  880|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  881|      0|    } else {
  882|       |      /* only ordered dithering is supported */
  883|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (883:11): [True: 0, False: 0]
  ------------------
  884|      0|        cconvert->pub._color_convert = ycc_rgb565D_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  885|      0|        build_ycc_rgb_table(cinfo);
  886|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (886:18): [True: 0, False: 0]
  ------------------
  887|      0|        cconvert->pub._color_convert = gray_rgb565D_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  888|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (888:18): [True: 0, False: 0]
  ------------------
  889|      0|        cconvert->pub._color_convert = rgb_rgb565D_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  890|      0|      } else
  891|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  892|      0|    }
  893|      0|    break;
  894|       |
  895|    219|  case JCS_CMYK:
  ------------------
  |  Branch (895:3): [True: 219, False: 331]
  ------------------
  896|    219|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (896:9): [True: 0, False: 219]
  ------------------
  897|    219|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (897:9): [True: 0, False: 0]
  ------------------
  898|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  899|    219|    cinfo->out_color_components = 4;
  900|    219|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (900:9): [True: 0, False: 219]
  ------------------
  901|      0|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  902|      0|      build_ycc_rgb_table(cinfo);
  903|    219|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (903:16): [True: 219, False: 0]
  ------------------
  904|    219|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  265|    219|#define _color_convert  color_convert
  ------------------
  905|    219|    } else
  906|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  907|    219|    break;
  908|       |
  909|      0|  default:
  ------------------
  |  Branch (909:3): [True: 0, False: 550]
  ------------------
  910|       |    /* Permit null conversion to same output space */
  911|      0|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (911:9): [True: 0, False: 0]
  ------------------
  912|      0|      cinfo->out_color_components = cinfo->num_components;
  913|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  914|      0|    } else                      /* unsupported non-null conversion */
  915|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  916|      0|    break;
  917|    550|  }
  918|       |
  919|    550|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (919:7): [True: 0, False: 550]
  ------------------
  920|      0|    cinfo->output_components = 1; /* single colormapped output component */
  921|    550|  else
  922|    550|    cinfo->output_components = cinfo->out_color_components;
  923|    550|}

jinit_inverse_dct:
  341|    550|{
  342|    550|  my_idct_ptr idct;
  343|    550|  int ci;
  344|    550|  jpeg_component_info *compptr;
  345|       |
  346|    550|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   34|    550|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (346:7): [True: 0, False: 550]
  ------------------
  347|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  348|       |
  349|    550|  idct = (my_idct_ptr)
  350|    550|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    550|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  351|    550|                                sizeof(my_idct_controller));
  352|    550|  cinfo->idct = (struct jpeg_inverse_dct *)idct;
  353|    550|  idct->pub.start_pass = start_pass;
  354|       |
  355|  2.07k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (355:44): [True: 1.52k, False: 550]
  ------------------
  356|  1.52k|       ci++, compptr++) {
  357|       |    /* Allocate and pre-zero a multiplier table for each component */
  358|  1.52k|    compptr->dct_table =
  359|  1.52k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.52k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  360|  1.52k|                                  sizeof(multiplier_table));
  361|  1.52k|    memset(compptr->dct_table, 0, sizeof(multiplier_table));
  362|       |    /* Mark multiplier table not yet set up for any method */
  363|  1.52k|    idct->cur_method[ci] = -1;
  364|  1.52k|  }
  365|    550|}

jpeg_make_d_derived_tbl:
  145|  2.52k|{
  146|  2.52k|  JHUFF_TBL *htbl;
  147|  2.52k|  d_derived_tbl *dtbl;
  148|  2.52k|  int p, i, l, si, numsymbols;
  149|  2.52k|  int lookbits, ctr;
  150|  2.52k|  char huffsize[257];
  151|  2.52k|  unsigned int huffcode[257];
  152|  2.52k|  unsigned int code;
  153|       |
  154|       |  /* Note that huffsize[] and huffcode[] are filled in code-length order,
  155|       |   * paralleling the order of the symbols themselves in htbl->huffval[].
  156|       |   */
  157|       |
  158|       |  /* Find the input Huffman table */
  159|  2.52k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  2.52k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (159:7): [True: 0, False: 2.52k]
  |  Branch (159:20): [True: 4, False: 2.52k]
  ------------------
  160|      4|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      4|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      4|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  161|  2.52k|  htbl =
  162|  2.52k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (162:5): [True: 1.26k, False: 1.26k]
  ------------------
  163|  2.52k|  if (htbl == NULL)
  ------------------
  |  Branch (163:7): [True: 1, False: 2.52k]
  ------------------
  164|      1|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  165|       |
  166|       |  /* Allocate a workspace if we haven't already done so. */
  167|  2.52k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (167:7): [True: 1.27k, False: 1.25k]
  ------------------
  168|  1.27k|    *pdtbl = (d_derived_tbl *)
  169|  1.27k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.27k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  170|  1.27k|                                  sizeof(d_derived_tbl));
  171|  2.52k|  dtbl = *pdtbl;
  172|  2.52k|  dtbl->pub = htbl;             /* fill in back link */
  173|       |
  174|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  175|       |
  176|  2.52k|  p = 0;
  177|  42.9k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (177:15): [True: 40.3k, False: 2.52k]
  ------------------
  178|  40.3k|    i = (int)htbl->bits[l];
  179|  40.3k|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (179:9): [True: 0, False: 40.3k]
  |  Branch (179:18): [True: 0, False: 40.3k]
  ------------------
  180|      0|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  181|   259k|    while (i--)
  ------------------
  |  Branch (181:12): [True: 218k, False: 40.3k]
  ------------------
  182|   218k|      huffsize[p++] = (char)l;
  183|  40.3k|  }
  184|  2.52k|  huffsize[p] = 0;
  185|  2.52k|  numsymbols = p;
  186|       |
  187|       |  /* Figure C.2: generate the codes themselves */
  188|       |  /* We also validate that the counts represent a legal Huffman code tree. */
  189|       |
  190|  2.52k|  code = 0;
  191|  2.52k|  si = huffsize[0];
  192|  2.52k|  p = 0;
  193|  32.1k|  while (huffsize[p]) {
  ------------------
  |  Branch (193:10): [True: 29.5k, False: 2.52k]
  ------------------
  194|   248k|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (194:12): [True: 218k, False: 29.5k]
  ------------------
  195|   218k|      huffcode[p++] = code;
  196|   218k|      code++;
  197|   218k|    }
  198|       |    /* code is now 1 more than the last code used for codelength si; but
  199|       |     * it must still fit in si bits, since no code is allowed to be all ones.
  200|       |     */
  201|  29.5k|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (201:9): [True: 0, False: 29.5k]
  ------------------
  202|      0|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|  29.5k|    code <<= 1;
  204|  29.5k|    si++;
  205|  29.5k|  }
  206|       |
  207|       |  /* Figure F.15: generate decoding tables for bit-sequential decoding */
  208|       |
  209|  2.52k|  p = 0;
  210|  42.9k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (210:15): [True: 40.3k, False: 2.52k]
  ------------------
  211|  40.3k|    if (htbl->bits[l]) {
  ------------------
  |  Branch (211:9): [True: 27.3k, False: 13.0k]
  ------------------
  212|       |      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
  213|       |       * minus the minimum code of length l
  214|       |       */
  215|  27.3k|      dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
  216|  27.3k|      p += htbl->bits[l];
  217|  27.3k|      dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
  218|  27.3k|    } else {
  219|  13.0k|      dtbl->maxcode[l] = -1;    /* -1 if no codes of this length */
  220|  13.0k|    }
  221|  40.3k|  }
  222|  2.52k|  dtbl->valoffset[17] = 0;
  223|  2.52k|  dtbl->maxcode[17] = 0xFFFFFL; /* ensures jpeg_huff_decode terminates */
  224|       |
  225|       |  /* Compute lookahead tables to speed up decoding.
  226|       |   * First we set all the table entries to 0, indicating "too long";
  227|       |   * then we iterate through the Huffman codes that are short enough and
  228|       |   * fill in all the entries that correspond to bit sequences starting
  229|       |   * with that code.
  230|       |   */
  231|       |
  232|   648k|  for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
  ------------------
  |  |   25|   648k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (232:15): [True: 646k, False: 2.52k]
  ------------------
  233|   646k|    dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|   646k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
                  dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|   646k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  234|       |
  235|  2.52k|  p = 0;
  236|  22.7k|  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
  ------------------
  |  |   25|  22.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (236:15): [True: 20.1k, False: 2.52k]
  ------------------
  237|  56.7k|    for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
  ------------------
  |  Branch (237:17): [True: 36.5k, False: 20.1k]
  ------------------
  238|       |      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
  239|       |      /* Generate left-justified code followed by all possible bit sequences */
  240|  36.5k|      lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
  ------------------
  |  |   25|  36.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  241|   674k|      for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
  ------------------
  |  |   25|  36.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (241:45): [True: 638k, False: 36.5k]
  ------------------
  242|   638k|        dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
  ------------------
  |  |   25|   638k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  243|   638k|        lookbits++;
  244|   638k|      }
  245|  36.5k|    }
  246|  20.1k|  }
  247|       |
  248|       |  /* Validate symbols as being reasonable.
  249|       |   * For AC tables, we make no check, but accept all byte values 0..255.
  250|       |   * For DC tables, we require the symbols to be in range 0..15 in lossy mode
  251|       |   * and 0..16 in lossless mode.  (Tighter bounds could be applied depending on
  252|       |   * the data depth and mode, but this is sufficient to ensure safe decoding.)
  253|       |   */
  254|  2.52k|  if (isDC) {
  ------------------
  |  Branch (254:7): [True: 1.26k, False: 1.26k]
  ------------------
  255|  16.4k|    for (i = 0; i < numsymbols; i++) {
  ------------------
  |  Branch (255:17): [True: 15.1k, False: 1.26k]
  ------------------
  256|  15.1k|      int sym = htbl->huffval[i];
  257|  15.1k|      if (sym < 0 || sym > (cinfo->master->lossless ? 16 : 15))
  ------------------
  |  Branch (257:11): [True: 0, False: 15.1k]
  |  Branch (257:22): [True: 6, False: 15.1k]
  |  Branch (257:29): [True: 0, False: 15.1k]
  ------------------
  258|      6|        ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      6|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      6|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  259|  15.1k|    }
  260|  1.26k|  }
  261|  2.52k|}
jpeg_fill_bit_buffer:
  291|  7.53k|{
  292|       |  /* Copy heavily used state fields into locals (hopefully registers) */
  293|  7.53k|  register const JOCTET *next_input_byte = state->next_input_byte;
  294|  7.53k|  register size_t bytes_in_buffer = state->bytes_in_buffer;
  295|  7.53k|  j_decompress_ptr cinfo = state->cinfo;
  296|       |
  297|       |  /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */
  298|       |  /* (It is assumed that no request will be for more than that many bits.) */
  299|       |  /* We fail to do so only if we hit a marker or are forced to suspend. */
  300|       |
  301|  7.53k|  if (cinfo->unread_marker == 0) {      /* cannot advance past a marker */
  ------------------
  |  Branch (301:7): [True: 7.20k, False: 330]
  ------------------
  302|  57.8k|    while (bits_left < MIN_GET_BITS) {
  ------------------
  |  |  282|  57.8k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|  57.8k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  |  Branch (302:12): [True: 51.0k, False: 6.77k]
  ------------------
  303|  51.0k|      register int c;
  304|       |
  305|       |      /* Attempt to read a byte */
  306|  51.0k|      if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (306:11): [True: 7, False: 51.0k]
  ------------------
  307|      7|        if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (307:13): [True: 0, False: 7]
  ------------------
  308|      0|          return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  309|      7|        next_input_byte = cinfo->src->next_input_byte;
  310|      7|        bytes_in_buffer = cinfo->src->bytes_in_buffer;
  311|      7|      }
  312|  51.0k|      bytes_in_buffer--;
  313|  51.0k|      c = *next_input_byte++;
  314|       |
  315|       |      /* If it's 0xFF, check and discard stuffed zero byte */
  316|  51.0k|      if (c == 0xFF) {
  ------------------
  |  Branch (316:11): [True: 4.62k, False: 46.4k]
  ------------------
  317|       |        /* Loop here to discard any padding FF's on terminating marker,
  318|       |         * so that we can save a valid unread_marker value.  NOTE: we will
  319|       |         * accept multiple FF's followed by a 0 as meaning a single FF data
  320|       |         * byte.  This data pattern is not valid according to the standard.
  321|       |         */
  322|  6.52k|        do {
  323|  6.52k|          if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (323:15): [True: 0, False: 6.52k]
  ------------------
  324|      0|            if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (324:17): [True: 0, False: 0]
  ------------------
  325|      0|              return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  326|      0|            next_input_byte = cinfo->src->next_input_byte;
  327|      0|            bytes_in_buffer = cinfo->src->bytes_in_buffer;
  328|      0|          }
  329|  6.52k|          bytes_in_buffer--;
  330|  6.52k|          c = *next_input_byte++;
  331|  6.52k|        } while (c == 0xFF);
  ------------------
  |  Branch (331:18): [True: 1.89k, False: 4.62k]
  ------------------
  332|       |
  333|  4.62k|        if (c == 0) {
  ------------------
  |  Branch (333:13): [True: 4.19k, False: 431]
  ------------------
  334|       |          /* Found FF/00, which represents an FF data byte */
  335|  4.19k|          c = 0xFF;
  336|  4.19k|        } else {
  337|       |          /* Oops, it's actually a marker indicating end of compressed data.
  338|       |           * Save the marker code for later use.
  339|       |           * Fine point: it might appear that we should save the marker into
  340|       |           * bitread working state, not straight into permanent state.  But
  341|       |           * once we have hit a marker, we cannot need to suspend within the
  342|       |           * current MCU, because we will read no more bytes from the data
  343|       |           * source.  So it is OK to update permanent state right away.
  344|       |           */
  345|    431|          cinfo->unread_marker = c;
  346|       |          /* See if we need to insert some fake zero bits. */
  347|    431|          goto no_more_bytes;
  348|    431|        }
  349|  4.62k|      }
  350|       |
  351|       |      /* OK, load c into get_buffer */
  352|  50.6k|      get_buffer = (get_buffer << 8) | c;
  353|  50.6k|      bits_left += 8;
  354|  50.6k|    } /* end while */
  355|  7.20k|  } else {
  356|    761|no_more_bytes:
  357|       |    /* We get here if we've read the marker that terminates the compressed
  358|       |     * data segment.  There should be enough bits in the buffer register
  359|       |     * to satisfy the request; if so, no problem.
  360|       |     */
  361|    761|    if (nbits > bits_left) {
  ------------------
  |  Branch (361:9): [True: 84, False: 677]
  ------------------
  362|       |      /* Uh-oh.  Report corrupted data to user and stuff zeroes into
  363|       |       * the data stream, so that we can produce some kind of image.
  364|       |       * We use a nonvolatile flag to ensure that only one warning message
  365|       |       * appears per data segment.
  366|       |       */
  367|     84|      if (!cinfo->entropy->insufficient_data) {
  ------------------
  |  Branch (367:11): [True: 84, False: 0]
  ------------------
  368|     84|        WARNMS(cinfo, JWRN_HIT_MARKER);
  ------------------
  |  |  283|     84|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     84|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  369|     84|        cinfo->entropy->insufficient_data = TRUE;
  ------------------
  |  |  209|     84|#define TRUE    1
  ------------------
  370|     84|      }
  371|       |      /* Fill the buffer with zero bits */
  372|     84|      get_buffer <<= MIN_GET_BITS - bits_left;
  ------------------
  |  |  282|     84|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|     84|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  373|     84|      bits_left = MIN_GET_BITS;
  ------------------
  |  |  282|     84|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|     84|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  374|     84|    }
  375|    761|  }
  376|       |
  377|       |  /* Unload the local registers */
  378|  7.53k|  state->next_input_byte = next_input_byte;
  379|  7.53k|  state->bytes_in_buffer = bytes_in_buffer;
  380|  7.53k|  state->get_buffer = get_buffer;
  381|  7.53k|  state->bits_left = bits_left;
  382|       |
  383|  7.53k|  return TRUE;
  ------------------
  |  |  209|  7.53k|#define TRUE    1
  ------------------
  384|  7.53k|}
jpeg_huff_decode:
  439|  8.52k|{
  440|  8.52k|  register int l = min_bits;
  441|  8.52k|  register JLONG code;
  442|       |
  443|       |  /* HUFF_DECODE has determined that the code is at least min_bits */
  444|       |  /* bits long, so fetch that many bits in one swoop. */
  445|       |
  446|  8.52k|  CHECK_BIT_BUFFER(*state, l, return -1);
  ------------------
  |  |  160|  8.52k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  8.52k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 55, False: 8.46k]
  |  |  ------------------
  |  |  162|     55|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 55]
  |  |  ------------------
  |  |  163|     55|      { action; } \
  |  |  164|     55|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|     55|  } \
  |  |  166|  8.52k|}
  ------------------
  447|  8.52k|  code = GET_BITS(l);
  ------------------
  |  |  169|  8.52k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  448|       |
  449|       |  /* Collect the rest of the Huffman code one bit at a time. */
  450|       |  /* This is per Figure F.16. */
  451|       |
  452|  40.9k|  while (code > htbl->maxcode[l]) {
  ------------------
  |  Branch (452:10): [True: 32.4k, False: 8.52k]
  ------------------
  453|  32.4k|    code <<= 1;
  454|  32.4k|    CHECK_BIT_BUFFER(*state, 1, return -1);
  ------------------
  |  |  160|  32.4k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  32.4k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 806, False: 31.6k]
  |  |  ------------------
  |  |  162|    806|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 806]
  |  |  ------------------
  |  |  163|    806|      { action; } \
  |  |  164|    806|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    806|  } \
  |  |  166|  32.4k|}
  ------------------
  455|  32.4k|    code |= GET_BITS(1);
  ------------------
  |  |  169|  32.4k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  456|  32.4k|    l++;
  457|  32.4k|  }
  458|       |
  459|       |  /* Unload the local registers */
  460|  8.52k|  state->get_buffer = get_buffer;
  461|  8.52k|  state->bits_left = bits_left;
  462|       |
  463|       |  /* With garbage input we may reach the sentinel value l = 17. */
  464|       |
  465|  8.52k|  if (l > 16) {
  ------------------
  |  Branch (465:7): [True: 14, False: 8.51k]
  ------------------
  466|     14|    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|     14|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     14|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  467|     14|    return 0;                   /* fake a zero as the safest result */
  468|     14|  }
  469|       |
  470|  8.51k|  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
  471|  8.52k|}
jinit_huff_decoder:
  815|    497|{
  816|    497|  huff_entropy_ptr entropy;
  817|    497|  int i;
  818|       |
  819|       |  /* Motion JPEG frames typically do not include the Huffman tables if they
  820|       |     are the default tables.  Thus, if the tables are not set by the time
  821|       |     the Huffman decoder is initialized (usually within the body of
  822|       |     jpeg_start_decompress()), we set them to default values. */
  823|    497|  std_huff_tables((j_common_ptr)cinfo);
  824|       |
  825|    497|  entropy = (huff_entropy_ptr)
  826|    497|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    497|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  827|    497|                                sizeof(huff_entropy_decoder));
  828|    497|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  829|    497|  entropy->pub.start_pass = start_pass_huff_decoder;
  830|    497|  entropy->pub.decode_mcu = decode_mcu;
  831|       |
  832|       |  /* Mark tables unallocated */
  833|  2.48k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  2.48k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (833:15): [True: 1.98k, False: 497]
  ------------------
  834|  1.98k|    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
  835|  1.98k|  }
  836|    497|}
jdhuff.c:start_pass_huff_decoder:
   80|    491|{
   81|    491|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   82|    491|  int ci, blkn, dctbl, actbl;
   83|    491|  d_derived_tbl **pdtbl;
   84|    491|  jpeg_component_info *compptr;
   85|       |
   86|       |  /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
   87|       |   * This ought to be an error condition, but we make it a warning because
   88|       |   * there are some baseline files out there with all zeroes in these bytes.
   89|       |   */
   90|    491|  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|    490|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (90:7): [True: 1, False: 490]
  |  Branch (90:25): [True: 1, False: 489]
  ------------------
   91|    491|      cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (91:7): [True: 1, False: 488]
  |  Branch (91:25): [True: 0, False: 488]
  ------------------
   92|      3|    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      3|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
   93|       |
   94|  1.75k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (94:16): [True: 1.26k, False: 491]
  ------------------
   95|  1.26k|    compptr = cinfo->cur_comp_info[ci];
   96|  1.26k|    dctbl = compptr->dc_tbl_no;
   97|  1.26k|    actbl = compptr->ac_tbl_no;
   98|       |    /* Compute derived values for Huffman tables */
   99|       |    /* We may do this more than once for a table, but it's not expensive */
  100|  1.26k|    pdtbl = (d_derived_tbl **)(entropy->dc_derived_tbls) + dctbl;
  101|  1.26k|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
  ------------------
  |  |  209|  1.26k|#define TRUE    1
  ------------------
  102|  1.26k|    pdtbl = (d_derived_tbl **)(entropy->ac_derived_tbls) + actbl;
  103|  1.26k|    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
  ------------------
  |  |  206|  1.26k|#define FALSE   0               /* values of boolean */
  ------------------
  104|       |    /* Initialize DC predictions to 0 */
  105|  1.26k|    entropy->saved.last_dc_val[ci] = 0;
  106|  1.26k|  }
  107|       |
  108|       |  /* Precalculate decoding info for each block in an MCU of this scan */
  109|  2.19k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (109:18): [True: 1.70k, False: 491]
  ------------------
  110|  1.70k|    ci = cinfo->MCU_membership[blkn];
  111|  1.70k|    compptr = cinfo->cur_comp_info[ci];
  112|       |    /* Precalculate which table to use for each block */
  113|  1.70k|    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
  114|  1.70k|    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
  115|       |    /* Decide whether we really care about the coefficient values */
  116|  1.70k|    if (compptr->component_needed) {
  ------------------
  |  Branch (116:9): [True: 1.70k, False: 0]
  ------------------
  117|  1.70k|      entropy->dc_needed[blkn] = TRUE;
  ------------------
  |  |  209|  1.70k|#define TRUE    1
  ------------------
  118|       |      /* we don't need the ACs if producing a 1/8th-size image */
  119|  1.70k|      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
  ------------------
  |  |   24|  1.70k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  120|  1.70k|    } else {
  121|      0|      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  122|      0|    }
  123|  1.70k|  }
  124|       |
  125|       |  /* Initialize bitread state variables */
  126|    491|  entropy->bitstate.bits_left = 0;
  127|    491|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  128|    491|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|    491|#define FALSE   0               /* values of boolean */
  ------------------
  129|       |
  130|       |  /* Initialize restart counter */
  131|    491|  entropy->restarts_to_go = cinfo->restart_interval;
  132|    491|}
jdhuff.c:decode_mcu:
  771|  10.2k|{
  772|  10.2k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  773|  10.2k|  int usefast = 1;
  774|       |
  775|       |  /* Process restart marker if needed; may have to suspend */
  776|  10.2k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (776:7): [True: 0, False: 10.2k]
  ------------------
  777|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (777:9): [True: 0, False: 0]
  ------------------
  778|      0|      if (!process_restart(cinfo))
  ------------------
  |  Branch (778:11): [True: 0, False: 0]
  ------------------
  779|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  780|      0|    usefast = 0;
  781|      0|  }
  782|       |
  783|  10.2k|  if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
  ------------------
  |  |  767|  10.2k|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  ------------------
  |  |  |  |   67|  10.2k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  ------------------
  |  Branch (783:7): [True: 9.82k, False: 390]
  ------------------
  784|  10.2k|      cinfo->unread_marker != 0)
  ------------------
  |  Branch (784:7): [True: 0, False: 390]
  ------------------
  785|  9.82k|    usefast = 0;
  786|       |
  787|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  788|       |   * This way, we return uniform gray for the remainder of the segment.
  789|       |   */
  790|  10.2k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (790:7): [True: 10.2k, False: 0]
  ------------------
  791|       |
  792|  10.2k|    if (usefast) {
  ------------------
  |  Branch (792:9): [True: 390, False: 9.82k]
  ------------------
  793|    390|      if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
  ------------------
  |  Branch (793:11): [True: 15, False: 375]
  ------------------
  794|  9.82k|    } else {
  795|  9.84k|use_slow:
  796|  9.84k|      if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (796:11): [True: 0, False: 9.84k]
  ------------------
  797|  9.84k|    }
  798|       |
  799|  10.2k|  }
  800|       |
  801|       |  /* Account for restart interval (no-op if not using restarts) */
  802|  10.2k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (802:7): [True: 0, False: 10.2k]
  ------------------
  803|      0|    entropy->restarts_to_go--;
  804|       |
  805|  10.2k|  return TRUE;
  ------------------
  |  |  209|  10.2k|#define TRUE    1
  ------------------
  806|  10.2k|}
jdhuff.c:decode_mcu_fast:
  664|    390|{
  665|    390|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  666|    390|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|    390|  register bit_buf_type get_buffer; \
  |  |  126|    390|  register int bits_left; \
  |  |  127|    390|  bitread_working_state br_state
  ------------------
  667|    390|  JOCTET *buffer;
  668|    390|  int blkn;
  669|    390|  savable_state state;
  670|       |  /* Outer loop handles each block in the MCU */
  671|       |
  672|       |  /* Load up working state */
  673|    390|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|    390|  br_state.cinfo = cinfop; \
  |  |  131|    390|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|    390|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|    390|  get_buffer = permstate.get_buffer; \
  |  |  134|    390|  bits_left = permstate.bits_left;
  ------------------
  674|    390|  buffer = (JOCTET *)br_state.next_input_byte;
  675|    390|  state = entropy->saved;
  676|       |
  677|  1.05k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (677:18): [True: 666, False: 390]
  ------------------
  678|    666|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (678:23): [True: 666, False: 0]
  ------------------
  679|    666|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  680|    666|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  681|    666|    register int s, k, r, l;
  682|       |
  683|    666|    HUFF_DECODE_FAST(s, l, dctbl);
  ------------------
  |  |  224|    666|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|    666|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 45, False: 621]
  |  |  |  |  ------------------
  |  |  |  |  416|     45|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|     45|#define GET_BYTE { \
  |  |  |  |  |  |  392|     45|  register int c0, c1; \
  |  |  |  |  |  |  393|     45|  c0 = *buffer++; \
  |  |  |  |  |  |  394|     45|  c1 = *buffer; \
  |  |  |  |  |  |  395|     45|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|     45|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|     45|  bits_left += 8; \
  |  |  |  |  |  |  398|     45|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3, False: 42]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      3|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      3|    buffer++; \
  |  |  |  |  |  |  401|      3|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 3, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      3|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      3|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      3|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      3|      buffer -= 2; \
  |  |  |  |  |  |  406|      3|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      3|    } \
  |  |  |  |  |  |  408|      3|  } \
  |  |  |  |  |  |  409|     45|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|     45|#define GET_BYTE { \
  |  |  |  |  |  |  392|     45|  register int c0, c1; \
  |  |  |  |  |  |  393|     45|  c0 = *buffer++; \
  |  |  |  |  |  |  394|     45|  c1 = *buffer; \
  |  |  |  |  |  |  395|     45|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|     45|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|     45|  bits_left += 8; \
  |  |  |  |  |  |  398|     45|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 5, False: 40]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      5|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      5|    buffer++; \
  |  |  |  |  |  |  401|      5|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 5, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      5|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      5|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      5|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      5|      buffer -= 2; \
  |  |  |  |  |  |  406|      5|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      5|    } \
  |  |  |  |  |  |  408|      5|  } \
  |  |  |  |  |  |  409|     45|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|     45|#define GET_BYTE { \
  |  |  |  |  |  |  392|     45|  register int c0, c1; \
  |  |  |  |  |  |  393|     45|  c0 = *buffer++; \
  |  |  |  |  |  |  394|     45|  c1 = *buffer; \
  |  |  |  |  |  |  395|     45|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|     45|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|     45|  bits_left += 8; \
  |  |  |  |  |  |  398|     45|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 5, False: 40]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      5|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      5|    buffer++; \
  |  |  |  |  |  |  401|      5|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 5, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      5|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      5|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      5|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      5|      buffer -= 2; \
  |  |  |  |  |  |  406|      5|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      5|    } \
  |  |  |  |  |  |  408|      5|  } \
  |  |  |  |  |  |  409|     45|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|     45|#define GET_BYTE { \
  |  |  |  |  |  |  392|     45|  register int c0, c1; \
  |  |  |  |  |  |  393|     45|  c0 = *buffer++; \
  |  |  |  |  |  |  394|     45|  c1 = *buffer; \
  |  |  |  |  |  |  395|     45|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|     45|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|     45|  bits_left += 8; \
  |  |  |  |  |  |  398|     45|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 5, False: 40]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      5|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      5|    buffer++; \
  |  |  |  |  |  |  401|      5|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 5, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      5|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      5|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      5|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      5|      buffer -= 2; \
  |  |  |  |  |  |  406|      5|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      5|    } \
  |  |  |  |  |  |  408|      5|  } \
  |  |  |  |  |  |  409|     45|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|     45|#define GET_BYTE { \
  |  |  |  |  |  |  392|     45|  register int c0, c1; \
  |  |  |  |  |  |  393|     45|  c0 = *buffer++; \
  |  |  |  |  |  |  394|     45|  c1 = *buffer; \
  |  |  |  |  |  |  395|     45|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|     45|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|     45|  bits_left += 8; \
  |  |  |  |  |  |  398|     45|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 7, False: 38]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      7|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      7|    buffer++; \
  |  |  |  |  |  |  401|      7|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 6, False: 1]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      6|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      6|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      6|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      6|      buffer -= 2; \
  |  |  |  |  |  |  406|      6|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      6|    } \
  |  |  |  |  |  |  408|      7|  } \
  |  |  |  |  |  |  409|     45|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|     45|#define GET_BYTE { \
  |  |  |  |  |  |  392|     45|  register int c0, c1; \
  |  |  |  |  |  |  393|     45|  c0 = *buffer++; \
  |  |  |  |  |  |  394|     45|  c1 = *buffer; \
  |  |  |  |  |  |  395|     45|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|     45|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|     45|  bits_left += 8; \
  |  |  |  |  |  |  398|     45|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 6, False: 39]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      6|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      6|    buffer++; \
  |  |  |  |  |  |  401|      6|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 6, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      6|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      6|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      6|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      6|      buffer -= 2; \
  |  |  |  |  |  |  406|      6|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      6|    } \
  |  |  |  |  |  |  408|      6|  } \
  |  |  |  |  |  |  409|     45|}
  |  |  |  |  ------------------
  |  |  |  |  417|     45|  }
  |  |  ------------------
  |  |  225|    666|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|    666|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|    666|  s = htbl->lookup[s]; \
  |  |  227|    666|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|    666|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|    666|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|    666|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|    666|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|    666|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|    666|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|    666|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.33k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 4, False: 662]
  |  |  ------------------
  |  |  232|      4|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|      4|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|      4|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|     12|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 8, False: 4]
  |  |  ------------------
  |  |  236|      8|      s <<= 1; \
  |  |  237|      8|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|      8|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|      8|      nb++; \
  |  |  239|      8|    } \
  |  |  240|      4|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 1, False: 3]
  |  |  ------------------
  |  |  241|      4|      s = 0; \
  |  |  242|      4|    else \
  |  |  243|      4|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|      4|  }
  ------------------
  684|    666|    if (s) {
  ------------------
  |  Branch (684:9): [True: 432, False: 234]
  ------------------
  685|    432|      FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|    432|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 8, False: 424]
  |  |  ------------------
  |  |  416|      8|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      8|#define GET_BYTE { \
  |  |  |  |  392|      8|  register int c0, c1; \
  |  |  |  |  393|      8|  c0 = *buffer++; \
  |  |  |  |  394|      8|  c1 = *buffer; \
  |  |  |  |  395|      8|  /* Pre-execute most common case */ \
  |  |  |  |  396|      8|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      8|  bits_left += 8; \
  |  |  |  |  398|      8|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1, False: 7]
  |  |  |  |  ------------------
  |  |  |  |  399|      1|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      1|    buffer++; \
  |  |  |  |  401|      1|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      1|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      1|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      1|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      1|      buffer -= 2; \
  |  |  |  |  406|      1|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      1|    } \
  |  |  |  |  408|      1|  } \
  |  |  |  |  409|      8|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      8|#define GET_BYTE { \
  |  |  |  |  392|      8|  register int c0, c1; \
  |  |  |  |  393|      8|  c0 = *buffer++; \
  |  |  |  |  394|      8|  c1 = *buffer; \
  |  |  |  |  395|      8|  /* Pre-execute most common case */ \
  |  |  |  |  396|      8|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      8|  bits_left += 8; \
  |  |  |  |  398|      8|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1, False: 7]
  |  |  |  |  ------------------
  |  |  |  |  399|      1|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      1|    buffer++; \
  |  |  |  |  401|      1|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      1|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      1|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      1|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      1|      buffer -= 2; \
  |  |  |  |  406|      1|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      1|    } \
  |  |  |  |  408|      1|  } \
  |  |  |  |  409|      8|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      8|#define GET_BYTE { \
  |  |  |  |  392|      8|  register int c0, c1; \
  |  |  |  |  393|      8|  c0 = *buffer++; \
  |  |  |  |  394|      8|  c1 = *buffer; \
  |  |  |  |  395|      8|  /* Pre-execute most common case */ \
  |  |  |  |  396|      8|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      8|  bits_left += 8; \
  |  |  |  |  398|      8|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1, False: 7]
  |  |  |  |  ------------------
  |  |  |  |  399|      1|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      1|    buffer++; \
  |  |  |  |  401|      1|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      1|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      1|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      1|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      1|      buffer -= 2; \
  |  |  |  |  406|      1|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      1|    } \
  |  |  |  |  408|      1|  } \
  |  |  |  |  409|      8|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      8|#define GET_BYTE { \
  |  |  |  |  392|      8|  register int c0, c1; \
  |  |  |  |  393|      8|  c0 = *buffer++; \
  |  |  |  |  394|      8|  c1 = *buffer; \
  |  |  |  |  395|      8|  /* Pre-execute most common case */ \
  |  |  |  |  396|      8|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      8|  bits_left += 8; \
  |  |  |  |  398|      8|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3, False: 5]
  |  |  |  |  ------------------
  |  |  |  |  399|      3|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      3|    buffer++; \
  |  |  |  |  401|      3|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      3|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      3|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      3|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      3|      buffer -= 2; \
  |  |  |  |  406|      3|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      3|    } \
  |  |  |  |  408|      3|  } \
  |  |  |  |  409|      8|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      8|#define GET_BYTE { \
  |  |  |  |  392|      8|  register int c0, c1; \
  |  |  |  |  393|      8|  c0 = *buffer++; \
  |  |  |  |  394|      8|  c1 = *buffer; \
  |  |  |  |  395|      8|  /* Pre-execute most common case */ \
  |  |  |  |  396|      8|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      8|  bits_left += 8; \
  |  |  |  |  398|      8|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3, False: 5]
  |  |  |  |  ------------------
  |  |  |  |  399|      3|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      3|    buffer++; \
  |  |  |  |  401|      3|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      3|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      3|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      3|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      3|      buffer -= 2; \
  |  |  |  |  406|      3|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      3|    } \
  |  |  |  |  408|      3|  } \
  |  |  |  |  409|      8|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      8|#define GET_BYTE { \
  |  |  |  |  392|      8|  register int c0, c1; \
  |  |  |  |  393|      8|  c0 = *buffer++; \
  |  |  |  |  394|      8|  c1 = *buffer; \
  |  |  |  |  395|      8|  /* Pre-execute most common case */ \
  |  |  |  |  396|      8|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      8|  bits_left += 8; \
  |  |  |  |  398|      8|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3, False: 5]
  |  |  |  |  ------------------
  |  |  |  |  399|      3|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      3|    buffer++; \
  |  |  |  |  401|      3|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      3|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      3|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      3|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      3|      buffer -= 2; \
  |  |  |  |  406|      3|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      3|    } \
  |  |  |  |  408|      3|  } \
  |  |  |  |  409|      8|}
  |  |  ------------------
  |  |  417|      8|  }
  ------------------
  686|    432|      r = GET_BITS(s);
  ------------------
  |  |  169|    432|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  687|    432|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|    432|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|    432|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  688|    432|    }
  689|       |
  690|    666|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (690:9): [True: 666, False: 0]
  ------------------
  691|    666|      int ci = cinfo->MCU_membership[blkn];
  692|       |      /* Refer to the comment in decode_mcu_slow() regarding the supression of
  693|       |       * a UBSan integer overflow error in this line of code.
  694|       |       */
  695|    666|      s += state.last_dc_val[ci];
  696|    666|      state.last_dc_val[ci] = s;
  697|    666|      if (block)
  ------------------
  |  Branch (697:11): [True: 666, False: 0]
  ------------------
  698|    666|        (*block)[0] = (JCOEF)s;
  699|    666|    }
  700|       |
  701|    666|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (701:9): [True: 666, False: 0]
  |  Branch (701:37): [True: 666, False: 0]
  ------------------
  702|       |
  703|  18.6k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  18.6k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (703:19): [True: 18.2k, False: 379]
  ------------------
  704|  18.2k|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|  18.2k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|  18.2k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 180, False: 18.0k]
  |  |  |  |  ------------------
  |  |  |  |  416|    180|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|    180|#define GET_BYTE { \
  |  |  |  |  |  |  392|    180|  register int c0, c1; \
  |  |  |  |  |  |  393|    180|  c0 = *buffer++; \
  |  |  |  |  |  |  394|    180|  c1 = *buffer; \
  |  |  |  |  |  |  395|    180|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|    180|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|    180|  bits_left += 8; \
  |  |  |  |  |  |  398|    180|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 45, False: 135]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|     45|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|     45|    buffer++; \
  |  |  |  |  |  |  401|     45|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 45, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     45|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     45|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     45|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     45|      buffer -= 2; \
  |  |  |  |  |  |  406|     45|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     45|    } \
  |  |  |  |  |  |  408|     45|  } \
  |  |  |  |  |  |  409|    180|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|    180|#define GET_BYTE { \
  |  |  |  |  |  |  392|    180|  register int c0, c1; \
  |  |  |  |  |  |  393|    180|  c0 = *buffer++; \
  |  |  |  |  |  |  394|    180|  c1 = *buffer; \
  |  |  |  |  |  |  395|    180|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|    180|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|    180|  bits_left += 8; \
  |  |  |  |  |  |  398|    180|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 46, False: 134]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|     46|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|     46|    buffer++; \
  |  |  |  |  |  |  401|     46|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 45, False: 1]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     45|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     45|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     45|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     45|      buffer -= 2; \
  |  |  |  |  |  |  406|     45|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     45|    } \
  |  |  |  |  |  |  408|     46|  } \
  |  |  |  |  |  |  409|    180|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|    180|#define GET_BYTE { \
  |  |  |  |  |  |  392|    180|  register int c0, c1; \
  |  |  |  |  |  |  393|    180|  c0 = *buffer++; \
  |  |  |  |  |  |  394|    180|  c1 = *buffer; \
  |  |  |  |  |  |  395|    180|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|    180|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|    180|  bits_left += 8; \
  |  |  |  |  |  |  398|    180|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 45, False: 135]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|     45|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|     45|    buffer++; \
  |  |  |  |  |  |  401|     45|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 45, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     45|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     45|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     45|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     45|      buffer -= 2; \
  |  |  |  |  |  |  406|     45|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     45|    } \
  |  |  |  |  |  |  408|     45|  } \
  |  |  |  |  |  |  409|    180|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|    180|#define GET_BYTE { \
  |  |  |  |  |  |  392|    180|  register int c0, c1; \
  |  |  |  |  |  |  393|    180|  c0 = *buffer++; \
  |  |  |  |  |  |  394|    180|  c1 = *buffer; \
  |  |  |  |  |  |  395|    180|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|    180|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|    180|  bits_left += 8; \
  |  |  |  |  |  |  398|    180|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 47, False: 133]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|     47|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|     47|    buffer++; \
  |  |  |  |  |  |  401|     47|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 45, False: 2]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     45|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     45|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     45|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     45|      buffer -= 2; \
  |  |  |  |  |  |  406|     45|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     45|    } \
  |  |  |  |  |  |  408|     47|  } \
  |  |  |  |  |  |  409|    180|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|    180|#define GET_BYTE { \
  |  |  |  |  |  |  392|    180|  register int c0, c1; \
  |  |  |  |  |  |  393|    180|  c0 = *buffer++; \
  |  |  |  |  |  |  394|    180|  c1 = *buffer; \
  |  |  |  |  |  |  395|    180|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|    180|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|    180|  bits_left += 8; \
  |  |  |  |  |  |  398|    180|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 45, False: 135]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|     45|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|     45|    buffer++; \
  |  |  |  |  |  |  401|     45|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 45, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     45|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     45|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     45|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     45|      buffer -= 2; \
  |  |  |  |  |  |  406|     45|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     45|    } \
  |  |  |  |  |  |  408|     45|  } \
  |  |  |  |  |  |  409|    180|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|    180|#define GET_BYTE { \
  |  |  |  |  |  |  392|    180|  register int c0, c1; \
  |  |  |  |  |  |  393|    180|  c0 = *buffer++; \
  |  |  |  |  |  |  394|    180|  c1 = *buffer; \
  |  |  |  |  |  |  395|    180|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|    180|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|    180|  bits_left += 8; \
  |  |  |  |  |  |  398|    180|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 48, False: 132]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|     48|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|     48|    buffer++; \
  |  |  |  |  |  |  401|     48|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 45, False: 3]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     45|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     45|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     45|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     45|      buffer -= 2; \
  |  |  |  |  |  |  406|     45|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     45|    } \
  |  |  |  |  |  |  408|     48|  } \
  |  |  |  |  |  |  409|    180|}
  |  |  |  |  ------------------
  |  |  |  |  417|    180|  }
  |  |  ------------------
  |  |  225|  18.2k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  18.2k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|  18.2k|  s = htbl->lookup[s]; \
  |  |  227|  18.2k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|  18.2k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|  18.2k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|  18.2k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  18.2k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|  18.2k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  18.2k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|  18.2k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  36.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 162, False: 18.0k]
  |  |  ------------------
  |  |  232|    162|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|    162|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|    162|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|    811|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 649, False: 162]
  |  |  ------------------
  |  |  236|    649|      s <<= 1; \
  |  |  237|    649|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|    649|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|    649|      nb++; \
  |  |  239|    649|    } \
  |  |  240|    162|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 1, False: 161]
  |  |  ------------------
  |  |  241|    162|      s = 0; \
  |  |  242|    162|    else \
  |  |  243|    162|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|    162|  }
  ------------------
  705|  18.2k|        r = s >> 4;
  706|  18.2k|        s &= 15;
  707|       |
  708|  18.2k|        if (s) {
  ------------------
  |  Branch (708:13): [True: 17.9k, False: 287]
  ------------------
  709|  17.9k|          k += r;
  710|  17.9k|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  17.9k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 1.45k, False: 16.5k]
  |  |  ------------------
  |  |  416|  1.45k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  1.45k|#define GET_BYTE { \
  |  |  |  |  392|  1.45k|  register int c0, c1; \
  |  |  |  |  393|  1.45k|  c0 = *buffer++; \
  |  |  |  |  394|  1.45k|  c1 = *buffer; \
  |  |  |  |  395|  1.45k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  1.45k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  1.45k|  bits_left += 8; \
  |  |  |  |  398|  1.45k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 81, False: 1.37k]
  |  |  |  |  ------------------
  |  |  |  |  399|     81|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|     81|    buffer++; \
  |  |  |  |  401|     81|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 78, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  402|     78|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     78|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     78|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     78|      buffer -= 2; \
  |  |  |  |  406|     78|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     78|    } \
  |  |  |  |  408|     81|  } \
  |  |  |  |  409|  1.45k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  1.45k|#define GET_BYTE { \
  |  |  |  |  392|  1.45k|  register int c0, c1; \
  |  |  |  |  393|  1.45k|  c0 = *buffer++; \
  |  |  |  |  394|  1.45k|  c1 = *buffer; \
  |  |  |  |  395|  1.45k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  1.45k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  1.45k|  bits_left += 8; \
  |  |  |  |  398|  1.45k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 80, False: 1.37k]
  |  |  |  |  ------------------
  |  |  |  |  399|     80|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|     80|    buffer++; \
  |  |  |  |  401|     80|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 80, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|     80|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     80|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     80|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     80|      buffer -= 2; \
  |  |  |  |  406|     80|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     80|    } \
  |  |  |  |  408|     80|  } \
  |  |  |  |  409|  1.45k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  1.45k|#define GET_BYTE { \
  |  |  |  |  392|  1.45k|  register int c0, c1; \
  |  |  |  |  393|  1.45k|  c0 = *buffer++; \
  |  |  |  |  394|  1.45k|  c1 = *buffer; \
  |  |  |  |  395|  1.45k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  1.45k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  1.45k|  bits_left += 8; \
  |  |  |  |  398|  1.45k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 97, False: 1.36k]
  |  |  |  |  ------------------
  |  |  |  |  399|     97|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|     97|    buffer++; \
  |  |  |  |  401|     97|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 80, False: 17]
  |  |  |  |  ------------------
  |  |  |  |  402|     80|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     80|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     80|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     80|      buffer -= 2; \
  |  |  |  |  406|     80|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     80|    } \
  |  |  |  |  408|     97|  } \
  |  |  |  |  409|  1.45k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  1.45k|#define GET_BYTE { \
  |  |  |  |  392|  1.45k|  register int c0, c1; \
  |  |  |  |  393|  1.45k|  c0 = *buffer++; \
  |  |  |  |  394|  1.45k|  c1 = *buffer; \
  |  |  |  |  395|  1.45k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  1.45k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  1.45k|  bits_left += 8; \
  |  |  |  |  398|  1.45k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 80, False: 1.37k]
  |  |  |  |  ------------------
  |  |  |  |  399|     80|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|     80|    buffer++; \
  |  |  |  |  401|     80|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 80, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|     80|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     80|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     80|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     80|      buffer -= 2; \
  |  |  |  |  406|     80|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     80|    } \
  |  |  |  |  408|     80|  } \
  |  |  |  |  409|  1.45k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  1.45k|#define GET_BYTE { \
  |  |  |  |  392|  1.45k|  register int c0, c1; \
  |  |  |  |  393|  1.45k|  c0 = *buffer++; \
  |  |  |  |  394|  1.45k|  c1 = *buffer; \
  |  |  |  |  395|  1.45k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  1.45k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  1.45k|  bits_left += 8; \
  |  |  |  |  398|  1.45k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 89, False: 1.36k]
  |  |  |  |  ------------------
  |  |  |  |  399|     89|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|     89|    buffer++; \
  |  |  |  |  401|     89|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 83, False: 6]
  |  |  |  |  ------------------
  |  |  |  |  402|     83|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     83|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     83|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     83|      buffer -= 2; \
  |  |  |  |  406|     83|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     83|    } \
  |  |  |  |  408|     89|  } \
  |  |  |  |  409|  1.45k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  1.45k|#define GET_BYTE { \
  |  |  |  |  392|  1.45k|  register int c0, c1; \
  |  |  |  |  393|  1.45k|  c0 = *buffer++; \
  |  |  |  |  394|  1.45k|  c1 = *buffer; \
  |  |  |  |  395|  1.45k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  1.45k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  1.45k|  bits_left += 8; \
  |  |  |  |  398|  1.45k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 90, False: 1.36k]
  |  |  |  |  ------------------
  |  |  |  |  399|     90|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|     90|    buffer++; \
  |  |  |  |  401|     90|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 86, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  402|     86|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     86|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     86|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     86|      buffer -= 2; \
  |  |  |  |  406|     86|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     86|    } \
  |  |  |  |  408|     90|  } \
  |  |  |  |  409|  1.45k|}
  |  |  ------------------
  |  |  417|  1.45k|  }
  ------------------
  711|  17.9k|          r = GET_BITS(s);
  ------------------
  |  |  169|  17.9k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  712|  17.9k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  17.9k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  17.9k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  713|  17.9k|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  714|  17.9k|        } else {
  715|    287|          if (r != 15) break;
  ------------------
  |  Branch (715:15): [True: 287, False: 0]
  ------------------
  716|      0|          k += 15;
  717|      0|        }
  718|  18.2k|      }
  719|       |
  720|    666|    } else {
  721|       |
  722|      0|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (722:19): [True: 0, False: 0]
  ------------------
  723|      0|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|      0|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|      0|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|      0|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |  417|      0|  }
  |  |  ------------------
  |  |  225|      0|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|      0|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|      0|  s = htbl->lookup[s]; \
  |  |  227|      0|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|      0|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|      0|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|      0|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|      0|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|      0|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  232|      0|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|      0|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|      0|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|      0|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  236|      0|      s <<= 1; \
  |  |  237|      0|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|      0|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|      0|      nb++; \
  |  |  239|      0|    } \
  |  |  240|      0|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  241|      0|      s = 0; \
  |  |  242|      0|    else \
  |  |  243|      0|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|      0|  }
  ------------------
  724|      0|        r = s >> 4;
  725|      0|        s &= 15;
  726|       |
  727|      0|        if (s) {
  ------------------
  |  Branch (727:13): [True: 0, False: 0]
  ------------------
  728|      0|          k += r;
  729|      0|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|      0|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  416|      0|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |  417|      0|  }
  ------------------
  730|      0|          DROP_BITS(s);
  ------------------
  |  |  175|      0|  (bits_left -= (nbits))
  ------------------
  731|      0|        } else {
  732|      0|          if (r != 15) break;
  ------------------
  |  Branch (732:15): [True: 0, False: 0]
  ------------------
  733|      0|          k += 15;
  734|      0|        }
  735|      0|      }
  736|      0|    }
  737|    666|  }
  738|       |
  739|    390|  if (cinfo->unread_marker != 0) {
  ------------------
  |  Branch (739:7): [True: 15, False: 375]
  ------------------
  740|     15|    cinfo->unread_marker = 0;
  741|     15|    return FALSE;
  ------------------
  |  |  206|     15|#define FALSE   0               /* values of boolean */
  ------------------
  742|     15|  }
  743|       |
  744|    375|  br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
  745|    375|  br_state.next_input_byte = buffer;
  746|    375|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|    375|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|    375|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|    375|  permstate.get_buffer = get_buffer; \
  |  |  140|    375|  permstate.bits_left = bits_left
  ------------------
  747|    375|  entropy->saved = state;
  748|    375|  return TRUE;
  ------------------
  |  |  209|    375|#define TRUE    1
  ------------------
  749|    390|}
jdhuff.c:decode_mcu_slow:
  553|  9.84k|{
  554|  9.84k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  555|  9.84k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  9.84k|  register bit_buf_type get_buffer; \
  |  |  126|  9.84k|  register int bits_left; \
  |  |  127|  9.84k|  bitread_working_state br_state
  ------------------
  556|  9.84k|  int blkn;
  557|  9.84k|  savable_state state;
  558|       |  /* Outer loop handles each block in the MCU */
  559|       |
  560|       |  /* Load up working state */
  561|  9.84k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  9.84k|  br_state.cinfo = cinfop; \
  |  |  131|  9.84k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  9.84k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  9.84k|  get_buffer = permstate.get_buffer; \
  |  |  134|  9.84k|  bits_left = permstate.bits_left;
  ------------------
  562|  9.84k|  state = entropy->saved;
  563|       |
  564|  37.3k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (564:18): [True: 27.4k, False: 9.83k]
  ------------------
  565|  27.4k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (565:23): [True: 27.4k, False: 0]
  ------------------
  566|  27.4k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  567|  27.4k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  568|  27.4k|    register int s, k, r;
  569|       |
  570|       |    /* Decode a single block's worth of coefficients */
  571|       |
  572|       |    /* Section F.2.2.1: decode the DC coefficient difference */
  573|  27.4k|    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
  ------------------
  |  |  200|  27.4k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  27.4k|  register int nb, look; \
  |  |  202|  27.4k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  27.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 1.85k, False: 25.6k]
  |  |  ------------------
  |  |  203|  1.85k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 1.85k]
  |  |  ------------------
  |  |  204|  1.85k|      { failaction; } \
  |  |  205|  1.85k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  1.85k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.85k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 22, False: 1.83k]
  |  |  ------------------
  |  |  207|     22|      nb = 1;  goto slowlabel; \
  |  |  208|     22|    } \
  |  |  209|  1.85k|  } \
  |  |  210|  27.4k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  27.4k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  27.4k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  27.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  27.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 27.3k, False: 52]
  |  |  ------------------
  |  |  212|  27.3k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  27.3k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  27.3k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  27.3k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  27.3k|  } else { \
  |  |  215|     72|slowlabel: \
  |  |  216|     72|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 72]
  |  |  ------------------
  |  |  217|     72|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|     72|      { failaction; } \
  |  |  219|     72|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|     72|  } \
  |  |  221|  27.4k|}
  ------------------
  574|  27.4k|    if (s) {
  ------------------
  |  Branch (574:9): [True: 6.00k, False: 21.4k]
  ------------------
  575|  6.00k|      CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  6.00k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  6.00k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 522, False: 5.48k]
  |  |  ------------------
  |  |  162|    522|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 522]
  |  |  ------------------
  |  |  163|    522|      { action; } \
  |  |  164|    522|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    522|  } \
  |  |  166|  6.00k|}
  ------------------
  576|  6.00k|      r = GET_BITS(s);
  ------------------
  |  |  169|  6.00k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  577|  6.00k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  6.00k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  6.00k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  578|  6.00k|    }
  579|       |
  580|  27.4k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (580:9): [True: 27.4k, False: 25]
  ------------------
  581|       |      /* Convert DC difference to actual value, update last_dc_val */
  582|  27.4k|      int ci = cinfo->MCU_membership[blkn];
  583|       |      /* Certain malformed JPEG images produce repeated DC coefficient
  584|       |       * differences of 2047 or -2047, which causes state.last_dc_val[ci] to
  585|       |       * grow until it overflows or underflows a 32-bit signed integer.  This
  586|       |       * behavior is, to the best of our understanding, innocuous, and it is
  587|       |       * unclear how to work around it without potentially affecting
  588|       |       * performance.  Thus, we (hopefully temporarily) suppress UBSan integer
  589|       |       * overflow errors for this function and decode_mcu_fast().
  590|       |       */
  591|  27.4k|      s += state.last_dc_val[ci];
  592|  27.4k|      state.last_dc_val[ci] = s;
  593|  27.4k|      if (block) {
  ------------------
  |  Branch (593:11): [True: 27.4k, False: 0]
  ------------------
  594|       |        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
  595|  27.4k|        (*block)[0] = (JCOEF)s;
  596|  27.4k|      }
  597|  27.4k|    }
  598|       |
  599|  27.4k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (599:9): [True: 27.4k, False: 25]
  |  Branch (599:37): [True: 27.4k, False: 0]
  ------------------
  600|       |
  601|       |      /* Section F.2.2.2: decode the AC coefficients */
  602|       |      /* Since zeroes are skipped, output area must be cleared beforehand */
  603|  45.6k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  45.6k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (603:19): [True: 45.2k, False: 374]
  ------------------
  604|  45.2k|        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
  ------------------
  |  |  200|  45.2k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  45.2k|  register int nb, look; \
  |  |  202|  45.2k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  45.2k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 3.46k, False: 41.7k]
  |  |  ------------------
  |  |  203|  3.46k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 3.46k]
  |  |  ------------------
  |  |  204|  3.46k|      { failaction; } \
  |  |  205|  3.46k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  3.46k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  3.46k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 379, False: 3.08k]
  |  |  ------------------
  |  |  207|    379|      nb = 1;  goto slowlabel; \
  |  |  208|    379|    } \
  |  |  209|  3.46k|  } \
  |  |  210|  45.2k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  44.8k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  44.8k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  44.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  44.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 36.7k, False: 8.07k]
  |  |  ------------------
  |  |  212|  36.7k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  36.7k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  36.7k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  36.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  36.7k|  } else { \
  |  |  215|  8.45k|slowlabel: \
  |  |  216|  8.45k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 8.45k]
  |  |  ------------------
  |  |  217|  8.45k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  8.45k|      { failaction; } \
  |  |  219|  8.45k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  8.45k|  } \
  |  |  221|  44.8k|}
  ------------------
  605|       |
  606|  45.2k|        r = s >> 4;
  607|  45.2k|        s &= 15;
  608|       |
  609|  45.2k|        if (s) {
  ------------------
  |  Branch (609:13): [True: 18.1k, False: 27.1k]
  ------------------
  610|  18.1k|          k += r;
  611|  18.1k|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  18.1k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  18.1k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 794, False: 17.3k]
  |  |  ------------------
  |  |  162|    794|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 794]
  |  |  ------------------
  |  |  163|    794|      { action; } \
  |  |  164|    794|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    794|  } \
  |  |  166|  18.1k|}
  ------------------
  612|  18.1k|          r = GET_BITS(s);
  ------------------
  |  |  169|  18.1k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  613|  18.1k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  18.1k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  18.1k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  614|       |          /* Output coefficient in natural (dezigzagged) order.
  615|       |           * Note: the extra entries in jpeg_natural_order[] will save us
  616|       |           * if k >= DCTSIZE2, which could happen if the data is corrupted.
  617|       |           */
  618|  18.1k|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  619|  27.1k|        } else {
  620|  27.1k|          if (r != 15)
  ------------------
  |  Branch (620:15): [True: 27.0k, False: 69]
  ------------------
  621|  27.0k|            break;
  622|     69|          k += 15;
  623|     69|        }
  624|  45.2k|      }
  625|       |
  626|  27.4k|    } else {
  627|       |
  628|       |      /* Section F.2.2.2: decode the AC coefficients */
  629|       |      /* In this path we just discard the values */
  630|     25|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|     25|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (630:19): [True: 0, False: 25]
  ------------------
  631|      0|        HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
  ------------------
  |  |  200|      0|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|      0|  register int nb, look; \
  |  |  202|      0|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  203|      0|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  204|      0|      { failaction; } \
  |  |  205|      0|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|      0|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  207|      0|      nb = 1;  goto slowlabel; \
  |  |  208|      0|    } \
  |  |  209|      0|  } \
  |  |  210|      0|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|      0|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|      0|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  212|      0|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|      0|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|      0|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|      0|  } else { \
  |  |  215|      0|slowlabel: \
  |  |  216|      0|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  217|      0|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|      0|      { failaction; } \
  |  |  219|      0|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|      0|  } \
  |  |  221|      0|}
  ------------------
  632|       |
  633|      0|        r = s >> 4;
  634|      0|        s &= 15;
  635|       |
  636|      0|        if (s) {
  ------------------
  |  Branch (636:13): [True: 0, False: 0]
  ------------------
  637|      0|          k += r;
  638|      0|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|      0|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|      0|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  162|      0|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  163|      0|      { action; } \
  |  |  164|      0|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|      0|  } \
  |  |  166|      0|}
  ------------------
  639|      0|          DROP_BITS(s);
  ------------------
  |  |  175|      0|  (bits_left -= (nbits))
  ------------------
  640|      0|        } else {
  641|      0|          if (r != 15)
  ------------------
  |  Branch (641:15): [True: 0, False: 0]
  ------------------
  642|      0|            break;
  643|      0|          k += 15;
  644|      0|        }
  645|      0|      }
  646|     25|    }
  647|  27.4k|  }
  648|       |
  649|       |  /* Completed MCU, so update state */
  650|  9.83k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  9.83k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  9.83k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  9.83k|  permstate.get_buffer = get_buffer; \
  |  |  140|  9.83k|  permstate.bits_left = bits_left
  ------------------
  651|  9.83k|  entropy->saved = state;
  652|  9.83k|  return TRUE;
  ------------------
  |  |  209|  9.83k|#define TRUE    1
  ------------------
  653|  9.84k|}

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

jdmainct.c:start_pass_main:
  259|    528|{
  260|    528|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|    528|  switch (pass_mode) {
  263|    528|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 528, False: 0]
  ------------------
  264|    528|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 152, False: 376]
  ------------------
  265|    152|      main_ptr->pub._process_data = process_data_context_main;
  ------------------
  |  |  139|    152|#define _process_data  process_data_12
  ------------------
  266|    152|      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
  267|    152|      main_ptr->whichptr = 0;   /* Read first iMCU row into xbuffer[0] */
  268|    152|      main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|    152|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  269|    152|      main_ptr->iMCU_row_ctr = 0;
  270|    376|    } else {
  271|       |      /* Simple case with no context needed */
  272|    376|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  139|    376|#define _process_data  process_data_12
  ------------------
  273|    376|    }
  274|    528|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  206|    528|#define FALSE   0               /* values of boolean */
  ------------------
  275|    528|    main_ptr->rowgroup_ctr = 0;
  276|    528|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 528]
  ------------------
  279|       |    /* For last pass of 2-pass quantization, just crank the postprocessor */
  280|      0|    main_ptr->pub._process_data = process_data_crank_post;
  ------------------
  |  |  139|      0|#define _process_data  process_data_12
  ------------------
  281|      0|    break;
  282|      0|#endif
  283|      0|  default:
  ------------------
  |  Branch (283:3): [True: 0, False: 528]
  ------------------
  284|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  285|      0|    break;
  286|    528|  }
  287|    528|}
jdmainct.c:process_data_context_main:
  337|  5.39k|{
  338|  5.39k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  339|       |
  340|       |  /* Read input data if we haven't filled the main buffer yet */
  341|  5.39k|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (341:7): [True: 396, False: 4.99k]
  ------------------
  342|    396|    if (!(*cinfo->coef->_decompress_data) (cinfo,
  ------------------
  |  |  141|    396|#define _decompress_data  decompress_data_12
  ------------------
  |  Branch (342:9): [True: 0, False: 396]
  ------------------
  343|    396|                                           main_ptr->xbuffer[main_ptr->whichptr]))
  344|      0|      return;                   /* suspension forced, can do nothing more */
  345|    396|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  209|    396|#define TRUE    1
  ------------------
  346|    396|    main_ptr->iMCU_row_ctr++;   /* count rows received */
  347|    396|  }
  348|       |
  349|       |  /* Postprocessor typically will not swallow all the input data it is handed
  350|       |   * in one call (due to filling the output buffer first).  Must be prepared
  351|       |   * to exit and restart.  This switch lets us keep track of how far we got.
  352|       |   * Note that each case falls through to the next on successful completion.
  353|       |   */
  354|  5.39k|  switch (main_ptr->context_state) {
  ------------------
  |  Branch (354:11): [True: 57, False: 5.33k]
  ------------------
  355|    402|  case CTX_POSTPONED_ROW:
  ------------------
  |  |   48|    402|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  |  Branch (355:3): [True: 402, False: 4.99k]
  ------------------
  356|       |    /* Call postprocessor using previously set pointers for postponed row */
  357|    402|    (*cinfo->post->_post_process_data) (cinfo,
  ------------------
  |  |  143|    402|#define _post_process_data  post_process_data_12
  ------------------
  358|    402|                                        main_ptr->xbuffer[main_ptr->whichptr],
  359|    402|                                        &main_ptr->rowgroup_ctr,
  360|    402|                                        main_ptr->rowgroups_avail, output_buf,
  361|    402|                                        out_row_ctr, out_rows_avail);
  362|    402|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (362:9): [True: 201, False: 201]
  ------------------
  363|    201|      return;                   /* Need to suspend */
  364|    201|    main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|    201|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  365|    201|    if (*out_row_ctr >= out_rows_avail)
  ------------------
  |  Branch (365:9): [True: 201, False: 0]
  ------------------
  366|    201|      return;                   /* Postprocessor exactly filled output buf */
  367|       |    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|      0|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  368|    339|  case CTX_PREPARE_FOR_IMCU:
  ------------------
  |  |   46|    339|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  |  Branch (368:3): [True: 339, False: 5.05k]
  ------------------
  369|       |    /* Prepare to process first M-1 row groups of this iMCU row */
  370|    339|    main_ptr->rowgroup_ctr = 0;
  371|    339|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size - 1);
  ------------------
  |  |   27|    339|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  372|       |    /* Check for bottom of image: if so, tweak pointers to "duplicate"
  373|       |     * the last sample row, and adjust rowgroups_avail to ignore padding rows.
  374|       |     */
  375|    339|    if (main_ptr->iMCU_row_ctr == cinfo->total_iMCU_rows)
  ------------------
  |  Branch (375:9): [True: 95, False: 244]
  ------------------
  376|     95|      set_bottom_pointers(cinfo);
  377|    339|    main_ptr->context_state = CTX_PROCESS_IMCU;
  ------------------
  |  |   47|    339|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  378|       |    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|    339|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  379|  4.93k|  case CTX_PROCESS_IMCU:
  ------------------
  |  |   47|  4.93k|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  |  Branch (379:3): [True: 4.59k, False: 798]
  ------------------
  380|       |    /* Call postprocessor using previously set pointers */
  381|  4.93k|    (*cinfo->post->_post_process_data) (cinfo,
  ------------------
  |  |  143|  4.93k|#define _post_process_data  post_process_data_12
  ------------------
  382|  4.93k|                                        main_ptr->xbuffer[main_ptr->whichptr],
  383|  4.93k|                                        &main_ptr->rowgroup_ctr,
  384|  4.93k|                                        main_ptr->rowgroups_avail, output_buf,
  385|  4.93k|                                        out_row_ctr, out_rows_avail);
  386|  4.93k|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (386:9): [True: 4.59k, False: 339]
  ------------------
  387|  4.59k|      return;                   /* Need to suspend */
  388|       |    /* After the first iMCU, change wraparound pointers to normal state */
  389|    339|    if (main_ptr->iMCU_row_ctr == 1)
  ------------------
  |  Branch (389:9): [True: 138, False: 201]
  ------------------
  390|    138|      set_wraparound_pointers(cinfo);
  391|       |    /* Prepare to load new iMCU row using other xbuffer list */
  392|    339|    main_ptr->whichptr ^= 1;    /* 0=>1 or 1=>0 */
  393|    339|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  206|    339|#define FALSE   0               /* values of boolean */
  ------------------
  394|       |    /* Still need to process last row group of this iMCU row, */
  395|       |    /* which is saved at index M+1 of the other xbuffer */
  396|    339|    main_ptr->rowgroup_ctr = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 1);
  ------------------
  |  |   27|    339|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  397|    339|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 2);
  ------------------
  |  |   27|    339|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  398|    339|    main_ptr->context_state = CTX_POSTPONED_ROW;
  ------------------
  |  |   48|    339|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  399|  5.39k|  }
  400|  5.39k|}
jdmainct.c:set_bottom_pointers:
  222|     95|{
  223|     95|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  224|     95|  int ci, i, rgroup, iMCUheight, rows_left;
  225|     95|  jpeg_component_info *compptr;
  226|     95|  _JSAMPARRAY xbuf;
  ------------------
  |  |  113|     95|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  227|       |
  228|    380|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (228:44): [True: 285, False: 95]
  ------------------
  229|    285|       ci++, compptr++) {
  230|       |    /* Count sample rows in one iMCU row and in one row group */
  231|    285|    iMCUheight = compptr->v_samp_factor * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|    285|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  232|    285|    rgroup = iMCUheight / cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    285|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  233|       |    /* Count nondummy sample rows remaining for this component */
  234|    285|    rows_left = (int)(compptr->downsampled_height % (JDIMENSION)iMCUheight);
  235|    285|    if (rows_left == 0) rows_left = iMCUheight;
  ------------------
  |  Branch (235:9): [True: 285, False: 0]
  ------------------
  236|       |    /* Count nondummy row groups.  Should get same answer for each component,
  237|       |     * so we need only do it once.
  238|       |     */
  239|    285|    if (ci == 0) {
  ------------------
  |  Branch (239:9): [True: 95, False: 190]
  ------------------
  240|     95|      main_ptr->rowgroups_avail = (JDIMENSION)((rows_left - 1) / rgroup + 1);
  241|     95|    }
  242|       |    /* Duplicate the last real sample row rgroup*2 times; this pads out the
  243|       |     * last partial rowgroup and ensures at least one full rowgroup of context.
  244|       |     */
  245|    285|    xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci];
  246|  1.04k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (246:17): [True: 760, False: 285]
  ------------------
  247|    760|      xbuf[rows_left + i] = xbuf[rows_left - 1];
  248|    760|    }
  249|    285|  }
  250|     95|}
jdmainct.c:make_funny_pointers:
  181|    152|{
  182|    152|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  183|    152|  int ci, i, rgroup;
  184|    152|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    152|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  185|    152|  jpeg_component_info *compptr;
  186|    152|  _JSAMPARRAY buf, xbuf0, xbuf1;
  ------------------
  |  |  113|    152|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  187|       |
  188|    608|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (188:44): [True: 456, False: 152]
  ------------------
  189|    456|       ci++, compptr++) {
  190|    456|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    456|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  191|    456|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|    456|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  192|    456|    xbuf0 = main_ptr->xbuffer[0][ci];
  193|    456|    xbuf1 = main_ptr->xbuffer[1][ci];
  194|       |    /* First copy the workspace pointers as-is */
  195|    456|    buf = main_ptr->buffer[ci];
  196|  6.53k|    for (i = 0; i < rgroup * (M + 2); i++) {
  ------------------
  |  Branch (196:17): [True: 6.08k, False: 456]
  ------------------
  197|  6.08k|      xbuf0[i] = xbuf1[i] = buf[i];
  198|  6.08k|    }
  199|       |    /* In the second list, put the last four row groups in swapped order */
  200|  1.67k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (200:17): [True: 1.21k, False: 456]
  ------------------
  201|  1.21k|      xbuf1[rgroup * (M - 2) + i] = buf[rgroup * M + i];
  202|  1.21k|      xbuf1[rgroup * M + i] = buf[rgroup * (M - 2) + i];
  203|  1.21k|    }
  204|       |    /* The wraparound pointers at top and bottom will be filled later
  205|       |     * (see set_wraparound_pointers, below).  Initially we want the "above"
  206|       |     * pointers to duplicate the first actual data line.  This only needs
  207|       |     * to happen in xbuffer[0].
  208|       |     */
  209|  1.06k|    for (i = 0; i < rgroup; i++) {
  ------------------
  |  Branch (209:17): [True: 608, False: 456]
  ------------------
  210|    608|      xbuf0[i - rgroup] = xbuf0[0];
  211|    608|    }
  212|    456|  }
  213|    152|}
jdmainct.c:process_data_simple_main:
  298|  16.7k|{
  299|  16.7k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  300|  16.7k|  JDIMENSION rowgroups_avail;
  301|       |
  302|       |  /* Read input data if we haven't filled the main buffer yet */
  303|  16.7k|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (303:7): [True: 2.14k, False: 14.6k]
  ------------------
  304|  2.14k|    if (!(*cinfo->coef->_decompress_data) (cinfo, main_ptr->buffer))
  ------------------
  |  |  141|  2.14k|#define _decompress_data  decompress_data_12
  ------------------
  |  Branch (304:9): [True: 0, False: 2.14k]
  ------------------
  305|      0|      return;                   /* suspension forced, can do nothing more */
  306|  2.14k|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  209|  2.14k|#define TRUE    1
  ------------------
  307|  2.14k|  }
  308|       |
  309|       |  /* There are always min_DCT_scaled_size row groups in an iMCU row. */
  310|  16.7k|  rowgroups_avail = (JDIMENSION)cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  16.7k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  311|       |  /* Note: at the bottom of the image, we may pass extra garbage row groups
  312|       |   * to the postprocessor.  The postprocessor has to check for bottom
  313|       |   * of image anyway (at row resolution), so no point in us doing it too.
  314|       |   */
  315|       |
  316|       |  /* Feed the postprocessor */
  317|  16.7k|  (*cinfo->post->_post_process_data) (cinfo, main_ptr->buffer,
  ------------------
  |  |  143|  16.7k|#define _post_process_data  post_process_data_12
  ------------------
  318|  16.7k|                                      &main_ptr->rowgroup_ctr, rowgroups_avail,
  319|  16.7k|                                      output_buf, out_row_ctr, out_rows_avail);
  320|       |
  321|       |  /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
  322|  16.7k|  if (main_ptr->rowgroup_ctr >= rowgroups_avail) {
  ------------------
  |  Branch (322:7): [True: 2.09k, False: 14.6k]
  ------------------
  323|  2.09k|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  206|  2.09k|#define FALSE   0               /* values of boolean */
  ------------------
  324|  2.09k|    main_ptr->rowgroup_ctr = 0;
  325|  2.09k|  }
  326|  16.7k|}
jdmainct.c:alloc_funny_pointers:
  139|    160|{
  140|    160|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  141|    160|  int ci, rgroup;
  142|    160|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    160|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  143|    160|  jpeg_component_info *compptr;
  144|    160|  _JSAMPARRAY xbuf;
  ------------------
  |  |  113|    160|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  145|       |
  146|       |  /* Get top-level space for component array pointers.
  147|       |   * We alloc both arrays with one call to save a few cycles.
  148|       |   */
  149|    160|  main_ptr->xbuffer[0] = (_JSAMPIMAGE)
  150|    160|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    160|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  151|    160|                                cinfo->num_components * 2 *
  152|    160|                                sizeof(_JSAMPARRAY));
  153|    160|  main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
  154|       |
  155|    640|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (155:44): [True: 480, False: 160]
  ------------------
  156|    480|       ci++, compptr++) {
  157|    480|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    480|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  158|    480|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|    480|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  159|       |    /* Get space for pointer lists --- M+4 row groups in each list.
  160|       |     * We alloc both pointer lists with one call to save a few cycles.
  161|       |     */
  162|    480|    xbuf = (_JSAMPARRAY)
  163|    480|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    480|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  164|    480|                                  2 * (rgroup * (M + 4)) * sizeof(_JSAMPROW));
  165|    480|    xbuf += rgroup;             /* want one row group at negative offsets */
  166|    480|    main_ptr->xbuffer[0][ci] = xbuf;
  167|    480|    xbuf += rgroup * (M + 4);
  168|    480|    main_ptr->xbuffer[1][ci] = xbuf;
  169|    480|  }
  170|    160|}
jinit_d_main_controller:
  429|    550|{
  430|    550|  my_main_ptr main_ptr;
  431|    550|  int ci, rgroup, ngroups;
  432|    550|  jpeg_component_info *compptr;
  433|       |
  434|    550|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   34|    550|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (434:7): [True: 0, False: 550]
  ------------------
  435|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  436|       |
  437|    550|  main_ptr = (my_main_ptr)
  438|    550|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    550|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  439|    550|                                sizeof(my_main_controller));
  440|    550|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  441|    550|  main_ptr->pub.start_pass = start_pass_main;
  442|       |
  443|    550|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (443:7): [True: 0, False: 550]
  ------------------
  444|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  445|       |
  446|       |  /* Allocate the workspace.
  447|       |   * ngroups is the number of row groups we need.
  448|       |   */
  449|    550|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (449:7): [True: 160, False: 390]
  ------------------
  450|    160|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|    160|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (450:9): [True: 0, False: 160]
  ------------------
  451|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  452|    160|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  453|    160|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|    160|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  454|    390|  } else {
  455|    390|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    390|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  456|    390|  }
  457|       |
  458|  2.07k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (458:44): [True: 1.52k, False: 550]
  ------------------
  459|  1.52k|       ci++, compptr++) {
  460|  1.52k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.52k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  461|  1.52k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  1.52k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  462|  1.52k|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  463|  1.52k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.52k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|  1.52k|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|  1.52k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  465|  1.52k|                         (JDIMENSION)(rgroup * ngroups));
  466|  1.52k|  }
  467|    550|}

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

jinit_marker_reader:
 1287|  1.09k|{
 1288|  1.09k|  my_marker_ptr marker;
 1289|  1.09k|  int i;
 1290|       |
 1291|       |  /* Create subobject in permanent pool */
 1292|  1.09k|  marker = (my_marker_ptr)
 1293|  1.09k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  883|  1.09k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
 1294|  1.09k|                                sizeof(my_marker_reader));
 1295|  1.09k|  cinfo->marker = (struct jpeg_marker_reader *)marker;
 1296|       |  /* Initialize public method pointers */
 1297|  1.09k|  marker->pub.reset_marker_reader = reset_marker_reader;
 1298|  1.09k|  marker->pub.read_markers = read_markers;
 1299|  1.09k|  marker->pub.read_restart_marker = read_restart_marker;
 1300|       |  /* Initialize COM/APPn processing.
 1301|       |   * By default, we examine and then discard APP0 and APP14,
 1302|       |   * but simply discard COM and all other APPn.
 1303|       |   */
 1304|  1.09k|  marker->process_COM = skip_variable;
 1305|  1.09k|  marker->length_limit_COM = 0;
 1306|  18.5k|  for (i = 0; i < 16; i++) {
  ------------------
  |  Branch (1306:15): [True: 17.4k, False: 1.09k]
  ------------------
 1307|  17.4k|    marker->process_APPn[i] = skip_variable;
 1308|  17.4k|    marker->length_limit_APPn[i] = 0;
 1309|  17.4k|  }
 1310|  1.09k|  marker->process_APPn[0] = get_interesting_appn;
 1311|  1.09k|  marker->process_APPn[14] = get_interesting_appn;
 1312|       |  /* Reset marker processing state */
 1313|  1.09k|  reset_marker_reader(cinfo);
 1314|  1.09k|}
jdmarker.c:next_marker:
  891|  7.39k|{
  892|  7.39k|  int c;
  893|  7.39k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  7.39k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  7.39k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  7.39k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  894|       |
  895|  9.74k|  for (;;) {
  896|  9.74k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  9.74k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  9.78k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 13]
  |  |  |  |  |  Branch (279:38): [True: 13, False: 9.73k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  9.74k|            bytes_in_buffer--; \
  |  |  156|  9.74k|            V = *next_input_byte++; )
  ------------------
  897|       |    /* Skip any non-FF bytes.
  898|       |     * This may look a bit inefficient, but it will not occur in a valid file.
  899|       |     * We sync after each discarded byte so that a suspending data source
  900|       |     * can discard the byte from its buffer.
  901|       |     */
  902|  1.75M|    while (c != 0xFF) {
  ------------------
  |  Branch (902:12): [True: 1.74M, False: 9.74k]
  ------------------
  903|  1.74M|      cinfo->marker->discarded_bytes++;
  904|  1.74M|      INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  1.74M|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  1.74M|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  905|  1.74M|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  1.74M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.74M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 32]
  |  |  |  |  |  Branch (279:38): [True: 32, False: 1.74M]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  1.74M|            bytes_in_buffer--; \
  |  |  156|  1.74M|            V = *next_input_byte++; )
  ------------------
  906|  1.74M|    }
  907|       |    /* This loop swallows any duplicate FF bytes.  Extra FFs are legal as
  908|       |     * pad bytes, so don't count them in discarded_bytes.  We assume there
  909|       |     * will not be so many consecutive FF bytes as to overflow a suspending
  910|       |     * data source's input buffer.
  911|       |     */
  912|  13.7k|    do {
  913|  13.7k|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  13.7k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  13.7k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 13.7k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  13.7k|            bytes_in_buffer--; \
  |  |  156|  13.7k|            V = *next_input_byte++; )
  ------------------
  914|  13.7k|    } while (c == 0xFF);
  ------------------
  |  Branch (914:14): [True: 4.05k, False: 9.74k]
  ------------------
  915|  9.74k|    if (c != 0)
  ------------------
  |  Branch (915:9): [True: 7.35k, False: 2.39k]
  ------------------
  916|  7.35k|      break;                    /* found a valid marker, exit loop */
  917|       |    /* Reach here if we found a stuffed-zero data sequence (FF/00).
  918|       |     * Discard it and loop back to try again.
  919|       |     */
  920|  2.39k|    cinfo->marker->discarded_bytes += 2;
  921|  2.39k|    INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  2.39k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  2.39k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  922|  2.39k|  }
  923|       |
  924|  7.39k|  if (cinfo->marker->discarded_bytes != 0) {
  ------------------
  |  Branch (924:7): [True: 253, False: 7.14k]
  ------------------
  925|    253|    WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
  ------------------
  |  |  290|    253|  ((cinfo)->err->msg_code = (code), \
  |  |  291|    253|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|    253|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|    253|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  926|    253|    cinfo->marker->discarded_bytes = 0;
  927|    253|  }
  928|       |
  929|  7.39k|  cinfo->unread_marker = c;
  930|       |
  931|  7.39k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  7.39k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  7.39k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  932|  7.39k|  return TRUE;
  ------------------
  |  |  209|  7.39k|#define TRUE    1
  ------------------
  933|  7.39k|}
jdmarker.c:reset_marker_reader:
 1267|  2.18k|{
 1268|  2.18k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1269|       |
 1270|  2.18k|  cinfo->comp_info = NULL;              /* until allocated by get_sof */
 1271|  2.18k|  cinfo->input_scan_number = 0;         /* no SOS seen yet */
 1272|  2.18k|  cinfo->unread_marker = 0;             /* no pending marker */
 1273|  2.18k|  marker->pub.saw_SOI = FALSE;          /* set internal state too */
  ------------------
  |  |  206|  2.18k|#define FALSE   0               /* values of boolean */
  ------------------
 1274|  2.18k|  marker->pub.saw_SOF = FALSE;
  ------------------
  |  |  206|  2.18k|#define FALSE   0               /* values of boolean */
  ------------------
 1275|  2.18k|  marker->pub.discarded_bytes = 0;
 1276|  2.18k|  marker->cur_marker = NULL;
 1277|  2.18k|}
jdmarker.c:read_markers:
  969|  1.51k|{
  970|       |  /* Outer loop repeats once for each marker. */
  971|  8.87k|  for (;;) {
  972|       |    /* Collect the marker proper, unless we already did. */
  973|       |    /* NB: first_marker() enforces the requirement that SOI appear first. */
  974|  8.87k|    if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (974:9): [True: 8.49k, False: 380]
  ------------------
  975|  8.49k|      if (!cinfo->marker->saw_SOI) {
  ------------------
  |  Branch (975:11): [True: 1.09k, False: 7.39k]
  ------------------
  976|  1.09k|        if (!first_marker(cinfo))
  ------------------
  |  Branch (976:13): [True: 0, False: 1.09k]
  ------------------
  977|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  978|  7.39k|      } else {
  979|  7.39k|        if (!next_marker(cinfo))
  ------------------
  |  Branch (979:13): [True: 0, False: 7.39k]
  ------------------
  980|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  981|  7.39k|      }
  982|  8.49k|    }
  983|       |    /* At this point cinfo->unread_marker contains the marker code and the
  984|       |     * input point is just past the marker proper, but before any parameters.
  985|       |     * A suspension will cause us to return with this state still true.
  986|       |     */
  987|  8.87k|    switch (cinfo->unread_marker) {
  988|  1.07k|    case M_SOI:
  ------------------
  |  Branch (988:5): [True: 1.07k, False: 7.79k]
  ------------------
  989|  1.07k|      if (!get_soi(cinfo))
  ------------------
  |  Branch (989:11): [True: 0, False: 1.07k]
  ------------------
  990|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  991|  1.07k|      break;
  992|       |
  993|  1.07k|    case M_SOF0:                /* Baseline */
  ------------------
  |  Branch (993:5): [True: 902, False: 7.96k]
  ------------------
  994|    902|    case M_SOF1:                /* Extended sequential, Huffman */
  ------------------
  |  Branch (994:5): [True: 0, False: 8.87k]
  ------------------
  995|    902|      if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  206|    902|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  206|    902|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  206|    902|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (995:11): [True: 0, False: 902]
  ------------------
  996|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  997|    902|      break;
  998|       |
  999|    902|    case M_SOF2:                /* Progressive, Huffman */
  ------------------
  |  Branch (999:5): [True: 1, False: 8.87k]
  ------------------
 1000|      1|      if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  209|      1|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  206|      1|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  206|      1|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1000:11): [True: 0, False: 1]
  ------------------
 1001|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1002|      1|      break;
 1003|       |
 1004|      1|    case M_SOF3:                /* Lossless, Huffman */
  ------------------
  |  Branch (1004:5): [True: 0, False: 8.87k]
  ------------------
 1005|      0|      if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1005:11): [True: 0, False: 0]
  ------------------
 1006|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1007|      0|      break;
 1008|       |
 1009|     52|    case M_SOF9:                /* Extended sequential, arithmetic */
  ------------------
  |  Branch (1009:5): [True: 52, False: 8.81k]
  ------------------
 1010|     52|      if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  206|     52|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  206|     52|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  209|     52|#define TRUE    1
  ------------------
  |  Branch (1010:11): [True: 0, False: 52]
  ------------------
 1011|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1012|     52|      break;
 1013|       |
 1014|     52|    case M_SOF10:               /* Progressive, arithmetic */
  ------------------
  |  Branch (1014:5): [True: 0, False: 8.87k]
  ------------------
 1015|      0|      if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  |  Branch (1015:11): [True: 0, False: 0]
  ------------------
 1016|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1017|      0|      break;
 1018|       |
 1019|      1|    case M_SOF11:               /* Lossless, arithmetic */
  ------------------
  |  Branch (1019:5): [True: 1, False: 8.87k]
  ------------------
 1020|      1|      if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  206|      1|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  209|      1|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  209|      1|#define TRUE    1
  ------------------
  |  Branch (1020:11): [True: 0, False: 1]
  ------------------
 1021|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1022|      1|      break;
 1023|       |
 1024|       |    /* Currently unsupported SOFn types */
 1025|      1|    case M_SOF5:                /* Differential sequential, Huffman */
  ------------------
  |  Branch (1025:5): [True: 0, False: 8.87k]
  ------------------
 1026|      0|    case M_SOF6:                /* Differential progressive, Huffman */
  ------------------
  |  Branch (1026:5): [True: 0, False: 8.87k]
  ------------------
 1027|      0|    case M_SOF7:                /* Differential lossless, Huffman */
  ------------------
  |  Branch (1027:5): [True: 0, False: 8.87k]
  ------------------
 1028|      0|    case M_JPG:                 /* Reserved for JPEG extensions */
  ------------------
  |  Branch (1028:5): [True: 0, False: 8.87k]
  ------------------
 1029|      0|    case M_SOF13:               /* Differential sequential, arithmetic */
  ------------------
  |  Branch (1029:5): [True: 0, False: 8.87k]
  ------------------
 1030|      0|    case M_SOF14:               /* Differential progressive, arithmetic */
  ------------------
  |  Branch (1030:5): [True: 0, False: 8.87k]
  ------------------
 1031|      1|    case M_SOF15:               /* Differential lossless, arithmetic */
  ------------------
  |  Branch (1031:5): [True: 1, False: 8.87k]
  ------------------
 1032|      1|      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, 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)))
  ------------------
 1033|      1|      break;
 1034|       |
 1035|    574|    case M_SOS:
  ------------------
  |  Branch (1035:5): [True: 574, False: 8.29k]
  ------------------
 1036|    574|      if (!get_sos(cinfo))
  ------------------
  |  Branch (1036:11): [True: 0, False: 574]
  ------------------
 1037|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1038|    574|      cinfo->unread_marker = 0; /* processed the marker */
 1039|    574|      return JPEG_REACHED_SOS;
  ------------------
  |  | 1106|    574|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
 1040|       |
 1041|    348|    case M_EOI:
  ------------------
  |  Branch (1041:5): [True: 348, False: 8.52k]
  ------------------
 1042|    348|      TRACEMS(cinfo, 1, JTRC_EOI);
  ------------------
  |  |  297|    348|  ((cinfo)->err->msg_code = (code), \
  |  |  298|    348|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1043|    348|      cinfo->unread_marker = 0; /* processed the marker */
 1044|    348|      return JPEG_REACHED_EOI;
  ------------------
  |  | 1107|    348|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
 1045|       |
 1046|      0|    case M_DAC:
  ------------------
  |  Branch (1046:5): [True: 0, False: 8.87k]
  ------------------
 1047|      0|      if (!get_dac(cinfo))
  ------------------
  |  Branch (1047:11): [True: 0, False: 0]
  ------------------
 1048|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1049|      0|      break;
 1050|       |
 1051|  2.15k|    case M_DHT:
  ------------------
  |  Branch (1051:5): [True: 2.15k, False: 6.71k]
  ------------------
 1052|  2.15k|      if (!get_dht(cinfo))
  ------------------
  |  Branch (1052:11): [True: 0, False: 2.15k]
  ------------------
 1053|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1054|  2.15k|      break;
 1055|       |
 1056|  2.15k|    case M_DQT:
  ------------------
  |  Branch (1056:5): [True: 1.24k, False: 7.63k]
  ------------------
 1057|  1.24k|      if (!get_dqt(cinfo))
  ------------------
  |  Branch (1057:11): [True: 0, False: 1.24k]
  ------------------
 1058|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1059|  1.24k|      break;
 1060|       |
 1061|  1.24k|    case M_DRI:
  ------------------
  |  Branch (1061:5): [True: 1, False: 8.87k]
  ------------------
 1062|      1|      if (!get_dri(cinfo))
  ------------------
  |  Branch (1062:11): [True: 0, False: 1]
  ------------------
 1063|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1064|      1|      break;
 1065|       |
 1066|    625|    case M_APP0:
  ------------------
  |  Branch (1066:5): [True: 625, False: 8.24k]
  ------------------
 1067|    662|    case M_APP1:
  ------------------
  |  Branch (1067:5): [True: 37, False: 8.83k]
  ------------------
 1068|    662|    case M_APP2:
  ------------------
  |  Branch (1068:5): [True: 0, False: 8.87k]
  ------------------
 1069|    662|    case M_APP3:
  ------------------
  |  Branch (1069:5): [True: 0, False: 8.87k]
  ------------------
 1070|    662|    case M_APP4:
  ------------------
  |  Branch (1070:5): [True: 0, False: 8.87k]
  ------------------
 1071|    662|    case M_APP5:
  ------------------
  |  Branch (1071:5): [True: 0, False: 8.87k]
  ------------------
 1072|    662|    case M_APP6:
  ------------------
  |  Branch (1072:5): [True: 0, False: 8.87k]
  ------------------
 1073|    662|    case M_APP7:
  ------------------
  |  Branch (1073:5): [True: 0, False: 8.87k]
  ------------------
 1074|    662|    case M_APP8:
  ------------------
  |  Branch (1074:5): [True: 0, False: 8.87k]
  ------------------
 1075|    662|    case M_APP9:
  ------------------
  |  Branch (1075:5): [True: 0, False: 8.87k]
  ------------------
 1076|    662|    case M_APP10:
  ------------------
  |  Branch (1076:5): [True: 0, False: 8.87k]
  ------------------
 1077|    662|    case M_APP11:
  ------------------
  |  Branch (1077:5): [True: 0, False: 8.87k]
  ------------------
 1078|    663|    case M_APP12:
  ------------------
  |  Branch (1078:5): [True: 1, False: 8.87k]
  ------------------
 1079|    667|    case M_APP13:
  ------------------
  |  Branch (1079:5): [True: 4, False: 8.86k]
  ------------------
 1080|  1.11k|    case M_APP14:
  ------------------
  |  Branch (1080:5): [True: 450, False: 8.42k]
  ------------------
 1081|  1.11k|    case M_APP15:
  ------------------
  |  Branch (1081:5): [True: 1, False: 8.87k]
  ------------------
 1082|  1.11k|      if (!(*((my_marker_ptr)cinfo->marker)->process_APPn[
  ------------------
  |  Branch (1082:11): [True: 0, False: 1.11k]
  ------------------
 1083|  1.11k|               cinfo->unread_marker - (int)M_APP0]) (cinfo))
 1084|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1085|  1.11k|      break;
 1086|       |
 1087|  1.11k|    case M_COM:
  ------------------
  |  Branch (1087:5): [True: 1.04k, False: 7.82k]
  ------------------
 1088|  1.04k|      if (!(*((my_marker_ptr)cinfo->marker)->process_COM) (cinfo))
  ------------------
  |  Branch (1088:11): [True: 0, False: 1.04k]
  ------------------
 1089|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1090|  1.04k|      break;
 1091|       |
 1092|  1.04k|    case M_RST0:                /* these are all parameterless */
  ------------------
  |  Branch (1092:5): [True: 0, False: 8.87k]
  ------------------
 1093|      0|    case M_RST1:
  ------------------
  |  Branch (1093:5): [True: 0, False: 8.87k]
  ------------------
 1094|      0|    case M_RST2:
  ------------------
  |  Branch (1094:5): [True: 0, False: 8.87k]
  ------------------
 1095|      0|    case M_RST3:
  ------------------
  |  Branch (1095:5): [True: 0, False: 8.87k]
  ------------------
 1096|      0|    case M_RST4:
  ------------------
  |  Branch (1096:5): [True: 0, False: 8.87k]
  ------------------
 1097|      0|    case M_RST5:
  ------------------
  |  Branch (1097:5): [True: 0, False: 8.87k]
  ------------------
 1098|      0|    case M_RST6:
  ------------------
  |  Branch (1098:5): [True: 0, False: 8.87k]
  ------------------
 1099|      2|    case M_RST7:
  ------------------
  |  Branch (1099:5): [True: 2, False: 8.86k]
  ------------------
 1100|      3|    case M_TEM:
  ------------------
  |  Branch (1100:5): [True: 1, False: 8.87k]
  ------------------
 1101|      3|      TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
  ------------------
  |  |  300|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  301|      3|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|      3|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1102|      3|      break;
 1103|       |
 1104|      0|    case M_DNL:                 /* Ignore DNL ... perhaps the wrong thing */
  ------------------
  |  Branch (1104:5): [True: 0, False: 8.87k]
  ------------------
 1105|      0|      if (!skip_variable(cinfo))
  ------------------
  |  Branch (1105:11): [True: 0, False: 0]
  ------------------
 1106|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1107|      0|      break;
 1108|       |
 1109|     37|    default:                    /* must be DHP, EXP, JPGn, or RESn */
  ------------------
  |  Branch (1109:5): [True: 37, False: 8.83k]
  ------------------
 1110|       |      /* For now, we treat the reserved markers as fatal errors since they are
 1111|       |       * likely to be used to signal incompatible JPEG Part 3 extensions.
 1112|       |       * Once the JPEG 3 version-number marker is well defined, this code
 1113|       |       * ought to change!
 1114|       |       */
 1115|     37|      ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  243|     37|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     37|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     37|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1116|     37|      break;
 1117|  8.87k|    }
 1118|       |    /* Successfully processed marker, so reset state variable */
 1119|  7.35k|    cinfo->unread_marker = 0;
 1120|  7.35k|  } /* end loop */
 1121|  1.51k|}
jdmarker.c:first_marker:
  944|  1.09k|{
  945|  1.09k|  int c, c2;
  946|  1.09k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  1.09k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  1.09k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  1.09k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  947|       |
  948|  1.09k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  1.09k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.09k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.09k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  1.09k|            bytes_in_buffer--; \
  |  |  156|  1.09k|            V = *next_input_byte++; )
  ------------------
  949|  1.09k|  INPUT_BYTE(cinfo, c2, return FALSE);
  ------------------
  |  |  154|  1.09k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.09k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.09k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  1.09k|            bytes_in_buffer--; \
  |  |  156|  1.09k|            V = *next_input_byte++; )
  ------------------
  950|  1.09k|  if (c != 0xFF || c2 != (int)M_SOI)
  ------------------
  |  Branch (950:7): [True: 14, False: 1.07k]
  |  Branch (950:20): [True: 1, False: 1.07k]
  ------------------
  951|     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)))
  ------------------
  952|       |
  953|  1.09k|  cinfo->unread_marker = c2;
  954|       |
  955|  1.09k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  1.09k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  1.09k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  956|  1.09k|  return TRUE;
  ------------------
  |  |  209|  1.09k|#define TRUE    1
  ------------------
  957|  1.09k|}
jdmarker.c:get_soi:
  204|  1.07k|{
  205|  1.07k|  int i;
  206|       |
  207|  1.07k|  TRACEMS(cinfo, 1, JTRC_SOI);
  ------------------
  |  |  297|  1.07k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|  1.07k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  208|       |
  209|  1.07k|  if (cinfo->marker->saw_SOI)
  ------------------
  |  Branch (209:7): [True: 1, False: 1.07k]
  ------------------
  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|  18.3k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|  18.3k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (214:15): [True: 17.2k, False: 1.07k]
  ------------------
  215|  17.2k|    cinfo->arith_dc_L[i] = 0;
  216|  17.2k|    cinfo->arith_dc_U[i] = 1;
  217|  17.2k|    cinfo->arith_ac_K[i] = 5;
  218|  17.2k|  }
  219|  1.07k|  cinfo->restart_interval = 0;
  220|       |
  221|       |  /* Set initial assumptions for colorspace etc */
  222|       |
  223|  1.07k|  cinfo->jpeg_color_space = JCS_UNKNOWN;
  224|  1.07k|  cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
  ------------------
  |  |  206|  1.07k|#define FALSE   0               /* values of boolean */
  ------------------
  225|       |
  226|  1.07k|  cinfo->saw_JFIF_marker = FALSE;
  ------------------
  |  |  206|  1.07k|#define FALSE   0               /* values of boolean */
  ------------------
  227|  1.07k|  cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */
  228|  1.07k|  cinfo->JFIF_minor_version = 1;
  229|  1.07k|  cinfo->density_unit = 0;
  230|  1.07k|  cinfo->X_density = 1;
  231|  1.07k|  cinfo->Y_density = 1;
  232|  1.07k|  cinfo->saw_Adobe_marker = FALSE;
  ------------------
  |  |  206|  1.07k|#define FALSE   0               /* values of boolean */
  ------------------
  233|  1.07k|  cinfo->Adobe_transform = 0;
  234|       |
  235|  1.07k|  cinfo->marker->saw_SOI = TRUE;
  ------------------
  |  |  209|  1.07k|#define TRUE    1
  ------------------
  236|       |
  237|  1.07k|  return TRUE;
  ------------------
  |  |  209|  1.07k|#define TRUE    1
  ------------------
  238|  1.07k|}
jdmarker.c:get_sof:
  245|    956|{
  246|    956|  JLONG length;
  247|    956|  int c, ci;
  248|    956|  jpeg_component_info *compptr;
  249|    956|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    956|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    956|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    956|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  250|       |
  251|    956|  if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (251:7): [True: 1, False: 955]
  ------------------
  252|      1|    ERREXIT(cinfo, JERR_SOF_DUPLICATE);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  253|       |
  254|    956|  cinfo->progressive_mode = is_prog;
  255|    956|  cinfo->master->lossless = is_lossless;
  256|    956|  cinfo->arith_code = is_arith;
  257|       |
  258|    956|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|    956|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.91k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 956]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 956]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    956|            bytes_in_buffer--; \
  |  |  164|    956|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    956|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    956|            bytes_in_buffer--; \
  |  |  167|    956|            V += *next_input_byte++; )
  ------------------
  259|       |
  260|    956|  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
  ------------------
  |  |  154|    956|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    956|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 956]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    956|            bytes_in_buffer--; \
  |  |  156|    956|            V = *next_input_byte++; )
  ------------------
  261|    956|  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);
  ------------------
  |  |  162|    956|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.91k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 956]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 956]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    956|            bytes_in_buffer--; \
  |  |  164|    956|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    956|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    956|            bytes_in_buffer--; \
  |  |  167|    956|            V += *next_input_byte++; )
  ------------------
  262|    956|  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);
  ------------------
  |  |  162|    956|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.91k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 956]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 956]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    956|            bytes_in_buffer--; \
  |  |  164|    956|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    956|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    956|            bytes_in_buffer--; \
  |  |  167|    956|            V += *next_input_byte++; )
  ------------------
  263|    956|  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);
  ------------------
  |  |  154|    956|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    956|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 956]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    956|            bytes_in_buffer--; \
  |  |  156|    956|            V = *next_input_byte++; )
  ------------------
  264|       |
  265|    956|  length -= 8;
  266|       |
  267|    956|  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
  ------------------
  |  |  314|    956|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    956|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|    956|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|    956|           (cinfo)->err->msg_code = (code); \
  |  |  317|    956|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  268|    956|           (int)cinfo->image_width, (int)cinfo->image_height,
  269|    956|           cinfo->num_components);
  270|       |
  271|       |  /* We don't support files in which the image height is initially specified */
  272|       |  /* as 0 and is later redefined by DNL.  As long as we have to check that,  */
  273|       |  /* might as well have a general sanity check. */
  274|    956|  if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
  ------------------
  |  Branch (274:7): [True: 3, False: 953]
  |  Branch (274:35): [True: 1, False: 952]
  ------------------
  275|    956|      cinfo->num_components <= 0)
  ------------------
  |  Branch (275:7): [True: 2, False: 950]
  ------------------
  276|      5|    ERREXIT(cinfo, JERR_EMPTY_IMAGE);
  ------------------
  |  |  240|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  277|       |
  278|    956|  if (length != (cinfo->num_components * 3))
  ------------------
  |  Branch (278:7): [True: 32, False: 924]
  ------------------
  279|     32|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     32|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     32|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  280|       |
  281|    956|  if (cinfo->comp_info == NULL) /* do only once, even if suspend */
  ------------------
  |  Branch (281:7): [True: 918, False: 38]
  ------------------
  282|    918|    cinfo->comp_info = (jpeg_component_info *)(*cinfo->mem->alloc_small)
  283|    918|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    918|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  284|    918|                         cinfo->num_components * sizeof(jpeg_component_info));
  285|       |
  286|  3.39k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (286:44): [True: 2.43k, False: 956]
  ------------------
  287|  2.43k|       ci++, compptr++) {
  288|  2.43k|    compptr->component_index = ci;
  289|  2.43k|    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
  ------------------
  |  |  154|  2.43k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.43k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.43k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.43k|            bytes_in_buffer--; \
  |  |  156|  2.43k|            V = *next_input_byte++; )
  ------------------
  290|  2.43k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  2.43k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.43k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.43k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.43k|            bytes_in_buffer--; \
  |  |  156|  2.43k|            V = *next_input_byte++; )
  ------------------
  291|  2.43k|    compptr->h_samp_factor = (c >> 4) & 15;
  292|  2.43k|    compptr->v_samp_factor = (c     ) & 15;
  293|  2.43k|    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);
  ------------------
  |  |  154|  2.43k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.43k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.43k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.43k|            bytes_in_buffer--; \
  |  |  156|  2.43k|            V = *next_input_byte++; )
  ------------------
  294|       |
  295|  2.43k|    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
  ------------------
  |  |  314|  2.43k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  2.43k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  2.43k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  2.43k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  2.43k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  296|  2.43k|             compptr->component_id, compptr->h_samp_factor,
  297|  2.43k|             compptr->v_samp_factor, compptr->quant_tbl_no);
  298|  2.43k|  }
  299|       |
  300|    956|  cinfo->marker->saw_SOF = TRUE;
  ------------------
  |  |  209|    956|#define TRUE    1
  ------------------
  301|       |
  302|    956|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    956|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    956|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  303|    956|  return TRUE;
  ------------------
  |  |  209|    956|#define TRUE    1
  ------------------
  304|    956|}
jdmarker.c:get_sos:
  310|    574|{
  311|    574|  JLONG length;
  312|    574|  int i, ci, n, c, cc, pi;
  313|    574|  jpeg_component_info *compptr;
  314|    574|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    574|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    574|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    574|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  315|       |
  316|    574|  if (!cinfo->marker->saw_SOF)
  ------------------
  |  Branch (316:7): [True: 0, False: 574]
  ------------------
  317|      0|    ERREXIT(cinfo, JERR_SOS_NO_SOF);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  318|       |
  319|    574|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|    574|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.14k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 574]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 574]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    574|            bytes_in_buffer--; \
  |  |  164|    574|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    574|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    574|            bytes_in_buffer--; \
  |  |  167|    574|            V += *next_input_byte++; )
  ------------------
  320|       |
  321|    574|  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
  ------------------
  |  |  154|    574|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    574|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 574]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    574|            bytes_in_buffer--; \
  |  |  156|    574|            V = *next_input_byte++; )
  ------------------
  322|       |
  323|    574|  TRACEMS1(cinfo, 1, JTRC_SOS, n);
  ------------------
  |  |  300|    574|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    574|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    574|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  324|       |
  325|    574|  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|    571|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (325:7): [True: 3, False: 571]
  |  Branch (325:32): [True: 0, False: 571]
  |  Branch (325:41): [True: 0, False: 571]
  ------------------
  326|      3|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      3|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  327|       |
  328|    574|  cinfo->comps_in_scan = n;
  329|       |
  330|       |  /* Collect the component-spec parameters */
  331|       |
  332|  2.85k|  for (i = 0; i < MAX_COMPS_IN_SCAN; i++)
  ------------------
  |  |   71|  2.85k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (332:15): [True: 2.28k, False: 574]
  ------------------
  333|  2.28k|    cinfo->cur_comp_info[i] = NULL;
  334|       |
  335|  2.15k|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (335:15): [True: 1.59k, False: 561]
  ------------------
  336|  1.59k|    INPUT_BYTE(cinfo, cc, return FALSE);
  ------------------
  |  |  154|  1.59k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.59k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.59k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  1.59k|            bytes_in_buffer--; \
  |  |  156|  1.59k|            V = *next_input_byte++; )
  ------------------
  337|  1.59k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  1.59k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.59k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.59k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  1.59k|            bytes_in_buffer--; \
  |  |  156|  1.59k|            V = *next_input_byte++; )
  ------------------
  338|       |
  339|  1.59k|    for (ci = 0, compptr = cinfo->comp_info;
  340|  3.49k|         ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN;
  ------------------
  |  |   71|  3.48k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (340:10): [True: 3.48k, False: 13]
  |  Branch (340:40): [True: 3.48k, False: 0]
  ------------------
  341|  3.48k|         ci++, compptr++) {
  342|  3.48k|      if (cc == compptr->component_id && !cinfo->cur_comp_info[ci])
  ------------------
  |  Branch (342:11): [True: 1.58k, False: 1.90k]
  |  Branch (342:42): [True: 1.58k, False: 0]
  ------------------
  343|  1.58k|        goto id_found;
  344|  3.48k|    }
  345|       |
  346|     13|    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|     13|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     13|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     13|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  347|       |
  348|  1.58k|id_found:
  349|       |
  350|  1.58k|    cinfo->cur_comp_info[i] = compptr;
  351|  1.58k|    compptr->dc_tbl_no = (c >> 4) & 15;
  352|  1.58k|    compptr->ac_tbl_no = (c     ) & 15;
  353|       |
  354|  1.58k|    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
  ------------------
  |  |  309|  1.58k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  1.58k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  1.58k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  1.58k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  1.58k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  355|  1.58k|             compptr->dc_tbl_no, compptr->ac_tbl_no);
  356|       |
  357|       |    /* This CSi (cc) should differ from the previous CSi */
  358|  3.43k|    for (pi = 0; pi < i; pi++) {
  ------------------
  |  Branch (358:18): [True: 1.85k, False: 1.58k]
  ------------------
  359|  1.85k|      if (cinfo->cur_comp_info[pi] == compptr) {
  ------------------
  |  Branch (359:11): [True: 0, False: 1.85k]
  ------------------
  360|      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)))
  ------------------
  361|      0|      }
  362|  1.85k|    }
  363|  1.58k|  }
  364|       |
  365|       |  /* Collect the additional scan parameters Ss, Se, Ah/Al. */
  366|    561|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|    561|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    561|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 561]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    561|            bytes_in_buffer--; \
  |  |  156|    561|            V = *next_input_byte++; )
  ------------------
  367|    561|  cinfo->Ss = c;
  368|    561|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|    561|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    561|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 561]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    561|            bytes_in_buffer--; \
  |  |  156|    561|            V = *next_input_byte++; )
  ------------------
  369|    561|  cinfo->Se = c;
  370|    561|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|    561|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    561|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 561]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    561|            bytes_in_buffer--; \
  |  |  156|    561|            V = *next_input_byte++; )
  ------------------
  371|    561|  cinfo->Ah = (c >> 4) & 15;
  372|    561|  cinfo->Al = (c     ) & 15;
  373|       |
  374|    561|  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
  ------------------
  |  |  314|    561|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    561|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|    561|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|    561|           (cinfo)->err->msg_code = (code); \
  |  |  317|    561|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  375|    561|           cinfo->Ah, cinfo->Al);
  376|       |
  377|       |  /* Prepare to scan data & restart markers */
  378|    561|  cinfo->marker->next_restart_num = 0;
  379|       |
  380|       |  /* Count another SOS marker */
  381|    561|  cinfo->input_scan_number++;
  382|       |
  383|    561|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    561|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    561|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  384|    561|  return TRUE;
  ------------------
  |  |  209|    561|#define TRUE    1
  ------------------
  385|    561|}
jdmarker.c:get_dht:
  439|  2.15k|{
  440|  2.15k|  JLONG length;
  441|  2.15k|  UINT8 bits[17];
  442|  2.15k|  UINT8 huffval[256];
  443|  2.15k|  int i, index, count;
  444|  2.15k|  JHUFF_TBL **htblptr;
  445|  2.15k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  2.15k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  2.15k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  2.15k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  446|       |
  447|  2.15k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  2.15k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.31k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.15k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.15k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  2.15k|            bytes_in_buffer--; \
  |  |  164|  2.15k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  2.15k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  2.15k|            bytes_in_buffer--; \
  |  |  167|  2.15k|            V += *next_input_byte++; )
  ------------------
  448|  2.15k|  length -= 2;
  449|       |
  450|  4.35k|  while (length > 16) {
  ------------------
  |  Branch (450:10): [True: 2.19k, False: 2.15k]
  ------------------
  451|  2.19k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|  2.19k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.19k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.19k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.19k|            bytes_in_buffer--; \
  |  |  156|  2.19k|            V = *next_input_byte++; )
  ------------------
  452|       |
  453|  2.19k|    TRACEMS1(cinfo, 1, JTRC_DHT, index);
  ------------------
  |  |  300|  2.19k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  2.19k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  2.19k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  454|       |
  455|  2.19k|    bits[0] = 0;
  456|  2.19k|    count = 0;
  457|  37.3k|    for (i = 1; i <= 16; i++) {
  ------------------
  |  Branch (457:17): [True: 35.1k, False: 2.19k]
  ------------------
  458|  35.1k|      INPUT_BYTE(cinfo, bits[i], return FALSE);
  ------------------
  |  |  154|  35.1k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  35.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 35.1k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  35.1k|            bytes_in_buffer--; \
  |  |  156|  35.1k|            V = *next_input_byte++; )
  ------------------
  459|  35.1k|      count += bits[i];
  460|  35.1k|    }
  461|       |
  462|  2.19k|    length -= 1 + 16;
  463|       |
  464|  2.19k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|  2.19k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  2.19k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  2.19k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|  2.19k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|  2.19k|           (cinfo)->err->msg_code = (code); \
  |  |  329|  2.19k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  465|  2.19k|             bits[1], bits[2], bits[3], bits[4],
  466|  2.19k|             bits[5], bits[6], bits[7], bits[8]);
  467|  2.19k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|  2.19k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  2.19k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  2.19k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|  2.19k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|  2.19k|           (cinfo)->err->msg_code = (code); \
  |  |  329|  2.19k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  468|  2.19k|             bits[9], bits[10], bits[11], bits[12],
  469|  2.19k|             bits[13], bits[14], bits[15], bits[16]);
  470|       |
  471|       |    /* Here we just do minimal validation of the counts to avoid walking
  472|       |     * off the end of our table space.  jdhuff.c will check more carefully.
  473|       |     */
  474|  2.19k|    if (count > 256 || ((JLONG)count) > length)
  ------------------
  |  Branch (474:9): [True: 144, False: 2.05k]
  |  Branch (474:24): [True: 17, False: 2.03k]
  ------------------
  475|    160|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|    160|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    160|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  476|       |
  477|   164k|    for (i = 0; i < count; i++)
  ------------------
  |  Branch (477:17): [True: 162k, False: 2.19k]
  ------------------
  478|   162k|      INPUT_BYTE(cinfo, huffval[i], return FALSE);
  ------------------
  |  |  154|   162k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   164k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 162k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.19k|            bytes_in_buffer--; \
  |  |  156|  2.19k|            V = *next_input_byte++; )
  ------------------
  479|       |
  480|  2.19k|    memset(&huffval[count], 0, (256 - count) * sizeof(UINT8));
  481|       |
  482|  2.19k|    length -= count;
  483|       |
  484|  2.19k|    if (index & 0x10) {         /* AC table definition */
  ------------------
  |  Branch (484:9): [True: 961, False: 1.23k]
  ------------------
  485|    961|      index -= 0x10;
  486|    961|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|    961|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (486:11): [True: 0, False: 961]
  |  Branch (486:24): [True: 18, False: 943]
  ------------------
  487|     18|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|     18|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     18|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     18|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  488|    961|      htblptr = &cinfo->ac_huff_tbl_ptrs[index];
  489|  1.23k|    } else {                    /* DC table definition */
  490|  1.23k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  1.07k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (490:11): [True: 162, False: 1.07k]
  |  Branch (490:24): [True: 2, False: 1.07k]
  ------------------
  491|      2|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  492|  1.23k|      htblptr = &cinfo->dc_huff_tbl_ptrs[index];
  493|  1.23k|    }
  494|       |
  495|  2.19k|    if (*htblptr == NULL)
  ------------------
  |  Branch (495:9): [True: 2.01k, False: 183]
  ------------------
  496|  2.01k|      *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
  497|       |
  498|  2.19k|    memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
  499|  2.19k|    memcpy((*htblptr)->huffval, huffval, sizeof((*htblptr)->huffval));
  500|  2.19k|  }
  501|       |
  502|  2.15k|  if (length != 0)
  ------------------
  |  Branch (502:7): [True: 4, False: 2.15k]
  ------------------
  503|      4|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      4|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  504|       |
  505|  2.15k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  2.15k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  2.15k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  506|  2.15k|  return TRUE;
  ------------------
  |  |  209|  2.15k|#define TRUE    1
  ------------------
  507|  2.15k|}
jdmarker.c:get_dqt:
  513|  1.24k|{
  514|  1.24k|  JLONG length;
  515|  1.24k|  int n, i, prec;
  516|  1.24k|  unsigned int tmp;
  517|  1.24k|  JQUANT_TBL *quant_ptr;
  518|  1.24k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  1.24k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  1.24k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  1.24k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  519|       |
  520|  1.24k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  1.24k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.48k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.24k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.24k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  1.24k|            bytes_in_buffer--; \
  |  |  164|  1.24k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  1.24k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  1.24k|            bytes_in_buffer--; \
  |  |  167|  1.24k|            V += *next_input_byte++; )
  ------------------
  521|  1.24k|  length -= 2;
  522|       |
  523|  2.50k|  while (length > 0) {
  ------------------
  |  Branch (523:10): [True: 1.26k, False: 1.24k]
  ------------------
  524|  1.26k|    INPUT_BYTE(cinfo, n, return FALSE);
  ------------------
  |  |  154|  1.26k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.26k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.26k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  1.26k|            bytes_in_buffer--; \
  |  |  156|  1.26k|            V = *next_input_byte++; )
  ------------------
  525|  1.26k|    prec = n >> 4;
  526|  1.26k|    n &= 0x0F;
  527|       |
  528|  1.26k|    TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);
  ------------------
  |  |  304|  1.26k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  1.26k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  1.26k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  1.26k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  529|       |
  530|  1.26k|    if (n >= NUM_QUANT_TBLS)
  ------------------
  |  |   68|  1.26k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (530:9): [True: 3, False: 1.26k]
  ------------------
  531|      3|      ERREXIT1(cinfo, JERR_DQT_INDEX, n);
  ------------------
  |  |  243|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      3|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      3|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  532|       |
  533|  1.26k|    if (cinfo->quant_tbl_ptrs[n] == NULL)
  ------------------
  |  Branch (533:9): [True: 1.25k, False: 5]
  ------------------
  534|  1.25k|      cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr)cinfo);
  535|  1.26k|    quant_ptr = cinfo->quant_tbl_ptrs[n];
  536|       |
  537|  81.7k|    for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  81.7k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (537:17): [True: 80.4k, False: 1.26k]
  ------------------
  538|  80.4k|      if (prec)
  ------------------
  |  Branch (538:11): [True: 574, False: 79.8k]
  ------------------
  539|  80.4k|        INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|    574|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.15k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 572]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 573]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  80.4k|            bytes_in_buffer--; \
  |  |  164|  80.4k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  80.4k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  80.4k|            bytes_in_buffer--; \
  |  |  167|  80.4k|            V += *next_input_byte++; )
  ------------------
  540|  79.8k|      else
  541|  80.4k|        INPUT_BYTE(cinfo, tmp, return FALSE);
  ------------------
  |  |  154|  79.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  79.8k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 79.8k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  80.4k|            bytes_in_buffer--; \
  |  |  156|  80.4k|            V = *next_input_byte++; )
  ------------------
  542|       |      /* We convert the zigzag-order table to natural array order. */
  543|  80.4k|      quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16)tmp;
  544|  80.4k|    }
  545|       |
  546|  1.26k|    if (cinfo->err->trace_level >= 2) {
  ------------------
  |  Branch (546:9): [True: 0, False: 1.26k]
  ------------------
  547|      0|      for (i = 0; i < DCTSIZE2; i += 8) {
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (547:19): [True: 0, False: 0]
  ------------------
  548|      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 - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  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)); )
  ------------------
  549|      0|                 quant_ptr->quantval[i],     quant_ptr->quantval[i + 1],
  550|      0|                 quant_ptr->quantval[i + 2], quant_ptr->quantval[i + 3],
  551|      0|                 quant_ptr->quantval[i + 4], quant_ptr->quantval[i + 5],
  552|      0|                 quant_ptr->quantval[i + 6], quant_ptr->quantval[i + 7]);
  553|      0|      }
  554|      0|    }
  555|       |
  556|  1.26k|    length -= DCTSIZE2 + 1;
  ------------------
  |  |   67|  1.26k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  557|  1.26k|    if (prec) length -= DCTSIZE2;
  ------------------
  |  |   67|      8|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (557:9): [True: 8, False: 1.25k]
  ------------------
  558|  1.26k|  }
  559|       |
  560|  1.24k|  if (length != 0)
  ------------------
  |  Branch (560:7): [True: 6, False: 1.23k]
  ------------------
  561|      6|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      6|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      6|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  562|       |
  563|  1.24k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  1.24k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  1.24k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  564|  1.24k|  return TRUE;
  ------------------
  |  |  209|  1.24k|#define TRUE    1
  ------------------
  565|  1.24k|}
jdmarker.c:get_dri:
  571|      1|{
  572|      1|  JLONG length;
  573|      1|  unsigned int tmp;
  574|      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
  ------------------
  575|       |
  576|      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 - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  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++; )
  ------------------
  577|       |
  578|      1|  if (length != 4)
  ------------------
  |  Branch (578:7): [True: 1, False: 0]
  ------------------
  579|      1|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  580|       |
  581|      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 - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  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++; )
  ------------------
  582|       |
  583|      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)))
  ------------------
  584|       |
  585|      1|  cinfo->restart_interval = tmp;
  586|       |
  587|      1|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|      1|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|      1|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  588|      1|  return TRUE;
  ------------------
  |  |  209|      1|#define TRUE    1
  ------------------
  589|      1|}
jdmarker.c:skip_variable:
  863|  1.08k|{
  864|  1.08k|  JLONG length;
  865|  1.08k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  1.08k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  1.08k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  1.08k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  866|       |
  867|  1.08k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  1.08k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.17k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.08k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.08k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  1.08k|            bytes_in_buffer--; \
  |  |  164|  1.08k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  1.08k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  1.08k|            bytes_in_buffer--; \
  |  |  167|  1.08k|            V += *next_input_byte++; )
  ------------------
  868|  1.08k|  length -= 2;
  869|       |
  870|  1.08k|  TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int)length);
  ------------------
  |  |  304|  1.08k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  1.08k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  1.08k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  1.08k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  871|       |
  872|  1.08k|  INPUT_SYNC(cinfo);            /* do before skip_input_data */
  ------------------
  |  |  131|  1.08k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  1.08k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  873|  1.08k|  if (length > 0)
  ------------------
  |  Branch (873:7): [True: 60, False: 1.02k]
  ------------------
  874|     60|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  875|       |
  876|  1.08k|  return TRUE;
  ------------------
  |  |  209|  1.08k|#define TRUE    1
  ------------------
  877|  1.08k|}
jdmarker.c:get_interesting_appn:
  711|  1.07k|{
  712|  1.07k|  JLONG length;
  713|  1.07k|  JOCTET b[APPN_DATA_LEN];
  714|  1.07k|  unsigned int i, numtoread;
  715|  1.07k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  1.07k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  1.07k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  1.07k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  716|       |
  717|  1.07k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  1.07k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.15k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.07k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.07k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  1.07k|            bytes_in_buffer--; \
  |  |  164|  1.07k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  1.07k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  1.07k|            bytes_in_buffer--; \
  |  |  167|  1.07k|            V += *next_input_byte++; )
  ------------------
  718|  1.07k|  length -= 2;
  719|       |
  720|       |  /* get the interesting part of the marker data */
  721|  1.07k|  if (length >= APPN_DATA_LEN)
  ------------------
  |  |  601|  1.07k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  |  Branch (721:7): [True: 624, False: 451]
  ------------------
  722|    624|    numtoread = APPN_DATA_LEN;
  ------------------
  |  |  601|    624|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  723|    451|  else if (length > 0)
  ------------------
  |  Branch (723:12): [True: 447, False: 4]
  ------------------
  724|    447|    numtoread = (unsigned int)length;
  725|      4|  else
  726|      4|    numtoread = 0;
  727|  15.1k|  for (i = 0; i < numtoread; i++)
  ------------------
  |  Branch (727:15): [True: 14.0k, False: 1.07k]
  ------------------
  728|  14.0k|    INPUT_BYTE(cinfo, b[i], return FALSE);
  ------------------
  |  |  154|  14.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  15.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 14.0k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  1.07k|            bytes_in_buffer--; \
  |  |  156|  1.07k|            V = *next_input_byte++; )
  ------------------
  729|  1.07k|  length -= numtoread;
  730|       |
  731|       |  /* process it */
  732|  1.07k|  switch (cinfo->unread_marker) {
  733|    625|  case M_APP0:
  ------------------
  |  Branch (733:3): [True: 625, False: 450]
  ------------------
  734|    625|    examine_app0(cinfo, (JOCTET *)b, numtoread, length);
  735|    625|    break;
  736|    448|  case M_APP14:
  ------------------
  |  Branch (736:3): [True: 448, False: 627]
  ------------------
  737|    448|    examine_app14(cinfo, (JOCTET *)b, numtoread, length);
  738|    448|    break;
  739|      0|  default:
  ------------------
  |  Branch (739:3): [True: 0, False: 1.07k]
  ------------------
  740|       |    /* can't get here unless jpeg_save_markers chooses wrong processor */
  741|      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)))
  ------------------
  742|      0|    break;
  743|  1.07k|  }
  744|       |
  745|       |  /* skip any remaining data -- could be lots */
  746|  1.07k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  1.07k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  1.07k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  747|  1.07k|  if (length > 0)
  ------------------
  |  Branch (747:7): [True: 3, False: 1.06k]
  ------------------
  748|      3|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  749|       |
  750|  1.07k|  return TRUE;
  ------------------
  |  |  209|  1.07k|#define TRUE    1
  ------------------
  751|  1.07k|}
jdmarker.c:examine_app0:
  611|    625|{
  612|    625|  JLONG totallen = (JLONG)datalen + remaining;
  613|       |
  614|    625|  if (datalen >= APP0_DATA_LEN &&
  ------------------
  |  |  599|  1.25k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  |  Branch (614:7): [True: 621, False: 4]
  ------------------
  615|    625|      data[0] == 0x4A &&
  ------------------
  |  Branch (615:7): [True: 620, False: 1]
  ------------------
  616|    625|      data[1] == 0x46 &&
  ------------------
  |  Branch (616:7): [True: 619, False: 1]
  ------------------
  617|    625|      data[2] == 0x49 &&
  ------------------
  |  Branch (617:7): [True: 617, False: 2]
  ------------------
  618|    625|      data[3] == 0x46 &&
  ------------------
  |  Branch (618:7): [True: 616, False: 1]
  ------------------
  619|    625|      data[4] == 0) {
  ------------------
  |  Branch (619:7): [True: 615, False: 1]
  ------------------
  620|       |    /* Found JFIF APP0 marker: save info */
  621|    615|    cinfo->saw_JFIF_marker = TRUE;
  ------------------
  |  |  209|    615|#define TRUE    1
  ------------------
  622|    615|    cinfo->JFIF_major_version = data[5];
  623|    615|    cinfo->JFIF_minor_version = data[6];
  624|    615|    cinfo->density_unit = data[7];
  625|    615|    cinfo->X_density = (data[8] << 8) + data[9];
  626|    615|    cinfo->Y_density = (data[10] << 8) + data[11];
  627|       |    /* Check version.
  628|       |     * Major version must be 1, anything else signals an incompatible change.
  629|       |     * (We used to treat this as an error, but now it's a nonfatal warning,
  630|       |     * because some bozo at Hijaak couldn't read the spec.)
  631|       |     * Minor version should be 0..2, but process anyway if newer.
  632|       |     */
  633|    615|    if (cinfo->JFIF_major_version != 1)
  ------------------
  |  Branch (633:9): [True: 1, False: 614]
  ------------------
  634|      1|      WARNMS2(cinfo, JWRN_JFIF_MAJOR,
  ------------------
  |  |  290|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      1|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      1|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  635|    615|              cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
  636|       |    /* Generate trace messages */
  637|    615|    TRACEMS5(cinfo, 1, JTRC_JFIF,
  ------------------
  |  |  319|    615|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    615|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  320|    615|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  321|    615|           _mp[4] = (p5); \
  |  |  322|    615|           (cinfo)->err->msg_code = (code); \
  |  |  323|    615|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  638|    615|             cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
  639|    615|             cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
  640|       |    /* Validate thumbnail dimensions and issue appropriate messages */
  641|    615|    if (data[12] | data[13])
  ------------------
  |  Branch (641:9): [True: 5, False: 610]
  ------------------
  642|      5|      TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, data[12], data[13]);
  ------------------
  |  |  304|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  305|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|      5|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|      5|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  643|    615|    totallen -= APP0_DATA_LEN;
  ------------------
  |  |  599|    615|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  644|    615|    if (totallen != ((JLONG)data[12] * (JLONG)data[13] * (JLONG)3))
  ------------------
  |  Branch (644:9): [True: 2, False: 613]
  ------------------
  645|      2|      TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)totallen);
  ------------------
  |  |  300|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  301|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|      2|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  646|    615|  } else if (datalen >= 6 &&
  ------------------
  |  Branch (646:14): [True: 6, False: 4]
  ------------------
  647|     10|             data[0] == 0x4A &&
  ------------------
  |  Branch (647:14): [True: 5, False: 1]
  ------------------
  648|     10|             data[1] == 0x46 &&
  ------------------
  |  Branch (648:14): [True: 4, False: 1]
  ------------------
  649|     10|             data[2] == 0x58 &&
  ------------------
  |  Branch (649:14): [True: 0, False: 4]
  ------------------
  650|     10|             data[3] == 0x58 &&
  ------------------
  |  Branch (650:14): [True: 0, False: 0]
  ------------------
  651|     10|             data[4] == 0) {
  ------------------
  |  Branch (651:14): [True: 0, False: 0]
  ------------------
  652|       |    /* Found JFIF "JFXX" extension APP0 marker */
  653|       |    /* The library doesn't actually do anything with these,
  654|       |     * but we try to produce a helpful trace message.
  655|       |     */
  656|      0|    switch (data[5]) {
  657|      0|    case 0x10:
  ------------------
  |  Branch (657:5): [True: 0, False: 0]
  ------------------
  658|      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)))
  ------------------
  659|      0|      break;
  660|      0|    case 0x11:
  ------------------
  |  Branch (660:5): [True: 0, False: 0]
  ------------------
  661|      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)))
  ------------------
  662|      0|      break;
  663|      0|    case 0x13:
  ------------------
  |  Branch (663:5): [True: 0, False: 0]
  ------------------
  664|      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)))
  ------------------
  665|      0|      break;
  666|      0|    default:
  ------------------
  |  Branch (666:5): [True: 0, False: 0]
  ------------------
  667|      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)))
  ------------------
  668|      0|      break;
  669|      0|    }
  670|     10|  } else {
  671|       |    /* Start of APP0 does not match "JFIF" or "JFXX", or too short */
  672|     10|    TRACEMS1(cinfo, 1, JTRC_APP0, (int)totallen);
  ------------------
  |  |  300|     10|  ((cinfo)->err->msg_code = (code), \
  |  |  301|     10|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|     10|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  673|     10|  }
  674|    625|}
jdmarker.c:examine_app14:
  684|    448|{
  685|    448|  unsigned int version, flags0, flags1, transform;
  686|       |
  687|    448|  if (datalen >= APP14_DATA_LEN &&
  ------------------
  |  |  600|    896|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
  |  Branch (687:7): [True: 447, False: 1]
  ------------------
  688|    448|      data[0] == 0x41 &&
  ------------------
  |  Branch (688:7): [True: 443, False: 4]
  ------------------
  689|    448|      data[1] == 0x64 &&
  ------------------
  |  Branch (689:7): [True: 442, False: 1]
  ------------------
  690|    448|      data[2] == 0x6F &&
  ------------------
  |  Branch (690:7): [True: 440, False: 2]
  ------------------
  691|    448|      data[3] == 0x62 &&
  ------------------
  |  Branch (691:7): [True: 416, False: 24]
  ------------------
  692|    448|      data[4] == 0x65) {
  ------------------
  |  Branch (692:7): [True: 411, False: 5]
  ------------------
  693|       |    /* Found Adobe APP14 marker */
  694|    411|    version = (data[5] << 8) + data[6];
  695|    411|    flags0 = (data[7] << 8) + data[8];
  696|    411|    flags1 = (data[9] << 8) + data[10];
  697|    411|    transform = data[11];
  698|    411|    TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
  ------------------
  |  |  314|    411|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    411|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|    411|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|    411|           (cinfo)->err->msg_code = (code); \
  |  |  317|    411|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  699|    411|    cinfo->saw_Adobe_marker = TRUE;
  ------------------
  |  |  209|    411|#define TRUE    1
  ------------------
  700|    411|    cinfo->Adobe_transform = (UINT8)transform;
  701|    411|  } else {
  702|       |    /* Start of APP14 does not match "Adobe", or too short */
  703|     37|    TRACEMS1(cinfo, 1, JTRC_APP14, (int)(datalen + remaining));
  ------------------
  |  |  300|     37|  ((cinfo)->err->msg_code = (code), \
  |  |  301|     37|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|     37|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  704|     37|  }
  705|    448|}

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

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

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

jinit_upsampler:
  417|    550|{
  418|    550|  my_upsample_ptr upsample;
  419|    550|  int ci;
  420|    550|  jpeg_component_info *compptr;
  421|    550|  boolean need_buffer, do_fancy;
  422|    550|  int h_in_group, v_in_group, h_out_group, v_out_group;
  423|       |
  424|    550|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   34|    550|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (424:7): [True: 0, False: 550]
  ------------------
  425|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  426|       |
  427|    550|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (427:7): [True: 550, False: 0]
  ------------------
  428|    550|    upsample = (my_upsample_ptr)
  429|    550|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    550|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  430|    550|                                  sizeof(my_upsampler));
  431|    550|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  432|    550|    upsample->pub.start_pass = start_pass_upsample;
  433|    550|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  263|    550|#define _upsample  upsample
  ------------------
  434|    550|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  206|    550|#define FALSE   0               /* values of boolean */
  ------------------
  435|    550|  } else
  436|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  437|       |
  438|    550|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (438:7): [True: 0, False: 550]
  ------------------
  439|      0|    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  440|       |
  441|       |  /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,
  442|       |   * so don't ask for it.
  443|       |   */
  444|    550|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|    550|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (444:14): [True: 550, False: 0]
  |  Branch (444:44): [True: 550, False: 0]
  ------------------
  445|       |
  446|       |  /* Verify we can handle the sampling factors, select per-component methods,
  447|       |   * and create storage as needed.
  448|       |   */
  449|  2.07k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (449:44): [True: 1.52k, False: 550]
  ------------------
  450|  1.52k|       ci++, compptr++) {
  451|       |    /* Compute size of an "input group" after IDCT scaling.  This many samples
  452|       |     * are to be converted to max_h_samp_factor * max_v_samp_factor pixels.
  453|       |     */
  454|  1.52k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.52k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  455|  1.52k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.52k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  456|  1.52k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.52k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  457|  1.52k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.52k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  458|  1.52k|    h_out_group = cinfo->max_h_samp_factor;
  459|  1.52k|    v_out_group = cinfo->max_v_samp_factor;
  460|  1.52k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  461|  1.52k|    need_buffer = TRUE;
  ------------------
  |  |  209|  1.52k|#define TRUE    1
  ------------------
  462|  1.52k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (462:9): [True: 0, False: 1.52k]
  ------------------
  463|       |      /* Don't bother to upsample an uninteresting component. */
  464|      0|      upsample->methods[ci] = noop_upsample;
  465|      0|      need_buffer = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  466|  1.52k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (466:16): [True: 1.20k, False: 320]
  |  Branch (466:45): [True: 1.20k, False: 0]
  ------------------
  467|       |      /* Fullsize components can be processed without any work. */
  468|  1.20k|      upsample->methods[ci] = fullsize_upsample;
  469|  1.20k|      need_buffer = FALSE;
  ------------------
  |  |  206|  1.20k|#define FALSE   0               /* values of boolean */
  ------------------
  470|  1.20k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (470:16): [True: 320, False: 0]
  |  Branch (470:49): [True: 0, False: 320]
  ------------------
  471|       |      /* Special cases for 2h1v upsampling */
  472|      0|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (472:11): [True: 0, False: 0]
  |  Branch (472:23): [True: 0, False: 0]
  ------------------
  473|      0|#ifdef WITH_SIMD
  474|      0|        if (jsimd_can_h2v1_fancy_upsample())
  ------------------
  |  Branch (474:13): [True: 0, False: 0]
  ------------------
  475|      0|          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  476|      0|        else
  477|      0|#endif
  478|      0|          upsample->methods[ci] = h2v1_fancy_upsample;
  479|      0|      } else {
  480|      0|#ifdef WITH_SIMD
  481|      0|        if (jsimd_can_h2v1_upsample())
  ------------------
  |  Branch (481:13): [True: 0, False: 0]
  ------------------
  482|      0|          upsample->methods[ci] = jsimd_h2v1_upsample;
  483|      0|        else
  484|      0|#endif
  485|      0|          upsample->methods[ci] = h2v1_upsample;
  486|      0|      }
  487|    320|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (487:16): [True: 0, False: 320]
  ------------------
  488|    320|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (488:16): [True: 0, False: 0]
  |  Branch (488:49): [True: 0, False: 0]
  ------------------
  489|       |      /* Non-fancy upsampling is handled by the generic method */
  490|       |#if defined(WITH_SIMD) && (defined(__arm__) || defined(__aarch64__) || \
  491|       |                           defined(_M_ARM) || defined(_M_ARM64))
  492|       |      if (jsimd_can_h1v2_fancy_upsample())
  493|       |        upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
  494|       |      else
  495|       |#endif
  496|      0|        upsample->methods[ci] = h1v2_fancy_upsample;
  497|      0|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  498|    320|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (498:16): [True: 320, False: 0]
  ------------------
  499|    320|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (499:16): [True: 320, False: 0]
  ------------------
  500|       |      /* Special cases for 2h2v upsampling */
  501|    320|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (501:11): [True: 320, False: 0]
  |  Branch (501:23): [True: 320, False: 0]
  ------------------
  502|    320|#ifdef WITH_SIMD
  503|    320|        if (jsimd_can_h2v2_fancy_upsample())
  ------------------
  |  Branch (503:13): [True: 0, False: 320]
  ------------------
  504|      0|          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  505|    320|        else
  506|    320|#endif
  507|    320|          upsample->methods[ci] = h2v2_fancy_upsample;
  508|    320|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  209|    320|#define TRUE    1
  ------------------
  509|    320|      } else {
  510|      0|#ifdef WITH_SIMD
  511|      0|        if (jsimd_can_h2v2_upsample())
  ------------------
  |  Branch (511:13): [True: 0, False: 0]
  ------------------
  512|      0|          upsample->methods[ci] = jsimd_h2v2_upsample;
  513|      0|        else
  514|      0|#endif
  515|      0|          upsample->methods[ci] = h2v2_upsample;
  516|      0|      }
  517|    320|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (517:16): [True: 0, False: 0]
  ------------------
  518|      0|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (518:16): [True: 0, False: 0]
  ------------------
  519|       |      /* Generic integral-factors upsampling method */
  520|       |#if defined(WITH_SIMD) && defined(__mips__)
  521|       |      if (jsimd_can_int_upsample())
  522|       |        upsample->methods[ci] = jsimd_int_upsample;
  523|       |      else
  524|       |#endif
  525|      0|        upsample->methods[ci] = int_upsample;
  526|      0|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  527|      0|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  528|      0|    } else
  529|      0|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  530|  1.52k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (530:9): [True: 320, False: 1.20k]
  |  Branch (530:24): [True: 320, False: 0]
  ------------------
  531|    320|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  532|    320|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    320|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  533|    320|         (JDIMENSION)jround_up((long)cinfo->output_width,
  534|    320|                               (long)cinfo->max_h_samp_factor),
  535|    320|         (JDIMENSION)cinfo->max_v_samp_factor);
  536|    320|    }
  537|  1.52k|  }
  538|    550|}
jdsample.c:start_pass_upsample:
   43|    528|{
   44|    528|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   45|       |
   46|       |  /* Mark the conversion buffer empty */
   47|    528|  upsample->next_row_out = cinfo->max_v_samp_factor;
   48|       |  /* Initialize total-height counter for detecting bottom of image */
   49|    528|  upsample->rows_to_go = cinfo->output_height;
   50|    528|}
jdsample.c:sep_upsample:
   66|  22.0k|{
   67|  22.0k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   68|  22.0k|  int ci;
   69|  22.0k|  jpeg_component_info *compptr;
   70|  22.0k|  JDIMENSION num_rows;
   71|       |
   72|       |  /* Fill the conversion buffer, if it's empty */
   73|  22.0k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (73:7): [True: 19.4k, False: 2.66k]
  ------------------
   74|  70.7k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (74:46): [True: 51.3k, False: 19.4k]
  ------------------
   75|  51.3k|         ci++, compptr++) {
   76|       |      /* Invoke per-component upsample method.  Notice we pass a POINTER
   77|       |       * to color_buf[ci], so that fullsize_upsample can change it.
   78|       |       */
   79|  51.3k|      (*upsample->methods[ci]) (cinfo, compptr,
   80|  51.3k|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   81|  51.3k|        upsample->color_buf + ci);
   82|  51.3k|    }
   83|  19.4k|    upsample->next_row_out = 0;
   84|  19.4k|  }
   85|       |
   86|       |  /* Color-convert and emit rows */
   87|       |
   88|       |  /* How many we have in the buffer: */
   89|  22.0k|  num_rows = (JDIMENSION)(cinfo->max_v_samp_factor - upsample->next_row_out);
   90|       |  /* Not more than the distance to the end of the image.  Need this test
   91|       |   * in case the image height is not a multiple of max_v_samp_factor:
   92|       |   */
   93|  22.0k|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (93:7): [True: 0, False: 22.0k]
  ------------------
   94|      0|    num_rows = upsample->rows_to_go;
   95|       |  /* And not more than what the client can accept: */
   96|  22.0k|  out_rows_avail -= *out_row_ctr;
   97|  22.0k|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (97:7): [True: 2.66k, False: 19.4k]
  ------------------
   98|  2.66k|    num_rows = out_rows_avail;
   99|       |
  100|  22.0k|  (*cinfo->cconvert->_color_convert) (cinfo, upsample->color_buf,
  ------------------
  |  |  265|  22.0k|#define _color_convert  color_convert
  ------------------
  101|  22.0k|                                      (JDIMENSION)upsample->next_row_out,
  102|  22.0k|                                      output_buf + *out_row_ctr,
  103|  22.0k|                                      (int)num_rows);
  104|       |
  105|       |  /* Adjust counts */
  106|  22.0k|  *out_row_ctr += num_rows;
  107|  22.0k|  upsample->rows_to_go -= num_rows;
  108|  22.0k|  upsample->next_row_out += num_rows;
  109|       |  /* When the buffer is emptied, declare this input row group consumed */
  110|  22.0k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (110:7): [True: 19.4k, False: 2.66k]
  ------------------
  111|  19.4k|    (*in_row_group_ctr)++;
  112|  22.0k|}
jdsample.c:fullsize_upsample:
  131|  46.0k|{
  132|  46.0k|  *output_data_ptr = input_data;
  133|  46.0k|}
jdsample.c:h2v2_fancy_upsample:
  364|  5.33k|{
  365|  5.33k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  228|  5.33k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  366|  5.33k|  register _JSAMPROW inptr0, inptr1, outptr;
  367|  5.33k|#if BITS_IN_JSAMPLE == 8
  368|  5.33k|  register int thiscolsum, lastcolsum, nextcolsum;
  369|       |#else
  370|       |  register JLONG thiscolsum, lastcolsum, nextcolsum;
  371|       |#endif
  372|  5.33k|  register JDIMENSION colctr;
  373|  5.33k|  int inrow, outrow, v;
  374|       |
  375|  5.33k|  inrow = outrow = 0;
  376|  10.6k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (376:10): [True: 5.33k, False: 5.33k]
  ------------------
  377|  16.0k|    for (v = 0; v < 2; v++) {
  ------------------
  |  Branch (377:17): [True: 10.6k, False: 5.33k]
  ------------------
  378|       |      /* inptr0 points to nearest input row, inptr1 points to next nearest */
  379|  10.6k|      inptr0 = input_data[inrow];
  380|  10.6k|      if (v == 0)               /* next nearest is row above */
  ------------------
  |  Branch (380:11): [True: 5.33k, False: 5.33k]
  ------------------
  381|  5.33k|        inptr1 = input_data[inrow - 1];
  382|  5.33k|      else                      /* next nearest is row below */
  383|  5.33k|        inptr1 = input_data[inrow + 1];
  384|  10.6k|      outptr = output_data[outrow++];
  385|       |
  386|       |      /* Special case for first column */
  387|  10.6k|      thiscolsum = (*inptr0++) * 3 + (*inptr1++);
  388|  10.6k|      nextcolsum = (*inptr0++) * 3 + (*inptr1++);
  389|  10.6k|      *outptr++ = (_JSAMPLE)((thiscolsum * 4 + 8) >> 4);
  390|  10.6k|      *outptr++ = (_JSAMPLE)((thiscolsum * 3 + nextcolsum + 7) >> 4);
  391|  10.6k|      lastcolsum = thiscolsum;  thiscolsum = nextcolsum;
  392|       |
  393|   202k|      for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
  ------------------
  |  Branch (393:53): [True: 191k, False: 10.6k]
  ------------------
  394|       |        /* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */
  395|       |        /* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */
  396|   191k|        nextcolsum = (*inptr0++) * 3 + (*inptr1++);
  397|   191k|        *outptr++ = (_JSAMPLE)((thiscolsum * 3 + lastcolsum + 8) >> 4);
  398|   191k|        *outptr++ = (_JSAMPLE)((thiscolsum * 3 + nextcolsum + 7) >> 4);
  399|   191k|        lastcolsum = thiscolsum;  thiscolsum = nextcolsum;
  400|   191k|      }
  401|       |
  402|       |      /* Special case for last column */
  403|  10.6k|      *outptr++ = (_JSAMPLE)((thiscolsum * 3 + lastcolsum + 8) >> 4);
  404|  10.6k|      *outptr++ = (_JSAMPLE)((thiscolsum * 4 + 7) >> 4);
  405|  10.6k|    }
  406|  5.33k|    inrow++;
  407|  5.33k|  }
  408|  5.33k|}

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

jpeg_idct_islow:
  176|  33.4k|{
  177|  33.4k|  JLONG tmp0, tmp1, tmp2, tmp3;
  178|  33.4k|  JLONG tmp10, tmp11, tmp12, tmp13;
  179|  33.4k|  JLONG z1, z2, z3, z4, z5;
  180|  33.4k|  JCOEFPTR inptr;
  181|  33.4k|  ISLOW_MULT_TYPE *quantptr;
  182|  33.4k|  int *wsptr;
  183|  33.4k|  _JSAMPROW outptr;
  ------------------
  |  |  227|  33.4k|#define _JSAMPROW  JSAMPROW
  ------------------
  184|  33.4k|  _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |  222|  33.4k|#define _JSAMPLE  JSAMPLE
  ------------------
                _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |   89|  33.4k|  ((_JSAMPLE *)((cinfo)->sample_range_limit) + _CENTERJSAMPLE)
  |  |  ------------------
  |  |  |  |  225|  33.4k|#define _CENTERJSAMPLE   CENTERJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  33.4k|#define CENTERJSAMPLE    128
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  185|  33.4k|  int ctr;
  186|  33.4k|  int workspace[DCTSIZE2];      /* buffers data between passes */
  187|       |  SHIFT_TEMPS
  188|       |
  189|       |  /* Pass 1: process columns from input, store into work array. */
  190|       |  /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
  191|       |  /* furthermore, we scale the results by 2**PASS1_BITS. */
  192|       |
  193|  33.4k|  inptr = coef_block;
  194|  33.4k|  quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
  195|  33.4k|  wsptr = workspace;
  196|   301k|  for (ctr = DCTSIZE; ctr > 0; ctr--) {
  ------------------
  |  |   66|  33.4k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (196:23): [True: 267k, False: 33.4k]
  ------------------
  197|       |    /* Due to quantization, we will usually find that many of the input
  198|       |     * coefficients are zero, especially the AC terms.  We can exploit this
  199|       |     * by short-circuiting the IDCT calculation for any column in which all
  200|       |     * the AC terms are zero.  In that case each output is equal to the
  201|       |     * DC coefficient (with scale factor as needed).
  202|       |     * With typical images and quantization tables, half or more of the
  203|       |     * column DCT calculations can be simplified this way.
  204|       |     */
  205|       |
  206|   267k|    if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|   267k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|   258k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (206:9): [True: 258k, False: 8.90k]
  |  Branch (206:36): [True: 257k, False: 1.54k]
  ------------------
  207|   267k|        inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|   257k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|   256k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (207:9): [True: 256k, False: 424]
  |  Branch (207:36): [True: 256k, False: 458]
  ------------------
  208|   267k|        inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|   256k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|   256k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (208:9): [True: 256k, False: 269]
  |  Branch (208:36): [True: 256k, False: 180]
  ------------------
  209|   267k|        inptr[DCTSIZE * 7] == 0) {
  ------------------
  |  |   66|   256k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (209:9): [True: 255k, False: 50]
  ------------------
  210|       |      /* AC terms all zero */
  211|   255k|      int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
  ------------------
  |  |   85|   255k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  212|   255k|                             quantptr[DCTSIZE * 0]), PASS1_BITS);
  213|       |
  214|   255k|      wsptr[DCTSIZE * 0] = dcval;
  ------------------
  |  |   66|   255k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  215|   255k|      wsptr[DCTSIZE * 1] = dcval;
  ------------------
  |  |   66|   255k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  216|   255k|      wsptr[DCTSIZE * 2] = dcval;
  ------------------
  |  |   66|   255k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  217|   255k|      wsptr[DCTSIZE * 3] = dcval;
  ------------------
  |  |   66|   255k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  218|   255k|      wsptr[DCTSIZE * 4] = dcval;
  ------------------
  |  |   66|   255k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  219|   255k|      wsptr[DCTSIZE * 5] = dcval;
  ------------------
  |  |   66|   255k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  220|   255k|      wsptr[DCTSIZE * 6] = dcval;
  ------------------
  |  |   66|   255k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  221|   255k|      wsptr[DCTSIZE * 7] = dcval;
  ------------------
  |  |   66|   255k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  222|       |
  223|   255k|      inptr++;                  /* advance pointers to next column */
  224|   255k|      quantptr++;
  225|   255k|      wsptr++;
  226|   255k|      continue;
  227|   255k|    }
  228|       |
  229|       |    /* Even part: reverse the even part of the forward DCT. */
  230|       |    /* The rotator is sqrt(2)*c(-6). */
  231|       |
  232|  11.8k|    z2 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
  ------------------
  |  |  165|  11.8k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  233|  11.8k|    z3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
  ------------------
  |  |  165|  11.8k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  234|       |
  235|  11.8k|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  154|  11.8k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  11.8k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  236|  11.8k|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  154|  11.8k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  11.8k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  237|  11.8k|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  154|  11.8k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  11.8k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  238|       |
  239|  11.8k|    z2 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
  ------------------
  |  |  165|  11.8k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  240|  11.8k|    z3 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
  ------------------
  |  |  165|  11.8k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  241|       |
  242|  11.8k|    tmp0 = LEFT_SHIFT(z2 + z3, CONST_BITS);
  ------------------
  |  |   85|  11.8k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  243|  11.8k|    tmp1 = LEFT_SHIFT(z2 - z3, CONST_BITS);
  ------------------
  |  |   85|  11.8k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  244|       |
  245|  11.8k|    tmp10 = tmp0 + tmp3;
  246|  11.8k|    tmp13 = tmp0 - tmp3;
  247|  11.8k|    tmp11 = tmp1 + tmp2;
  248|  11.8k|    tmp12 = tmp1 - tmp2;
  249|       |
  250|       |    /* Odd part per figure 8; the matrix is unitary and hence its
  251|       |     * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
  252|       |     */
  253|       |
  254|  11.8k|    tmp0 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
  ------------------
  |  |  165|  11.8k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  255|  11.8k|    tmp1 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
  ------------------
  |  |  165|  11.8k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  256|  11.8k|    tmp2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
  ------------------
  |  |  165|  11.8k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  257|  11.8k|    tmp3 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
  ------------------
  |  |  165|  11.8k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  258|       |
  259|  11.8k|    z1 = tmp0 + tmp3;
  260|  11.8k|    z2 = tmp1 + tmp2;
  261|  11.8k|    z3 = tmp0 + tmp2;
  262|  11.8k|    z4 = tmp1 + tmp3;
  263|  11.8k|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  154|  11.8k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  11.8k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  264|       |
  265|  11.8k|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  154|  11.8k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  11.8k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  266|  11.8k|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  154|  11.8k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  11.8k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  267|  11.8k|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  154|  11.8k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  11.8k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  268|  11.8k|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  154|  11.8k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  11.8k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  269|  11.8k|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  154|  11.8k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  11.8k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  270|  11.8k|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  154|  11.8k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  11.8k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  271|  11.8k|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  154|  11.8k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  11.8k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  272|  11.8k|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  154|  11.8k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  11.8k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  273|       |
  274|  11.8k|    z3 += z5;
  275|  11.8k|    z4 += z5;
  276|       |
  277|  11.8k|    tmp0 += z1 + z3;
  278|  11.8k|    tmp1 += z2 + z4;
  279|  11.8k|    tmp2 += z2 + z3;
  280|  11.8k|    tmp3 += z1 + z4;
  281|       |
  282|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  283|       |
  284|  11.8k|    wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  11.8k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  11.8k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  11.8k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  285|  11.8k|    wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  11.8k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  11.8k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  11.8k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  286|  11.8k|    wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  11.8k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  11.8k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  11.8k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  287|  11.8k|    wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  11.8k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  11.8k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  11.8k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  288|  11.8k|    wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  11.8k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  11.8k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  11.8k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  289|  11.8k|    wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  11.8k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  11.8k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  11.8k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  290|  11.8k|    wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  11.8k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  11.8k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  11.8k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  291|  11.8k|    wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  11.8k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  11.8k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  11.8k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  292|       |
  293|  11.8k|    inptr++;                    /* advance pointers to next column */
  294|  11.8k|    quantptr++;
  295|  11.8k|    wsptr++;
  296|  11.8k|  }
  297|       |
  298|       |  /* Pass 2: process rows from work array, store into output array. */
  299|       |  /* Note that we must descale the results by a factor of 8 == 2**3, */
  300|       |  /* and also undo the PASS1_BITS scaling. */
  301|       |
  302|  33.4k|  wsptr = workspace;
  303|   301k|  for (ctr = 0; ctr < DCTSIZE; ctr++) {
  ------------------
  |  |   66|   301k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (303:17): [True: 267k, False: 33.4k]
  ------------------
  304|   267k|    outptr = output_buf[ctr] + output_col;
  305|       |    /* Rows of zeroes can be exploited in the same way as we did with columns.
  306|       |     * However, the column calculation has created many nonzero AC terms, so
  307|       |     * the simplification applies less often (typically 5% to 10% of the time).
  308|       |     * On machines with very fast multiplication, it's possible that the
  309|       |     * test takes more time than it's worth.  In that case this section
  310|       |     * may be commented out.
  311|       |     */
  312|       |
  313|   267k|#ifndef NO_ZERO_ROW_TEST
  314|   267k|    if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
  ------------------
  |  Branch (314:9): [True: 239k, False: 28.0k]
  |  Branch (314:26): [True: 238k, False: 1.48k]
  |  Branch (314:43): [True: 237k, False: 1.00k]
  |  Branch (314:60): [True: 237k, False: 112]
  ------------------
  315|   267k|        wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
  ------------------
  |  Branch (315:9): [True: 237k, False: 24]
  |  Branch (315:26): [True: 237k, False: 8]
  |  Branch (315:43): [True: 237k, False: 0]
  ------------------
  316|       |      /* AC terms all zero */
  317|   237k|      _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  222|   237k|#define _JSAMPLE  JSAMPLE
  ------------------
                    _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  191|   237k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|   237k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  318|   237k|                                                PASS1_BITS + 3) & RANGE_MASK];
  ------------------
  |  |   91|   237k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|   237k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|   237k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  319|       |
  320|   237k|      outptr[0] = dcval;
  321|   237k|      outptr[1] = dcval;
  322|   237k|      outptr[2] = dcval;
  323|   237k|      outptr[3] = dcval;
  324|   237k|      outptr[4] = dcval;
  325|   237k|      outptr[5] = dcval;
  326|   237k|      outptr[6] = dcval;
  327|   237k|      outptr[7] = dcval;
  328|       |
  329|   237k|      wsptr += DCTSIZE;         /* advance pointer to next row */
  ------------------
  |  |   66|   237k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  330|   237k|      continue;
  331|   237k|    }
  332|  30.7k|#endif
  333|       |
  334|       |    /* Even part: reverse the even part of the forward DCT. */
  335|       |    /* The rotator is sqrt(2)*c(-6). */
  336|       |
  337|  30.7k|    z2 = (JLONG)wsptr[2];
  338|  30.7k|    z3 = (JLONG)wsptr[6];
  339|       |
  340|  30.7k|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  154|  30.7k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  30.7k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  341|  30.7k|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  154|  30.7k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  30.7k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  342|  30.7k|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  154|  30.7k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  30.7k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  343|       |
  344|  30.7k|    tmp0 = LEFT_SHIFT((JLONG)wsptr[0] + (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|  30.7k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  345|  30.7k|    tmp1 = LEFT_SHIFT((JLONG)wsptr[0] - (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|  30.7k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  346|       |
  347|  30.7k|    tmp10 = tmp0 + tmp3;
  348|  30.7k|    tmp13 = tmp0 - tmp3;
  349|  30.7k|    tmp11 = tmp1 + tmp2;
  350|  30.7k|    tmp12 = tmp1 - tmp2;
  351|       |
  352|       |    /* Odd part per figure 8; the matrix is unitary and hence its
  353|       |     * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
  354|       |     */
  355|       |
  356|  30.7k|    tmp0 = (JLONG)wsptr[7];
  357|  30.7k|    tmp1 = (JLONG)wsptr[5];
  358|  30.7k|    tmp2 = (JLONG)wsptr[3];
  359|  30.7k|    tmp3 = (JLONG)wsptr[1];
  360|       |
  361|  30.7k|    z1 = tmp0 + tmp3;
  362|  30.7k|    z2 = tmp1 + tmp2;
  363|  30.7k|    z3 = tmp0 + tmp2;
  364|  30.7k|    z4 = tmp1 + tmp3;
  365|  30.7k|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  154|  30.7k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  30.7k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  366|       |
  367|  30.7k|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  154|  30.7k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  30.7k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  368|  30.7k|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  154|  30.7k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  30.7k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  369|  30.7k|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  154|  30.7k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  30.7k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  370|  30.7k|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  154|  30.7k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  30.7k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  371|  30.7k|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  154|  30.7k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  30.7k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  372|  30.7k|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  154|  30.7k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  30.7k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  373|  30.7k|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  154|  30.7k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  30.7k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  374|  30.7k|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  154|  30.7k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  30.7k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  375|       |
  376|  30.7k|    z3 += z5;
  377|  30.7k|    z4 += z5;
  378|       |
  379|  30.7k|    tmp0 += z1 + z3;
  380|  30.7k|    tmp1 += z2 + z4;
  381|  30.7k|    tmp2 += z2 + z3;
  382|  30.7k|    tmp3 += z1 + z4;
  383|       |
  384|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  385|       |
  386|  30.7k|    outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp3,
  ------------------
  |  |  191|  30.7k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  30.7k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  387|  30.7k|                                         CONST_BITS + PASS1_BITS + 3) &
  388|  30.7k|                            RANGE_MASK];
  ------------------
  |  |   91|  30.7k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  30.7k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  30.7k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  389|  30.7k|    outptr[7] = range_limit[(int)DESCALE(tmp10 - tmp3,
  ------------------
  |  |  191|  30.7k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  30.7k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  390|  30.7k|                                         CONST_BITS + PASS1_BITS + 3) &
  391|  30.7k|                            RANGE_MASK];
  ------------------
  |  |   91|  30.7k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  30.7k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  30.7k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  392|  30.7k|    outptr[1] = range_limit[(int)DESCALE(tmp11 + tmp2,
  ------------------
  |  |  191|  30.7k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  30.7k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  393|  30.7k|                                         CONST_BITS + PASS1_BITS + 3) &
  394|  30.7k|                            RANGE_MASK];
  ------------------
  |  |   91|  30.7k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  30.7k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  30.7k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  395|  30.7k|    outptr[6] = range_limit[(int)DESCALE(tmp11 - tmp2,
  ------------------
  |  |  191|  30.7k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  30.7k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  396|  30.7k|                                         CONST_BITS + PASS1_BITS + 3) &
  397|  30.7k|                            RANGE_MASK];
  ------------------
  |  |   91|  30.7k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  30.7k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  30.7k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  398|  30.7k|    outptr[2] = range_limit[(int)DESCALE(tmp12 + tmp1,
  ------------------
  |  |  191|  30.7k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  30.7k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  399|  30.7k|                                         CONST_BITS + PASS1_BITS + 3) &
  400|  30.7k|                            RANGE_MASK];
  ------------------
  |  |   91|  30.7k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  30.7k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  30.7k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  401|  30.7k|    outptr[5] = range_limit[(int)DESCALE(tmp12 - tmp1,
  ------------------
  |  |  191|  30.7k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  30.7k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  402|  30.7k|                                         CONST_BITS + PASS1_BITS + 3) &
  403|  30.7k|                            RANGE_MASK];
  ------------------
  |  |   91|  30.7k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  30.7k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  30.7k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  404|  30.7k|    outptr[3] = range_limit[(int)DESCALE(tmp13 + tmp0,
  ------------------
  |  |  191|  30.7k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  30.7k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  405|  30.7k|                                         CONST_BITS + PASS1_BITS + 3) &
  406|  30.7k|                            RANGE_MASK];
  ------------------
  |  |   91|  30.7k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  30.7k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  30.7k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  407|  30.7k|    outptr[4] = range_limit[(int)DESCALE(tmp13 - tmp0,
  ------------------
  |  |  191|  30.7k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  30.7k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  408|  30.7k|                                         CONST_BITS + PASS1_BITS + 3) &
  409|  30.7k|                            RANGE_MASK];
  ------------------
  |  |   91|  30.7k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  30.7k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  30.7k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  410|       |
  411|  30.7k|    wsptr += DCTSIZE;           /* advance pointer to next row */
  ------------------
  |  |   66|  30.7k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  412|  30.7k|  }
  413|  33.4k|}

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

jinit_memory_mgr:
 1195|  1.09k|{
 1196|  1.09k|  my_mem_ptr mem;
 1197|  1.09k|  long max_to_use;
 1198|  1.09k|  int pool;
 1199|  1.09k|  size_t test_mac;
 1200|       |
 1201|  1.09k|  cinfo->mem = NULL;            /* for safety if init fails */
 1202|       |
 1203|       |  /* Check for configuration errors.
 1204|       |   * sizeof(ALIGN_TYPE) should be a power of 2; otherwise, it probably
 1205|       |   * doesn't reflect any real hardware alignment requirement.
 1206|       |   * The test is a little tricky: for X>0, X and X-1 have no one-bits
 1207|       |   * in common if and only if X is a power of 2, ie has only one one-bit.
 1208|       |   * Some compilers may give an "unreachable code" warning here; ignore it.
 1209|       |   */
 1210|  1.09k|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  1.09k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  1.09k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1210:7): [Folded - Ignored]
  ------------------
 1211|      0|    ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1212|       |  /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be
 1213|       |   * a multiple of ALIGN_SIZE.
 1214|       |   * Again, an "unreachable code" warning may be ignored here.
 1215|       |   * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK.
 1216|       |   */
 1217|  1.09k|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  1.09k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1218|  1.09k|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|  2.18k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1218:7): [True: 0, False: 1.09k]
  ------------------
 1219|  1.09k|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|  1.09k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  1.09k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1219:7): [Folded - Ignored]
  ------------------
 1220|      0|    ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1221|       |
 1222|  1.09k|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1223|       |
 1224|       |  /* Attempt to allocate memory manager's control block */
 1225|  1.09k|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1226|       |
 1227|  1.09k|  if (mem == NULL) {
  ------------------
  |  Branch (1227:7): [True: 0, False: 1.09k]
  ------------------
 1228|      0|    jpeg_mem_term(cinfo);       /* system-dependent cleanup */
 1229|      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)))
  ------------------
 1230|      0|  }
 1231|       |
 1232|       |  /* OK, fill in the method pointers */
 1233|  1.09k|  mem->pub.alloc_small = alloc_small;
 1234|  1.09k|  mem->pub.alloc_large = alloc_large;
 1235|  1.09k|  mem->pub.alloc_sarray = alloc_sarray;
 1236|  1.09k|  mem->pub.alloc_barray = alloc_barray;
 1237|  1.09k|  mem->pub.request_virt_sarray = request_virt_sarray;
 1238|  1.09k|  mem->pub.request_virt_barray = request_virt_barray;
 1239|  1.09k|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1240|  1.09k|  mem->pub.access_virt_sarray = access_virt_sarray;
 1241|  1.09k|  mem->pub.access_virt_barray = access_virt_barray;
 1242|  1.09k|  mem->pub.free_pool = free_pool;
 1243|  1.09k|  mem->pub.self_destruct = self_destruct;
 1244|       |
 1245|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1246|  1.09k|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  1.09k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1247|       |
 1248|       |  /* Initialize working state */
 1249|  1.09k|  mem->pub.max_memory_to_use = max_to_use;
 1250|       |
 1251|  3.27k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  885|  1.09k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  883|  3.27k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1251:35): [True: 2.18k, False: 1.09k]
  ------------------
 1252|  2.18k|    mem->small_list[pool] = NULL;
 1253|  2.18k|    mem->large_list[pool] = NULL;
 1254|  2.18k|  }
 1255|  1.09k|  mem->virt_sarray_list = NULL;
 1256|  1.09k|  mem->virt_barray_list = NULL;
 1257|       |
 1258|  1.09k|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1259|       |
 1260|       |  /* Declare ourselves open for business */
 1261|  1.09k|  cinfo->mem = &mem->pub;
 1262|       |
 1263|       |  /* Check for an environment variable JPEGMEM; if found, override the
 1264|       |   * default max_memory setting from jpeg_mem_init.  Note that the
 1265|       |   * surrounding application may again override this value.
 1266|       |   * If your system doesn't support getenv(), define NO_GETENV to disable
 1267|       |   * this feature.
 1268|       |   */
 1269|  1.09k|#ifndef NO_GETENV
 1270|  1.09k|  {
 1271|  1.09k|    char memenv[30] = { 0 };
 1272|       |
 1273|  1.09k|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1273:9): [True: 1.09k, False: 0]
  |  Branch (1273:45): [True: 0, False: 1.09k]
  ------------------
 1274|      0|      char ch = 'x';
 1275|       |
 1276|       |#ifdef _MSC_VER
 1277|       |      if (sscanf_s(memenv, "%ld%c", &max_to_use, &ch, 1) > 0) {
 1278|       |#else
 1279|      0|      if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) {
  ------------------
  |  Branch (1279:11): [True: 0, False: 0]
  ------------------
 1280|      0|#endif
 1281|      0|        if (ch == 'm' || ch == 'M')
  ------------------
  |  Branch (1281:13): [True: 0, False: 0]
  |  Branch (1281:26): [True: 0, False: 0]
  ------------------
 1282|      0|          max_to_use *= 1000L;
 1283|      0|        mem->pub.max_memory_to_use = max_to_use * 1000L;
 1284|      0|      }
 1285|      0|    }
 1286|  1.09k|  }
 1287|  1.09k|#endif
 1288|       |
 1289|  1.09k|}
jmemmgr.c:alloc_small:
  268|  22.2k|{
  269|  22.2k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  270|  22.2k|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  271|  22.2k|  char *data_ptr;
  272|  22.2k|  size_t min_request, slop;
  273|       |
  274|       |  /*
  275|       |   * Round up the requested size to a multiple of ALIGN_SIZE in order
  276|       |   * to assure alignment for the next object allocated in the same pool
  277|       |   * and so that algorithms can straddle outside the proper area up
  278|       |   * to the next alignment.
  279|       |   */
  280|  22.2k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  22.2k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (280:7): [True: 0, False: 22.2k]
  ------------------
  281|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  282|       |       is close to SIZE_MAX. */
  283|      0|    out_of_memory(cinfo, 7);
  284|      0|  }
  285|  22.2k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  22.2k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  286|       |
  287|       |  /* Check for unsatisfiable request (do now to ensure no overflow below) */
  288|  22.2k|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  22.2k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (288:7): [True: 0, False: 22.2k]
  ------------------
  289|  22.2k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  22.2k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  290|      0|    out_of_memory(cinfo, 1);    /* request exceeds malloc's ability */
  291|       |
  292|       |  /* See if space is available in any existing pool */
  293|  22.2k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  885|  22.2k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (293:7): [True: 0, False: 22.2k]
  |  Branch (293:22): [True: 0, False: 22.2k]
  ------------------
  294|      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)))
  ------------------
  295|  22.2k|  prev_hdr_ptr = NULL;
  296|  22.2k|  hdr_ptr = mem->small_list[pool_id];
  297|  22.6k|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (297:10): [True: 20.2k, False: 2.33k]
  ------------------
  298|  20.2k|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (298:9): [True: 19.9k, False: 323]
  ------------------
  299|  19.9k|      break;                    /* found pool with enough space */
  300|    323|    prev_hdr_ptr = hdr_ptr;
  301|    323|    hdr_ptr = hdr_ptr->next;
  302|    323|  }
  303|       |
  304|       |  /* Time to make a new pool? */
  305|  22.2k|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (305:7): [True: 2.33k, False: 19.9k]
  ------------------
  306|       |    /* min_request is what we need now, slop is what will be leftover */
  307|  2.33k|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  2.33k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  308|  2.33k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (308:9): [True: 2.01k, False: 322]
  ------------------
  309|  2.01k|      slop = first_pool_slop[pool_id];
  310|    322|    else
  311|    322|      slop = extra_pool_slop[pool_id];
  312|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  313|  2.33k|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|  2.33k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (313:9): [True: 0, False: 2.33k]
  ------------------
  314|      0|      slop = (size_t)(MAX_ALLOC_CHUNK - min_request);
  ------------------
  |  |   62|      0|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  315|       |    /* Try to get space, if fail reduce slop and try again */
  316|  2.33k|    for (;;) {
  317|  2.33k|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  318|  2.33k|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (318:11): [True: 2.33k, False: 0]
  ------------------
  319|  2.33k|        break;
  320|      0|      slop /= 2;
  321|      0|      if (slop < MIN_SLOP)      /* give up when it gets real small */
  ------------------
  |  |  262|      0|#define MIN_SLOP  50            /* greater than 0 to avoid futile looping */
  ------------------
  |  Branch (321:11): [True: 0, False: 0]
  ------------------
  322|      0|        out_of_memory(cinfo, 2); /* jpeg_get_small failed */
  323|      0|    }
  324|  2.33k|    mem->total_space_allocated += min_request + slop;
  325|       |    /* Success, initialize the new pool header and add to end of list */
  326|  2.33k|    hdr_ptr->next = NULL;
  327|  2.33k|    hdr_ptr->bytes_used = 0;
  328|  2.33k|    hdr_ptr->bytes_left = sizeofobject + slop;
  329|  2.33k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (329:9): [True: 2.01k, False: 322]
  ------------------
  330|  2.01k|      mem->small_list[pool_id] = hdr_ptr;
  331|    322|    else
  332|    322|      prev_hdr_ptr->next = hdr_ptr;
  333|  2.33k|  }
  334|       |
  335|       |  /* OK, allocate the object from the current pool */
  336|  22.2k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  337|  22.2k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  338|  22.2k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  22.2k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (338:7): [True: 22.2k, False: 0]
  ------------------
  339|  22.2k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  22.2k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  22.2k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  340|  22.2k|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  341|  22.2k|  hdr_ptr->bytes_used += sizeofobject;
  342|  22.2k|  hdr_ptr->bytes_left -= sizeofobject;
  343|       |
  344|  22.2k|  return (void *)data_ptr;
  345|  22.2k|}
jmemmgr.c:round_up_pow2:
   45|  27.6k|{
   46|  27.6k|  return ((a + b - 1) & (~(b - 1)));
   47|  27.6k|}
jmemmgr.c:alloc_large:
  365|  2.94k|{
  366|  2.94k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  367|  2.94k|  large_pool_ptr hdr_ptr;
  368|  2.94k|  char *data_ptr;
  369|       |
  370|       |  /*
  371|       |   * Round up the requested size to a multiple of ALIGN_SIZE so that
  372|       |   * algorithms can straddle outside the proper area up to the next
  373|       |   * alignment.
  374|       |   */
  375|  2.94k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  2.94k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (375:7): [True: 0, False: 2.94k]
  ------------------
  376|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  377|       |       is close to SIZE_MAX. */
  378|      0|    out_of_memory(cinfo, 8);
  379|      0|  }
  380|  2.94k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  2.94k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  381|       |
  382|       |  /* Check for unsatisfiable request (do now to ensure no overflow below) */
  383|  2.94k|  if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  2.94k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (383:7): [True: 0, False: 2.94k]
  ------------------
  384|  2.94k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  2.94k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  385|      0|    out_of_memory(cinfo, 3);    /* request exceeds malloc's ability */
  386|       |
  387|       |  /* Always make a new pool */
  388|  2.94k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  885|  2.94k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (388:7): [True: 0, False: 2.94k]
  |  Branch (388:22): [True: 0, False: 2.94k]
  ------------------
  389|      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)))
  ------------------
  390|       |
  391|  2.94k|  hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
  392|  2.94k|                                           sizeof(large_pool_hdr) +
  393|  2.94k|                                           ALIGN_SIZE - 1);
  ------------------
  |  |   89|  2.94k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  394|  2.94k|  if (hdr_ptr == NULL)
  ------------------
  |  Branch (394:7): [True: 0, False: 2.94k]
  ------------------
  395|      0|    out_of_memory(cinfo, 4);    /* jpeg_get_large failed */
  396|  2.94k|  mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
  397|  2.94k|                                ALIGN_SIZE - 1;
  ------------------
  |  |   89|  2.94k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  398|       |
  399|       |  /* Success, initialize the new pool header and add to list */
  400|  2.94k|  hdr_ptr->next = mem->large_list[pool_id];
  401|       |  /* We maintain space counts in each pool header for statistical purposes,
  402|       |   * even though they are not needed for allocation.
  403|       |   */
  404|  2.94k|  hdr_ptr->bytes_used = sizeofobject;
  405|  2.94k|  hdr_ptr->bytes_left = 0;
  406|  2.94k|  mem->large_list[pool_id] = hdr_ptr;
  407|       |
  408|  2.94k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  409|  2.94k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  410|  2.94k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  2.94k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (410:7): [True: 2.94k, False: 0]
  ------------------
  411|  2.94k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  2.94k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  2.94k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  412|       |
  413|  2.94k|  return (void *)data_ptr;
  414|  2.94k|}
jmemmgr.c:alloc_sarray:
  437|  2.39k|{
  438|  2.39k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  439|  2.39k|  JSAMPARRAY result;
  440|  2.39k|  JSAMPROW workspace;
  441|  2.39k|  JDIMENSION rowsperchunk, currow, i;
  442|  2.39k|  long ltemp;
  443|  2.39k|  J12SAMPARRAY result12;
  444|  2.39k|  J12SAMPROW workspace12;
  445|  2.39k|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  446|  2.39k|  J16SAMPARRAY result16;
  447|  2.39k|  J16SAMPROW workspace16;
  448|  2.39k|#endif
  449|  2.39k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (449:24): [True: 2.39k, False: 0]
  ------------------
  450|  2.39k|                        ((j_decompress_ptr)cinfo)->data_precision :
  451|  2.39k|                        ((j_compress_ptr)cinfo)->data_precision;
  452|  2.39k|  size_t sample_size = data_precision == 16 ?
  ------------------
  |  Branch (452:24): [True: 0, False: 2.39k]
  ------------------
  453|  2.39k|                       sizeof(J16SAMPLE) : (data_precision == 12 ?
  ------------------
  |  Branch (453:45): [True: 0, False: 2.39k]
  ------------------
  454|      0|                                            sizeof(J12SAMPLE) :
  455|  2.39k|                                            sizeof(JSAMPLE));
  456|       |
  457|       |  /* Make sure each row is properly aligned */
  458|  2.39k|  if ((ALIGN_SIZE % sample_size) != 0)
  ------------------
  |  |   89|  2.39k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (458:7): [True: 0, False: 2.39k]
  ------------------
  459|      0|    out_of_memory(cinfo, 5);    /* safety check */
  460|       |
  461|  2.39k|  if (samplesperrow > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  2.39k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (461:7): [True: 0, False: 2.39k]
  ------------------
  462|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  463|       |       is close to SIZE_MAX. */
  464|      0|    out_of_memory(cinfo, 9);
  465|      0|  }
  466|  2.39k|  samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) /
  ------------------
  |  |   89|  2.39k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  467|  2.39k|                                                           sample_size);
  468|       |
  469|       |  /* Calculate max # of rows allowed in one allocation chunk */
  470|  2.39k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  2.39k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  471|  2.39k|          ((long)samplesperrow * (long)sample_size);
  472|  2.39k|  if (ltemp <= 0)
  ------------------
  |  Branch (472:7): [True: 0, False: 2.39k]
  ------------------
  473|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  474|  2.39k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (474:7): [True: 0, False: 2.39k]
  ------------------
  475|      0|    rowsperchunk = (JDIMENSION)ltemp;
  476|  2.39k|  else
  477|  2.39k|    rowsperchunk = numrows;
  478|  2.39k|  mem->last_rowsperchunk = rowsperchunk;
  479|       |
  480|  2.39k|  if (data_precision == 16) {
  ------------------
  |  Branch (480:7): [True: 0, False: 2.39k]
  ------------------
  481|      0|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  482|       |    /* Get space for row pointers (small object) */
  483|      0|    result16 = (J16SAMPARRAY)alloc_small(cinfo, pool_id,
  484|      0|                                         (size_t)(numrows *
  485|      0|                                                  sizeof(J16SAMPROW)));
  486|       |
  487|       |    /* Get the rows themselves (large objects) */
  488|      0|    currow = 0;
  489|      0|    while (currow < numrows) {
  ------------------
  |  Branch (489:12): [True: 0, False: 0]
  ------------------
  490|      0|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  447|      0|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (447:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  491|      0|      workspace16 = (J16SAMPROW)alloc_large(cinfo, pool_id,
  492|      0|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  493|      0|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (493:30): [True: 0, False: 0]
  ------------------
  494|      0|        result16[currow++] = workspace16;
  495|      0|        workspace16 += samplesperrow;
  496|      0|      }
  497|      0|    }
  498|       |
  499|      0|    return (JSAMPARRAY)result16;
  500|       |#else
  501|       |    ERREXIT1(cinfo, JERR_BAD_PRECISION, data_precision);
  502|       |    return NULL;
  503|       |#endif
  504|  2.39k|  } else if (data_precision == 12) {
  ------------------
  |  Branch (504:14): [True: 0, False: 2.39k]
  ------------------
  505|       |    /* Get space for row pointers (small object) */
  506|      0|    result12 = (J12SAMPARRAY)alloc_small(cinfo, pool_id,
  507|      0|                                         (size_t)(numrows *
  508|      0|                                                  sizeof(J12SAMPROW)));
  509|       |
  510|       |    /* Get the rows themselves (large objects) */
  511|      0|    currow = 0;
  512|      0|    while (currow < numrows) {
  ------------------
  |  Branch (512:12): [True: 0, False: 0]
  ------------------
  513|      0|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  447|      0|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (447:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  514|      0|      workspace12 = (J12SAMPROW)alloc_large(cinfo, pool_id,
  515|      0|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  516|      0|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (516:30): [True: 0, False: 0]
  ------------------
  517|      0|        result12[currow++] = workspace12;
  518|      0|        workspace12 += samplesperrow;
  519|      0|      }
  520|      0|    }
  521|       |
  522|      0|    return (JSAMPARRAY)result12;
  523|  2.39k|  } else {
  524|       |    /* Get space for row pointers (small object) */
  525|  2.39k|    result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
  526|  2.39k|                                     (size_t)(numrows * sizeof(JSAMPROW)));
  527|       |
  528|       |    /* Get the rows themselves (large objects) */
  529|  2.39k|    currow = 0;
  530|  4.79k|    while (currow < numrows) {
  ------------------
  |  Branch (530:12): [True: 2.39k, False: 2.39k]
  ------------------
  531|  2.39k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  447|  2.39k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (447:26): [True: 0, False: 2.39k]
  |  |  ------------------
  ------------------
  532|  2.39k|      workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
  533|  2.39k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  534|  18.3k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (534:30): [True: 15.9k, False: 2.39k]
  ------------------
  535|  15.9k|        result[currow++] = workspace;
  536|  15.9k|        workspace += samplesperrow;
  537|  15.9k|      }
  538|  2.39k|    }
  539|       |
  540|  2.39k|    return result;
  541|  2.39k|  }
  542|  2.39k|}
jmemmgr.c:alloc_barray:
  554|      3|{
  555|      3|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  556|      3|  JBLOCKARRAY result;
  557|      3|  JBLOCKROW workspace;
  558|      3|  JDIMENSION rowsperchunk, currow, i;
  559|      3|  long ltemp;
  560|       |
  561|       |  /* Make sure each row is properly aligned */
  562|      3|  if ((sizeof(JBLOCK) % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|      3|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (562:7): [Folded - Ignored]
  ------------------
  563|      0|    out_of_memory(cinfo, 6);    /* safety check */
  564|       |
  565|       |  /* Calculate max # of rows allowed in one allocation chunk */
  566|      3|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|      3|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  567|      3|          ((long)blocksperrow * sizeof(JBLOCK));
  568|      3|  if (ltemp <= 0)
  ------------------
  |  Branch (568:7): [True: 0, False: 3]
  ------------------
  569|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  570|      3|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (570:7): [True: 0, False: 3]
  ------------------
  571|      0|    rowsperchunk = (JDIMENSION)ltemp;
  572|      3|  else
  573|      3|    rowsperchunk = numrows;
  574|      3|  mem->last_rowsperchunk = rowsperchunk;
  575|       |
  576|       |  /* Get space for row pointers (small object) */
  577|      3|  result = (JBLOCKARRAY)alloc_small(cinfo, pool_id,
  578|      3|                                    (size_t)(numrows * sizeof(JBLOCKROW)));
  579|       |
  580|       |  /* Get the rows themselves (large objects) */
  581|      3|  currow = 0;
  582|      6|  while (currow < numrows) {
  ------------------
  |  Branch (582:10): [True: 3, False: 3]
  ------------------
  583|      3|    rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  447|      3|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (447:26): [True: 0, False: 3]
  |  |  ------------------
  ------------------
  584|      3|    workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
  585|      3|        (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
  586|      3|                  sizeof(JBLOCK)));
  587|     23|    for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (587:28): [True: 20, False: 3]
  ------------------
  588|     20|      result[currow++] = workspace;
  589|     20|      workspace += blocksperrow;
  590|     20|    }
  591|      3|  }
  592|       |
  593|      3|  return result;
  594|      3|}
jmemmgr.c:request_virt_barray:
  669|      3|{
  670|      3|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  671|      3|  jvirt_barray_ptr result;
  672|       |
  673|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  674|      3|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  884|      3|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (674:7): [True: 0, False: 3]
  ------------------
  675|      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)))
  ------------------
  676|       |
  677|       |  /* get control block */
  678|      3|  result = (jvirt_barray_ptr)alloc_small(cinfo, pool_id,
  679|      3|                                         sizeof(struct jvirt_barray_control));
  680|       |
  681|      3|  result->mem_buffer = NULL;    /* marks array not yet realized */
  682|      3|  result->rows_in_array = numrows;
  683|      3|  result->blocksperrow = blocksperrow;
  684|      3|  result->maxaccess = maxaccess;
  685|      3|  result->pre_zero = pre_zero;
  686|      3|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  206|      3|#define FALSE   0               /* values of boolean */
  ------------------
  687|      3|  result->next = mem->virt_barray_list; /* add to list of virtual arrays */
  688|      3|  mem->virt_barray_list = result;
  689|       |
  690|      3|  return result;
  691|      3|}
jmemmgr.c:realize_virt_arrays:
  697|    550|{
  698|    550|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  699|    550|  size_t space_per_minheight, maximum_space, avail_mem;
  700|    550|  size_t minheights, max_minheights;
  701|    550|  jvirt_sarray_ptr sptr;
  702|    550|  jvirt_barray_ptr bptr;
  703|    550|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (703:24): [True: 550, False: 0]
  ------------------
  704|    550|                        ((j_decompress_ptr)cinfo)->data_precision :
  705|    550|                        ((j_compress_ptr)cinfo)->data_precision;
  706|    550|  size_t sample_size = data_precision == 16 ?
  ------------------
  |  Branch (706:24): [True: 0, False: 550]
  ------------------
  707|    550|                       sizeof(J16SAMPLE) : (data_precision == 12 ?
  ------------------
  |  Branch (707:45): [True: 0, False: 550]
  ------------------
  708|      0|                                            sizeof(J12SAMPLE) :
  709|    550|                                            sizeof(JSAMPLE));
  710|       |
  711|       |  /* Compute the minimum space needed (maxaccess rows in each buffer)
  712|       |   * and the maximum space needed (full image height in each buffer).
  713|       |   * These may be of use to the system-dependent jpeg_mem_available routine.
  714|       |   */
  715|    550|  space_per_minheight = 0;
  716|    550|  maximum_space = 0;
  717|    550|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (717:38): [True: 0, False: 550]
  ------------------
  718|      0|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (718:9): [True: 0, False: 0]
  ------------------
  719|      0|      size_t new_space = (long)sptr->rows_in_array *
  720|      0|                         (long)sptr->samplesperrow * sample_size;
  721|       |
  722|      0|      space_per_minheight += (long)sptr->maxaccess *
  723|      0|                             (long)sptr->samplesperrow * sample_size;
  724|      0|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (724:11): [True: 0, False: 0]
  ------------------
  725|      0|        out_of_memory(cinfo, 10);
  726|      0|      maximum_space += new_space;
  727|      0|    }
  728|      0|  }
  729|    553|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (729:38): [True: 3, False: 550]
  ------------------
  730|      3|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (730:9): [True: 3, False: 0]
  ------------------
  731|      3|      size_t new_space = (long)bptr->rows_in_array *
  732|      3|                         (long)bptr->blocksperrow * sizeof(JBLOCK);
  733|       |
  734|      3|      space_per_minheight += (long)bptr->maxaccess *
  735|      3|                             (long)bptr->blocksperrow * sizeof(JBLOCK);
  736|      3|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (736:11): [True: 0, False: 3]
  ------------------
  737|      0|        out_of_memory(cinfo, 11);
  738|      3|      maximum_space += new_space;
  739|      3|    }
  740|      3|  }
  741|       |
  742|    550|  if (space_per_minheight <= 0)
  ------------------
  |  Branch (742:7): [True: 549, False: 1]
  ------------------
  743|    549|    return;                     /* no unrealized arrays, no work */
  744|       |
  745|       |  /* Determine amount of memory to actually use; this is system-dependent. */
  746|      1|  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
  747|      1|                                 mem->total_space_allocated);
  748|       |
  749|       |  /* If the maximum space needed is available, make all the buffers full
  750|       |   * height; otherwise parcel it out with the same number of minheights
  751|       |   * in each buffer.
  752|       |   */
  753|      1|  if (avail_mem >= maximum_space)
  ------------------
  |  Branch (753:7): [True: 1, False: 0]
  ------------------
  754|      1|    max_minheights = 1000000000L;
  755|      0|  else {
  756|      0|    max_minheights = avail_mem / space_per_minheight;
  757|       |    /* If there doesn't seem to be enough space, try to get the minimum
  758|       |     * anyway.  This allows a "stub" implementation of jpeg_mem_available().
  759|       |     */
  760|      0|    if (max_minheights <= 0)
  ------------------
  |  Branch (760:9): [True: 0, False: 0]
  ------------------
  761|      0|      max_minheights = 1;
  762|      0|  }
  763|       |
  764|       |  /* Allocate the in-memory buffers and initialize backing store as needed. */
  765|       |
  766|      1|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (766:38): [True: 0, False: 1]
  ------------------
  767|      0|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (767:9): [True: 0, False: 0]
  ------------------
  768|      0|      minheights = ((long)sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
  769|      0|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (769:11): [True: 0, False: 0]
  ------------------
  770|       |        /* This buffer fits in memory */
  771|      0|        sptr->rows_in_mem = sptr->rows_in_array;
  772|      0|      } else {
  773|       |        /* It doesn't fit in memory, create backing store. */
  774|      0|        sptr->rows_in_mem = (JDIMENSION)(max_minheights * sptr->maxaccess);
  775|      0|        jpeg_open_backing_store(cinfo, &sptr->b_s_info,
  776|      0|                                (long)sptr->rows_in_array *
  777|      0|                                (long)sptr->samplesperrow *
  778|      0|                                (long)sample_size);
  779|      0|        sptr->b_s_open = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  780|      0|      }
  781|      0|      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  782|      0|                                      sptr->samplesperrow, sptr->rows_in_mem);
  783|      0|      sptr->rowsperchunk = mem->last_rowsperchunk;
  784|      0|      sptr->cur_start_row = 0;
  785|      0|      sptr->first_undef_row = 0;
  786|      0|      sptr->dirty = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  787|      0|    }
  788|      0|  }
  789|       |
  790|      4|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (790:38): [True: 3, False: 1]
  ------------------
  791|      3|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (791:9): [True: 3, False: 0]
  ------------------
  792|      3|      minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
  793|      3|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (793:11): [True: 3, False: 0]
  ------------------
  794|       |        /* This buffer fits in memory */
  795|      3|        bptr->rows_in_mem = bptr->rows_in_array;
  796|      3|      } else {
  797|       |        /* It doesn't fit in memory, create backing store. */
  798|      0|        bptr->rows_in_mem = (JDIMENSION)(max_minheights * bptr->maxaccess);
  799|      0|        jpeg_open_backing_store(cinfo, &bptr->b_s_info,
  800|      0|                                (long)bptr->rows_in_array *
  801|      0|                                (long)bptr->blocksperrow *
  802|      0|                                (long)sizeof(JBLOCK));
  803|      0|        bptr->b_s_open = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  804|      0|      }
  805|      3|      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      3|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  806|      3|                                      bptr->blocksperrow, bptr->rows_in_mem);
  807|      3|      bptr->rowsperchunk = mem->last_rowsperchunk;
  808|      3|      bptr->cur_start_row = 0;
  809|      3|      bptr->first_undef_row = 0;
  810|      3|      bptr->dirty = FALSE;
  ------------------
  |  |  206|      3|#define FALSE   0               /* values of boolean */
  ------------------
  811|      3|    }
  812|      3|  }
  813|      1|}
jmemmgr.c:access_virt_barray:
 1014|     20|{
 1015|     20|  JDIMENSION end_row = start_row + num_rows;
 1016|     20|  JDIMENSION undef_row;
 1017|       |
 1018|       |  /* debugging check */
 1019|     20|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (1019:7): [True: 0, False: 20]
  |  Branch (1019:39): [True: 0, False: 20]
  ------------------
 1020|     20|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (1020:7): [True: 0, False: 20]
  ------------------
 1021|      0|    ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1022|       |
 1023|       |  /* Make the desired part of the virtual array accessible */
 1024|     20|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (1024:7): [True: 0, False: 20]
  ------------------
 1025|     20|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (1025:7): [True: 0, False: 20]
  ------------------
 1026|      0|    if (!ptr->b_s_open)
  ------------------
  |  Branch (1026:9): [True: 0, False: 0]
  ------------------
 1027|      0|      ERREXIT(cinfo, JERR_VIRTUAL_BUG);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1028|       |    /* Flush old buffer contents if necessary */
 1029|      0|    if (ptr->dirty) {
  ------------------
  |  Branch (1029:9): [True: 0, False: 0]
  ------------------
 1030|      0|      do_barray_io(cinfo, ptr, TRUE);
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
 1031|      0|      ptr->dirty = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1032|      0|    }
 1033|       |    /* Decide what part of virtual array to access.
 1034|       |     * Algorithm: if target address > current window, assume forward scan,
 1035|       |     * load starting at target address.  If target address < current window,
 1036|       |     * assume backward scan, load so that target area is top of window.
 1037|       |     * Note that when switching from forward write to forward read, will have
 1038|       |     * start_row = 0, so the limiting case applies and we load from 0 anyway.
 1039|       |     */
 1040|      0|    if (start_row > ptr->cur_start_row) {
  ------------------
  |  Branch (1040:9): [True: 0, False: 0]
  ------------------
 1041|      0|      ptr->cur_start_row = start_row;
 1042|      0|    } else {
 1043|       |      /* use long arithmetic here to avoid overflow & unsigned problems */
 1044|      0|      long ltemp;
 1045|       |
 1046|      0|      ltemp = (long)end_row - (long)ptr->rows_in_mem;
 1047|      0|      if (ltemp < 0)
  ------------------
  |  Branch (1047:11): [True: 0, False: 0]
  ------------------
 1048|      0|        ltemp = 0;              /* don't fall off front end of file */
 1049|      0|      ptr->cur_start_row = (JDIMENSION)ltemp;
 1050|      0|    }
 1051|       |    /* Read in the selected part of the array.
 1052|       |     * During the initial write pass, we will do no actual read
 1053|       |     * because the selected part is all undefined.
 1054|       |     */
 1055|      0|    do_barray_io(cinfo, ptr, FALSE);
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1056|      0|  }
 1057|       |  /* Ensure the accessed part of the array is defined; prezero if needed.
 1058|       |   * To improve locality of access, we only prezero the part of the array
 1059|       |   * that the caller is about to access, not the entire in-memory array.
 1060|       |   */
 1061|     20|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (1061:7): [True: 15, False: 5]
  ------------------
 1062|     15|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (1062:9): [True: 0, False: 15]
  ------------------
 1063|      0|      if (writable)             /* writer skipped over a section of array */
  ------------------
  |  Branch (1063:11): [True: 0, False: 0]
  ------------------
 1064|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1065|      0|      undef_row = start_row;    /* but reader is allowed to read ahead */
 1066|     15|    } else {
 1067|     15|      undef_row = ptr->first_undef_row;
 1068|     15|    }
 1069|     15|    if (writable)
  ------------------
  |  Branch (1069:9): [True: 15, False: 0]
  ------------------
 1070|     15|      ptr->first_undef_row = end_row;
 1071|     15|    if (ptr->pre_zero) {
  ------------------
  |  Branch (1071:9): [True: 15, False: 0]
  ------------------
 1072|     15|      size_t bytesperrow = (size_t)ptr->blocksperrow * sizeof(JBLOCK);
 1073|     15|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
 1074|     15|      end_row -= ptr->cur_start_row;
 1075|     35|      while (undef_row < end_row) {
  ------------------
  |  Branch (1075:14): [True: 20, False: 15]
  ------------------
 1076|     20|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
 1077|     20|        undef_row++;
 1078|     20|      }
 1079|     15|    } else {
 1080|      0|      if (!writable)            /* reader looking at undefined data */
  ------------------
  |  Branch (1080:11): [True: 0, False: 0]
  ------------------
 1081|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1082|      0|    }
 1083|     15|  }
 1084|       |  /* Flag the buffer dirty if caller will write in it */
 1085|     20|  if (writable)
  ------------------
  |  Branch (1085:7): [True: 20, False: 0]
  ------------------
 1086|     20|    ptr->dirty = TRUE;
  ------------------
  |  |  209|     20|#define TRUE    1
  ------------------
 1087|       |  /* Return address of proper part of the buffer */
 1088|     20|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1089|     20|}
jmemmgr.c:free_pool:
 1098|  2.52k|{
 1099|  2.52k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
 1100|  2.52k|  small_pool_ptr shdr_ptr;
 1101|  2.52k|  large_pool_ptr lhdr_ptr;
 1102|  2.52k|  size_t space_freed;
 1103|       |
 1104|  2.52k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  885|  2.52k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (1104:7): [True: 0, False: 2.52k]
  |  Branch (1104:22): [True: 0, False: 2.52k]
  ------------------
 1105|      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)))
  ------------------
 1106|       |
 1107|       |#ifdef MEM_STATS
 1108|       |  if (cinfo->err->trace_level > 1)
 1109|       |    print_mem_stats(cinfo, pool_id); /* print pool's memory usage statistics */
 1110|       |#endif
 1111|       |
 1112|       |  /* If freeing IMAGE pool, close any virtual arrays first */
 1113|  2.52k|  if (pool_id == JPOOL_IMAGE) {
  ------------------
  |  |  884|  2.52k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (1113:7): [True: 1.43k, False: 1.09k]
  ------------------
 1114|  1.43k|    jvirt_sarray_ptr sptr;
 1115|  1.43k|    jvirt_barray_ptr bptr;
 1116|       |
 1117|  1.43k|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1117:40): [True: 0, False: 1.43k]
  ------------------
 1118|      0|      if (sptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1118:11): [True: 0, False: 0]
  ------------------
 1119|      0|        sptr->b_s_open = FALSE; /* prevent recursive close if error */
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1120|      0|        (*sptr->b_s_info.close_backing_store) (cinfo, &sptr->b_s_info);
 1121|      0|      }
 1122|      0|    }
 1123|  1.43k|    mem->virt_sarray_list = NULL;
 1124|  1.44k|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1124:40): [True: 3, False: 1.43k]
  ------------------
 1125|      3|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1125:11): [True: 0, False: 3]
  ------------------
 1126|      0|        bptr->b_s_open = FALSE; /* prevent recursive close if error */
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1127|      0|        (*bptr->b_s_info.close_backing_store) (cinfo, &bptr->b_s_info);
 1128|      0|      }
 1129|      3|    }
 1130|  1.43k|    mem->virt_barray_list = NULL;
 1131|  1.43k|  }
 1132|       |
 1133|       |  /* Release large objects */
 1134|  2.52k|  lhdr_ptr = mem->large_list[pool_id];
 1135|  2.52k|  mem->large_list[pool_id] = NULL;
 1136|       |
 1137|  5.47k|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1137:10): [True: 2.94k, False: 2.52k]
  ------------------
 1138|  2.94k|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1139|  2.94k|    space_freed = lhdr_ptr->bytes_used +
 1140|  2.94k|                  lhdr_ptr->bytes_left +
 1141|  2.94k|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  2.94k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1142|  2.94k|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1143|  2.94k|    mem->total_space_allocated -= space_freed;
 1144|  2.94k|    lhdr_ptr = next_lhdr_ptr;
 1145|  2.94k|  }
 1146|       |
 1147|       |  /* Release small objects */
 1148|  2.52k|  shdr_ptr = mem->small_list[pool_id];
 1149|  2.52k|  mem->small_list[pool_id] = NULL;
 1150|       |
 1151|  4.86k|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1151:10): [True: 2.33k, False: 2.52k]
  ------------------
 1152|  2.33k|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1153|  2.33k|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1154|  2.33k|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  2.33k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1155|  2.33k|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1156|  2.33k|    mem->total_space_allocated -= space_freed;
 1157|  2.33k|    shdr_ptr = next_shdr_ptr;
 1158|  2.33k|  }
 1159|  2.52k|}
jmemmgr.c:self_destruct:
 1169|  1.09k|{
 1170|  1.09k|  int pool;
 1171|       |
 1172|       |  /* Close all backing store, release all memory.
 1173|       |   * Releasing pools in reverse order might help avoid fragmentation
 1174|       |   * with some (brain-damaged) malloc libraries.
 1175|       |   */
 1176|  3.27k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  885|  1.09k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  883|  3.27k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1176:35): [True: 2.18k, False: 1.09k]
  ------------------
 1177|  2.18k|    free_pool(cinfo, pool);
 1178|  2.18k|  }
 1179|       |
 1180|       |  /* Release the memory manager control block too. */
 1181|  1.09k|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1182|  1.09k|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1183|       |
 1184|  1.09k|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1185|  1.09k|}

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

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

jdiv_round_up:
   81|  15.7k|{
   82|  15.7k|  return (a + b - 1L) / b;
   83|  15.7k|}
jround_up:
   90|    326|{
   91|    326|  a += b - 1L;
   92|    326|  return a - (a % b);
   93|    326|}
jcopy_sample_rows:
  110|  7.85k|{
  111|  7.85k|  register _JSAMPROW inptr, outptr;
  112|  7.85k|  register size_t count = (size_t)(num_cols * sizeof(_JSAMPLE));
  113|  7.85k|  register int row;
  114|       |
  115|  7.85k|  input_array += source_row;
  116|  7.85k|  output_array += dest_row;
  117|       |
  118|  15.7k|  for (row = num_rows; row > 0; row--) {
  ------------------
  |  Branch (118:24): [True: 7.85k, False: 7.85k]
  ------------------
  119|  7.85k|    inptr = *input_array++;
  120|  7.85k|    outptr = *output_array++;
  121|  7.85k|    memcpy(outptr, inptr, count);
  122|  7.85k|  }
  123|  7.85k|}
jzero_far:
  144|  11.8k|{
  145|  11.8k|  memset(target, 0, bytestozero);
  146|  11.8k|}

jsimd_can_ycc_rgb:
  113|    160|{
  114|    160|  init_simd();
  115|       |
  116|       |  /* The code is optimised for these values only */
  117|    160|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|    160|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (117:7): [Folded - Ignored]
  ------------------
  118|      0|    return 0;
  119|    160|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (119:7): [Folded - Ignored]
  ------------------
  120|      0|    return 0;
  121|    160|  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
  ------------------
  |  |  298|    160|#define RGB_PIXELSIZE   3       /* JSAMPLEs per RGB scanline element */
  ------------------
                if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
  ------------------
  |  |  298|      0|#define RGB_PIXELSIZE   3       /* JSAMPLEs per RGB scanline element */
  ------------------
  |  Branch (121:7): [Folded - Ignored]
  |  Branch (121:31): [Folded - Ignored]
  ------------------
  122|      0|    return 0;
  123|       |
  124|    160|  if ((simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   28|    160|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (124:7): [True: 0, False: 160]
  ------------------
  125|    160|      IS_ALIGNED_AVX(jconst_ycc_rgb_convert_avx2))
  ------------------
  |  |   32|      0|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   29|      0|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (32:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  126|      0|    return 1;
  127|    160|  if ((simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   24|    160|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (127:7): [True: 0, False: 160]
  ------------------
  128|    160|      IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2))
  ------------------
  |  |   31|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   29|      0|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (31:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  129|      0|    return 1;
  130|       |
  131|    160|  return 0;
  132|    160|}
jsimd_can_h2v2_fancy_upsample:
  449|    320|{
  450|    320|  init_simd();
  451|       |
  452|       |  /* The code is optimised for these values only */
  453|    320|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|    320|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (453:7): [Folded - Ignored]
  ------------------
  454|      0|    return 0;
  455|    320|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (455:7): [Folded - Ignored]
  ------------------
  456|      0|    return 0;
  457|       |
  458|    320|  if ((simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   28|    320|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (458:7): [True: 0, False: 320]
  ------------------
  459|    320|      IS_ALIGNED_AVX(jconst_fancy_upsample_avx2))
  ------------------
  |  |   32|      0|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   29|      0|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (32:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  460|      0|    return 1;
  461|    320|  if ((simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   24|    320|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (461:7): [True: 0, False: 320]
  ------------------
  462|    320|      IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
  ------------------
  |  |   31|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   29|      0|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (31:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  463|      0|    return 1;
  464|       |
  465|    320|  return 0;
  466|    320|}
jsimd_can_idct_islow:
  931|  1.45k|{
  932|  1.45k|  init_simd();
  933|       |
  934|       |  /* The code is optimised for these values only */
  935|  1.45k|  if (DCTSIZE != 8)
  ------------------
  |  |   66|  1.45k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (935:7): [Folded - Ignored]
  ------------------
  936|      0|    return 0;
  937|  1.45k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (937:7): [Folded - Ignored]
  ------------------
  938|      0|    return 0;
  939|  1.45k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  1.45k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (939:7): [Folded - Ignored]
  ------------------
  940|      0|    return 0;
  941|  1.45k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (941:7): [Folded - Ignored]
  ------------------
  942|      0|    return 0;
  943|  1.45k|  if (sizeof(ISLOW_MULT_TYPE) != 2)
  ------------------
  |  Branch (943:7): [Folded - Ignored]
  ------------------
  944|      0|    return 0;
  945|       |
  946|  1.45k|  if ((simd_support & JSIMD_AVX2) && IS_ALIGNED_AVX(jconst_idct_islow_avx2))
  ------------------
  |  |   28|  1.45k|#define JSIMD_AVX2     0x80
  ------------------
                if ((simd_support & JSIMD_AVX2) && IS_ALIGNED_AVX(jconst_idct_islow_avx2))
  ------------------
  |  |   32|      0|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   29|      0|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (32:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (946:7): [True: 0, False: 1.45k]
  ------------------
  947|      0|    return 1;
  948|  1.45k|  if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2))
  ------------------
  |  |   24|  1.45k|#define JSIMD_SSE2     0x08
  ------------------
                if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2))
  ------------------
  |  |   31|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   29|      0|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (31:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (948:7): [True: 0, False: 1.45k]
  ------------------
  949|      0|    return 1;
  950|       |
  951|  1.45k|  return 0;
  952|  1.45k|}
jsimd.c:init_simd:
   42|  1.93k|{
   43|  1.93k|#ifndef NO_GETENV
   44|  1.93k|  char env[2] = { 0 };
   45|  1.93k|#endif
   46|       |
   47|  1.93k|  if (simd_support != ~0U)
  ------------------
  |  Branch (47:7): [True: 1.93k, False: 1]
  ------------------
   48|  1.93k|    return;
   49|       |
   50|      1|  simd_support = jpeg_simd_cpu_support();
   51|       |
   52|      1|#ifndef NO_GETENV
   53|       |  /* Force different settings through environment variables */
   54|      1|  if (!GETENV_S(env, 2, "JSIMD_FORCESSE2") && !strcmp(env, "1"))
  ------------------
  |  Branch (54:7): [True: 1, False: 0]
  |  Branch (54:47): [True: 0, False: 1]
  ------------------
   55|      0|    simd_support &= JSIMD_SSE2;
  ------------------
  |  |   24|      0|#define JSIMD_SSE2     0x08
  ------------------
   56|      1|  if (!GETENV_S(env, 2, "JSIMD_FORCEAVX2") && !strcmp(env, "1"))
  ------------------
  |  Branch (56:7): [True: 1, False: 0]
  |  Branch (56:47): [True: 0, False: 1]
  ------------------
   57|      0|    simd_support &= JSIMD_AVX2;
  ------------------
  |  |   28|      0|#define JSIMD_AVX2     0x80
  ------------------
   58|      1|  if (!GETENV_S(env, 2, "JSIMD_FORCENONE") && !strcmp(env, "1"))
  ------------------
  |  Branch (58:7): [True: 1, False: 0]
  |  Branch (58:47): [True: 1, False: 0]
  ------------------
   59|      1|    simd_support = 0;
   60|      1|  if (!GETENV_S(env, 2, "JSIMD_NOHUFFENC") && !strcmp(env, "1"))
  ------------------
  |  Branch (60:7): [True: 1, False: 0]
  |  Branch (60:47): [True: 0, False: 1]
  ------------------
   61|      0|    simd_huffman = 0;
   62|      1|#endif
   63|      1|}

_ZN10FuzzHelperC2EPKhm:
   48|  3.33k|{
   49|  3.33k|}
_ZN10FuzzHelper7getQpdfEv:
   53|  3.33k|{
   54|  3.33k|    auto is =
   55|  3.33k|        std::shared_ptr<InputSource>(new BufferInputSource("fuzz input", &this->input_buffer));
   56|  3.33k|    auto qpdf = QPDF::create();
   57|  3.33k|    qpdf->setMaxWarnings(200);
   58|  3.33k|    qpdf->processInputSource(is);
   59|  3.33k|    return qpdf;
   60|  3.33k|}
_ZN10FuzzHelper9getWriterENSt3__110shared_ptrI4QPDFEE:
   64|  2.01k|{
   65|  2.01k|    auto w = std::make_shared<QPDFWriter>(*qpdf);
   66|  2.01k|    w->setOutputPipeline(&this->discard);
   67|  2.01k|    w->setDecodeLevel(qpdf_dl_all);
   68|  2.01k|    return w;
   69|  2.01k|}
_ZN10FuzzHelper7doWriteENSt3__110shared_ptrI10QPDFWriterEE:
   73|  2.00k|{
   74|  2.00k|    try {
   75|  2.00k|        w->write();
   76|  2.00k|    } catch (QPDFExc const& e) {
   77|    535|        std::cerr << e.what() << std::endl;
   78|    535|    } catch (std::runtime_error const& e) {
   79|     53|        std::cerr << e.what() << std::endl;
   80|     53|    }
   81|  2.00k|}
_ZN10FuzzHelper9testWriteEv:
   85|  3.33k|{
   86|       |    // Write in various ways to exercise QPDFWriter
   87|       |
   88|  3.33k|    std::shared_ptr<QPDF> q;
   89|  3.33k|    std::shared_ptr<QPDFWriter> w;
   90|       |
   91|  3.33k|    q = getQpdf();
   92|  3.33k|    w = getWriter(q);
   93|  3.33k|    w->setDeterministicID(true);
   94|  3.33k|    w->setObjectStreamMode(qpdf_o_generate);
   95|  3.33k|    w->setLinearization(true);
   96|  3.33k|    doWrite(w);
   97|  3.33k|}
_ZN10FuzzHelper8doChecksEv:
  101|  3.33k|{
  102|       |    // Limit the memory used to decompress JPEG files during fuzzing. Excessive memory use during
  103|       |    // fuzzing is due to corrupt JPEG data which sometimes cannot be detected before
  104|       |    // jpeg_start_decompress is called. During normal use of qpdf very large JPEGs can occasionally
  105|       |    // occur legitimately and therefore must be allowed during normal operations.
  106|  3.33k|    Pl_DCT::setMemoryLimit(100'000'000);
  107|  3.33k|    Pl_DCT::setScanLimit(50);
  108|       |
  109|  3.33k|    Pl_PNGFilter::setMemoryLimit(1'000'000);
  110|  3.33k|    Pl_TIFFPredictor::setMemoryLimit(1'000'000);
  111|  3.33k|    Pl_Flate::setMemoryLimit(1'000'000);
  112|       |
  113|       |    // Do not decompress corrupt data. This may cause extended runtime within jpeglib without
  114|       |    // exercising additional code paths in qpdf, and potentially causing counterproductive timeouts.
  115|  3.33k|    Pl_DCT::setThrowOnCorruptData(true);
  116|       |
  117|       |    // Get as much coverage as possible in parts of the library that
  118|       |    // might benefit from fuzzing.
  119|  3.33k|    std::cerr << "\ninfo: starting testWrite\n";
  120|  3.33k|    testWrite();
  121|  3.33k|}
_ZN10FuzzHelper3runEv:
  125|  3.33k|{
  126|       |    // The goal here is that you should be able to throw anything at
  127|       |    // libqpdf and it will respond without any memory errors and never
  128|       |    // do anything worse than throwing a QPDFExc or
  129|       |    // std::runtime_error. Throwing any other kind of exception,
  130|       |    // segfaulting, or having a memory error (when built with
  131|       |    // appropriate sanitizers) will all cause abnormal exit.
  132|  3.33k|    try {
  133|  3.33k|        doChecks();
  134|  3.33k|    } catch (QPDFExc const& e) {
  135|  1.31k|        std::cerr << "QPDFExc: " << e.what() << std::endl;
  136|  1.31k|    } catch (std::runtime_error const& e) {
  137|     16|        std::cerr << "runtime_error: " << e.what() << std::endl;
  138|     16|    }
  139|  3.33k|}
LLVMFuzzerTestOneInput:
  143|  3.33k|{
  144|  3.33k|#ifndef _WIN32
  145|       |    // Used by jpeg library to work around false positives in memory
  146|       |    // sanitizer.
  147|  3.33k|    setenv("JSIMD_FORCENONE", "1", 1);
  148|  3.33k|#endif
  149|  3.33k|    FuzzHelper f(data, size);
  150|  3.33k|    f.run();
  151|  3.33k|    return 0;
  152|  3.33k|}

_ZN11InputSourceC2Ev:
   37|  10.9k|    {
   38|  10.9k|    }
_ZN11InputSource10loadBufferEv:
  116|  1.49M|{
  117|  1.49M|    this->buf_idx = 0;
  118|  1.49M|    this->buf_len = qpdf_offset_t(read(this->buffer, this->buf_size));
  119|       |    // NB read sets last_offset
  120|  1.49M|    this->buf_start = this->last_offset;
  121|  1.49M|}
_ZN11InputSource8fastTellEv:
  125|  10.2M|{
  126|  10.2M|    if (this->buf_len == 0) {
  ------------------
  |  Branch (126:9): [True: 15.9k, False: 10.1M]
  ------------------
  127|  15.9k|        loadBuffer();
  128|  10.1M|    } else {
  129|  10.1M|        auto curr = tell();
  130|  10.1M|        if (curr < this->buf_start || curr >= (this->buf_start + this->buf_len)) {
  ------------------
  |  Branch (130:13): [True: 67.0k, False: 10.1M]
  |  Branch (130:39): [True: 1.41M, False: 8.71M]
  ------------------
  131|  1.48M|            loadBuffer();
  132|  8.71M|        } else {
  133|  8.71M|            this->last_offset = curr;
  134|  8.71M|            this->buf_idx = curr - this->buf_start;
  135|  8.71M|        }
  136|  10.1M|    }
  137|  10.2M|    return this->last_offset;
  138|  10.2M|}
_ZN11InputSource8fastReadERc:
  142|   143M|{
  143|       |    // Before calling fastRead, fastTell must be called to prepare the buffer. Once reading is
  144|       |    // complete, fastUnread must be called to set the correct file position.
  145|   143M|    if (this->buf_idx < this->buf_len) {
  ------------------
  |  Branch (145:9): [True: 142M, False: 981k]
  ------------------
  146|   142M|        ch = this->buffer[this->buf_idx];
  147|   142M|        ++(this->buf_idx);
  148|   142M|        ++(this->last_offset);
  149|   142M|        return true;
  150|       |
  151|   142M|    } else if (this->buf_len == 0) {
  ------------------
  |  Branch (151:16): [True: 12.3k, False: 969k]
  ------------------
  152|  12.3k|        return false;
  153|   969k|    } else {
  154|   969k|        seek(this->buf_start + this->buf_len, SEEK_SET);
  155|   969k|        fastTell();
  156|   969k|        return fastRead(ch);
  157|   969k|    }
  158|   143M|}
_ZN11InputSource10fastUnreadEb:
  162|  9.24M|{
  163|  9.24M|    this->last_offset -= back ? 1 : 0;
  ------------------
  |  Branch (163:26): [True: 7.53M, False: 1.71M]
  ------------------
  164|  9.24M|    seek(this->last_offset, SEEK_SET);
  165|  9.24M|}
_ZN11InputSourceD2Ev:
   40|  10.9k|    virtual ~InputSource() = default;
_ZN11InputSource6FinderC2Ev:
   46|  14.4k|        Finder() = default;
_ZN11InputSource6FinderD2Ev:
   48|  14.4k|        virtual ~Finder() = default;

_ZN8PipelineD2Ev:
   53|   370k|    virtual ~Pipeline() = default;

_ZN9Pl_Buffer7MembersC2Ev:
   81|  96.4k|        Members() = default;
_ZN9Pl_Buffer7MembersD2Ev:
   78|  96.4k|        ~Members() = default;

_ZN6Pl_DCT7MembersD2Ev:
   86|  1.11k|        ~Members() = default;

_ZN12Pl_RunLength7MembersD2Ev:
   55|  1.47k|        ~Members() = default;

_ZN5QIntC9to_offsetImEExRKT_:
  221|  17.9M|    {
  222|  17.9M|        return IntConverter<T, qpdf_offset_t>::convert(i);
  223|  17.9M|    }
_ZN5QIntC12IntConverterImxLb0ELb1EE7convertERKm:
  146|  17.9M|        {
  147|       |            // From is unsigned, and to is signed. Convert To's max to the
  148|       |            // unsigned version of To and compare i against that.
  149|  17.9M|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  150|  17.9M|            if (i > maxval) {
  ------------------
  |  Branch (150:17): [True: 0, False: 17.9M]
  ------------------
  151|      0|                error(i);
  152|      0|            }
  153|  17.9M|            return static_cast<To>(i);
  154|  17.9M|        }
_ZN5QIntC11range_checkIxEEvRKT_S3_:
  273|   194k|    {
  274|   194k|        if ((delta > 0) != (cur > 0)) {
  ------------------
  |  Branch (274:13): [True: 149k, False: 45.1k]
  ------------------
  275|   149k|            return;
  276|   149k|        }
  277|  45.1k|        QIntC::range_check_error<T>(cur, delta);
  278|  45.1k|    }
_ZN5QIntC17range_check_errorIxEEvRKT_S3_:
  256|  45.1k|    {
  257|  45.1k|        if ((delta > 0) && ((std::numeric_limits<T>::max() - cur) < delta)) {
  ------------------
  |  Branch (257:13): [True: 45.1k, False: 0]
  |  Branch (257:28): [True: 0, False: 45.1k]
  ------------------
  258|      0|            std::ostringstream msg;
  259|      0|            msg.imbue(std::locale::classic());
  260|      0|            msg << "adding " << delta << " to " << cur << " would cause an integer overflow";
  261|      0|            throw std::range_error(msg.str());
  262|  45.1k|        } else if ((delta < 0) && ((std::numeric_limits<T>::min() - cur) > delta)) {
  ------------------
  |  Branch (262:20): [True: 0, False: 45.1k]
  |  Branch (262:35): [True: 0, False: 0]
  ------------------
  263|      0|            std::ostringstream msg;
  264|      0|            msg.imbue(std::locale::classic());
  265|      0|            msg << "adding " << delta << " to " << cur << " would cause an integer underflow";
  266|      0|            throw std::range_error(msg.str());
  267|      0|        }
  268|  45.1k|    }
_ZN5QIntC7to_sizeIxEEmRKT_:
  214|  2.18M|    {
  215|  2.18M|        return IntConverter<T, size_t>::convert(i);
  216|  2.18M|    }
_ZN5QIntC12IntConverterIxmLb1ELb0EE7convertERKx:
  118|  2.18M|        {
  119|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  120|       |            // convert it to the corresponding unsigned type and to
  121|       |            // compare with To's max.
  122|  2.18M|            auto ii = static_cast<typename to_u<From>::type>(i);
  123|  2.18M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (123:17): [True: 0, False: 2.18M]
  |  Branch (123:28): [True: 0, False: 2.18M]
  ------------------
  124|      0|                error(i);
  125|      0|            }
  126|  2.18M|            return static_cast<To>(i);
  127|  2.18M|        }
_ZN5QIntC7to_sizeIlEEmRKT_:
  214|   304k|    {
  215|   304k|        return IntConverter<T, size_t>::convert(i);
  216|   304k|    }
_ZN5QIntC12IntConverterIlmLb1ELb0EE7convertERKl:
  118|   304k|        {
  119|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  120|       |            // convert it to the corresponding unsigned type and to
  121|       |            // compare with To's max.
  122|   304k|            auto ii = static_cast<typename to_u<From>::type>(i);
  123|   304k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (123:17): [True: 0, False: 304k]
  |  Branch (123:28): [True: 0, False: 304k]
  ------------------
  124|      0|                error(i);
  125|      0|            }
  126|   304k|            return static_cast<To>(i);
  127|   304k|        }
_ZN5QIntC7to_uintIiEEjRKT_:
  207|  1.39k|    {
  208|  1.39k|        return IntConverter<T, unsigned int>::convert(i);
  209|  1.39k|    }
_ZN5QIntC12IntConverterIijLb1ELb0EE7convertERKi:
  118|  1.39k|        {
  119|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  120|       |            // convert it to the corresponding unsigned type and to
  121|       |            // compare with To's max.
  122|  1.39k|            auto ii = static_cast<typename to_u<From>::type>(i);
  123|  1.39k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (123:17): [True: 0, False: 1.39k]
  |  Branch (123:28): [True: 0, False: 1.39k]
  ------------------
  124|      0|                error(i);
  125|      0|            }
  126|  1.39k|            return static_cast<To>(i);
  127|  1.39k|        }
_ZN5QIntC7to_sizeIjEEmRKT_:
  214|  66.1k|    {
  215|  66.1k|        return IntConverter<T, size_t>::convert(i);
  216|  66.1k|    }
_ZN5QIntC12IntConverterIjmLb0ELb0EE7convertERKj:
   68|  66.1k|        {
   69|       |            // From and To are both unsigned.
   70|  66.1k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (70:17): [True: 0, False: 66.1k]
  ------------------
   71|      0|                error(i);
   72|      0|            }
   73|  66.1k|            return static_cast<To>(i);
   74|  66.1k|        }
_ZN5QIntC7to_sizeIiEEmRKT_:
  214|   886k|    {
  215|   886k|        return IntConverter<T, size_t>::convert(i);
  216|   886k|    }
_ZN5QIntC12IntConverterIimLb1ELb0EE7convertERKi:
  118|   886k|        {
  119|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  120|       |            // convert it to the corresponding unsigned type and to
  121|       |            // compare with To's max.
  122|   886k|            auto ii = static_cast<typename to_u<From>::type>(i);
  123|   886k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (123:17): [True: 0, False: 886k]
  |  Branch (123:28): [True: 0, False: 886k]
  ------------------
  124|      0|                error(i);
  125|      0|            }
  126|   886k|            return static_cast<To>(i);
  127|   886k|        }
_ZN5QIntC7to_uintImEEjRKT_:
  207|  5.05M|    {
  208|  5.05M|        return IntConverter<T, unsigned int>::convert(i);
  209|  5.05M|    }
_ZN5QIntC12IntConverterImjLb0ELb0EE7convertERKm:
   68|  5.05M|        {
   69|       |            // From and To are both unsigned.
   70|  5.05M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (70:17): [True: 0, False: 5.05M]
  ------------------
   71|      0|                error(i);
   72|      0|            }
   73|  5.05M|            return static_cast<To>(i);
   74|  5.05M|        }
_ZN5QIntC8to_ulongImEEmRKT_:
  235|  4.21M|    {
  236|  4.21M|        return IntConverter<T, unsigned long>::convert(i);
  237|  4.21M|    }
_ZN5QIntC12IntConverterImmLb0ELb0EE7convertERKm:
   68|  4.21M|        {
   69|       |            // From and To are both unsigned.
   70|  4.21M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (70:17): [True: 0, False: 4.21M]
  ------------------
   71|      0|                error(i);
   72|      0|            }
   73|  4.21M|            return static_cast<To>(i);
   74|  4.21M|        }
_ZN5QIntC6to_intIlEEiRKT_:
  200|    345|    {
  201|    345|        return IntConverter<T, int>::convert(i);
  202|    345|    }
_ZN5QIntC12IntConverterIliLb1ELb1EE7convertERKl:
   93|    345|        {
   94|       |            // From and To are both signed.
   95|    345|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (95:17): [True: 0, False: 345]
  |  Branch (95:57): [True: 0, False: 345]
  ------------------
   96|      0|                error(i);
   97|      0|            }
   98|    345|            return static_cast<To>(i);
   99|    345|        }
_ZN5QIntC6to_intIxEEiRKT_:
  200|  1.87M|    {
  201|  1.87M|        return IntConverter<T, int>::convert(i);
  202|  1.87M|    }
_ZN5QIntC12IntConverterIxiLb1ELb1EE7convertERKx:
   93|  1.87M|        {
   94|       |            // From and To are both signed.
   95|  1.87M|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (95:17): [True: 4, False: 1.87M]
  |  Branch (95:57): [True: 87, False: 1.87M]
  ------------------
   96|     91|                error(i);
   97|     91|            }
   98|  1.87M|            return static_cast<To>(i);
   99|  1.87M|        }
_ZN5QIntC12IntConverterIxiLb1ELb1EE5errorEx:
  103|     91|        {
  104|     91|            std::ostringstream msg;
  105|     91|            msg.imbue(std::locale::classic());
  106|     91|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  107|     91|                << "-byte signed type to a " << sizeof(To) << "-byte signed type";
  108|     91|            throw std::range_error(msg.str());
  109|     91|        }
_ZN5QIntC7to_sizeIyEEmRKT_:
  214|  45.1k|    {
  215|  45.1k|        return IntConverter<T, size_t>::convert(i);
  216|  45.1k|    }
_ZN5QIntC12IntConverterIymLb0ELb0EE7convertERKy:
   68|  45.1k|        {
   69|       |            // From and To are both unsigned.
   70|  45.1k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (70:17): [True: 0, False: 45.1k]
  ------------------
   71|      0|                error(i);
   72|      0|            }
   73|  45.1k|            return static_cast<To>(i);
   74|  45.1k|        }
_ZN5QIntC6to_intImEEiRKT_:
  200|  93.0k|    {
  201|  93.0k|        return IntConverter<T, int>::convert(i);
  202|  93.0k|    }
_ZN5QIntC12IntConverterImiLb0ELb1EE7convertERKm:
  146|  93.0k|        {
  147|       |            // From is unsigned, and to is signed. Convert To's max to the
  148|       |            // unsigned version of To and compare i against that.
  149|  93.0k|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  150|  93.0k|            if (i > maxval) {
  ------------------
  |  Branch (150:17): [True: 2, False: 92.9k]
  ------------------
  151|      2|                error(i);
  152|      2|            }
  153|  93.0k|            return static_cast<To>(i);
  154|  93.0k|        }
_ZN5QIntC12IntConverterImiLb0ELb1EE5errorEm:
  158|      2|        {
  159|      2|            std::ostringstream msg;
  160|      2|            msg.imbue(std::locale::classic());
  161|      2|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  162|      2|                << "-byte unsigned type to a " << sizeof(To) << "-byte signed type";
  163|      2|            throw std::range_error(msg.str());
  164|      2|        }
_ZN5QIntC11to_longlongImEExRKT_:
  242|  6.08k|    {
  243|  6.08k|        return IntConverter<T, long long>::convert(i);
  244|  6.08k|    }
_ZN5QIntC7to_sizeImEEmRKT_:
  214|  1.96k|    {
  215|  1.96k|        return IntConverter<T, size_t>::convert(i);
  216|  1.96k|    }
_ZN5QIntC12to_ulonglongIxEEyRKT_:
  249|   142k|    {
  250|   142k|        return IntConverter<T, unsigned long long>::convert(i);
  251|   142k|    }
_ZN5QIntC12IntConverterIxyLb1ELb0EE7convertERKx:
  118|   142k|        {
  119|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  120|       |            // convert it to the corresponding unsigned type and to
  121|       |            // compare with To's max.
  122|   142k|            auto ii = static_cast<typename to_u<From>::type>(i);
  123|   142k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (123:17): [True: 0, False: 142k]
  |  Branch (123:28): [True: 0, False: 142k]
  ------------------
  124|      0|                error(i);
  125|      0|            }
  126|   142k|            return static_cast<To>(i);
  127|   142k|        }
_ZN5QIntC12to_ulonglongIiEEyRKT_:
  249|   158k|    {
  250|   158k|        return IntConverter<T, unsigned long long>::convert(i);
  251|   158k|    }
_ZN5QIntC12IntConverterIiyLb1ELb0EE7convertERKi:
  118|   158k|        {
  119|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  120|       |            // convert it to the corresponding unsigned type and to
  121|       |            // compare with To's max.
  122|   158k|            auto ii = static_cast<typename to_u<From>::type>(i);
  123|   158k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (123:17): [True: 0, False: 158k]
  |  Branch (123:28): [True: 0, False: 158k]
  ------------------
  124|      0|                error(i);
  125|      0|            }
  126|   158k|            return static_cast<To>(i);
  127|   158k|        }

_ZN4QPDF6Writer8optimizeERS_RKN10QPDFWriter8ObjTableENSt3__18functionIFiR16QPDFObjectHandleEEE:
  739|  1.94k|        {
  740|  1.94k|            return qpdf.optimize(obj, skip_stream_parameters);
  741|  1.94k|        }
_ZN4QPDF6Writer18getLinearizedPartsERS_RKN10QPDFWriter8ObjTableERNSt3__16vectorI16QPDFObjectHandleNS6_9allocatorIS8_EEEESC_SC_SC_SC_:
  752|  1.91k|        {
  753|  1.91k|            qpdf.getLinearizedParts(obj, part4, part6, part7, part8, part9);
  754|  1.91k|        }
_ZN4QPDF6Writer18generateHintStreamERS_RKN10QPDFWriter11NewObjTableERKNS2_8ObjTableERNSt3__110shared_ptrI6BufferEERiSE_b:
  765|  1.43k|        {
  766|  1.43k|            return qpdf.generateHintStream(new_obj, obj, hint_stream, S, O, compressed);
  767|  1.43k|        }
_ZN4QPDF6Writer22getCompressibleObjGensERS_:
  771|  2.00k|        {
  772|  2.00k|            return qpdf.getCompressibleObjVector();
  773|  2.00k|        }
_ZN4QPDF6Writer9tableSizeERS_:
  789|  1.96k|        {
  790|  1.96k|            return qpdf.tableSize();
  791|  1.96k|        }
_ZN4QPDF8Resolver8resolvedEPS_10QPDFObjGen:
  804|  92.4k|        {
  805|  92.4k|            return qpdf->resolve(og);
  806|  92.4k|        }
_ZN4QPDF10ParseGuardC2EPS_:
  831|   172k|        {
  832|   172k|            if (qpdf) {
  ------------------
  |  Branch (832:17): [True: 170k, False: 2.43k]
  ------------------
  833|   170k|                qpdf->inParse(true);
  834|   170k|            }
  835|   172k|        }
_ZN4QPDF10ParseGuard9getObjectEPS_iib:
  839|   381k|        {
  840|   381k|            return qpdf->getObjectForParser(id, gen, parse_pdf);
  841|   381k|        }
_ZN4QPDF10ParseGuardD2Ev:
  844|   172k|        {
  845|   172k|            if (qpdf) {
  ------------------
  |  Branch (845:17): [True: 170k, False: 2.43k]
  ------------------
  846|   170k|                qpdf->inParse(false);
  847|   170k|            }
  848|   172k|        }
_ZN4QPDF4Pipe14pipeStreamDataEPS_RK10QPDFObjGenxm16QPDFObjectHandleP8Pipelinebb:
  868|  83.3k|        {
  869|  83.3k|            return qpdf->pipeStreamData(
  870|  83.3k|                og, offset, length, dict, pipeline, suppress_warnings, will_retry);
  871|  83.3k|        }
_ZN4QPDF8ObjCacheC2Ev:
  907|  33.3k|        {
  908|  33.3k|        }
_ZN4QPDF8ObjCacheC2ENSt3__110shared_ptrI10QPDFObjectEExx:
  916|   189k|        {
  917|   189k|        }
_ZN4QPDF15ResolveRecorderC2EPS_RK10QPDFObjGen:
 1019|   155k|        {
 1020|   155k|        }
_ZN4QPDF15ResolveRecorderD2Ev:
 1022|   155k|        {
 1023|   155k|            this->qpdf->m->resolving.erase(iter);
 1024|   155k|        }
_ZN4QPDF19CHSharedObjectEntryC2Ei:
 1325|  6.45k|        {
 1326|  6.45k|        }
_ZN4QPDF13PatternFinderC2ERS_MS_FbvE:
 1384|  14.4k|        {
 1385|  14.4k|        }
_ZN4QPDF13PatternFinder5checkEv:
 1389|  14.4k|        {
 1390|  14.4k|            return (this->qpdf.*checker)();
 1391|  14.4k|        }
_ZN4QPDF7MembersD2Ev:
 1500|  3.33k|        ~Members() = default;
_ZN4QPDF3toOImEExRKT_:
 1471|  2.91M|    {
 1472|  2.91M|        return QIntC::to_offset(i);
 1473|  2.91M|    }
_ZN4QPDF3toIIlEEiRKT_:
 1483|    345|    {
 1484|    345|        return QIntC::to_int(i);
 1485|    345|    }
_ZN4QPDF3toIIxEEiRKT_:
 1483|   179k|    {
 1484|   179k|        return QIntC::to_int(i);
 1485|   179k|    }
_ZN4QPDF3toSIiEEmRKT_:
 1477|   426k|    {
 1478|   426k|        return QIntC::to_size(i);
 1479|   426k|    }
_ZN4QPDF3toSIyEEmRKT_:
 1477|  45.1k|    {
 1478|  45.1k|        return QIntC::to_size(i);
 1479|  45.1k|    }
_ZN4QPDF3toSIxEEmRKT_:
 1477|  7.51k|    {
 1478|  7.51k|        return QIntC::to_size(i);
 1479|  7.51k|    }
_ZN4QPDF3toIImEEiRKT_:
 1483|  80.4k|    {
 1484|  80.4k|        return QIntC::to_int(i);
 1485|  80.4k|    }
_ZN4QPDF5toULLIxEEyRKT_:
 1489|  3.46k|    {
 1490|  3.46k|        return QIntC::to_ulonglong(i);
 1491|  3.46k|    }
_ZN4QPDF5toULLIiEEyRKT_:
 1489|  1.43k|    {
 1490|  1.43k|        return QIntC::to_ulonglong(i);
 1491|  1.43k|    }

_ZN14QPDFCryptoImplC2Ev:
   39|  94.6k|    QPDFCryptoImpl() = default;
_ZN14QPDFCryptoImplD2Ev:
   42|  94.6k|    virtual ~QPDFCryptoImpl() = default;

_ZN18QPDFCryptoProviderD2Ev:
   67|      1|    ~QPDFCryptoProvider() = default;
_ZN18QPDFCryptoProvider7MembersC2Ev:
   83|      1|        Members() = default;
_ZN18QPDFCryptoProvider7MembersD2Ev:
   85|      1|        ~Members() = default;

_ZN7QPDFExcD2Ev:
   40|   812k|    ~QPDFExc() noexcept override = default;

_ZN10QPDFObjGenC2Ev:
   38|  4.76M|    {
   39|  4.76M|    }
_ZN10QPDFObjGenC2Eii:
   44|  1.35M|    {
   45|  1.35M|    }
_ZNK10QPDFObjGenltERKS_:
   49|  43.9M|    {
   50|  43.9M|        return (obj < rhs.obj) || ((obj == rhs.obj) && (gen < rhs.gen));
  ------------------
  |  Branch (50:16): [True: 22.7M, False: 21.1M]
  |  Branch (50:36): [True: 5.93M, False: 15.2M]
  |  Branch (50:56): [True: 5.78k, False: 5.93M]
  ------------------
   51|  43.9M|    }
_ZNK10QPDFObjGeneqERKS_:
   55|   389k|    {
   56|   389k|        return (obj == rhs.obj) && (gen == rhs.gen);
  ------------------
  |  Branch (56:16): [True: 2.87k, False: 386k]
  |  Branch (56:36): [True: 2.87k, False: 2]
  ------------------
   57|   389k|    }
_ZNK10QPDFObjGenneERKS_:
   61|   145k|    {
   62|   145k|        return (obj != rhs.obj) || (gen != rhs.gen);
  ------------------
  |  Branch (62:16): [True: 6, False: 145k]
  |  Branch (62:36): [True: 2, False: 145k]
  ------------------
   63|   145k|    }
_ZNK10QPDFObjGen6getObjEv:
   67|  8.33M|    {
   68|  8.33M|        return obj;
   69|  8.33M|    }
_ZNK10QPDFObjGen6getGenEv:
   73|   246k|    {
   74|   246k|        return gen;
   75|   246k|    }
_ZNK10QPDFObjGen10isIndirectEv:
   79|  1.93M|    {
   80|  1.93M|        return obj != 0;
   81|  1.93M|    }
_ZN10QPDFObjGen3set3addES_:
  113|   248k|        {
  114|   248k|            if (og.isIndirect()) {
  ------------------
  |  Branch (114:17): [True: 248k, False: 10]
  ------------------
  115|   248k|                if (count(og) > 0) {
  ------------------
  |  Branch (115:21): [True: 60.3k, False: 188k]
  ------------------
  116|  60.3k|                    return false;
  117|  60.3k|                }
  118|   188k|                emplace(og);
  119|   188k|            }
  120|   188k|            return true;
  121|   248k|        }

_ZN16QPDFObjectHandle9RectangleC2Edddd:
  249|  2.24k|        {
  250|  2.24k|        }
_ZN16QPDFObjectHandle16DisconnectAccess10disconnectES_:
 1271|   737k|        {
 1272|   737k|            o.disconnect();
 1273|   737k|        }
_ZN16QPDFObjectHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
 1337|  3.64M|    {
 1338|  3.64M|    }
_ZN16QPDFObjectHandle6getObjEv:
 1341|   164k|    {
 1342|   164k|        return obj;
 1343|   164k|    }
_ZNK16QPDFObjectHandle6getObjEv:
 1346|  25.4k|    {
 1347|  25.4k|        return obj;
 1348|  25.4k|    }
_ZNK16QPDFObjectHandle12getObjectPtrEv:
 1356|  49.2k|    {
 1357|  49.2k|        return obj.get();
 1358|  49.2k|    }
_ZNK16QPDFObjectHandle14QPDFArrayItems8iteratorneERKS1_:
 1575|  36.5k|        {
 1576|  36.5k|            return !operator==(other);
 1577|  36.5k|        }
_ZNK16QPDFObjectHandle11getObjectIDEv:
 1615|  6.43M|{
 1616|  6.43M|    return getObjGen().getObj();
 1617|  6.43M|}
_ZNK16QPDFObjectHandle10isIndirectEv:
 1627|  4.50M|{
 1628|  4.50M|    return (obj != nullptr) && (getObjectID() != 0);
  ------------------
  |  Branch (1628:12): [True: 4.50M, False: 0]
  |  Branch (1628:32): [True: 967k, False: 3.53M]
  ------------------
 1629|  4.50M|}
_ZNK16QPDFObjectHandle13isInitializedEv:
 1633|  12.4M|{
 1634|  12.4M|    return obj != nullptr;
 1635|  12.4M|}
_ZN16QPDFObjectHandleC2ERKS_:
  294|  20.6M|    QPDFObjectHandle(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandleaSERKS_:
  296|   568k|    QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle15StringDecrypterD2Ev:
  202|   145k|        virtual ~StringDecrypter() = default;
_ZN16QPDFObjectHandleC2Ev:
  292|   374k|    QPDFObjectHandle() = default;
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorD2Ev:
 1545|  4.56k|        virtual ~iterator() = default;

_ZN16QPDFStreamFilterC2Ev:
   30|  52.8k|    QPDFStreamFilter() = default;
_ZN16QPDFStreamFilterD2Ev:
   33|  52.8k|    virtual ~QPDFStreamFilter() = default;

_ZN13QPDFTokenizer5TokenC2Ev:
   63|  4.61M|        {
   64|  4.61M|        }
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES8_S8_:
   76|  4.61M|        {
   77|  4.61M|        }
_ZNK13QPDFTokenizer5Token7getTypeEv:
   80|  4.61M|        {
   81|  4.61M|            return this->type;
   82|  4.61M|        }
_ZNK13QPDFTokenizer5Token8getValueEv:
   85|  3.73M|        {
   86|  3.73M|            return this->value;
   87|  3.73M|        }
_ZNK13QPDFTokenizer5Token9isIntegerEv:
  107|  3.76M|        {
  108|  3.76M|            return this->type == tt_integer;
  109|  3.76M|        }
_ZNK13QPDFTokenizer5Token6isWordERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  117|  1.85M|        {
  118|  1.85M|            return this->type == tt_word && this->value == value;
  ------------------
  |  Branch (118:20): [True: 1.12M, False: 729k]
  |  Branch (118:45): [True: 636k, False: 488k]
  ------------------
  119|  1.85M|        }
_ZNK13QPDFTokenizer7getTypeEv:
  300|  5.68M|{
  301|  5.68M|    return this->type;
  302|  5.68M|}
_ZNK13QPDFTokenizer8getValueEv:
  305|  3.59M|{
  306|  3.59M|    return (this->type == tt_name || this->type == tt_string) ? this->val : this->raw_val;
  ------------------
  |  Branch (306:13): [True: 1.75M, False: 1.83M]
  |  Branch (306:38): [True: 35.8k, False: 1.80M]
  ------------------
  307|  3.59M|}
_ZNK13QPDFTokenizer15getErrorMessageEv:
  315|  12.5k|{
  316|  12.5k|    return this->error_message;
  317|  12.5k|}

_ZN10QPDFWriterD2Ev:
   74|  2.00k|    ~QPDFWriter() = default;
_ZN10QPDFWriter14PipelinePopperC2EPS_PNSt3__110shared_ptrI6BufferEE:
  470|   156k|        {
  471|   156k|        }

_ZN13QPDFXRefEntryC2Ex:
   43|   366k|    {
   44|   366k|    }
_ZN13QPDFXRefEntryC2Eii:
   51|   156k|    {
   52|   156k|    }

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

_ZN5QUtil8is_spaceEc:
  499|  21.2M|{
  500|  21.2M|    return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v';
  ------------------
  |  Branch (500:12): [True: 9.86M, False: 11.4M]
  |  Branch (500:25): [True: 963k, False: 10.4M]
  |  Branch (500:39): [True: 573k, False: 9.87M]
  |  Branch (500:53): [True: 23.8k, False: 9.85M]
  |  Branch (500:67): [True: 28.3k, False: 9.82M]
  |  Branch (500:81): [True: 379k, False: 9.44M]
  ------------------
  501|  21.2M|}
_ZN5QUtil8is_digitEc:
  505|  8.20M|{
  506|  8.20M|    return ((ch >= '0') && (ch <= '9'));
  ------------------
  |  Branch (506:13): [True: 5.32M, False: 2.87M]
  |  Branch (506:28): [True: 5.27M, False: 53.0k]
  ------------------
  507|  8.20M|}
_ZN5QUtil15hex_encode_charEc:
  539|   204k|{
  540|   204k|    static auto constexpr hexchars = "0123456789abcdef";
  541|   204k|    return {'#', hexchars[static_cast<unsigned char>(c) >> 4], hexchars[c & 0x0f]};
  542|   204k|}
_ZN5QUtil15hex_decode_charEc:
  546|   752k|{
  547|   752k|    return digit <= '9' && digit >= '0'
  ------------------
  |  Branch (547:12): [True: 558k, False: 194k]
  |  Branch (547:28): [True: 351k, False: 206k]
  ------------------
  548|   752k|        ? char(digit - '0')
  549|   752k|        : (digit >= 'a' ? char(digit - 'a' + 10) : (digit >= 'A' ? char(digit - 'A' + 10) : '\20'));
  ------------------
  |  Branch (549:12): [True: 147k, False: 253k]
  |  Branch (549:53): [True: 26.7k, False: 226k]
  ------------------
  550|   752k|}
_ZN5QUtil17make_shared_arrayIhEENSt3__110shared_ptrIT_EEm:
  181|  78.8k|    {
  182|  78.8k|        return std::shared_ptr<T>(new T[n], std::default_delete<T[]>());
  183|  78.8k|    }

_ZN9BitWriterC2EP8Pipeline:
   11|  1.43k|{
   12|  1.43k|}
_ZN9BitWriter9writeBitsEym:
   16|   161k|{
   17|   161k|    write_bits(this->ch, this->bit_offset, val, bits, this->pl);
   18|   161k|}
_ZN9BitWriter12writeBitsIntEim:
   34|  26.1k|{
   35|  26.1k|    writeBits(static_cast<unsigned long long>(val), bits);
   36|  26.1k|}
_ZN9BitWriter5flushEv:
   40|  14.3k|{
   41|  14.3k|    if (bit_offset < 7) {
  ------------------
  |  Branch (41:9): [True: 5.95k, False: 8.35k]
  ------------------
   42|  5.95k|        size_t bits_to_write = bit_offset + 1;
   43|  5.95k|        write_bits(this->ch, this->bit_offset, 0, bits_to_write, this->pl);
   44|  5.95k|    }
   45|  14.3k|}

_ZN6Buffer7MembersC2EmPhb:
   22|   277k|{
   23|   277k|    if (own_memory) {
  ------------------
  |  Branch (23:9): [True: 273k, False: 3.33k]
  ------------------
   24|   273k|        this->buf = (size ? new unsigned char[size] : nullptr);
  ------------------
  |  Branch (24:22): [True: 273k, False: 0]
  ------------------
   25|   273k|    } else {
   26|  3.33k|        this->buf = buf;
   27|  3.33k|    }
   28|   277k|}
_ZN6Buffer7MembersC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   35|  64.5k|{
   36|  64.5k|}
_ZN6Buffer7MembersD2Ev:
   39|   341k|{
   40|   341k|    if (this->own_memory) {
  ------------------
  |  Branch (40:9): [True: 273k, False: 67.8k]
  ------------------
   41|   273k|        delete[] this->buf;
   42|   273k|    }
   43|   341k|}
_ZN6BufferC2Em:
   52|   273k|{
   53|   273k|}
_ZN6BufferC2EONSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   57|  64.5k|{
   58|  64.5k|}
_ZN6BufferC2EPhm:
   62|  3.33k|{
   63|  3.33k|}
_ZN6BufferC2EOS_:
   86|   699k|{
   87|   699k|}
_ZNK6Buffer7getSizeEv:
  109|   594k|{
  110|   594k|    return m->size;
  111|   594k|}
_ZN6Buffer9getBufferEv:
  121|  6.04M|{
  122|  6.04M|    return m->buf;
  123|  6.04M|}

_ZN17BufferInputSourceC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEP6Bufferb:
   14|  4.17k|{
   15|  4.17k|}
_ZN17BufferInputSourceC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
   23|  2.43k|{
   24|  2.43k|    memcpy(buf->getBuffer(), contents.c_str(), contents.length());
   25|  2.43k|}
_ZN17BufferInputSourceD2Ev:
   28|  6.61k|{
   29|  6.61k|    if (this->own_memory) {
  ------------------
  |  Branch (29:9): [True: 2.43k, False: 4.17k]
  ------------------
   30|  2.43k|        delete this->buf;
   31|  2.43k|    }
   32|  6.61k|}
_ZN17BufferInputSource18findAndSkipNextEOLEv:
   36|  2.87M|{
   37|  2.87M|    if (this->cur_offset < 0) {
  ------------------
  |  Branch (37:9): [True: 0, False: 2.87M]
  ------------------
   38|      0|        throw std::logic_error("INTERNAL ERROR: BufferInputSource offset < 0");
   39|      0|    }
   40|  2.87M|    qpdf_offset_t end_pos = this->max_offset;
   41|  2.87M|    if (this->cur_offset >= end_pos) {
  ------------------
  |  Branch (41:9): [True: 1.91k, False: 2.87M]
  ------------------
   42|  1.91k|        this->last_offset = end_pos;
   43|  1.91k|        this->cur_offset = end_pos;
   44|  1.91k|        return end_pos;
   45|  1.91k|    }
   46|       |
   47|  2.87M|    qpdf_offset_t result = 0;
   48|  2.87M|    unsigned char const* buffer = this->buf->getBuffer();
   49|  2.87M|    unsigned char const* end = buffer + end_pos;
   50|  2.87M|    unsigned char const* p = buffer + this->cur_offset;
   51|       |
   52|   143M|    while ((p < end) && !((*p == '\r') || (*p == '\n'))) {
  ------------------
  |  Branch (52:12): [True: 143M, False: 1.22k]
  |  Branch (52:27): [True: 1.38M, False: 142M]
  |  Branch (52:43): [True: 1.48M, False: 140M]
  ------------------
   53|   140M|        ++p;
   54|   140M|    }
   55|  2.87M|    if (p < end) {
  ------------------
  |  Branch (55:9): [True: 2.87M, False: 1.22k]
  ------------------
   56|  2.87M|        result = p - buffer;
   57|  2.87M|        this->cur_offset = result + 1;
   58|  2.87M|        ++p;
   59|  3.43M|        while ((this->cur_offset < end_pos) && ((*p == '\r') || (*p == '\n'))) {
  ------------------
  |  Branch (59:16): [True: 3.43M, False: 220]
  |  Branch (59:49): [True: 10.2k, False: 3.42M]
  |  Branch (59:65): [True: 548k, False: 2.87M]
  ------------------
   60|   558k|            ++p;
   61|   558k|            ++this->cur_offset;
   62|   558k|        }
   63|  2.87M|    } else {
   64|  1.22k|        this->cur_offset = end_pos;
   65|  1.22k|        result = end_pos;
   66|  1.22k|    }
   67|  2.87M|    return result;
   68|  2.87M|}
_ZNK17BufferInputSource7getNameEv:
   72|   450k|{
   73|   450k|    return this->description;
   74|   450k|}
_ZN17BufferInputSource4tellEv:
   78|  20.6M|{
   79|  20.6M|    return this->cur_offset;
   80|  20.6M|}
_ZN17BufferInputSource4seekExi:
   84|  11.3M|{
   85|  11.3M|    switch (whence) {
   86|  11.1M|    case SEEK_SET:
  ------------------
  |  Branch (86:5): [True: 11.1M, False: 194k]
  ------------------
   87|  11.1M|        this->cur_offset = offset;
   88|  11.1M|        break;
   89|       |
   90|  6.61k|    case SEEK_END:
  ------------------
  |  Branch (90:5): [True: 6.61k, False: 11.3M]
  ------------------
   91|  6.61k|        QIntC::range_check(this->max_offset, offset);
   92|  6.61k|        this->cur_offset = this->max_offset + offset;
   93|  6.61k|        break;
   94|       |
   95|   188k|    case SEEK_CUR:
  ------------------
  |  Branch (95:5): [True: 188k, False: 11.1M]
  ------------------
   96|   188k|        QIntC::range_check(this->cur_offset, offset);
   97|   188k|        this->cur_offset += offset;
   98|   188k|        break;
   99|       |
  100|      0|    default:
  ------------------
  |  Branch (100:5): [True: 0, False: 11.3M]
  ------------------
  101|      0|        throw std::logic_error("INTERNAL ERROR: invalid argument to BufferInputSource::seek");
  102|      0|        break;
  103|  11.3M|    }
  104|       |
  105|  11.3M|    if (this->cur_offset < 0) {
  ------------------
  |  Branch (105:9): [True: 13, False: 11.3M]
  ------------------
  106|     13|        throw std::runtime_error(this->description + ": seek before beginning of buffer");
  107|     13|    }
  108|  11.3M|}
_ZN17BufferInputSource4readEPcm:
  118|  2.16M|{
  119|  2.16M|    if (this->cur_offset < 0) {
  ------------------
  |  Branch (119:9): [True: 0, False: 2.16M]
  ------------------
  120|      0|        throw std::logic_error("INTERNAL ERROR: BufferInputSource offset < 0");
  121|      0|    }
  122|  2.16M|    qpdf_offset_t end_pos = this->max_offset;
  123|  2.16M|    if (this->cur_offset >= end_pos) {
  ------------------
  |  Branch (123:9): [True: 18.4k, False: 2.15M]
  ------------------
  124|  18.4k|        this->last_offset = end_pos;
  125|  18.4k|        return 0;
  126|  18.4k|    }
  127|       |
  128|  2.15M|    this->last_offset = this->cur_offset;
  129|  2.15M|    size_t len = std::min(QIntC::to_size(end_pos - this->cur_offset), length);
  130|  2.15M|    memcpy(buffer, this->buf->getBuffer() + this->cur_offset, len);
  131|  2.15M|    this->cur_offset += QIntC::to_offset(len);
  132|  2.15M|    return len;
  133|  2.16M|}
_ZN17BufferInputSource8unreadChEc:
  137|  1.94k|{
  138|  1.94k|    if (this->cur_offset > 0) {
  ------------------
  |  Branch (138:9): [True: 1.94k, False: 0]
  ------------------
  139|  1.94k|        --this->cur_offset;
  140|  1.94k|    }
  141|  1.94k|}

_ZN11InputSource13setLastOffsetEx:
   10|  9.75M|{
   11|  9.75M|    this->last_offset = offset;
   12|  9.75M|}
_ZNK11InputSource13getLastOffsetEv:
   16|  3.01M|{
   17|  3.01M|    return this->last_offset;
   18|  3.01M|}
_ZN11InputSource8readLineEm:
   22|  3.52k|{
   23|       |    // Return at most max_line_length characters from the next line. Lines are terminated by one or
   24|       |    // more \r or \n characters. Consume the trailing newline characters but don't return them.
   25|       |    // After this is called, the file will be positioned after a line terminator or at the end of
   26|       |    // the file, and last_offset will point to position the file had when this method was called.
   27|       |
   28|  3.52k|    qpdf_offset_t offset = this->tell();
   29|  3.52k|    auto bp = std::make_unique<char[]>(max_line_length + 1);
   30|  3.52k|    char* buf = bp.get();
   31|  3.52k|    memset(buf, '\0', max_line_length + 1);
   32|  3.52k|    this->read(buf, max_line_length);
   33|  3.52k|    this->seek(offset, SEEK_SET);
   34|  3.52k|    qpdf_offset_t eol = this->findAndSkipNextEOL();
   35|  3.52k|    this->last_offset = offset;
   36|  3.52k|    size_t line_length = QIntC::to_size(eol - offset);
   37|  3.52k|    if (line_length < max_line_length) {
  ------------------
  |  Branch (37:9): [True: 3.45k, False: 75]
  ------------------
   38|  3.45k|        buf[line_length] = '\0';
   39|  3.45k|    }
   40|  3.52k|    return {buf};
   41|  3.52k|}
_ZN11InputSource9findFirstEPKcxmRNS_6FinderE:
   45|  16.5k|{
   46|       |    // Basic approach: search for the first character of start_chars starting from offset but not
   47|       |    // going past len (if len != 0). Once the first character is found, see if it is the beginning
   48|       |    // of a sequence of characters matching start_chars. If so, call finder.check() to do
   49|       |    // caller-specific additional checks. If not, keep searching.
   50|       |
   51|       |    // This code is tricky and highly subject to off-by-one or other edge case logic errors. See
   52|       |    // comments throughout that explain how we're not missing any edge cases. There are also tests
   53|       |    // specifically constructed to make sure we caught the edge cases in testing.
   54|       |
   55|  16.5k|    char buf[1025]; // size known to input_source.cc in libtests
   56|       |    // To enable us to guarantee null-termination, save an extra byte so that buf[size] is valid
   57|       |    // memory.
   58|  16.5k|    size_t size = sizeof(buf) - 1;
   59|  16.5k|    if ((strlen(start_chars) < 1) || (strlen(start_chars) > size)) {
  ------------------
  |  Branch (59:9): [True: 0, False: 16.5k]
  |  Branch (59:38): [True: 0, False: 16.5k]
  ------------------
   60|      0|        throw std::logic_error("InputSource::findSource called with"
   61|      0|                               " too small or too large of a character sequence");
   62|      0|    }
   63|       |
   64|  16.5k|    char* p = nullptr;
   65|  16.5k|    qpdf_offset_t buf_offset = offset;
   66|  16.5k|    size_t bytes_read = 0;
   67|       |
   68|       |    // Guarantee that we return from this loop. Each time through, we either return, advance p, or
   69|       |    // restart the loop with a condition that will cause return on the next pass. Eventually we will
   70|       |    // either be out of range or hit EOF, either of which forces us to return.
   71|   308k|    while (true) {
  ------------------
  |  Branch (71:12): [Folded - Ignored]
  ------------------
   72|       |        // Do we need to read more data? Pretend size = 5, buf starts at 0, and start_chars has 3
   73|       |        // characters. buf[5] is valid and null. If p == 2, start_chars could be buf[2] through
   74|       |        // buf[4], so p + strlen(start_chars) == buf + size is okay. If p points to buf[size], since
   75|       |        // strlen(start_chars) is always >= 1, this overflow test will be correct for that case
   76|       |        // regardless of start_chars.
   77|   308k|        if ((p == nullptr) || ((p + strlen(start_chars)) > (buf + bytes_read))) {
  ------------------
  |  Branch (77:13): [True: 16.5k, False: 291k]
  |  Branch (77:31): [True: 74.7k, False: 217k]
  ------------------
   78|  91.2k|            if (p) {
  ------------------
  |  Branch (78:17): [True: 74.7k, False: 16.5k]
  ------------------
   79|  74.7k|                QTC::TC(
   80|  74.7k|                    "libtests", "InputSource read next block", ((p == buf + bytes_read) ? 0 : 1));
  ------------------
  |  Branch (80:65): [True: 73.8k, False: 937]
  ------------------
   81|  74.7k|                buf_offset += (p - buf);
   82|  74.7k|            }
   83|  91.2k|            this->seek(buf_offset, SEEK_SET);
   84|       |            // Read into buffer and zero out the rest of the buffer including buf[size]. We
   85|       |            // allocated an extra byte so that we could guarantee null termination as an extra
   86|       |            // protection against overrun when using string functions.
   87|  91.2k|            bytes_read = this->read(buf, size);
   88|  91.2k|            if (bytes_read < strlen(start_chars)) {
  ------------------
  |  Branch (88:17): [True: 4.05k, False: 87.2k]
  ------------------
   89|  4.05k|                QTC::TC("libtests", "InputSource find EOF", bytes_read == 0 ? 0 : 1);
  ------------------
  |  Branch (89:61): [True: 3.60k, False: 452]
  ------------------
   90|  4.05k|                return false;
   91|  4.05k|            }
   92|  87.2k|            memset(buf + bytes_read, '\0', 1 + (size - bytes_read));
   93|  87.2k|            p = buf;
   94|  87.2k|        }
   95|       |
   96|       |        // Search for the first character.
   97|   304k|        if ((p = static_cast<char*>(
  ------------------
  |  Branch (97:13): [True: 230k, False: 73.8k]
  ------------------
   98|       |                 // line-break
   99|   304k|                 memchr(p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) != nullptr) {
  100|   230k|            if (p == buf) {
  ------------------
  |  Branch (100:17): [True: 2.35k, False: 228k]
  ------------------
  101|  2.35k|                QTC::TC("libtests", "InputSource found match at buf[0]");
  102|  2.35k|            }
  103|       |            // Found first letter.
  104|   230k|            if (len != 0) {
  ------------------
  |  Branch (104:17): [True: 6.61k, False: 223k]
  ------------------
  105|       |                // Make sure it's in range.
  106|  6.61k|                size_t p_relative_offset = QIntC::to_size((p - buf) + (buf_offset - offset));
  107|  6.61k|                if (p_relative_offset >= len) {
  ------------------
  |  Branch (107:21): [True: 272, False: 6.34k]
  ------------------
  108|       |                    // out of range
  109|    272|                    QTC::TC("libtests", "InputSource out of range");
  110|    272|                    return false;
  111|    272|                }
  112|  6.61k|            }
  113|   230k|            if ((p + strlen(start_chars)) > (buf + bytes_read)) {
  ------------------
  |  Branch (113:17): [True: 567, False: 229k]
  ------------------
  114|       |                // If there are not enough bytes left in the file for start_chars, we will detect
  115|       |                // this on the next pass as EOF and return.
  116|    567|                QTC::TC("libtests", "InputSource not enough bytes");
  117|    567|                continue;
  118|    567|            }
  119|       |
  120|       |            // See if p points to a sequence matching start_chars. We already checked above to make
  121|       |            // sure we are not going to overrun memory.
  122|   229k|            if (strncmp(p, start_chars, strlen(start_chars)) == 0) {
  ------------------
  |  Branch (122:17): [True: 14.4k, False: 215k]
  ------------------
  123|       |                // Call finder.check() with the input source positioned to the point of the match.
  124|  14.4k|                this->seek(buf_offset + (p - buf), SEEK_SET);
  125|  14.4k|                if (finder.check()) {
  ------------------
  |  Branch (125:21): [True: 12.1k, False: 2.21k]
  ------------------
  126|  12.1k|                    return true;
  127|  12.1k|                } else {
  128|  2.21k|                    QTC::TC("libtests", "InputSource start_chars matched but not check");
  129|  2.21k|                }
  130|   215k|            } else {
  131|   215k|                QTC::TC("libtests", "InputSource first char matched but not string");
  132|   215k|            }
  133|       |            // This occurrence of the first character wasn't a match. Skip over it and keep
  134|       |            // searching.
  135|   217k|            ++p;
  136|   217k|        } else {
  137|       |            // Trigger reading the next block
  138|  73.8k|            p = buf + bytes_read;
  139|  73.8k|        }
  140|   304k|    }
  141|      0|    throw std::logic_error("InputSource after while (true)");
  142|  16.5k|}
_ZN11InputSource8findLastEPKcxmRNS_6FinderE:
  146|  3.33k|{
  147|  3.33k|    bool found = false;
  148|  3.33k|    qpdf_offset_t after_found_offset = 0;
  149|  3.33k|    qpdf_offset_t cur_offset = offset;
  150|  3.33k|    size_t cur_len = len;
  151|  5.39k|    while (this->findFirst(start_chars, cur_offset, cur_len, finder)) {
  ------------------
  |  Branch (151:12): [True: 2.06k, False: 3.33k]
  ------------------
  152|  2.06k|        if (found) {
  ------------------
  |  Branch (152:13): [True: 246, False: 1.81k]
  ------------------
  153|    246|            QTC::TC("libtests", "InputSource findLast found more than one");
  154|  1.81k|        } else {
  155|  1.81k|            found = true;
  156|  1.81k|        }
  157|  2.06k|        after_found_offset = this->tell();
  158|  2.06k|        cur_offset = after_found_offset;
  159|  2.06k|        cur_len = len - QIntC::to_size((cur_offset - offset));
  160|  2.06k|    }
  161|  3.33k|    if (found) {
  ------------------
  |  Branch (161:9): [True: 1.81k, False: 1.51k]
  ------------------
  162|  1.81k|        this->seek(after_found_offset, SEEK_SET);
  163|  1.81k|    }
  164|  3.33k|    return found;
  165|  3.33k|}

_ZN3MD5C2Ev:
   10|  92.8k|{
   11|  92.8k|    init();
   12|  92.8k|}
_ZN3MD54initEv:
   16|  94.6k|{
   17|  94.6k|    this->crypto = QPDFCryptoProvider::getImpl();
   18|  94.6k|    this->crypto->MD5_init();
   19|  94.6k|}
_ZN3MD55resetEv:
   29|  1.80k|{
   30|  1.80k|    init();
   31|  1.80k|}
_ZN3MD512encodeStringEPKc:
   35|  1.42k|{
   36|  1.42k|    size_t len = strlen(str);
   37|  1.42k|    crypto->MD5_init();
   38|  1.42k|    encodeDataIncrementally(str, len);
   39|  1.42k|    crypto->MD5_finalize();
   40|  1.42k|}
_ZN3MD523encodeDataIncrementallyEPKcm:
   50|  2.32M|{
   51|  2.32M|    this->crypto->MD5_update(QUtil::unsigned_char_pointer(data), len);
   52|  2.32M|}
_ZN3MD56digestEPh:
   92|  92.4k|{
   93|  92.4k|    this->crypto->MD5_finalize();
   94|  92.4k|    this->crypto->MD5_digest(result);
   95|  92.4k|}
_ZN3MD57unparseEv:
  112|  1.43k|{
  113|  1.43k|    this->crypto->MD5_finalize();
  114|  1.43k|    Digest digest_val;
  115|  1.43k|    digest(digest_val);
  116|  1.43k|    return QUtil::hex_encode(std::string(reinterpret_cast<char*>(digest_val), 16));
  117|  1.43k|}

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

_ZN17OffsetInputSourceC2ENSt3__110shared_ptrI11InputSourceEEx:
   11|    975|{
   12|    975|    if (global_offset < 0) {
  ------------------
  |  Branch (12:9): [True: 0, False: 975]
  ------------------
   13|      0|        throw std::logic_error("OffsetInputSource constructed with negative offset");
   14|      0|    }
   15|    975|    this->max_safe_offset = std::numeric_limits<qpdf_offset_t>::max() - global_offset;
   16|    975|}
_ZN17OffsetInputSource18findAndSkipNextEOLEv:
   20|   809k|{
   21|   809k|    return this->proxied->findAndSkipNextEOL() - this->global_offset;
   22|   809k|}
_ZNK17OffsetInputSource7getNameEv:
   26|   150k|{
   27|   150k|    return this->proxied->getName();
   28|   150k|}
_ZN17OffsetInputSource4tellEv:
   32|  7.94M|{
   33|  7.94M|    return this->proxied->tell() - this->global_offset;
   34|  7.94M|}
_ZN17OffsetInputSource4seekExi:
   38|  3.07M|{
   39|  3.07M|    if (whence == SEEK_SET) {
  ------------------
  |  Branch (39:9): [True: 3.00M, False: 74.6k]
  ------------------
   40|  3.00M|        if (offset > this->max_safe_offset) {
  ------------------
  |  Branch (40:13): [True: 1, False: 3.00M]
  ------------------
   41|      1|            std::ostringstream msg;
   42|      1|            msg.imbue(std::locale::classic());
   43|      1|            msg << "seeking to " << offset << " offset by " << global_offset
   44|      1|                << " would cause an overflow of the offset type";
   45|      1|            throw std::range_error(msg.str());
   46|      1|        }
   47|  3.00M|        this->proxied->seek(offset + global_offset, whence);
   48|  3.00M|    } else {
   49|  74.6k|        this->proxied->seek(offset, whence);
   50|  74.6k|    }
   51|  3.07M|    if (tell() < 0) {
  ------------------
  |  Branch (51:9): [True: 0, False: 3.07M]
  ------------------
   52|      0|        throw std::runtime_error("offset input source: seek before beginning of file");
   53|      0|    }
   54|  3.07M|}
_ZN17OffsetInputSource4readEPcm:
   64|   512k|{
   65|   512k|    size_t result = this->proxied->read(buffer, length);
   66|   512k|    this->setLastOffset(this->proxied->getLastOffset() - global_offset);
   67|   512k|    return result;
   68|   512k|}
_ZN17OffsetInputSource8unreadChEc:
   72|    338|{
   73|    338|    this->proxied->unreadCh(ch);
   74|    338|}

_ZN8PipelineC2EPKcPS_:
    9|   370k|{
   10|   370k|}
_ZN8Pipeline7getNextEb:
   14|  18.3M|{
   15|  18.3M|    if ((this->next == nullptr) && (!allow_null)) {
  ------------------
  |  Branch (15:9): [True: 875k, False: 17.5M]
  |  Branch (15:36): [True: 0, False: 875k]
  ------------------
   16|      0|        throw std::logic_error(
   17|      0|            this->identifier + ": Pipeline::getNext() called on pipeline with no next");
   18|      0|    }
   19|  18.3M|    return this->next;
   20|  18.3M|}
_ZNK8Pipeline13getIdentifierEv:
   24|   156k|{
   25|   156k|    return this->identifier;
   26|   156k|}
_ZN8Pipeline9writeCStrEPKc:
   30|   720k|{
   31|   720k|    this->write(cstr, strlen(cstr));
   32|   720k|}
_ZN8Pipeline11writeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   36|  9.84k|{
   37|  9.84k|    this->write(str.c_str(), str.length());
   38|  9.84k|}
_ZN8PipelinelsEPKc:
   42|   720k|{
   43|   720k|    this->writeCStr(cstr);
   44|   720k|    return *this;
   45|   720k|}
_ZN8PipelinelsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   49|  8.37k|{
   50|  8.37k|    this->writeString(str);
   51|  8.37k|    return *this;
   52|  8.37k|}
_ZN8Pipeline5writeEPKcm:
  112|   813k|{
  113|   813k|    this->write(reinterpret_cast<unsigned char const*>(data), len);
  114|   813k|}

_ZN17Pl_ASCII85DecoderC2EPKcP8Pipeline:
   11|  24.3k|{
   12|  24.3k|    memset(this->inbuf, 117, 5);
   13|  24.3k|}
_ZN17Pl_ASCII85Decoder5writeEPKhm:
   17|  24.3k|{
   18|  24.3k|    if (eod > 1) {
  ------------------
  |  Branch (18:9): [True: 0, False: 24.3k]
  ------------------
   19|      0|        return;
   20|      0|    }
   21|  2.33M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (21:24): [True: 2.31M, False: 22.9k]
  ------------------
   22|  2.31M|        switch (buf[i]) {
  ------------------
  |  Branch (22:17): [True: 2.27M, False: 36.0k]
  ------------------
   23|  3.21k|        case ' ':
  ------------------
  |  Branch (23:9): [True: 3.21k, False: 2.30M]
  ------------------
   24|  3.55k|        case '\f':
  ------------------
  |  Branch (24:9): [True: 342, False: 2.31M]
  ------------------
   25|  5.08k|        case '\v':
  ------------------
  |  Branch (25:9): [True: 1.52k, False: 2.31M]
  ------------------
   26|  5.26k|        case '\t':
  ------------------
  |  Branch (26:9): [True: 184, False: 2.31M]
  ------------------
   27|  7.00k|        case '\r':
  ------------------
  |  Branch (27:9): [True: 1.73k, False: 2.31M]
  ------------------
   28|  36.0k|        case '\n':
  ------------------
  |  Branch (28:9): [True: 29.0k, False: 2.28M]
  ------------------
   29|  36.0k|            QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
   30|       |            // ignore whitespace
   31|  36.0k|            continue;
   32|  2.31M|        }
   33|  2.27M|        if (eod > 1) {
  ------------------
  |  Branch (33:13): [True: 244, False: 2.27M]
  ------------------
   34|    244|            break;
   35|  2.27M|        } else if (eod == 1) {
  ------------------
  |  Branch (35:20): [True: 23.0k, False: 2.25M]
  ------------------
   36|  23.0k|            if (buf[i] == '>') {
  ------------------
  |  Branch (36:17): [True: 23.0k, False: 13]
  ------------------
   37|  23.0k|                flush();
   38|  23.0k|                eod = 2;
   39|  23.0k|            } else {
   40|     13|                throw std::runtime_error("broken end-of-data sequence in base 85 data");
   41|     13|            }
   42|  2.25M|        } else {
   43|  2.25M|            switch (buf[i]) {
   44|  23.0k|            case '~':
  ------------------
  |  Branch (44:13): [True: 23.0k, False: 2.22M]
  ------------------
   45|  23.0k|                eod = 1;
   46|  23.0k|                break;
   47|       |
   48|  19.3k|            case 'z':
  ------------------
  |  Branch (48:13): [True: 19.3k, False: 2.23M]
  ------------------
   49|  19.3k|                if (pos != 0) {
  ------------------
  |  Branch (49:21): [True: 117, False: 19.2k]
  ------------------
   50|    117|                    throw std::runtime_error("unexpected z during base 85 decode");
   51|  19.2k|                } else {
   52|  19.2k|                    QTC::TC("libtests", "Pl_ASCII85Decoder read z");
   53|  19.2k|                    unsigned char zeroes[4];
   54|  19.2k|                    memset(zeroes, '\0', 4);
   55|  19.2k|                    getNext()->write(zeroes, 4);
   56|  19.2k|                }
   57|  19.2k|                break;
   58|       |
   59|  2.21M|            default:
  ------------------
  |  Branch (59:13): [True: 2.21M, False: 42.4k]
  ------------------
   60|  2.21M|                if ((buf[i] < 33) || (buf[i] > 117)) {
  ------------------
  |  Branch (60:21): [True: 250, False: 2.21M]
  |  Branch (60:38): [True: 297, False: 2.20M]
  ------------------
   61|    547|                    throw std::runtime_error("character out of range during base 85 decode");
   62|  2.20M|                } else {
   63|  2.20M|                    this->inbuf[this->pos++] = buf[i];
   64|  2.20M|                    if (pos == 5) {
  ------------------
  |  Branch (64:25): [True: 428k, False: 1.78M]
  ------------------
   65|   428k|                        flush();
   66|   428k|                    }
   67|  2.20M|                }
   68|  2.20M|                break;
   69|  2.25M|            }
   70|  2.25M|        }
   71|  2.27M|    }
   72|  24.3k|}
_ZN17Pl_ASCII85Decoder5flushEv:
   76|   476k|{
   77|   476k|    if (this->pos == 0) {
  ------------------
  |  Branch (77:9): [True: 27.1k, False: 449k]
  ------------------
   78|  27.1k|        QTC::TC("libtests", "Pl_ASCII85Decoder no-op flush");
   79|  27.1k|        return;
   80|  27.1k|    }
   81|   449k|    unsigned long lval = 0;
   82|  2.69M|    for (int i = 0; i < 5; ++i) {
  ------------------
  |  Branch (82:21): [True: 2.24M, False: 449k]
  ------------------
   83|  2.24M|        lval *= 85;
   84|  2.24M|        lval += (this->inbuf[i] - 33U);
   85|  2.24M|    }
   86|       |
   87|   449k|    unsigned char outbuf[4];
   88|   449k|    memset(outbuf, 0, 4);
   89|  2.24M|    for (int i = 3; i >= 0; --i) {
  ------------------
  |  Branch (89:21): [True: 1.79M, False: 449k]
  ------------------
   90|  1.79M|        outbuf[i] = lval & 0xff;
   91|  1.79M|        lval >>= 8;
   92|  1.79M|    }
   93|       |
   94|   449k|    QTC::TC("libtests", "Pl_ASCII85Decoder partial flush", (this->pos == 5) ? 0 : 1);
  ------------------
  |  Branch (94:60): [True: 428k, False: 20.2k]
  ------------------
   95|       |    // Reset before calling getNext()->write in case that throws an exception.
   96|   449k|    auto t = this->pos - 1;
   97|   449k|    this->pos = 0;
   98|   449k|    memset(this->inbuf, 117, 5);
   99|       |
  100|   449k|    getNext()->write(outbuf, t);
  101|   449k|}
_ZN17Pl_ASCII85Decoder6finishEv:
  105|  24.3k|{
  106|  24.3k|    flush();
  107|  24.3k|    getNext()->finish();
  108|  24.3k|}

_ZN18Pl_ASCIIHexDecoderC2EPKcP8Pipeline:
   11|     46|{
   12|     46|    this->inbuf[0] = '0';
   13|     46|    this->inbuf[1] = '0';
   14|     46|    this->inbuf[2] = '\0';
   15|     46|}
_ZN18Pl_ASCIIHexDecoder5writeEPKhm:
   19|     46|{
   20|     46|    if (this->eod) {
  ------------------
  |  Branch (20:9): [True: 0, False: 46]
  ------------------
   21|      0|        return;
   22|      0|    }
   23|    719|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (23:24): [True: 683, False: 36]
  ------------------
   24|    683|        char ch = static_cast<char>(toupper(buf[i]));
   25|    683|        switch (ch) {
   26|     26|        case ' ':
  ------------------
  |  Branch (26:9): [True: 26, False: 657]
  ------------------
   27|     26|        case '\f':
  ------------------
  |  Branch (27:9): [True: 0, False: 683]
  ------------------
   28|     26|        case '\v':
  ------------------
  |  Branch (28:9): [True: 0, False: 683]
  ------------------
   29|     26|        case '\t':
  ------------------
  |  Branch (29:9): [True: 0, False: 683]
  ------------------
   30|     26|        case '\r':
  ------------------
  |  Branch (30:9): [True: 0, False: 683]
  ------------------
   31|     71|        case '\n':
  ------------------
  |  Branch (31:9): [True: 45, False: 638]
  ------------------
   32|     71|            QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space");
   33|       |            // ignore whitespace
   34|     71|            break;
   35|       |
   36|      0|        case '>':
  ------------------
  |  Branch (36:9): [True: 0, False: 683]
  ------------------
   37|      0|            this->eod = true;
   38|      0|            flush();
   39|      0|            break;
   40|       |
   41|    612|        default:
  ------------------
  |  Branch (41:9): [True: 612, False: 71]
  ------------------
   42|    612|            if (((ch >= '0') && (ch <= '9')) || ((ch >= 'A') && (ch <= 'F'))) {
  ------------------
  |  Branch (42:18): [True: 609, False: 3]
  |  Branch (42:33): [True: 481, False: 128]
  |  Branch (42:50): [True: 128, False: 3]
  |  Branch (42:65): [True: 121, False: 7]
  ------------------
   43|    602|                this->inbuf[this->pos++] = ch;
   44|    602|                if (this->pos == 2) {
  ------------------
  |  Branch (44:21): [True: 298, False: 304]
  ------------------
   45|    298|                    flush();
   46|    298|                }
   47|    602|            } else {
   48|     10|                char t[2];
   49|     10|                t[0] = ch;
   50|     10|                t[1] = 0;
   51|     10|                throw std::runtime_error(
   52|     10|                    std::string("character out of range"
   53|     10|                                " during base Hex decode: ") +
   54|     10|                    t);
   55|     10|            }
   56|    602|            break;
   57|    683|        }
   58|    673|        if (this->eod) {
  ------------------
  |  Branch (58:13): [True: 0, False: 673]
  ------------------
   59|      0|            break;
   60|      0|        }
   61|    673|    }
   62|     46|}
_ZN18Pl_ASCIIHexDecoder5flushEv:
   66|    343|{
   67|    343|    if (this->pos == 0) {
  ------------------
  |  Branch (67:9): [True: 39, False: 304]
  ------------------
   68|     39|        QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush");
   69|     39|        return;
   70|     39|    }
   71|    304|    int b[2];
   72|    912|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (72:21): [True: 608, False: 304]
  ------------------
   73|    608|        if (this->inbuf[i] >= 'A') {
  ------------------
  |  Branch (73:13): [True: 121, False: 487]
  ------------------
   74|    121|            b[i] = this->inbuf[i] - 'A' + 10;
   75|    487|        } else {
   76|    487|            b[i] = this->inbuf[i] - '0';
   77|    487|        }
   78|    608|    }
   79|    304|    auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
   80|       |
   81|    304|    QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", (this->pos == 2) ? 0 : 1);
  ------------------
  |  Branch (81:61): [True: 298, False: 6]
  ------------------
   82|       |    // Reset before calling getNext()->write in case that throws an exception.
   83|    304|    this->pos = 0;
   84|    304|    this->inbuf[0] = '0';
   85|    304|    this->inbuf[1] = '0';
   86|    304|    this->inbuf[2] = '\0';
   87|       |
   88|    304|    getNext()->write(&ch, 1);
   89|    304|}
_ZN18Pl_ASCIIHexDecoder6finishEv:
   93|     45|{
   94|     45|    flush();
   95|     45|    getNext()->finish();
   96|     45|}

_ZN9Pl_BufferC2EPKcP8Pipeline:
   11|  96.4k|{
   12|  96.4k|}
_ZN9Pl_BufferD2Ev:
   15|  96.4k|{
   16|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   17|  96.4k|}
_ZN9Pl_Buffer5writeEPKhm:
   21|   696k|{
   22|   696k|    if (!len) {
  ------------------
  |  Branch (22:9): [True: 0, False: 696k]
  ------------------
   23|      0|        return;
   24|      0|    }
   25|   696k|    m->data.append(reinterpret_cast<char const*>(buf), len);
   26|   696k|    m->ready = false;
   27|       |
   28|   696k|    if (getNext(true)) {
  ------------------
  |  Branch (28:9): [True: 0, False: 696k]
  ------------------
   29|      0|        getNext()->write(buf, len);
   30|      0|    }
   31|   696k|}
_ZN9Pl_Buffer6finishEv:
   35|   179k|{
   36|   179k|    m->ready = true;
   37|   179k|    if (getNext(true)) {
  ------------------
  |  Branch (37:9): [True: 0, False: 179k]
  ------------------
   38|      0|        getNext()->finish();
   39|      0|    }
   40|   179k|}
_ZN9Pl_Buffer9getBufferEv:
   44|  64.5k|{
   45|  64.5k|    if (!m->ready) {
  ------------------
  |  Branch (45:9): [True: 0, False: 64.5k]
  ------------------
   46|      0|        throw std::logic_error("Pl_Buffer::getBuffer() called when not ready");
   47|      0|    }
   48|  64.5k|    auto* b = new Buffer(std::move(m->data));
   49|  64.5k|    m->data.clear();
   50|  64.5k|    return b;
   51|  64.5k|}
_ZN9Pl_Buffer22getBufferSharedPointerEv:
   66|  63.3k|{
   67|  63.3k|    return std::shared_ptr<Buffer>(getBuffer());
   68|  63.3k|}

_ZN8Pl_Count7MembersC2Ev:
    8|   160k|{
    9|   160k|}
_ZN8Pl_CountC2EPKcP8Pipeline:
   14|   160k|{
   15|   160k|}
_ZN8Pl_CountD2Ev:
   18|   160k|{
   19|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   20|   160k|}
_ZN8Pl_Count5writeEPKhm:
   24|  12.8M|{
   25|  12.8M|    if (len) {
  ------------------
  |  Branch (25:9): [True: 12.8M, False: 6.70k]
  ------------------
   26|  12.8M|        m->count += QIntC::to_offset(len);
   27|  12.8M|        m->last_char = buf[len - 1];
   28|  12.8M|        getNext()->write(buf, len);
   29|  12.8M|    }
   30|  12.8M|}
_ZN8Pl_Count6finishEv:
   34|   323k|{
   35|   323k|    getNext()->finish();
   36|   323k|}
_ZNK8Pl_Count8getCountEv:
   40|   323k|{
   41|   323k|    return m->count;
   42|   323k|}
_ZNK8Pl_Count11getLastCharEv:
   46|  51.4k|{
   47|  51.4k|    return m->last_char;
   48|  51.4k|}

_ZN6Pl_DCT7MembersC2Ev:
   63|  1.11k|{
   64|  1.11k|}
_ZN6Pl_DCTC2EPKcP8Pipeline:
   80|  1.11k|{
   81|  1.11k|}
_ZN6Pl_DCT14setMemoryLimitEl:
   85|  3.33k|{
   86|  3.33k|    memory_limit = limit;
   87|  3.33k|}
_ZN6Pl_DCT12setScanLimitEi:
   91|  3.33k|{
   92|  3.33k|    scan_limit = limit;
   93|  3.33k|}
_ZN6Pl_DCT21setThrowOnCorruptDataEb:
   97|  3.33k|{
   98|  3.33k|    throw_on_corrupt_data = treat_as_error;
   99|  3.33k|}
_ZN6Pl_DCTD2Ev:
  114|  1.11k|{
  115|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
  116|  1.11k|}
_ZN6Pl_DCT5writeEPKhm:
  120|  1.12k|{
  121|  1.12k|    m->buf.write(data, len);
  122|  1.12k|}
_ZN6Pl_DCT6finishEv:
  126|  1.10k|{
  127|  1.10k|    m->buf.finish();
  128|       |
  129|       |    // Using a std::shared_ptr<Buffer> here and passing it into compress and decompress causes a
  130|       |    // memory leak with setjmp/longjmp. Just use a pointer and delete it.
  131|  1.10k|    Buffer* b = m->buf.getBuffer();
  132|  1.10k|    if (b->getSize() == 0) {
  ------------------
  |  Branch (132:9): [True: 17, False: 1.09k]
  ------------------
  133|       |        // Special case: empty data will never succeed and probably means we're calling finish a
  134|       |        // second time from an exception handler.
  135|     17|        delete b;
  136|     17|        this->getNext()->finish();
  137|     17|        return;
  138|     17|    }
  139|       |
  140|  1.09k|    struct jpeg_compress_struct cinfo_compress;
  141|  1.09k|    struct jpeg_decompress_struct cinfo_decompress;
  142|  1.09k|    struct qpdf_jpeg_error_mgr jerr;
  143|       |
  144|  1.09k|    cinfo_compress.err = jpeg_std_error(&(jerr.pub));
  145|  1.09k|    cinfo_decompress.err = jpeg_std_error(&(jerr.pub));
  146|  1.09k|    jerr.pub.error_exit = error_handler;
  147|  1.09k|    if (m->action == a_decompress && throw_on_corrupt_data) {
  ------------------
  |  Branch (147:9): [True: 1.09k, False: 0]
  |  Branch (147:38): [True: 1.09k, False: 0]
  ------------------
  148|  1.09k|        jerr.pub.emit_message = emit_message;
  149|  1.09k|    }
  150|       |
  151|  1.09k|    bool error = false;
  152|       |    // The jpeg library is a "C" library, so we use setjmp and longjmp for exception handling.
  153|  1.09k|    if (setjmp(jerr.jmpbuf) == 0) {
  ------------------
  |  Branch (153:9): [True: 1.09k, False: 0]
  ------------------
  154|  1.09k|        try {
  155|  1.09k|            if (m->action == a_compress) {
  ------------------
  |  Branch (155:17): [True: 0, False: 1.09k]
  ------------------
  156|      0|                compress(reinterpret_cast<void*>(&cinfo_compress), b);
  157|  1.09k|            } else {
  158|  1.09k|                decompress(reinterpret_cast<void*>(&cinfo_decompress), b);
  159|  1.09k|            }
  160|  1.09k|        } catch (std::exception& e) {
  161|       |            // Convert an exception back to a longjmp so we can ensure that the right cleanup
  162|       |            // happens. This will get converted back to an exception.
  163|     63|            jerr.msg = e.what();
  164|     63|            longjmp(jerr.jmpbuf, 1);
  165|     63|        }
  166|  1.09k|    } else {
  167|      0|        error = true;
  168|      0|    }
  169|    345|    delete b;
  170|       |
  171|    345|    if (m->action == a_compress) {
  ------------------
  |  Branch (171:9): [True: 0, False: 345]
  ------------------
  172|      0|        jpeg_destroy_compress(&cinfo_compress);
  173|      0|    }
  174|  1.09k|    if (m->action == a_decompress) {
  ------------------
  |  Branch (174:9): [True: 1.09k, False: 18.4E]
  ------------------
  175|  1.09k|        jpeg_destroy_decompress(&cinfo_decompress);
  176|  1.09k|    }
  177|    747|    if (error) {
  ------------------
  |  Branch (177:9): [True: 747, False: 18.4E]
  ------------------
  178|    747|        throw std::runtime_error(jerr.msg);
  179|    747|    }
  180|    345|}
_ZN6Pl_DCT10decompressEPvP6Buffer:
  334|  1.09k|{
  335|  1.09k|    auto* cinfo = reinterpret_cast<jpeg_decompress_struct*>(cinfo_p);
  336|       |
  337|  1.09k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  338|  1.09k|# pragma GCC diagnostic push
  339|  1.09k|# pragma GCC diagnostic ignored "-Wold-style-cast"
  340|  1.09k|#endif
  341|  1.09k|    jpeg_create_decompress(cinfo);
  342|  1.09k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  343|  1.09k|# pragma GCC diagnostic pop
  344|  1.09k|#endif
  345|       |
  346|  1.09k|    if (memory_limit > 0) {
  ------------------
  |  Branch (346:9): [True: 1.09k, False: 0]
  ------------------
  347|  1.09k|        cinfo->mem->max_memory_to_use = memory_limit;
  348|  1.09k|    }
  349|       |
  350|  1.09k|    jpeg_buffer_src(cinfo, b);
  351|       |
  352|  1.09k|    (void)jpeg_read_header(cinfo, TRUE);
  353|  1.09k|    (void)jpeg_calc_output_dimensions(cinfo);
  354|  1.09k|    unsigned int width = cinfo->output_width * QIntC::to_uint(cinfo->output_components);
  355|  1.09k|    if (memory_limit > 0 &&
  ------------------
  |  Branch (355:9): [True: 551, False: 541]
  ------------------
  356|  1.09k|        width > (static_cast<unsigned long>(memory_limit) / (20U * cinfo->output_height))) {
  ------------------
  |  Branch (356:9): [True: 1, False: 550]
  ------------------
  357|       |        // Even if jpeglib does not run out of memory, qpdf will while buffering the data before
  358|       |        // writing it. Furthermore, for very large images runtime can be significant before the
  359|       |        // first warning is encountered causing a timeout in oss-fuzz.
  360|      1|        throw std::runtime_error("Pl_DCT::decompress: JPEG data large - may be too slow");
  361|      1|    }
  362|  1.09k|    jpeg_progress_mgr progress_mgr;
  363|  1.09k|    if (scan_limit > 0) {
  ------------------
  |  Branch (363:9): [True: 550, False: 541]
  ------------------
  364|    550|        progress_mgr.progress_monitor = &progress_monitor;
  365|    550|        cinfo->progress = &progress_mgr;
  366|    550|    }
  367|  1.09k|    JSAMPARRAY buffer =
  368|  1.09k|        (*cinfo->mem->alloc_sarray)(reinterpret_cast<j_common_ptr>(cinfo), JPOOL_IMAGE, width, 1);
  369|       |
  370|  1.09k|    (void)jpeg_start_decompress(cinfo);
  371|  23.2k|    while (cinfo->output_scanline < cinfo->output_height) {
  ------------------
  |  Branch (371:12): [True: 22.1k, False: 1.09k]
  ------------------
  372|  22.1k|        (void)jpeg_read_scanlines(cinfo, buffer, 1);
  373|  22.1k|        getNext()->write(buffer[0], width * sizeof(buffer[0][0]));
  374|  22.1k|    }
  375|  1.09k|    (void)jpeg_finish_decompress(cinfo);
  376|  1.09k|    getNext()->finish();
  377|  1.09k|}
Pl_DCT.cc:_ZL13error_handlerP18jpeg_common_struct:
   31|    328|{
   32|    328|    auto* jerr = reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
   33|    328|    char buf[JMSG_LENGTH_MAX];
   34|    328|    (*cinfo->err->format_message)(cinfo, buf);
   35|    328|    jerr->msg = buf;
   36|    328|    longjmp(jerr->jmpbuf, 1);
   37|    328|}
Pl_DCT.cc:_ZL12emit_messageP18jpeg_common_structi:
   41|  17.9k|{
   42|  17.9k|    if (msg_level == -1) {
  ------------------
  |  Branch (42:9): [True: 356, False: 17.5k]
  ------------------
   43|    356|        auto* jerr = reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
   44|    356|        jerr->msg = "Pl_DCT::decompress: JPEG data is corrupt";
   45|    356|        longjmp(jerr->jmpbuf, 1);
   46|    356|    }
   47|  17.9k|}
Pl_DCT.cc:_ZL15jpeg_buffer_srcP22jpeg_decompress_structP6Buffer:
  271|  1.09k|{
  272|  1.09k|    cinfo->src = reinterpret_cast<jpeg_source_mgr*>(
  273|       |        // line-break
  274|  1.09k|        (*cinfo->mem->alloc_small)(
  275|  1.09k|            reinterpret_cast<j_common_ptr>(cinfo), JPOOL_PERMANENT, sizeof(jpeg_source_mgr)));
  276|       |
  277|  1.09k|    jpeg_source_mgr* src = cinfo->src;
  278|  1.09k|    src->init_source = init_buffer_source;
  279|  1.09k|    src->fill_input_buffer = fill_buffer_input_buffer;
  280|  1.09k|    src->skip_input_data = skip_buffer_input_data;
  281|  1.09k|    src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
  282|  1.09k|    src->term_source = term_buffer_source;
  283|  1.09k|    src->bytes_in_buffer = buffer->getSize();
  284|  1.09k|    src->next_input_byte = buffer->getBuffer();
  285|  1.09k|}
Pl_DCT.cc:_ZL18init_buffer_sourceP22jpeg_decompress_struct:
  235|  1.09k|{
  236|  1.09k|}
Pl_DCT.cc:_ZL24fill_buffer_input_bufferP22jpeg_decompress_struct:
  240|     62|{
  241|       |    // The whole JPEG data is expected to reside in the supplied memory buffer, so any request for
  242|       |    // more data beyond the given buffer size is treated as an error.
  243|     62|    throw std::runtime_error("invalid jpeg data reading from buffer");
  244|      0|    return TRUE;
  245|     62|}
Pl_DCT.cc:_ZL22skip_buffer_input_dataP22jpeg_decompress_structl:
  249|     63|{
  250|     63|    if (num_bytes < 0) {
  ------------------
  |  Branch (250:9): [True: 0, False: 63]
  ------------------
  251|      0|        throw std::runtime_error(
  252|      0|            "reading jpeg: jpeg library requested skipping a negative number of bytes");
  253|      0|    }
  254|     63|    size_t to_skip = QIntC::to_size(num_bytes);
  255|     63|    if ((to_skip > 0) && (to_skip <= cinfo->src->bytes_in_buffer)) {
  ------------------
  |  Branch (255:9): [True: 63, False: 0]
  |  Branch (255:26): [True: 50, False: 13]
  ------------------
  256|     50|        cinfo->src->next_input_byte += to_skip;
  257|     50|        cinfo->src->bytes_in_buffer -= to_skip;
  258|     50|    } else if (to_skip != 0) {
  ------------------
  |  Branch (258:16): [True: 13, False: 0]
  ------------------
  259|     13|        cinfo->src->next_input_byte += cinfo->src->bytes_in_buffer;
  260|     13|        cinfo->src->bytes_in_buffer = 0;
  261|     13|    }
  262|     63|}
Pl_DCT.cc:_ZL18term_buffer_sourceP22jpeg_decompress_struct:
  266|    345|{
  267|    345|}
Pl_DCT.cc:_ZL16progress_monitorP18jpeg_common_struct:
   51|  22.1k|{
   52|  22.1k|    if (cinfo->is_decompressor &&
  ------------------
  |  Branch (52:9): [True: 22.1k, False: 0]
  ------------------
   53|  22.1k|        reinterpret_cast<jpeg_decompress_struct*>(cinfo)->input_scan_number > scan_limit) {
  ------------------
  |  Branch (53:9): [True: 0, False: 22.1k]
  ------------------
   54|      0|        auto* jerr = reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
   55|      0|        jerr->msg = "Pl_DCT::decompress: JPEG data has too many scans";
   56|      0|        longjmp(jerr->jmpbuf, 1);
   57|      0|    }
   58|  22.1k|}

_ZN10Pl_DiscardC2Ev:
    7|  11.2k|{
    8|  11.2k|}
_ZN10Pl_DiscardD2Ev:
   11|  11.2k|{
   12|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   13|  11.2k|}
_ZN10Pl_Discard5writeEPKhm:
   17|  7.05M|{
   18|  7.05M|}
_ZN10Pl_Discard6finishEv:
   22|  64.2k|{
   23|  64.2k|}

_ZN8Pl_Flate7MembersC2EmNS_8action_eE:
   22|  66.1k|{
   23|  66.1k|    this->outbuf = QUtil::make_shared_array<unsigned char>(out_bufsize);
   24|       |    // Indirect through zdata to reach the z_stream so we don't have to include zlib.h in
   25|       |    // Pl_Flate.hh.  This means people using shared library versions of qpdf don't have to have zlib
   26|       |    // development files available, which particularly helps in a Windows environment.
   27|  66.1k|    this->zdata = new z_stream;
   28|       |
   29|  66.1k|    if (out_bufsize > UINT_MAX) {
  ------------------
  |  Branch (29:9): [True: 0, False: 66.1k]
  ------------------
   30|      0|        throw std::runtime_error(
   31|      0|            "Pl_Flate: zlib doesn't support buffer sizes larger than unsigned int");
   32|      0|    }
   33|       |
   34|  66.1k|    z_stream& zstream = *(static_cast<z_stream*>(this->zdata));
   35|  66.1k|    zstream.zalloc = nullptr;
   36|  66.1k|    zstream.zfree = nullptr;
   37|  66.1k|    zstream.opaque = nullptr;
   38|  66.1k|    zstream.next_in = nullptr;
   39|  66.1k|    zstream.avail_in = 0;
   40|  66.1k|    zstream.next_out = this->outbuf.get();
   41|  66.1k|    zstream.avail_out = QIntC::to_uint(out_bufsize);
   42|  66.1k|}
_ZN8Pl_Flate7MembersD2Ev:
   45|  66.1k|{
   46|  66.1k|    if (this->initialized) {
  ------------------
  |  Branch (46:9): [True: 871, False: 65.3k]
  ------------------
   47|    871|        z_stream& zstream = *(static_cast<z_stream*>(this->zdata));
   48|    871|        if (action == a_deflate) {
  ------------------
  |  Branch (48:13): [True: 171, False: 700]
  ------------------
   49|    171|            deflateEnd(&zstream);
   50|    700|        } else {
   51|    700|            inflateEnd(&zstream);
   52|    700|        }
   53|    871|    }
   54|       |
   55|  66.1k|    delete static_cast<z_stream*>(this->zdata);
   56|  66.1k|    this->zdata = nullptr;
   57|  66.1k|}
_ZN8Pl_FlateC2EPKcP8PipelineNS_8action_eEj:
   63|  66.1k|{
   64|  66.1k|}
_ZN8Pl_FlateD2Ev:
   67|  66.1k|{
   68|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   69|  66.1k|}
_ZN8Pl_Flate14setMemoryLimitEy:
   73|  3.33k|{
   74|  3.33k|    memory_limit = limit;
   75|  3.33k|}
_ZN8Pl_Flate15setWarnCallbackENSt3__18functionIFvPKciEEE:
   79|  24.7k|{
   80|  24.7k|    m->callback = callback;
   81|  24.7k|}
_ZN8Pl_Flate4warnEPKci:
   85|    966|{
   86|    966|    if (m->callback != nullptr) {
  ------------------
  |  Branch (86:9): [True: 966, False: 0]
  ------------------
   87|    966|        m->callback(msg, code);
   88|    966|    }
   89|    966|}
_ZN8Pl_Flate5writeEPKhm:
   93|  4.15M|{
   94|  4.15M|    if (m->outbuf == nullptr) {
  ------------------
  |  Branch (94:9): [True: 0, False: 4.15M]
  ------------------
   95|      0|        throw std::logic_error(
   96|      0|            this->identifier + ": Pl_Flate: write() called after finish() called");
   97|      0|    }
   98|       |
   99|       |    // Write in chunks in case len is too big to fit in an int. Assume int is at least 32 bits.
  100|  4.15M|    static size_t const max_bytes = 1 << 30;
  101|  4.15M|    size_t bytes_left = len;
  102|  4.15M|    unsigned char const* buf = data;
  103|  8.30M|    while (bytes_left > 0) {
  ------------------
  |  Branch (103:12): [True: 4.15M, False: 4.15M]
  ------------------
  104|  4.15M|        size_t bytes = (bytes_left >= max_bytes ? max_bytes : bytes_left);
  ------------------
  |  Branch (104:25): [True: 0, False: 4.15M]
  ------------------
  105|  4.15M|        handleData(buf, bytes, (m->action == a_inflate ? Z_SYNC_FLUSH : Z_NO_FLUSH));
  ------------------
  |  Branch (105:33): [True: 388k, False: 3.76M]
  ------------------
  106|  4.15M|        bytes_left -= bytes;
  107|  4.15M|        buf += bytes;
  108|  4.15M|    }
  109|  4.15M|}
_ZN8Pl_Flate10handleDataEPKhmi:
  113|  4.21M|{
  114|  4.21M|    if (len > UINT_MAX) {
  ------------------
  |  Branch (114:9): [True: 0, False: 4.21M]
  ------------------
  115|      0|        throw std::runtime_error("Pl_Flate: zlib doesn't support data blocks larger than int");
  116|      0|    }
  117|  4.21M|    z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  118|       |    // zlib is known not to modify the data pointed to by next_in but doesn't declare the field
  119|       |    // value const unless compiled to do so.
  120|  4.21M|    zstream.next_in = const_cast<unsigned char*>(data);
  121|  4.21M|    zstream.avail_in = QIntC::to_uint(len);
  122|       |
  123|  4.21M|    if (!m->initialized) {
  ------------------
  |  Branch (123:9): [True: 64.9k, False: 4.15M]
  ------------------
  124|  64.9k|        int err = Z_OK;
  125|       |
  126|       |        // deflateInit and inflateInit are macros that use old-style casts.
  127|  64.9k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  128|  64.9k|# pragma GCC diagnostic push
  129|  64.9k|# pragma GCC diagnostic ignored "-Wold-style-cast"
  130|  64.9k|#endif
  131|  64.9k|        if (m->action == a_deflate) {
  ------------------
  |  Branch (131:13): [True: 40.2k, False: 24.6k]
  ------------------
  132|  40.2k|            err = deflateInit(&zstream, compression_level);
  133|  40.2k|        } else {
  134|  24.6k|            err = inflateInit(&zstream);
  135|  24.6k|        }
  136|  64.9k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  137|  64.9k|# pragma GCC diagnostic pop
  138|  64.9k|#endif
  139|       |
  140|  64.9k|        checkError("Init", err);
  141|  64.9k|        m->initialized = true;
  142|  64.9k|    }
  143|       |
  144|  4.21M|    int err = Z_OK;
  145|       |
  146|  4.21M|    bool done = false;
  147|  8.43M|    while (!done) {
  ------------------
  |  Branch (147:12): [True: 4.21M, False: 4.21M]
  ------------------
  148|  4.21M|        if (m->action == a_deflate) {
  ------------------
  |  Branch (148:13): [True: 3.80M, False: 412k]
  ------------------
  149|  3.80M|            err = deflate(&zstream, flush);
  150|  3.80M|        } else {
  151|   412k|            err = inflate(&zstream, flush);
  152|   412k|        }
  153|  4.21M|        if ((m->action == a_inflate) && (err != Z_OK) && zstream.msg &&
  ------------------
  |  Branch (153:13): [True: 412k, False: 3.80M]
  |  Branch (153:41): [True: 48.9k, False: 363k]
  |  Branch (153:58): [True: 3.57k, False: 45.4k]
  ------------------
  154|  4.21M|            (strcmp(zstream.msg, "incorrect data check") == 0)) {
  ------------------
  |  Branch (154:13): [True: 2.30k, False: 1.27k]
  ------------------
  155|       |            // Other PDF readers ignore this specific error. Combining this with Z_SYNC_FLUSH
  156|       |            // enables qpdf to handle some broken zlib streams without losing data.
  157|  2.30k|            err = Z_STREAM_END;
  158|  2.30k|        }
  159|  4.21M|        switch (err) {
  160|    966|        case Z_BUF_ERROR:
  ------------------
  |  Branch (160:9): [True: 966, False: 4.21M]
  ------------------
  161|       |            // Probably shouldn't be able to happen, but possible as a boundary condition: if the
  162|       |            // last call to inflate exactly filled the output buffer, it's possible that the next
  163|       |            // call to inflate could have nothing to do. There are PDF files in the wild that have
  164|       |            // this error (including at least one in qpdf's test suite). In some cases, we want to
  165|       |            // know about this, because it indicates incorrect compression, so call a callback if
  166|       |            // provided.
  167|    966|            this->warn("input stream is complete but output may still be valid", err);
  168|    966|            done = true;
  169|    966|            break;
  170|       |
  171|  86.7k|        case Z_STREAM_END:
  ------------------
  |  Branch (171:9): [True: 86.7k, False: 4.13M]
  ------------------
  172|  86.7k|            done = true;
  173|       |            // fall through
  174|       |
  175|  4.21M|        case Z_OK:
  ------------------
  |  Branch (175:9): [True: 4.12M, False: 89.0k]
  ------------------
  176|  4.21M|            {
  177|  4.21M|                if ((zstream.avail_in == 0) && (zstream.avail_out > 0)) {
  ------------------
  |  Branch (177:21): [True: 4.21M, False: 1.28k]
  |  Branch (177:48): [True: 4.21M, False: 31]
  ------------------
  178|       |                    // There is nothing left to read, and there was sufficient buffer space to write
  179|       |                    // everything we needed, so we're done for now.
  180|  4.21M|                    done = true;
  181|  4.21M|                }
  182|  4.21M|                uLong ready = QIntC::to_ulong(m->out_bufsize - zstream.avail_out);
  183|  4.21M|                if (ready > 0) {
  ------------------
  |  Branch (183:21): [True: 266k, False: 3.94M]
  ------------------
  184|   266k|                    if (memory_limit) {
  ------------------
  |  Branch (184:25): [True: 266k, False: 0]
  ------------------
  185|   266k|                        m->written += ready;
  186|   266k|                        if (m->written > memory_limit) {
  ------------------
  |  Branch (186:29): [True: 0, False: 266k]
  ------------------
  187|      0|                            throw std::runtime_error("PL_Flate memory limit exceeded");
  188|      0|                        }
  189|   266k|                    }
  190|   266k|                    this->getNext()->write(m->outbuf.get(), ready);
  191|   266k|                    zstream.next_out = m->outbuf.get();
  192|   266k|                    zstream.avail_out = QIntC::to_uint(m->out_bufsize);
  193|   266k|                }
  194|  4.21M|            }
  195|  4.21M|            break;
  196|       |
  197|  4.21M|        default:
  ------------------
  |  Branch (197:9): [True: 1.30k, False: 4.21M]
  ------------------
  198|  1.30k|            this->checkError("data", err);
  199|  1.30k|            break;
  200|  4.21M|        }
  201|  4.21M|    }
  202|  4.21M|}
_ZN8Pl_Flate6finishEv:
  206|  65.3k|{
  207|  65.3k|    if (m->written > memory_limit) {
  ------------------
  |  Branch (207:9): [True: 0, False: 65.3k]
  ------------------
  208|      0|        return;
  209|      0|    }
  210|  65.3k|    try {
  211|  65.3k|        if (m->outbuf.get()) {
  ------------------
  |  Branch (211:13): [True: 65.3k, False: 0]
  ------------------
  212|  65.3k|            if (m->initialized) {
  ------------------
  |  Branch (212:17): [True: 64.7k, False: 638]
  ------------------
  213|  64.7k|                z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  214|  64.7k|                unsigned char buf[1];
  215|  64.7k|                buf[0] = '\0';
  216|  64.7k|                handleData(buf, 0, Z_FINISH);
  217|  64.7k|                int err = Z_OK;
  218|  64.7k|                if (m->action == a_deflate) {
  ------------------
  |  Branch (218:21): [True: 40.0k, False: 24.6k]
  ------------------
  219|  40.0k|                    err = deflateEnd(&zstream);
  220|  40.0k|                } else {
  221|  24.6k|                    err = inflateEnd(&zstream);
  222|  24.6k|                }
  223|  64.7k|                m->initialized = false;
  224|  64.7k|                checkError("End", err);
  225|  64.7k|            }
  226|       |
  227|  65.3k|            m->outbuf = nullptr;
  228|  65.3k|        }
  229|  65.3k|    } catch (std::exception& e) {
  230|    667|        try {
  231|    667|            this->getNext()->finish();
  232|    667|        } catch (...) {
  233|       |            // ignore secondary exception
  234|      0|        }
  235|    667|        throw std::runtime_error(e.what());
  236|    667|    }
  237|  64.6k|    this->getNext()->finish();
  238|  64.6k|}
_ZN8Pl_Flate10checkErrorEPKci:
  248|   130k|{
  249|   130k|    z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  250|   130k|    if (error_code != Z_OK) {
  ------------------
  |  Branch (250:9): [True: 1.30k, False: 128k]
  ------------------
  251|  1.30k|        char const* action_str = (m->action == a_deflate ? "deflate" : "inflate");
  ------------------
  |  Branch (251:35): [True: 0, False: 1.30k]
  ------------------
  252|  1.30k|        std::string msg = this->identifier + ": " + action_str + ": " + prefix + ": ";
  253|       |
  254|  1.30k|        if (zstream.msg) {
  ------------------
  |  Branch (254:13): [True: 1.27k, False: 37]
  ------------------
  255|  1.27k|            msg += zstream.msg;
  256|  1.27k|        } else {
  257|     37|            switch (error_code) {
  258|      0|            case Z_ERRNO:
  ------------------
  |  Branch (258:13): [True: 0, False: 37]
  ------------------
  259|      0|                msg += "zlib system error";
  260|      0|                break;
  261|       |
  262|      0|            case Z_STREAM_ERROR:
  ------------------
  |  Branch (262:13): [True: 0, False: 37]
  ------------------
  263|      0|                msg += "zlib stream error";
  264|      0|                break;
  265|       |
  266|      0|            case Z_DATA_ERROR:
  ------------------
  |  Branch (266:13): [True: 0, False: 37]
  ------------------
  267|      0|                msg += "zlib data error";
  268|      0|                break;
  269|       |
  270|      0|            case Z_MEM_ERROR:
  ------------------
  |  Branch (270:13): [True: 0, False: 37]
  ------------------
  271|      0|                msg += "zlib memory error";
  272|      0|                break;
  273|       |
  274|      0|            case Z_BUF_ERROR:
  ------------------
  |  Branch (274:13): [True: 0, False: 37]
  ------------------
  275|      0|                msg += "zlib buffer error";
  276|      0|                break;
  277|       |
  278|      0|            case Z_VERSION_ERROR:
  ------------------
  |  Branch (278:13): [True: 0, False: 37]
  ------------------
  279|      0|                msg += "zlib version error";
  280|      0|                break;
  281|       |
  282|     37|            default:
  ------------------
  |  Branch (282:13): [True: 37, False: 0]
  ------------------
  283|     37|                msg += std::string("zlib unknown error (") + std::to_string(error_code) + ")";
  284|     37|                break;
  285|     37|            }
  286|     37|        }
  287|       |
  288|  1.30k|        throw std::runtime_error(msg);
  289|  1.30k|    }
  290|   130k|}

_ZN13Pl_LZWDecoderC2EPKcP8Pipelineb:
   19|    953|{
   20|    953|    memset(buf, 0, 3);
   21|    953|}
_ZN13Pl_LZWDecoder5writeEPKhm:
   25|  81.4k|{
   26|   404k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (26:24): [True: 323k, False: 81.4k]
  ------------------
   27|   323k|        this->buf[next++] = bytes[i];
   28|   323k|        if (this->next == 3) {
  ------------------
  |  Branch (28:13): [True: 107k, False: 215k]
  ------------------
   29|   107k|            this->next = 0;
   30|   107k|        }
   31|   323k|        this->bits_available += 8;
   32|   323k|        if (this->bits_available >= this->code_size) {
  ------------------
  |  Branch (32:13): [True: 280k, False: 42.3k]
  ------------------
   33|   280k|            sendNextCode();
   34|   280k|        }
   35|   323k|    }
   36|  81.4k|}
_ZN13Pl_LZWDecoder6finishEv:
   40|    950|{
   41|    950|    getNext()->finish();
   42|    950|}
_ZN13Pl_LZWDecoder12sendNextCodeEv:
   46|   280k|{
   47|   280k|    unsigned int high = this->byte_pos;
   48|   280k|    unsigned int med = (this->byte_pos + 1) % 3;
   49|   280k|    unsigned int low = (this->byte_pos + 2) % 3;
   50|       |
   51|   280k|    unsigned int bits_from_high = 8 - this->bit_pos;
   52|   280k|    unsigned int bits_from_med = this->code_size - bits_from_high;
   53|   280k|    unsigned int bits_from_low = 0;
   54|   280k|    if (bits_from_med > 8) {
  ------------------
  |  Branch (54:9): [True: 14.1k, False: 266k]
  ------------------
   55|  14.1k|        bits_from_low = bits_from_med - 8;
   56|  14.1k|        bits_from_med = 8;
   57|  14.1k|    }
   58|   280k|    unsigned int high_mask = (1U << bits_from_high) - 1U;
   59|   280k|    unsigned int med_mask = 0xff - ((1U << (8 - bits_from_med)) - 1U);
   60|   280k|    unsigned int low_mask = 0xff - ((1U << (8 - bits_from_low)) - 1U);
   61|   280k|    unsigned int code = 0;
   62|   280k|    code += (this->buf[high] & high_mask) << bits_from_med;
   63|   280k|    code += ((this->buf[med] & med_mask) >> (8 - bits_from_med));
   64|   280k|    if (bits_from_low) {
  ------------------
  |  Branch (64:9): [True: 14.1k, False: 266k]
  ------------------
   65|  14.1k|        code <<= bits_from_low;
   66|  14.1k|        code += ((this->buf[low] & low_mask) >> (8 - bits_from_low));
   67|  14.1k|        this->byte_pos = low;
   68|  14.1k|        this->bit_pos = bits_from_low;
   69|   266k|    } else {
   70|   266k|        this->byte_pos = med;
   71|   266k|        this->bit_pos = bits_from_med;
   72|   266k|    }
   73|   280k|    if (this->bit_pos == 8) {
  ------------------
  |  Branch (73:9): [True: 27.2k, False: 253k]
  ------------------
   74|  27.2k|        this->bit_pos = 0;
   75|  27.2k|        ++this->byte_pos;
   76|  27.2k|        this->byte_pos %= 3;
   77|  27.2k|    }
   78|   280k|    this->bits_available -= this->code_size;
   79|       |
   80|   280k|    handleCode(code);
   81|   280k|}
_ZN13Pl_LZWDecoder12getFirstCharEj:
   85|   231k|{
   86|   231k|    unsigned char result = '\0';
   87|   231k|    if (code < 256) {
  ------------------
  |  Branch (87:9): [True: 8.72k, False: 222k]
  ------------------
   88|  8.72k|        result = static_cast<unsigned char>(code);
   89|   222k|    } else if (code > 257) {
  ------------------
  |  Branch (89:16): [True: 222k, False: 0]
  ------------------
   90|   222k|        unsigned int idx = code - 258;
   91|   222k|        if (idx >= table.size()) {
  ------------------
  |  Branch (91:13): [True: 0, False: 222k]
  ------------------
   92|      0|            throw std::runtime_error("Pl_LZWDecoder::getFirstChar: table overflow");
   93|      0|        }
   94|   222k|        Buffer& b = table.at(idx);
   95|   222k|        result = b.getBuffer()[0];
   96|   222k|    } else {
   97|      0|        throw std::runtime_error(
   98|      0|            "Pl_LZWDecoder::getFirstChar called with invalid code (" + std::to_string(code) + ")");
   99|      0|    }
  100|   231k|    return result;
  101|   231k|}
_ZN13Pl_LZWDecoder10addToTableEh:
  105|   271k|{
  106|   271k|    unsigned int last_size = 0;
  107|   271k|    unsigned char const* last_data = nullptr;
  108|   271k|    unsigned char tmp[1];
  109|       |
  110|   271k|    if (this->last_code < 256) {
  ------------------
  |  Branch (110:9): [True: 41.1k, False: 230k]
  ------------------
  111|  41.1k|        tmp[0] = static_cast<unsigned char>(this->last_code);
  112|  41.1k|        last_data = tmp;
  113|  41.1k|        last_size = 1;
  114|   230k|    } else if (this->last_code > 257) {
  ------------------
  |  Branch (114:16): [True: 230k, False: 0]
  ------------------
  115|   230k|        unsigned int idx = this->last_code - 258;
  116|   230k|        if (idx >= table.size()) {
  ------------------
  |  Branch (116:13): [True: 0, False: 230k]
  ------------------
  117|      0|            throw std::runtime_error("Pl_LZWDecoder::addToTable: table overflow");
  118|      0|        }
  119|   230k|        Buffer& b = table.at(idx);
  120|   230k|        last_data = b.getBuffer();
  121|   230k|        last_size = QIntC::to_uint(b.getSize());
  122|   230k|    } else {
  123|      0|        throw std::runtime_error(
  124|      0|            "Pl_LZWDecoder::addToTable called with invalid code (" +
  125|      0|            std::to_string(this->last_code) + ")");
  126|      0|    }
  127|       |
  128|   271k|    Buffer entry(1 + last_size);
  129|   271k|    unsigned char* new_data = entry.getBuffer();
  130|   271k|    memcpy(new_data, last_data, last_size);
  131|   271k|    new_data[last_size] = next;
  132|   271k|    this->table.push_back(std::move(entry));
  133|   271k|}
_ZN13Pl_LZWDecoder10handleCodeEj:
  137|   280k|{
  138|   280k|    if (this->eod) {
  ------------------
  |  Branch (138:9): [True: 6.49k, False: 274k]
  ------------------
  139|  6.49k|        return;
  140|  6.49k|    }
  141|       |
  142|   274k|    if (code == 256) {
  ------------------
  |  Branch (142:9): [True: 951, False: 273k]
  ------------------
  143|    951|        if (!this->table.empty()) {
  ------------------
  |  Branch (143:13): [True: 7, False: 944]
  ------------------
  144|      7|            QTC::TC("libtests", "Pl_LZWDecoder intermediate reset");
  145|      7|        }
  146|    951|        this->table.clear();
  147|    951|        this->code_size = 9;
  148|   273k|    } else if (code == 257) {
  ------------------
  |  Branch (148:16): [True: 789, False: 272k]
  ------------------
  149|    789|        this->eod = true;
  150|   272k|    } else {
  151|   272k|        if (this->last_code != 256) {
  ------------------
  |  Branch (151:13): [True: 271k, False: 958]
  ------------------
  152|       |            // Add to the table from last time.  New table entry would be what we read last plus the
  153|       |            // first character of what we're reading now.
  154|   271k|            unsigned char next = '\0';
  155|   271k|            unsigned int table_size = QIntC::to_uint(table.size());
  156|   271k|            if (code < 256) {
  ------------------
  |  Branch (156:17): [True: 40.3k, False: 231k]
  ------------------
  157|       |                // just read < 256; last time's next was code
  158|  40.3k|                next = static_cast<unsigned char>(code);
  159|   231k|            } else if (code > 257) {
  ------------------
  |  Branch (159:24): [True: 231k, False: 0]
  ------------------
  160|   231k|                size_t idx = code - 258;
  161|   231k|                if (idx > table_size) {
  ------------------
  |  Branch (161:21): [True: 98, False: 231k]
  ------------------
  162|     98|                    throw std::runtime_error("LZWDecoder: bad code received");
  163|   231k|                } else if (idx == table_size) {
  ------------------
  |  Branch (163:28): [True: 18.0k, False: 213k]
  ------------------
  164|       |                    // The encoder would have just created this entry, so the first character of
  165|       |                    // this entry would have been the same as the first character of the last entry.
  166|  18.0k|                    QTC::TC("libtests", "Pl_LZWDecoder last was table size");
  167|  18.0k|                    next = getFirstChar(this->last_code);
  168|   213k|                } else {
  169|   213k|                    next = getFirstChar(code);
  170|   213k|                }
  171|   231k|            }
  172|   271k|            unsigned int new_idx = 258 + table_size;
  173|   271k|            if (new_idx == 4096) {
  ------------------
  |  Branch (173:17): [True: 0, False: 271k]
  ------------------
  174|      0|                throw std::runtime_error("LZWDecoder: table full");
  175|      0|            }
  176|   271k|            addToTable(next);
  177|   271k|            unsigned int change_idx = new_idx + code_change_delta;
  178|   271k|            if ((change_idx == 511) || (change_idx == 1023) || (change_idx == 2047)) {
  ------------------
  |  Branch (178:17): [True: 807, False: 270k]
  |  Branch (178:40): [True: 0, False: 270k]
  |  Branch (178:64): [True: 0, False: 270k]
  ------------------
  179|    807|                ++this->code_size;
  180|    807|            }
  181|   271k|        }
  182|       |
  183|   272k|        if (code < 256) {
  ------------------
  |  Branch (183:13): [True: 41.2k, False: 231k]
  ------------------
  184|  41.2k|            auto ch = static_cast<unsigned char>(code);
  185|  41.2k|            getNext()->write(&ch, 1);
  186|   231k|        } else {
  187|   231k|            unsigned int idx = code - 258;
  188|   231k|            if (idx >= table.size()) {
  ------------------
  |  Branch (188:17): [True: 3, False: 231k]
  ------------------
  189|      3|                throw std::runtime_error("Pl_LZWDecoder::handleCode: table overflow");
  190|      3|            }
  191|   231k|            Buffer& b = table.at(idx);
  192|   231k|            getNext()->write(b.getBuffer(), b.getSize());
  193|   231k|        }
  194|   272k|    }
  195|       |
  196|   274k|    this->last_code = code;
  197|   274k|}

_ZN6Pl_MD5C2EPKcP8Pipeline:
   10|  1.80k|{
   11|  1.80k|}
_ZN6Pl_MD55writeEPKhm:
   15|  2.23M|{
   16|  2.23M|    if (this->enabled) {
  ------------------
  |  Branch (16:9): [True: 2.23M, False: 0]
  ------------------
   17|  2.23M|        if (!this->in_progress) {
  ------------------
  |  Branch (17:13): [True: 1.80k, False: 2.23M]
  ------------------
   18|  1.80k|            this->md5.reset();
   19|  1.80k|            this->in_progress = true;
   20|  1.80k|        }
   21|       |
   22|       |        // Write in chunks in case len is too big to fit in an int. Assume int is at least 32 bits.
   23|  2.23M|        static size_t const max_bytes = 1 << 30;
   24|  2.23M|        size_t bytes_left = len;
   25|  2.23M|        unsigned char const* data = buf;
   26|  4.47M|        while (bytes_left > 0) {
  ------------------
  |  Branch (26:16): [True: 2.23M, False: 2.23M]
  ------------------
   27|  2.23M|            size_t bytes = (bytes_left >= max_bytes ? max_bytes : bytes_left);
  ------------------
  |  Branch (27:29): [True: 0, False: 2.23M]
  ------------------
   28|  2.23M|            this->md5.encodeDataIncrementally(reinterpret_cast<char const*>(data), bytes);
   29|  2.23M|            bytes_left -= bytes;
   30|  2.23M|            data += bytes;
   31|  2.23M|        }
   32|  2.23M|    }
   33|       |
   34|  2.23M|    this->getNext()->write(buf, len);
   35|  2.23M|}
_ZN6Pl_MD56finishEv:
   39|  28.6k|{
   40|  28.6k|    this->getNext()->finish();
   41|  28.6k|    if (!this->persist_across_finish) {
  ------------------
  |  Branch (41:9): [True: 0, False: 28.6k]
  ------------------
   42|      0|        this->in_progress = false;
   43|      0|    }
   44|  28.6k|}
_ZN6Pl_MD56enableEb:
   48|  1.43k|{
   49|  1.43k|    this->enabled = enabled;
   50|  1.43k|}
_ZN6Pl_MD519persistAcrossFinishEb:
   54|  1.80k|{
   55|  1.80k|    this->persist_across_finish = persist;
   56|  1.80k|}
_ZN6Pl_MD512getHexDigestEv:
   60|  1.43k|{
   61|  1.43k|    if (!this->enabled) {
  ------------------
  |  Branch (61:9): [True: 0, False: 1.43k]
  ------------------
   62|      0|        throw std::logic_error("digest requested for a disabled MD5 Pipeline");
   63|      0|    }
   64|  1.43k|    this->in_progress = false;
   65|  1.43k|    return this->md5.unparse();
   66|  1.43k|}

_ZN10Pl_OStream7MembersC2ERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE:
    7|      2|{
    8|      2|}
_ZN10Pl_OStreamC2EPKcRNSt3__113basic_ostreamIcNS2_11char_traitsIcEEEE:
   13|      2|{
   14|      2|}
_ZN10Pl_OStreamD2Ev:
   17|      2|{
   18|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   19|      2|}
_ZN10Pl_OStream5writeEPKhm:
   23|   728k|{
   24|   728k|    m->os.write(reinterpret_cast<char const*>(buf), static_cast<std::streamsize>(len));
   25|   728k|}
_ZN10Pl_OStream6finishEv:
   29|      2|{
   30|      2|    m->os.flush();
   31|      2|}

_ZN12Pl_PNGFilterC2EPKcP8PipelineNS_8action_eEjjj:
   35|  6.34k|{
   36|  6.34k|    if (samples_per_pixel < 1) {
  ------------------
  |  Branch (36:9): [True: 0, False: 6.34k]
  ------------------
   37|      0|        throw std::runtime_error("PNGFilter created with invalid samples_per_pixel");
   38|      0|    }
   39|  6.34k|    if (!((bits_per_sample == 1) || (bits_per_sample == 2) || (bits_per_sample == 4) ||
  ------------------
  |  Branch (39:11): [True: 0, False: 6.34k]
  |  Branch (39:37): [True: 0, False: 6.34k]
  |  Branch (39:63): [True: 0, False: 6.34k]
  ------------------
   40|  6.34k|          (bits_per_sample == 8) || (bits_per_sample == 16))) {
  ------------------
  |  Branch (40:11): [True: 6.34k, False: 0]
  |  Branch (40:37): [True: 0, False: 0]
  ------------------
   41|      0|        throw std::runtime_error(
   42|      0|            "PNGFilter created with invalid bits_per_sample not 1, 2, 4, 8, or 16");
   43|      0|    }
   44|  6.34k|    this->bytes_per_pixel = ((bits_per_sample * samples_per_pixel) + 7) / 8;
   45|  6.34k|    unsigned long long bpr = ((columns * bits_per_sample * samples_per_pixel) + 7) / 8;
   46|  6.34k|    if ((bpr == 0) || (bpr > (UINT_MAX - 1))) {
  ------------------
  |  Branch (46:9): [True: 0, False: 6.34k]
  |  Branch (46:23): [True: 0, False: 6.34k]
  ------------------
   47|      0|        throw std::runtime_error("PNGFilter created with invalid columns value");
   48|      0|    }
   49|  6.34k|    if (memory_limit > 0 && bpr > (memory_limit / 2U)) {
  ------------------
  |  Branch (49:9): [True: 6.34k, False: 0]
  |  Branch (49:29): [True: 1, False: 6.34k]
  ------------------
   50|      1|        throw std::runtime_error("PNGFilter memory limit exceeded");
   51|      1|    }
   52|  6.34k|    this->bytes_per_row = bpr & UINT_MAX;
   53|  6.34k|    this->buf1 = QUtil::make_shared_array<unsigned char>(this->bytes_per_row + 1);
   54|  6.34k|    this->buf2 = QUtil::make_shared_array<unsigned char>(this->bytes_per_row + 1);
   55|  6.34k|    memset(this->buf1.get(), 0, this->bytes_per_row + 1);
   56|  6.34k|    memset(this->buf2.get(), 0, this->bytes_per_row + 1);
   57|  6.34k|    this->cur_row = this->buf1.get();
   58|  6.34k|    this->prev_row = this->buf2.get();
   59|       |
   60|       |    // number of bytes per incoming row
   61|  6.34k|    this->incoming = (action == a_encode ? this->bytes_per_row : this->bytes_per_row + 1);
  ------------------
  |  Branch (61:23): [True: 6.08k, False: 264]
  ------------------
   62|  6.34k|}
_ZN12Pl_PNGFilter14setMemoryLimitEy:
   66|  3.33k|{
   67|  3.33k|    memory_limit = limit;
   68|  3.33k|}
_ZN12Pl_PNGFilter5writeEPKhm:
   72|   497k|{
   73|   497k|    size_t left = this->incoming - this->pos;
   74|   497k|    size_t offset = 0;
   75|   700k|    while (len >= left) {
  ------------------
  |  Branch (75:12): [True: 203k, False: 497k]
  ------------------
   76|       |        // finish off current row
   77|   203k|        memcpy(this->cur_row + this->pos, data + offset, left);
   78|   203k|        offset += left;
   79|   203k|        len -= left;
   80|       |
   81|   203k|        processRow();
   82|       |
   83|       |        // Swap rows
   84|   203k|        unsigned char* t = this->prev_row;
   85|   203k|        this->prev_row = this->cur_row;
   86|   203k|        this->cur_row = t ? t : this->buf2.get();
  ------------------
  |  Branch (86:25): [True: 203k, False: 0]
  ------------------
   87|   203k|        memset(this->cur_row, 0, this->bytes_per_row + 1);
   88|   203k|        left = this->incoming;
   89|   203k|        this->pos = 0;
   90|   203k|    }
   91|   497k|    if (len) {
  ------------------
  |  Branch (91:9): [True: 330k, False: 167k]
  ------------------
   92|   330k|        memcpy(this->cur_row + this->pos, data + offset, len);
   93|   330k|    }
   94|   497k|    this->pos += len;
   95|   497k|}
_ZN12Pl_PNGFilter10processRowEv:
   99|   203k|{
  100|   203k|    if (this->action == a_encode) {
  ------------------
  |  Branch (100:9): [True: 166k, False: 36.2k]
  ------------------
  101|   166k|        encodeRow();
  102|   166k|    } else {
  103|  36.2k|        decodeRow();
  104|  36.2k|    }
  105|   203k|}
_ZN12Pl_PNGFilter9decodeRowEv:
  109|  36.2k|{
  110|  36.2k|    int filter = this->cur_row[0];
  111|  36.2k|    if (this->prev_row) {
  ------------------
  |  Branch (111:9): [True: 36.2k, False: 0]
  ------------------
  112|  36.2k|        switch (filter) {
  113|  1.66k|        case 0:
  ------------------
  |  Branch (113:9): [True: 1.66k, False: 34.6k]
  ------------------
  114|  1.66k|            break;
  115|    606|        case 1:
  ------------------
  |  Branch (115:9): [True: 606, False: 35.6k]
  ------------------
  116|    606|            this->decodeSub();
  117|    606|            break;
  118|  28.4k|        case 2:
  ------------------
  |  Branch (118:9): [True: 28.4k, False: 7.87k]
  ------------------
  119|  28.4k|            this->decodeUp();
  120|  28.4k|            break;
  121|     23|        case 3:
  ------------------
  |  Branch (121:9): [True: 23, False: 36.2k]
  ------------------
  122|     23|            this->decodeAverage();
  123|     23|            break;
  124|     48|        case 4:
  ------------------
  |  Branch (124:9): [True: 48, False: 36.2k]
  ------------------
  125|     48|            this->decodePaeth();
  126|     48|            break;
  127|  5.52k|        default:
  ------------------
  |  Branch (127:9): [True: 5.52k, False: 30.7k]
  ------------------
  128|       |            // ignore
  129|  5.52k|            break;
  130|  36.2k|        }
  131|  36.2k|    }
  132|       |
  133|  36.2k|    getNext()->write(this->cur_row + 1, this->bytes_per_row);
  134|  36.2k|}
_ZN12Pl_PNGFilter9decodeSubEv:
  138|    606|{
  139|    606|    QTC::TC("libtests", "Pl_PNGFilter decodeSub");
  140|    606|    unsigned char* buffer = this->cur_row + 1;
  141|    606|    unsigned int bpp = this->bytes_per_pixel;
  142|       |
  143|  2.69k|    for (unsigned int i = 0; i < this->bytes_per_row; ++i) {
  ------------------
  |  Branch (143:30): [True: 2.08k, False: 606]
  ------------------
  144|  2.08k|        unsigned char left = 0;
  145|       |
  146|  2.08k|        if (i >= bpp) {
  ------------------
  |  Branch (146:13): [True: 1.47k, False: 606]
  ------------------
  147|  1.47k|            left = buffer[i - bpp];
  148|  1.47k|        }
  149|       |
  150|  2.08k|        buffer[i] = static_cast<unsigned char>(buffer[i] + left);
  151|  2.08k|    }
  152|    606|}
_ZN12Pl_PNGFilter8decodeUpEv:
  156|  28.4k|{
  157|  28.4k|    QTC::TC("libtests", "Pl_PNGFilter decodeUp");
  158|  28.4k|    unsigned char* buffer = this->cur_row + 1;
  159|  28.4k|    unsigned char* above_buffer = this->prev_row + 1;
  160|       |
  161|   140k|    for (unsigned int i = 0; i < this->bytes_per_row; ++i) {
  ------------------
  |  Branch (161:30): [True: 112k, False: 28.4k]
  ------------------
  162|   112k|        unsigned char up = above_buffer[i];
  163|   112k|        buffer[i] = static_cast<unsigned char>(buffer[i] + up);
  164|   112k|    }
  165|  28.4k|}
_ZN12Pl_PNGFilter13decodeAverageEv:
  169|     23|{
  170|     23|    QTC::TC("libtests", "Pl_PNGFilter decodeAverage");
  171|     23|    unsigned char* buffer = this->cur_row + 1;
  172|     23|    unsigned char* above_buffer = this->prev_row + 1;
  173|     23|    unsigned int bpp = this->bytes_per_pixel;
  174|       |
  175|    110|    for (unsigned int i = 0; i < this->bytes_per_row; ++i) {
  ------------------
  |  Branch (175:30): [True: 87, False: 23]
  ------------------
  176|     87|        int left = 0;
  177|     87|        int up = 0;
  178|       |
  179|     87|        if (i >= bpp) {
  ------------------
  |  Branch (179:13): [True: 64, False: 23]
  ------------------
  180|     64|            left = buffer[i - bpp];
  181|     64|        }
  182|       |
  183|     87|        up = above_buffer[i];
  184|     87|        buffer[i] = static_cast<unsigned char>(buffer[i] + (left + up) / 2);
  185|     87|    }
  186|     23|}
_ZN12Pl_PNGFilter11decodePaethEv:
  190|     48|{
  191|     48|    QTC::TC("libtests", "Pl_PNGFilter decodePaeth");
  192|     48|    unsigned char* buffer = this->cur_row + 1;
  193|     48|    unsigned char* above_buffer = this->prev_row + 1;
  194|     48|    unsigned int bpp = this->bytes_per_pixel;
  195|       |
  196|    214|    for (unsigned int i = 0; i < this->bytes_per_row; ++i) {
  ------------------
  |  Branch (196:30): [True: 166, False: 48]
  ------------------
  197|    166|        int left = 0;
  198|    166|        int up = above_buffer[i];
  199|    166|        int upper_left = 0;
  200|       |
  201|    166|        if (i >= bpp) {
  ------------------
  |  Branch (201:13): [True: 118, False: 48]
  ------------------
  202|    118|            left = buffer[i - bpp];
  203|    118|            upper_left = above_buffer[i - bpp];
  204|    118|        }
  205|       |
  206|    166|        buffer[i] =
  207|    166|            static_cast<unsigned char>(buffer[i] + this->PaethPredictor(left, up, upper_left));
  208|    166|    }
  209|     48|}
_ZN12Pl_PNGFilter14PaethPredictorEiii:
  213|    166|{
  214|    166|    int p = a + b - c;
  215|    166|    int pa = abs_diff(p, a);
  216|    166|    int pb = abs_diff(p, b);
  217|    166|    int pc = abs_diff(p, c);
  218|       |
  219|    166|    if (pa <= pb && pa <= pc) {
  ------------------
  |  Branch (219:9): [True: 91, False: 75]
  |  Branch (219:21): [True: 90, False: 1]
  ------------------
  220|     90|        return a;
  221|     90|    }
  222|     76|    if (pb <= pc) {
  ------------------
  |  Branch (222:9): [True: 74, False: 2]
  ------------------
  223|     74|        return b;
  224|     74|    }
  225|      2|    return c;
  226|     76|}
_ZN12Pl_PNGFilter9encodeRowEv:
  230|   166k|{
  231|       |    // For now, hard-code to using UP filter.
  232|   166k|    unsigned char ch = 2;
  233|   166k|    getNext()->write(&ch, 1);
  234|   166k|    if (this->prev_row) {
  ------------------
  |  Branch (234:9): [True: 166k, False: 0]
  ------------------
  235|   914k|        for (unsigned int i = 0; i < this->bytes_per_row; ++i) {
  ------------------
  |  Branch (235:34): [True: 747k, False: 166k]
  ------------------
  236|   747k|            ch = static_cast<unsigned char>(this->cur_row[i] - this->prev_row[i]);
  237|   747k|            getNext()->write(&ch, 1);
  238|   747k|        }
  239|   166k|    } else {
  240|      0|        getNext()->write(this->cur_row, this->bytes_per_row);
  241|      0|    }
  242|   166k|}
_ZN12Pl_PNGFilter6finishEv:
  246|  6.34k|{
  247|  6.34k|    if (this->pos) {
  ------------------
  |  Branch (247:9): [True: 51, False: 6.29k]
  ------------------
  248|       |        // write partial row
  249|     51|        processRow();
  250|     51|    }
  251|  6.34k|    this->prev_row = nullptr;
  252|  6.34k|    this->cur_row = buf1.get();
  253|  6.34k|    this->pos = 0;
  254|  6.34k|    memset(this->cur_row, 0, this->bytes_per_row + 1);
  255|       |
  256|  6.34k|    getNext()->finish();
  257|  6.34k|}
Pl_PNGFilter.cc:_ZL8abs_diffii:
   17|    498|{
   18|    498|    return a > b ? a - b : b - a;
  ------------------
  |  Branch (18:12): [True: 248, False: 250]
  ------------------
   19|    498|}

_ZN12Pl_RunLength7MembersC2ENS_8action_eE:
   10|  1.47k|{
   11|  1.47k|}
_ZN12Pl_RunLengthC2EPKcP8PipelineNS_8action_eE:
   16|  1.47k|{
   17|  1.47k|}
_ZN12Pl_RunLengthD2Ev:
   20|  1.47k|{
   21|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   22|  1.47k|}
_ZN12Pl_RunLength5writeEPKhm:
   26|  1.57k|{
   27|  1.57k|    if (m->action == a_encode) {
  ------------------
  |  Branch (27:9): [True: 0, False: 1.57k]
  ------------------
   28|      0|        encode(data, len);
   29|  1.57k|    } else {
   30|  1.57k|        decode(data, len);
   31|  1.57k|    }
   32|  1.57k|}
_ZN12Pl_RunLength6decodeEPKhm:
   68|  1.57k|{
   69|  1.57k|    m->out.reserve(len);
   70|   108M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (70:24): [True: 108M, False: 1.57k]
  ------------------
   71|   108M|        unsigned char const& ch = data[i];
   72|   108M|        switch (m->state) {
  ------------------
  |  Branch (72:17): [True: 0, False: 108M]
  ------------------
   73|  44.4M|        case st_top:
  ------------------
  |  Branch (73:9): [True: 44.4M, False: 63.8M]
  ------------------
   74|  44.4M|            if (ch < 128) {
  ------------------
  |  Branch (74:17): [True: 26.2M, False: 18.2M]
  ------------------
   75|       |                // length represents remaining number of bytes to copy
   76|  26.2M|                m->length = 1U + ch;
   77|  26.2M|                m->state = st_copying;
   78|  26.2M|            } else if (ch > 128) {
  ------------------
  |  Branch (78:24): [True: 18.2M, False: 2.47k]
  ------------------
   79|       |                // length represents number of copies of next byte
   80|  18.2M|                m->length = 257U - ch;
   81|  18.2M|                m->state = st_run;
   82|  18.2M|            } else // ch == 128
   83|  2.47k|            {
   84|       |                // EOD; stay in this state
   85|  2.47k|            }
   86|  44.4M|            break;
   87|       |
   88|  45.6M|        case st_copying:
  ------------------
  |  Branch (88:9): [True: 45.6M, False: 62.7M]
  ------------------
   89|  45.6M|            m->out.append(1, static_cast<char>(ch));
   90|  45.6M|            if (--m->length == 0) {
  ------------------
  |  Branch (90:17): [True: 26.2M, False: 19.4M]
  ------------------
   91|  26.2M|                m->state = st_top;
   92|  26.2M|            }
   93|  45.6M|            break;
   94|       |
   95|  18.2M|        case st_run:
  ------------------
  |  Branch (95:9): [True: 18.2M, False: 90.1M]
  ------------------
   96|  18.2M|            m->out.append(m->length, static_cast<char>(ch));
   97|  18.2M|            m->state = st_top;
   98|  18.2M|            break;
   99|   108M|        }
  100|   108M|    }
  101|  1.57k|}
_ZN12Pl_RunLength6finishEv:
  135|  1.47k|{
  136|       |    // When decoding, we might have read a length byte not followed by data, which means the stream
  137|       |    // was terminated early, but we will just ignore this case since this is the only sensible thing
  138|       |    // to do.
  139|  1.47k|    auto next = getNext();
  140|  1.47k|    if (m->action == a_encode) {
  ------------------
  |  Branch (140:9): [True: 0, False: 1.47k]
  ------------------
  141|      0|        flush_encode();
  142|      0|        unsigned char ch = 128;
  143|      0|        next->write(&ch, 1);
  144|  1.47k|    } else {
  145|  1.47k|        next->writeString(m->out);
  146|  1.47k|    }
  147|  1.47k|    next->finish();
  148|  1.47k|}

_ZN16Pl_TIFFPredictorC2EPKcP8PipelineNS_8action_eEjjj:
   28|     17|{
   29|     17|    if (samples_per_pixel < 1) {
  ------------------
  |  Branch (29:9): [True: 0, False: 17]
  ------------------
   30|      0|        throw std::runtime_error("TIFFPredictor created with invalid samples_per_pixel");
   31|      0|    }
   32|     17|    if ((bits_per_sample < 1) || (bits_per_sample > (8 * (sizeof(unsigned long long))))) {
  ------------------
  |  Branch (32:9): [True: 0, False: 17]
  |  Branch (32:34): [True: 0, False: 17]
  ------------------
   33|      0|        throw std::runtime_error("TIFFPredictor created with invalid bits_per_sample");
   34|      0|    }
   35|     17|    unsigned long long bpr = ((columns * bits_per_sample * samples_per_pixel) + 7) / 8;
   36|     17|    if ((bpr == 0) || (bpr > (UINT_MAX - 1))) {
  ------------------
  |  Branch (36:9): [True: 0, False: 17]
  |  Branch (36:23): [True: 0, False: 17]
  ------------------
   37|      0|        throw std::runtime_error("TIFFPredictor created with invalid columns value");
   38|      0|    }
   39|     17|    if (memory_limit > 0 && bpr > (memory_limit / 2U)) {
  ------------------
  |  Branch (39:9): [True: 17, False: 0]
  |  Branch (39:29): [True: 0, False: 17]
  ------------------
   40|      0|        throw std::runtime_error("TIFFPredictor memory limit exceeded");
   41|      0|    }
   42|     17|    this->bytes_per_row = bpr & UINT_MAX;
   43|     17|}
_ZN16Pl_TIFFPredictor14setMemoryLimitEy:
   47|  3.33k|{
   48|  3.33k|    memory_limit = limit;
   49|  3.33k|}
_ZN16Pl_TIFFPredictor5writeEPKhm:
   53|      8|{
   54|      8|    auto end = data + len;
   55|      8|    auto row_end = data + (bytes_per_row - cur_row.size());
   56|    382|    while (row_end <= end) {
  ------------------
  |  Branch (56:12): [True: 374, False: 8]
  ------------------
   57|       |        // finish off current row
   58|    374|        cur_row.insert(cur_row.end(), data, row_end);
   59|    374|        data = row_end;
   60|    374|        row_end += bytes_per_row;
   61|       |
   62|    374|        processRow();
   63|       |
   64|       |        // Prepare for next row
   65|    374|        cur_row.clear();
   66|    374|    }
   67|       |
   68|      8|    cur_row.insert(cur_row.end(), data, end);
   69|      8|}
_ZN16Pl_TIFFPredictor10processRowEv:
   73|    379|{
   74|    379|    QTC::TC("libtests", "Pl_TIFFPredictor processRow", (action == a_decode ? 0 : 1));
  ------------------
  |  Branch (74:57): [True: 379, False: 0]
  ------------------
   75|    379|    previous.assign(samples_per_pixel, 0);
   76|    379|    if (bits_per_sample != 8) {
  ------------------
  |  Branch (76:9): [True: 0, False: 379]
  ------------------
   77|      0|        BitWriter bw(p_next);
   78|      0|        BitStream in(cur_row.data(), cur_row.size());
   79|      0|        for (unsigned int col = 0; col < this->columns; ++col) {
  ------------------
  |  Branch (79:36): [True: 0, False: 0]
  ------------------
   80|      0|            for (auto& prev: previous) {
  ------------------
  |  Branch (80:28): [True: 0, False: 0]
  ------------------
   81|      0|                long long sample = in.getBitsSigned(this->bits_per_sample);
   82|      0|                long long new_sample = sample;
   83|      0|                if (action == a_encode) {
  ------------------
  |  Branch (83:21): [True: 0, False: 0]
  ------------------
   84|      0|                    new_sample -= prev;
   85|      0|                    prev = sample;
   86|      0|                } else {
   87|      0|                    new_sample += prev;
   88|      0|                    prev = new_sample;
   89|      0|                }
   90|      0|                bw.writeBitsSigned(new_sample, this->bits_per_sample);
   91|      0|            }
   92|      0|        }
   93|      0|        bw.flush();
   94|    379|    } else {
   95|    379|        out.clear();
   96|    379|        auto next = cur_row.begin();
   97|    379|        auto cr_end = cur_row.end();
   98|    379|        auto pr_end = previous.end();
   99|       |
  100|  1.13k|        while (next != cr_end) {
  ------------------
  |  Branch (100:16): [True: 751, False: 379]
  ------------------
  101|  1.50k|            for (auto prev = previous.begin(); prev != pr_end && next != cr_end; ++prev, ++next) {
  ------------------
  |  Branch (101:48): [True: 751, False: 751]
  |  Branch (101:66): [True: 751, False: 0]
  ------------------
  102|    751|                long long sample = *next;
  103|    751|                long long new_sample = sample;
  104|    751|                if (action == a_encode) {
  ------------------
  |  Branch (104:21): [True: 0, False: 751]
  ------------------
  105|      0|                    new_sample -= *prev;
  106|      0|                    *prev = sample;
  107|    751|                } else {
  108|    751|                    new_sample += *prev;
  109|    751|                    *prev = new_sample;
  110|    751|                }
  111|    751|                out.push_back(static_cast<unsigned char>(255U & new_sample));
  112|    751|            }
  113|    751|        }
  114|    379|        p_next->write(out.data(), out.size());
  115|    379|    }
  116|    379|}
_ZN16Pl_TIFFPredictor6finishEv:
  120|     17|{
  121|     17|    if (!cur_row.empty()) {
  ------------------
  |  Branch (121:9): [True: 5, False: 12]
  ------------------
  122|       |        // write partial row
  123|      5|        cur_row.insert(cur_row.end(), bytes_per_row - cur_row.size(), 0);
  124|      5|        processRow();
  125|      5|    }
  126|     17|    cur_row.clear();
  127|     17|    p_next->finish();
  128|     17|}

_ZN4QPDF15StringDecrypterC2EPS_RK10QPDFObjGen:
  169|   145k|{
  170|   145k|}
_ZN4QPDF20EncryptionParametersC2Ev:
  196|  3.33k|{
  197|  3.33k|}
_ZN4QPDF7MembersC2Ev:
  203|  3.33k|{
  204|  3.33k|}
_ZN4QPDFC2Ev:
  208|  3.33k|{
  209|  3.33k|    m->tokenizer.allowEOF();
  210|       |    // Generate a unique ID. It just has to be unique among all QPDF objects allocated throughout
  211|       |    // the lifetime of this running application.
  212|  3.33k|    static std::atomic<unsigned long long> unique_id{0};
  213|  3.33k|    m->unique_id = unique_id.fetch_add(1ULL);
  214|  3.33k|}
_ZN4QPDFD2Ev:
  217|  3.33k|{
  218|       |    // If two objects are mutually referential (through each object having an array or dictionary
  219|       |    // that contains an indirect reference to the other), the circular references in the
  220|       |    // std::shared_ptr objects will prevent the objects from being deleted. Walk through all objects
  221|       |    // in the object cache, which is those objects that we read from the file, and break all
  222|       |    // resolved indirect references by replacing them with an internal object type representing that
  223|       |    // they have been destroyed. Note that we can't break references like this at any time when the
  224|       |    // QPDF object is active. The call to reset also causes all direct QPDFObjectHandle objects that
  225|       |    // are reachable from this object to release their association with this QPDF. Direct objects
  226|       |    // are not destroyed since they can be moved to other QPDF objects safely.
  227|       |
  228|       |    // At this point, obviously no one is still using the QPDF object, but we'll explicitly clear
  229|       |    // the xref table anyway just to prevent any possibility of resolve() succeeding.
  230|  3.33k|    m->xref_table.clear();
  231|   188k|    for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (231:26): [True: 188k, False: 3.33k]
  ------------------
  232|   188k|        iter.second.object->disconnect();
  233|   188k|        if (iter.second.object->getTypeCode() != ::ot_null) {
  ------------------
  |  Branch (233:13): [True: 168k, False: 20.2k]
  ------------------
  234|   168k|            iter.second.object->destroy();
  235|   168k|        }
  236|   188k|    }
  237|  3.33k|}
_ZN4QPDF6createEv:
  241|  3.33k|{
  242|  3.33k|    return std::make_shared<QPDF>();
  243|  3.33k|}
_ZN4QPDF18processInputSourceENSt3__110shared_ptrI11InputSourceEEPKc:
  273|  3.33k|{
  274|  3.33k|    m->file = source;
  275|  3.33k|    parse(password);
  276|  3.33k|}
_ZN4QPDF14setMaxWarningsEm:
  336|  3.33k|{
  337|  3.33k|    m->max_warnings = val;
  338|  3.33k|}
_ZN4QPDF18validatePDFVersionERPKcRNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  374|  3.22k|{
  375|  3.22k|    bool valid = QUtil::is_digit(*p);
  376|  3.22k|    if (valid) {
  ------------------
  |  Branch (376:9): [True: 2.88k, False: 335]
  ------------------
  377|  6.70k|        while (QUtil::is_digit(*p)) {
  ------------------
  |  Branch (377:16): [True: 3.81k, False: 2.88k]
  ------------------
  378|  3.81k|            version.append(1, *p++);
  379|  3.81k|        }
  380|  2.88k|        if ((*p == '.') && QUtil::is_digit(*(p + 1))) {
  ------------------
  |  Branch (380:13): [True: 2.64k, False: 240]
  |  Branch (380:28): [True: 2.60k, False: 43]
  ------------------
  381|  2.60k|            version.append(1, *p++);
  382|  5.33k|            while (QUtil::is_digit(*p)) {
  ------------------
  |  Branch (382:20): [True: 2.72k, False: 2.60k]
  ------------------
  383|  2.72k|                version.append(1, *p++);
  384|  2.72k|            }
  385|  2.60k|        } else {
  386|    283|            valid = false;
  387|    283|        }
  388|  2.88k|    }
  389|  3.22k|    return valid;
  390|  3.22k|}
_ZN4QPDF10findHeaderEv:
  394|  3.22k|{
  395|  3.22k|    qpdf_offset_t global_offset = m->file->tell();
  396|  3.22k|    std::string line = m->file->readLine(1024);
  397|  3.22k|    char const* p = line.c_str();
  398|  3.22k|    if (strncmp(p, "%PDF-", 5) != 0) {
  ------------------
  |  Branch (398:9): [True: 0, False: 3.22k]
  ------------------
  399|      0|        throw std::logic_error("findHeader is not looking at %PDF-");
  400|      0|    }
  401|  3.22k|    p += 5;
  402|  3.22k|    std::string version;
  403|       |    // Note: The string returned by line.c_str() is always null-terminated. The code below never
  404|       |    // overruns the buffer because a null character always short-circuits further advancement.
  405|  3.22k|    bool valid = validatePDFVersion(p, version);
  406|  3.22k|    if (valid) {
  ------------------
  |  Branch (406:9): [True: 2.60k, False: 618]
  ------------------
  407|  2.60k|        m->pdf_version = version;
  408|  2.60k|        if (global_offset != 0) {
  ------------------
  |  Branch (408:13): [True: 975, False: 1.63k]
  ------------------
  409|       |            // Empirical evidence strongly suggests that when there is leading material prior to the
  410|       |            // PDF header, all explicit offsets in the file are such that 0 points to the beginning
  411|       |            // of the header.
  412|    975|            QTC::TC("qpdf", "QPDF global offset");
  413|    975|            m->file = std::shared_ptr<InputSource>(new OffsetInputSource(m->file, global_offset));
  414|    975|        }
  415|  2.60k|    }
  416|  3.22k|    return valid;
  417|  3.22k|}
_ZN4QPDF13findStartxrefEv:
  421|  2.27k|{
  422|  2.27k|    if (readToken(m->file).isWord("startxref") && readToken(m->file).isInteger()) {
  ------------------
  |  Branch (422:9): [True: 2.22k, False: 49]
  |  Branch (422:9): [True: 2.06k, False: 205]
  |  Branch (422:51): [True: 2.06k, False: 156]
  ------------------
  423|       |        // Position in front of offset token
  424|  2.06k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
  425|  2.06k|        return true;
  426|  2.06k|    }
  427|    205|    return false;
  428|  2.27k|}
_ZN4QPDF5parseEPKc:
  432|  3.33k|{
  433|  3.33k|    if (password) {
  ------------------
  |  Branch (433:9): [True: 0, False: 3.33k]
  ------------------
  434|      0|        m->encp->provided_password = password;
  435|      0|    }
  436|       |
  437|       |    // Find the header anywhere in the first 1024 bytes of the file.
  438|  3.33k|    PatternFinder hf(*this, &QPDF::findHeader);
  439|  3.33k|    if (!m->file->findFirst("%PDF-", 0, 1024, hf)) {
  ------------------
  |  Branch (439:9): [True: 729, False: 2.60k]
  ------------------
  440|    729|        QTC::TC("qpdf", "QPDF not a pdf file");
  441|    729|        warn(damagedPDF("", 0, "can't find PDF header"));
  442|       |        // QPDFWriter writes files that usually require at least version 1.2 for /FlateDecode
  443|    729|        m->pdf_version = "1.2";
  444|    729|    }
  445|       |
  446|       |    // PDF spec says %%EOF must be found within the last 1024 bytes of/ the file.  We add an extra
  447|       |    // 30 characters to leave room for the startxref stuff.
  448|  3.33k|    m->file->seek(0, SEEK_END);
  449|  3.33k|    qpdf_offset_t end_offset = m->file->tell();
  450|  3.33k|    m->xref_table_max_offset = end_offset;
  451|       |    // Sanity check on object ids. All objects must appear in xref table / stream. In all realistic
  452|       |    // scenarios at least 3 bytes are required.
  453|  3.33k|    if (m->xref_table_max_id > m->xref_table_max_offset / 3) {
  ------------------
  |  Branch (453:9): [True: 3.33k, False: 0]
  ------------------
  454|  3.33k|        m->xref_table_max_id = static_cast<int>(m->xref_table_max_offset / 3);
  455|  3.33k|    }
  456|  3.33k|    qpdf_offset_t start_offset = (end_offset > 1054 ? end_offset - 1054 : 0);
  ------------------
  |  Branch (456:35): [True: 2.61k, False: 717]
  ------------------
  457|  3.33k|    PatternFinder sf(*this, &QPDF::findStartxref);
  458|  3.33k|    qpdf_offset_t xref_offset = 0;
  459|  3.33k|    if (m->file->findLast("startxref", start_offset, 0, sf)) {
  ------------------
  |  Branch (459:9): [True: 1.81k, False: 1.51k]
  ------------------
  460|  1.81k|        xref_offset = QUtil::string_to_ll(readToken(m->file).getValue().c_str());
  461|  1.81k|    }
  462|       |
  463|  3.33k|    try {
  464|  3.33k|        if (xref_offset == 0) {
  ------------------
  |  Branch (464:13): [True: 1.52k, False: 1.80k]
  ------------------
  465|  1.52k|            QTC::TC("qpdf", "QPDF can't find startxref");
  466|  1.52k|            throw damagedPDF("", 0, "can't find startxref");
  467|  1.52k|        }
  468|  1.80k|        try {
  469|  1.80k|            read_xref(xref_offset);
  470|  1.80k|        } catch (QPDFExc&) {
  471|  1.69k|            throw;
  472|  1.69k|        } catch (std::exception& e) {
  473|     23|            throw damagedPDF("", 0, std::string("error reading xref: ") + e.what());
  474|     23|        }
  475|  3.24k|    } catch (QPDFExc& e) {
  476|  3.24k|        if (m->attempt_recovery) {
  ------------------
  |  Branch (476:13): [True: 3.24k, False: 0]
  ------------------
  477|  3.24k|            reconstruct_xref(e);
  478|  3.24k|            QTC::TC("qpdf", "QPDF reconstructed xref table");
  479|  3.24k|        } else {
  480|      0|            throw;
  481|      0|        }
  482|  3.24k|    }
  483|       |
  484|  3.24k|    initializeEncryption();
  485|  2.04k|    m->parsed = true;
  486|  2.04k|    if (m->xref_table.size() > 0 && !getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (486:9): [True: 2.02k, False: 16]
  |  Branch (486:9): [True: 7, False: 2.03k]
  |  Branch (486:37): [True: 7, False: 2.02k]
  ------------------
  487|       |        // QPDFs created from JSON have an empty xref table and no root object yet.
  488|      7|        throw damagedPDF("", 0, "unable to find page tree");
  489|      7|    }
  490|  2.04k|}
_ZN4QPDF7inParseEb:
  494|   340k|{
  495|   340k|    if (m->in_parse == v) {
  ------------------
  |  Branch (495:9): [True: 0, False: 340k]
  ------------------
  496|       |        // This happens if QPDFParser::parse tries to resolve an indirect object while it is
  497|       |        // parsing.
  498|      0|        throw std::logic_error("QPDF: re-entrant parsing detected. This is a qpdf bug."
  499|      0|                               " Please report at https://github.com/qpdf/qpdf/issues.");
  500|      0|    }
  501|   340k|    m->in_parse = v;
  502|   340k|}
_ZN4QPDF4warnERK7QPDFExc:
  506|   238k|{
  507|   238k|    if (m->max_warnings > 0 && m->warnings.size() >= m->max_warnings) {
  ------------------
  |  Branch (507:9): [True: 238k, False: 0]
  |  Branch (507:32): [True: 1.66k, False: 237k]
  ------------------
  508|  1.66k|        stopOnError("Too many warnings - file is too badly damaged");
  509|  1.66k|    }
  510|   238k|    m->warnings.push_back(e);
  511|   238k|    if (!m->suppress_warnings) {
  ------------------
  |  Branch (511:9): [True: 237k, False: 1.66k]
  ------------------
  512|   237k|        *m->log->getWarn() << "WARNING: " << m->warnings.back().what() << "\n";
  513|   237k|    }
  514|   238k|}
_ZN4QPDF4warnE17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEExS9_:
  522|  1.37k|{
  523|  1.37k|    warn(QPDFExc(error_code, getFilename(), object, offset, message));
  524|  1.37k|}
_ZN4QPDF10setTrailerE16QPDFObjectHandle:
  528|  2.65k|{
  529|  2.65k|    if (m->trailer.isInitialized()) {
  ------------------
  |  Branch (529:9): [True: 15, False: 2.63k]
  ------------------
  530|     15|        return;
  531|     15|    }
  532|  2.63k|    m->trailer = obj;
  533|  2.63k|}
_ZN4QPDF16reconstruct_xrefER7QPDFExc:
  537|  3.38k|{
  538|  3.38k|    if (m->reconstructed_xref) {
  ------------------
  |  Branch (538:9): [True: 104, False: 3.28k]
  ------------------
  539|       |        // Avoid xref reconstruction infinite loops. This is getting very hard to reproduce because
  540|       |        // qpdf is throwing many fewer exceptions while parsing. Most situations are warnings now.
  541|    104|        throw e;
  542|    104|    }
  543|       |
  544|       |    // If recovery generates more than 1000 warnings, the file is so severely damaged that there
  545|       |    // probably is no point trying to continue.
  546|  3.28k|    const auto max_warnings = m->warnings.size() + 1000U;
  547|  3.28k|    auto check_warnings = [this, max_warnings]() {
  548|  3.28k|        if (m->warnings.size() > max_warnings) {
  549|  3.28k|            throw damagedPDF("", 0, "too many errors while reconstructing cross-reference table");
  550|  3.28k|        }
  551|  3.28k|    };
  552|       |
  553|  3.28k|    m->reconstructed_xref = true;
  554|       |    // We may find more objects, which may contain dangling references.
  555|  3.28k|    m->fixed_dangling_refs = false;
  556|       |
  557|  3.28k|    warn(damagedPDF("", 0, "file is damaged"));
  558|  3.28k|    warn(e);
  559|  3.28k|    warn(damagedPDF("", 0, "Attempting to reconstruct cross-reference table"));
  560|       |
  561|       |    // Delete all references to type 1 (uncompressed) objects
  562|  3.28k|    std::set<QPDFObjGen> to_delete;
  563|  5.34k|    for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (563:26): [True: 5.34k, False: 3.28k]
  ------------------
  564|  5.34k|        if (iter.second.getType() == 1) {
  ------------------
  |  Branch (564:13): [True: 3.92k, False: 1.41k]
  ------------------
  565|  3.92k|            to_delete.insert(iter.first);
  566|  3.92k|        }
  567|  5.34k|    }
  568|  3.92k|    for (auto const& iter: to_delete) {
  ------------------
  |  Branch (568:26): [True: 3.92k, False: 3.28k]
  ------------------
  569|  3.92k|        m->xref_table.erase(iter);
  570|  3.92k|    }
  571|       |
  572|  3.28k|    m->file->seek(0, SEEK_END);
  573|  3.28k|    qpdf_offset_t eof = m->file->tell();
  574|  3.28k|    m->file->seek(0, SEEK_SET);
  575|       |    // Don't allow very long tokens here during recovery. All the interesting tokens are covered.
  576|  3.28k|    static size_t const MAX_LEN = 10;
  577|  2.87M|    while (m->file->tell() < eof) {
  ------------------
  |  Branch (577:12): [True: 2.87M, False: 3.28k]
  ------------------
  578|  2.87M|        QPDFTokenizer::Token t1 = readToken(m->file, MAX_LEN);
  579|  2.87M|        qpdf_offset_t token_start = m->file->tell() - toO(t1.getValue().length());
  580|  2.87M|        if (t1.isInteger()) {
  ------------------
  |  Branch (580:13): [True: 543k, False: 2.32M]
  ------------------
  581|   543k|            auto pos = m->file->tell();
  582|   543k|            QPDFTokenizer::Token t2 = readToken(m->file, MAX_LEN);
  583|   543k|            if ((t2.isInteger()) && (readToken(m->file, MAX_LEN).isWord("obj"))) {
  ------------------
  |  Branch (583:17): [True: 442k, False: 100k]
  |  Branch (583:17): [True: 252k, False: 290k]
  |  Branch (583:37): [True: 252k, False: 189k]
  ------------------
  584|   252k|                int obj = QUtil::string_to_int(t1.getValue().c_str());
  585|   252k|                int gen = QUtil::string_to_int(t2.getValue().c_str());
  586|   252k|                if (obj <= m->xref_table_max_id) {
  ------------------
  |  Branch (586:21): [True: 252k, False: 37]
  ------------------
  587|   252k|                    insertReconstructedXrefEntry(obj, token_start, gen);
  588|   252k|                } else {
  589|     37|                    warn(damagedPDF(
  590|     37|                        "", 0, "ignoring object with impossibly large id " + std::to_string(obj)));
  591|     37|                }
  592|   252k|            }
  593|   543k|            m->file->seek(pos, SEEK_SET);
  594|  2.32M|        } else if (!m->trailer.isInitialized() && t1.isWord("trailer")) {
  ------------------
  |  Branch (594:20): [True: 955k, False: 1.37M]
  |  Branch (594:20): [True: 4.10k, False: 2.32M]
  |  Branch (594:51): [True: 4.10k, False: 951k]
  ------------------
  595|  4.10k|            auto pos = m->file->tell();
  596|  4.10k|            QPDFObjectHandle t = readTrailer();
  597|  4.10k|            if (!t.isDictionary()) {
  ------------------
  |  Branch (597:17): [True: 2.10k, False: 1.99k]
  ------------------
  598|       |                // Oh well.  It was worth a try.
  599|  2.10k|            } else {
  600|  1.99k|                setTrailer(t);
  601|  1.99k|            }
  602|  4.10k|            m->file->seek(pos, SEEK_SET);
  603|  4.10k|        }
  604|  2.87M|        check_warnings();
  605|  2.87M|        m->file->findAndSkipNextEOL();
  606|  2.87M|    }
  607|  3.28k|    m->deleted_objects.clear();
  608|       |
  609|  3.28k|    if (!m->trailer.isInitialized()) {
  ------------------
  |  Branch (609:9): [True: 1.16k, False: 2.12k]
  ------------------
  610|  1.16k|        qpdf_offset_t max_offset{0};
  611|       |        // If there are any xref streams, take the last one to appear.
  612|  17.5k|        for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (612:30): [True: 17.5k, False: 1.16k]
  ------------------
  613|  17.5k|            auto entry = iter.second;
  614|  17.5k|            if (entry.getType() != 1) {
  ------------------
  |  Branch (614:17): [True: 156, False: 17.3k]
  ------------------
  615|    156|                continue;
  616|    156|            }
  617|  17.3k|            auto oh = getObjectByObjGen(iter.first);
  618|  17.3k|            try {
  619|  17.3k|                if (!oh.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (619:21): [True: 16.1k, False: 1.23k]
  ------------------
  620|  16.1k|                    continue;
  621|  16.1k|                }
  622|  17.3k|            } catch (std::exception&) {
  623|    678|                continue;
  624|    678|            }
  625|    552|            auto offset = entry.getOffset();
  626|    552|            if (offset > max_offset) {
  ------------------
  |  Branch (626:17): [True: 503, False: 49]
  ------------------
  627|    503|                max_offset = offset;
  628|    503|                setTrailer(oh.getDict());
  629|    503|            }
  630|    552|            check_warnings();
  631|    552|        }
  632|  1.16k|        if (max_offset > 0) {
  ------------------
  |  Branch (632:13): [True: 488, False: 675]
  ------------------
  633|    488|            try {
  634|    488|                read_xref(max_offset);
  635|    488|            } catch (std::exception&) {
  636|    186|                throw damagedPDF(
  637|    186|                    "", 0, "error decoding candidate xref stream while recovering damaged file");
  638|    186|            }
  639|    302|            QTC::TC("qpdf", "QPDF recover xref stream");
  640|    302|        }
  641|  1.16k|    }
  642|       |
  643|  3.09k|    if (!m->trailer.isInitialized()) {
  ------------------
  |  Branch (643:9): [True: 675, False: 2.42k]
  ------------------
  644|       |        // We could check the last encountered object to see if it was an xref stream.  If so, we
  645|       |        // could try to get the trailer from there.  This may make it possible to recover files with
  646|       |        // bad startxref pointers even when they have object streams.
  647|       |
  648|    675|        throw damagedPDF("", 0, "unable to find trailer dictionary while recovering damaged file");
  649|    675|    }
  650|  2.42k|    if (m->xref_table.empty()) {
  ------------------
  |  Branch (650:9): [True: 44, False: 2.37k]
  ------------------
  651|       |        // We cannot check for an empty xref table in parse because empty tables are valid when
  652|       |        // creating QPDF objects from JSON.
  653|     44|        throw damagedPDF("", 0, "unable to find objects while recovering damaged file");
  654|     44|    }
  655|  2.37k|    check_warnings();
  656|  2.37k|    if (!m->parsed) {
  ------------------
  |  Branch (656:9): [True: 2.32k, False: 58]
  ------------------
  657|  2.32k|        m->parsed = true;
  658|  2.32k|        getAllPages();
  659|  2.32k|        check_warnings();
  660|  2.32k|        if (m->all_pages.empty()) {
  ------------------
  |  Branch (660:13): [True: 37, False: 2.28k]
  ------------------
  661|     37|            m->parsed = false;
  662|     37|            throw damagedPDF("", 0, "unable to find any pages while recovering damaged file");
  663|     37|        }
  664|  2.32k|    }
  665|       |    // We could iterate through the objects looking for streams and try to find objects inside of
  666|       |    // them, but it's probably not worth the trouble.  Acrobat can't recover files with any errors
  667|       |    // in an xref stream, and this would be a real long shot anyway.  If we wanted to do anything
  668|       |    // that involved looking at stream contents, we'd also have to call initializeEncryption() here.
  669|       |    // It's safe to call it more than once.
  670|  2.37k|}
_ZN4QPDF9read_xrefEx:
  674|  2.29k|{
  675|  2.29k|    std::map<int, int> free_table;
  676|  2.29k|    std::set<qpdf_offset_t> visited;
  677|  4.69k|    while (xref_offset) {
  ------------------
  |  Branch (677:12): [True: 2.40k, False: 2.29k]
  ------------------
  678|  2.40k|        visited.insert(xref_offset);
  679|  2.40k|        char buf[7];
  680|  2.40k|        memset(buf, 0, sizeof(buf));
  681|  2.40k|        m->file->seek(xref_offset, SEEK_SET);
  682|       |        // Some files miss the mark a little with startxref. We could do a better job of searching
  683|       |        // in the neighborhood for something that looks like either an xref table or stream, but the
  684|       |        // simple heuristic of skipping whitespace can help with the xref table case and is harmless
  685|       |        // with the stream case.
  686|  2.40k|        bool done = false;
  687|  2.40k|        bool skipped_space = false;
  688|  18.4k|        while (!done) {
  ------------------
  |  Branch (688:16): [True: 16.0k, False: 2.40k]
  ------------------
  689|  16.0k|            char ch;
  690|  16.0k|            if (1 == m->file->read(&ch, 1)) {
  ------------------
  |  Branch (690:17): [True: 15.4k, False: 585]
  ------------------
  691|  15.4k|                if (QUtil::is_space(ch)) {
  ------------------
  |  Branch (691:21): [True: 13.6k, False: 1.80k]
  ------------------
  692|  13.6k|                    skipped_space = true;
  693|  13.6k|                } else {
  694|  1.80k|                    m->file->unreadCh(ch);
  695|  1.80k|                    done = true;
  696|  1.80k|                }
  697|  15.4k|            } else {
  698|    585|                QTC::TC("qpdf", "QPDF eof skipping spaces before xref", skipped_space ? 0 : 1);
  ------------------
  |  Branch (698:73): [True: 1, False: 584]
  ------------------
  699|    585|                done = true;
  700|    585|            }
  701|  16.0k|        }
  702|       |
  703|  2.40k|        m->file->read(buf, sizeof(buf) - 1);
  704|       |        // The PDF spec says xref must be followed by a line terminator, but files exist in the wild
  705|       |        // where it is terminated by arbitrary whitespace.
  706|  2.40k|        if ((strncmp(buf, "xref", 4) == 0) && QUtil::is_space(buf[4])) {
  ------------------
  |  Branch (706:13): [True: 358, False: 2.04k]
  |  Branch (706:47): [True: 356, False: 2]
  ------------------
  707|    356|            if (skipped_space) {
  ------------------
  |  Branch (707:17): [True: 30, False: 326]
  ------------------
  708|     30|                QTC::TC("qpdf", "QPDF xref skipped space");
  709|     30|                warn(damagedPDF("", 0, "extraneous whitespace seen before xref"));
  710|     30|            }
  711|    356|            QTC::TC(
  712|    356|                "qpdf",
  713|    356|                "QPDF xref space",
  714|    356|                ((buf[4] == '\n')       ? 0
  ------------------
  |  Branch (714:18): [True: 126, False: 230]
  ------------------
  715|    356|                     : (buf[4] == '\r') ? 1
  ------------------
  |  Branch (715:24): [True: 199, False: 31]
  ------------------
  716|    230|                     : (buf[4] == ' ')  ? 2
  ------------------
  |  Branch (716:24): [True: 25, False: 6]
  ------------------
  717|     31|                                        : 9999));
  718|    356|            int skip = 4;
  719|       |            // buf is null-terminated, and QUtil::is_space('\0') is false, so this won't overrun.
  720|    725|            while (QUtil::is_space(buf[skip])) {
  ------------------
  |  Branch (720:20): [True: 369, False: 356]
  ------------------
  721|    369|                ++skip;
  722|    369|            }
  723|    356|            xref_offset = read_xrefTable(xref_offset + skip);
  724|  2.04k|        } else {
  725|  2.04k|            xref_offset = read_xrefStream(xref_offset);
  726|  2.04k|        }
  727|  2.40k|        if (visited.count(xref_offset) != 0) {
  ------------------
  |  Branch (727:13): [True: 2, False: 2.40k]
  ------------------
  728|      2|            QTC::TC("qpdf", "QPDF xref loop");
  729|      2|            throw damagedPDF("", 0, "loop detected following xref tables");
  730|      2|        }
  731|  2.40k|    }
  732|       |
  733|  2.29k|    if (!m->trailer.isInitialized()) {
  ------------------
  |  Branch (733:9): [True: 0, False: 2.29k]
  ------------------
  734|      0|        throw damagedPDF("", 0, "unable to find trailer while reading xref");
  735|      0|    }
  736|  2.29k|    int size = m->trailer.getKey("/Size").getIntValueAsInt();
  737|  2.29k|    int max_obj = 0;
  738|  2.29k|    if (!m->xref_table.empty()) {
  ------------------
  |  Branch (738:9): [True: 378, False: 1.91k]
  ------------------
  739|    378|        max_obj = m->xref_table.rbegin()->first.getObj();
  740|    378|    }
  741|  2.29k|    if (!m->deleted_objects.empty()) {
  ------------------
  |  Branch (741:9): [True: 272, False: 2.02k]
  ------------------
  742|    272|        max_obj = std::max(max_obj, *(m->deleted_objects.rbegin()));
  743|    272|    }
  744|  2.29k|    if ((size < 1) || (size - 1 != max_obj)) {
  ------------------
  |  Branch (744:9): [True: 1.92k, False: 371]
  |  Branch (744:23): [True: 80, False: 291]
  ------------------
  745|     99|        QTC::TC("qpdf", "QPDF xref size mismatch");
  746|     99|        warn(damagedPDF(
  747|     99|            "",
  748|     99|            0,
  749|     99|            ("reported number of objects (" + std::to_string(size) +
  750|     99|             ") is not one plus the highest object number (" + std::to_string(max_obj) + ")")));
  751|     99|    }
  752|       |
  753|       |    // We no longer need the deleted_objects table, so go ahead and clear it out to make sure we
  754|       |    // never depend on its being set.
  755|  2.29k|    m->deleted_objects.clear();
  756|       |
  757|       |    // Make sure we keep only the highest generation for any object.
  758|  2.29k|    QPDFObjGen last_og{-1, 0};
  759|  43.8k|    for (auto const& item: m->xref_table) {
  ------------------
  |  Branch (759:26): [True: 43.8k, False: 2.29k]
  ------------------
  760|  43.8k|        auto id = item.first.getObj();
  761|  43.8k|        if (id == last_og.getObj() && id > 0) {
  ------------------
  |  Branch (761:13): [True: 193, False: 43.6k]
  |  Branch (761:39): [True: 193, False: 0]
  ------------------
  762|    193|            removeObject(last_og);
  763|    193|        }
  764|  43.8k|        last_og = item.first;
  765|  43.8k|    }
  766|  2.29k|}
_ZN4QPDF15parse_xrefFirstERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERiS9_S9_:
  770|    418|{
  771|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  772|       |    // buffer.
  773|    418|    char const* p = line.c_str();
  774|    418|    char const* start = line.c_str();
  775|       |
  776|       |    // Skip zero or more spaces
  777|    907|    while (QUtil::is_space(*p)) {
  ------------------
  |  Branch (777:12): [True: 489, False: 418]
  ------------------
  778|    489|        ++p;
  779|    489|    }
  780|       |    // Require digit
  781|    418|    if (!QUtil::is_digit(*p)) {
  ------------------
  |  Branch (781:9): [True: 52, False: 366]
  ------------------
  782|     52|        return false;
  783|     52|    }
  784|       |    // Gather digits
  785|    366|    std::string obj_str;
  786|  1.21k|    while (QUtil::is_digit(*p)) {
  ------------------
  |  Branch (786:12): [True: 844, False: 366]
  ------------------
  787|    844|        obj_str.append(1, *p++);
  788|    844|    }
  789|       |    // Require space
  790|    366|    if (!QUtil::is_space(*p)) {
  ------------------
  |  Branch (790:9): [True: 4, False: 362]
  ------------------
  791|      4|        return false;
  792|      4|    }
  793|       |    // Skip spaces
  794|  1.10k|    while (QUtil::is_space(*p)) {
  ------------------
  |  Branch (794:12): [True: 739, False: 362]
  ------------------
  795|    739|        ++p;
  796|    739|    }
  797|       |    // Require digit
  798|    362|    if (!QUtil::is_digit(*p)) {
  ------------------
  |  Branch (798:9): [True: 17, False: 345]
  ------------------
  799|     17|        return false;
  800|     17|    }
  801|       |    // Gather digits
  802|    345|    std::string num_str;
  803|  1.11k|    while (QUtil::is_digit(*p)) {
  ------------------
  |  Branch (803:12): [True: 773, False: 345]
  ------------------
  804|    773|        num_str.append(1, *p++);
  805|    773|    }
  806|       |    // Skip any space including line terminators
  807|  1.80k|    while (QUtil::is_space(*p)) {
  ------------------
  |  Branch (807:12): [True: 1.46k, False: 345]
  ------------------
  808|  1.46k|        ++p;
  809|  1.46k|    }
  810|    345|    bytes = toI(p - start);
  811|    345|    obj = QUtil::string_to_int(obj_str.c_str());
  812|    345|    num = QUtil::string_to_int(num_str.c_str());
  813|    345|    return true;
  814|    362|}
_ZN4QPDF18read_bad_xrefEntryERxRiRc:
  818|    305|{
  819|       |    // Reposition after initial read attempt and reread.
  820|    305|    m->file->seek(m->file->getLastOffset(), SEEK_SET);
  821|    305|    auto line = m->file->readLine(30);
  822|       |
  823|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  824|       |    // buffer.
  825|    305|    char const* p = line.data();
  826|       |
  827|       |    // Skip zero or more spaces. There aren't supposed to be any.
  828|    305|    bool invalid = false;
  829|    462|    while (QUtil::is_space(*p)) {
  ------------------
  |  Branch (829:12): [True: 157, False: 305]
  ------------------
  830|    157|        ++p;
  831|    157|        QTC::TC("qpdf", "QPDF ignore first space in xref entry");
  832|    157|        invalid = true;
  833|    157|    }
  834|       |    // Require digit
  835|    305|    if (!QUtil::is_digit(*p)) {
  ------------------
  |  Branch (835:9): [True: 13, False: 292]
  ------------------
  836|     13|        return false;
  837|     13|    }
  838|       |    // Gather digits
  839|    292|    std::string f1_str;
  840|  2.46k|    while (QUtil::is_digit(*p)) {
  ------------------
  |  Branch (840:12): [True: 2.17k, False: 292]
  ------------------
  841|  2.17k|        f1_str.append(1, *p++);
  842|  2.17k|    }
  843|       |    // Require space
  844|    292|    if (!QUtil::is_space(*p)) {
  ------------------
  |  Branch (844:9): [True: 1, False: 291]
  ------------------
  845|      1|        return false;
  846|      1|    }
  847|    291|    if (QUtil::is_space(*(p + 1))) {
  ------------------
  |  Branch (847:9): [True: 13, False: 278]
  ------------------
  848|     13|        QTC::TC("qpdf", "QPDF ignore first extra space in xref entry");
  849|     13|        invalid = true;
  850|     13|    }
  851|       |    // Skip spaces
  852|    711|    while (QUtil::is_space(*p)) {
  ------------------
  |  Branch (852:12): [True: 420, False: 291]
  ------------------
  853|    420|        ++p;
  854|    420|    }
  855|       |    // Require digit
  856|    291|    if (!QUtil::is_digit(*p)) {
  ------------------
  |  Branch (856:9): [True: 13, False: 278]
  ------------------
  857|     13|        return false;
  858|     13|    }
  859|       |    // Gather digits
  860|    278|    std::string f2_str;
  861|  1.40k|    while (QUtil::is_digit(*p)) {
  ------------------
  |  Branch (861:12): [True: 1.12k, False: 278]
  ------------------
  862|  1.12k|        f2_str.append(1, *p++);
  863|  1.12k|    }
  864|       |    // Require space
  865|    278|    if (!QUtil::is_space(*p)) {
  ------------------
  |  Branch (865:9): [True: 27, False: 251]
  ------------------
  866|     27|        return false;
  867|     27|    }
  868|    251|    if (QUtil::is_space(*(p + 1))) {
  ------------------
  |  Branch (868:9): [True: 7, False: 244]
  ------------------
  869|      7|        QTC::TC("qpdf", "QPDF ignore second extra space in xref entry");
  870|      7|        invalid = true;
  871|      7|    }
  872|       |    // Skip spaces
  873|    569|    while (QUtil::is_space(*p)) {
  ------------------
  |  Branch (873:12): [True: 318, False: 251]
  ------------------
  874|    318|        ++p;
  875|    318|    }
  876|    251|    if ((*p == 'f') || (*p == 'n')) {
  ------------------
  |  Branch (876:9): [True: 42, False: 209]
  |  Branch (876:24): [True: 181, False: 28]
  ------------------
  877|    223|        type = *p;
  878|    223|    } else {
  879|     28|        return false;
  880|     28|    }
  881|    223|    if ((f1_str.length() != 10) || (f2_str.length() != 5)) {
  ------------------
  |  Branch (881:9): [True: 68, False: 155]
  |  Branch (881:36): [True: 3, False: 152]
  ------------------
  882|     71|        QTC::TC("qpdf", "QPDF ignore length error xref entry");
  883|     71|        invalid = true;
  884|     71|    }
  885|       |
  886|    223|    if (invalid) {
  ------------------
  |  Branch (886:9): [True: 71, False: 152]
  ------------------
  887|     71|        warn(damagedPDF("xref table", "accepting invalid xref table entry"));
  888|     71|    }
  889|       |
  890|    223|    f1 = QUtil::string_to_ll(f1_str.c_str());
  891|    223|    f2 = QUtil::string_to_int(f2_str.c_str());
  892|       |
  893|    223|    return true;
  894|    251|}
_ZN4QPDF14read_xrefEntryERxRiRc:
  900|  5.26k|{
  901|  5.26k|    std::array<char, 21> line;
  902|  5.26k|    if (m->file->read(line.data(), 20) != 20) {
  ------------------
  |  Branch (902:9): [True: 2, False: 5.26k]
  ------------------
  903|       |        // C++20: [[unlikely]]
  904|      2|        return false;
  905|      2|    }
  906|  5.26k|    line[20] = '\0';
  907|  5.26k|    char const* p = line.data();
  908|       |
  909|  5.26k|    int f1_len = 0;
  910|  5.26k|    int f2_len = 0;
  911|       |
  912|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  913|       |    // buffer.
  914|       |
  915|       |    // Gather f1 digits. NB No risk of overflow as 9'999'999'999 < max long long.
  916|  35.9k|    while (*p == '0') {
  ------------------
  |  Branch (916:12): [True: 30.6k, False: 5.26k]
  ------------------
  917|  30.6k|        ++f1_len;
  918|  30.6k|        ++p;
  919|  30.6k|    }
  920|  26.0k|    while (QUtil::is_digit(*p) && f1_len++ < 10) {
  ------------------
  |  Branch (920:12): [True: 20.8k, False: 5.25k]
  |  Branch (920:35): [True: 20.8k, False: 5]
  ------------------
  921|  20.8k|        f1 *= 10;
  922|  20.8k|        f1 += *p++ - '0';
  923|  20.8k|    }
  924|       |    // Require space
  925|  5.26k|    if (!QUtil::is_space(*p++)) {
  ------------------
  |  Branch (925:9): [True: 41, False: 5.22k]
  ------------------
  926|       |        // Entry doesn't start with space or digit.
  927|       |        // C++20: [[unlikely]]
  928|     41|        return false;
  929|     41|    }
  930|       |    // Gather digits. NB No risk of overflow as 99'999 < max int.
  931|  30.2k|    while (*p == '0') {
  ------------------
  |  Branch (931:12): [True: 25.0k, False: 5.22k]
  ------------------
  932|  25.0k|        ++f2_len;
  933|  25.0k|        ++p;
  934|  25.0k|    }
  935|  5.84k|    while (QUtil::is_digit(*p) && f2_len++ < 5) {
  ------------------
  |  Branch (935:12): [True: 629, False: 5.21k]
  |  Branch (935:35): [True: 621, False: 8]
  ------------------
  936|    621|        f2 *= 10;
  937|    621|        f2 += static_cast<int>(*p++ - '0');
  938|    621|    }
  939|  5.22k|    if (QUtil::is_space(*p++) && (*p == 'f' || *p == 'n')) {
  ------------------
  |  Branch (939:9): [True: 5.18k, False: 38]
  |  Branch (939:35): [True: 120, False: 5.06k]
  |  Branch (939:48): [True: 5.01k, False: 53]
  ------------------
  940|       |        // C++20: [[likely]]
  941|  5.13k|        type = *p;
  942|       |        // No test for valid line[19].
  943|  5.13k|        if (*(++p) && *(++p) && (*p == '\n' || *p == '\r') && f1_len == 10 && f2_len == 5) {
  ------------------
  |  Branch (943:13): [True: 5.12k, False: 2]
  |  Branch (943:23): [True: 5.12k, False: 3]
  |  Branch (943:34): [True: 4.94k, False: 185]
  |  Branch (943:48): [True: 0, False: 185]
  |  Branch (943:63): [True: 4.92k, False: 21]
  |  Branch (943:79): [True: 4.91k, False: 3]
  ------------------
  944|       |            // C++20: [[likely]]
  945|  4.91k|            return true;
  946|  4.91k|        }
  947|  5.13k|    }
  948|    305|    return read_bad_xrefEntry(f1, f2, type);
  949|  5.22k|}
_ZN4QPDF14read_xrefTableEx:
  954|    356|{
  955|    356|    std::vector<QPDFObjGen> deleted_items;
  956|       |
  957|    356|    m->file->seek(xref_offset, SEEK_SET);
  958|    356|    std::string line;
  959|    421|    while (true) {
  ------------------
  |  Branch (959:12): [Folded - Ignored]
  ------------------
  960|    418|        line.assign(50, '\0');
  961|    418|        m->file->read(line.data(), line.size());
  962|    418|        int obj = 0;
  963|    418|        int num = 0;
  964|    418|        int bytes = 0;
  965|    418|        if (!parse_xrefFirst(line, obj, num, bytes)) {
  ------------------
  |  Branch (965:13): [True: 73, False: 345]
  ------------------
  966|     73|            QTC::TC("qpdf", "QPDF invalid xref");
  967|     73|            throw damagedPDF("xref table", "xref syntax invalid");
  968|     73|        }
  969|    345|        m->file->seek(m->file->getLastOffset() + bytes, SEEK_SET);
  970|  5.48k|        for (qpdf_offset_t i = obj; i - num < obj; ++i) {
  ------------------
  |  Branch (970:37): [True: 5.26k, False: 220]
  ------------------
  971|  5.26k|            if (i == 0) {
  ------------------
  |  Branch (971:17): [True: 112, False: 5.15k]
  ------------------
  972|       |                // This is needed by checkLinearization()
  973|    112|                m->first_xref_item_offset = m->file->tell();
  974|    112|            }
  975|       |            // For xref_table, these will always be small enough to be ints
  976|  5.26k|            qpdf_offset_t f1 = 0;
  977|  5.26k|            int f2 = 0;
  978|  5.26k|            char type = '\0';
  979|  5.26k|            if (!read_xrefEntry(f1, f2, type)) {
  ------------------
  |  Branch (979:17): [True: 125, False: 5.14k]
  ------------------
  980|    125|                QTC::TC("qpdf", "QPDF invalid xref entry");
  981|    125|                throw damagedPDF(
  982|    125|                    "xref table", "invalid xref entry (obj=" + std::to_string(i) + ")");
  983|    125|            }
  984|  5.14k|            if (type == 'f') {
  ------------------
  |  Branch (984:17): [True: 122, False: 5.01k]
  ------------------
  985|       |                // Save deleted items until after we've checked the XRefStm, if any.
  986|    122|                deleted_items.emplace_back(toI(i), f2);
  987|  5.01k|            } else {
  988|  5.01k|                insertXrefEntry(toI(i), 1, f1, f2);
  989|  5.01k|            }
  990|  5.14k|        }
  991|    220|        qpdf_offset_t pos = m->file->tell();
  992|    220|        if (readToken(m->file).isWord("trailer")) {
  ------------------
  |  Branch (992:13): [True: 155, False: 65]
  ------------------
  993|    155|            break;
  994|    155|        } else {
  995|     65|            m->file->seek(pos, SEEK_SET);
  996|     65|        }
  997|    220|    }
  998|       |
  999|       |    // Set offset to previous xref table if any
 1000|    158|    QPDFObjectHandle cur_trailer = readTrailer();
 1001|    158|    if (!cur_trailer.isDictionary()) {
  ------------------
  |  Branch (1001:9): [True: 19, False: 139]
  ------------------
 1002|     19|        QTC::TC("qpdf", "QPDF missing trailer");
 1003|     19|        throw damagedPDF("", "expected trailer dictionary");
 1004|     19|    }
 1005|       |
 1006|    139|    if (!m->trailer.isInitialized()) {
  ------------------
  |  Branch (1006:9): [True: 127, False: 12]
  ------------------
 1007|    127|        setTrailer(cur_trailer);
 1008|       |
 1009|    127|        if (!m->trailer.hasKey("/Size")) {
  ------------------
  |  Branch (1009:13): [True: 1, False: 126]
  ------------------
 1010|      1|            QTC::TC("qpdf", "QPDF trailer lacks size");
 1011|      1|            throw damagedPDF("trailer", "trailer dictionary lacks /Size key");
 1012|      1|        }
 1013|    126|        if (!m->trailer.getKey("/Size").isInteger()) {
  ------------------
  |  Branch (1013:13): [True: 2, False: 124]
  ------------------
 1014|      2|            QTC::TC("qpdf", "QPDF trailer size not integer");
 1015|      2|            throw damagedPDF("trailer", "/Size key in trailer dictionary is not an integer");
 1016|      2|        }
 1017|    126|    }
 1018|       |
 1019|    136|    if (cur_trailer.hasKey("/XRefStm")) {
  ------------------
  |  Branch (1019:9): [True: 0, False: 136]
  ------------------
 1020|      0|        if (m->ignore_xref_streams) {
  ------------------
  |  Branch (1020:13): [True: 0, False: 0]
  ------------------
 1021|      0|            QTC::TC("qpdf", "QPDF ignoring XRefStm in trailer");
 1022|      0|        } else {
 1023|      0|            if (cur_trailer.getKey("/XRefStm").isInteger()) {
  ------------------
  |  Branch (1023:17): [True: 0, False: 0]
  ------------------
 1024|       |                // Read the xref stream but disregard any return value -- we'll use our trailer's
 1025|       |                // /Prev key instead of the xref stream's.
 1026|      0|                (void)read_xrefStream(cur_trailer.getKey("/XRefStm").getIntValue());
 1027|      0|            } else {
 1028|      0|                throw damagedPDF("xref stream", xref_offset, "invalid /XRefStm");
 1029|      0|            }
 1030|      0|        }
 1031|      0|    }
 1032|       |
 1033|       |    // Handle any deleted items now that we've read the /XRefStm.
 1034|    136|    for (auto const& og: deleted_items) {
  ------------------
  |  Branch (1034:24): [True: 54, False: 136]
  ------------------
 1035|     54|        insertFreeXrefEntry(og);
 1036|     54|    }
 1037|       |
 1038|    136|    if (cur_trailer.hasKey("/Prev")) {
  ------------------
  |  Branch (1038:9): [True: 82, False: 54]
  ------------------
 1039|     82|        if (!cur_trailer.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (1039:13): [True: 1, False: 81]
  ------------------
 1040|      1|            QTC::TC("qpdf", "QPDF trailer prev not integer");
 1041|      1|            throw damagedPDF("trailer", "/Prev key in trailer dictionary is not an integer");
 1042|      1|        }
 1043|     81|        QTC::TC("qpdf", "QPDF prev key in trailer dictionary");
 1044|     81|        xref_offset = cur_trailer.getKey("/Prev").getIntValue();
 1045|     81|    } else {
 1046|     54|        xref_offset = 0;
 1047|     54|    }
 1048|       |
 1049|    135|    return xref_offset;
 1050|    136|}
_ZN4QPDF15read_xrefStreamEx:
 1055|  2.03k|{
 1056|  2.03k|    if (!m->ignore_xref_streams) {
  ------------------
  |  Branch (1056:9): [True: 2.03k, False: 0]
  ------------------
 1057|  2.03k|        QPDFObjGen x_og;
 1058|  2.03k|        QPDFObjectHandle xref_obj;
 1059|  2.03k|        try {
 1060|  2.03k|            xref_obj =
 1061|  2.03k|                readObjectAtOffset(false, xref_offset, "xref stream", QPDFObjGen(0, 0), x_og, true);
 1062|  2.03k|        } catch (QPDFExc&) {
 1063|       |            // ignore -- report error below
 1064|  1.35k|        }
 1065|  2.03k|        if (xref_obj.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (1065:13): [True: 617, False: 1.41k]
  ------------------
 1066|    617|            QTC::TC("qpdf", "QPDF found xref stream");
 1067|    617|            return processXRefStream(xref_offset, xref_obj);
 1068|    617|        }
 1069|  2.02k|    }
 1070|       |
 1071|  1.41k|    QTC::TC("qpdf", "QPDF can't find xref");
 1072|  1.41k|    throw damagedPDF("", xref_offset, "xref not found");
 1073|      0|    return 0; // unreachable
 1074|  2.03k|}
_ZN4QPDF12processXRefWER16QPDFObjectHandleNSt3__18functionIF7QPDFExcNS2_17basic_string_viewIcNS2_11char_traitsIcEEEEEEE:
 1079|    617|{
 1080|    617|    auto W_obj = dict.getKey("/W");
 1081|    617|    if (!(W_obj.isArray() && (W_obj.getArrayNItems() >= 3) && W_obj.getArrayItem(0).isInteger() &&
  ------------------
  |  Branch (1081:9): [True: 28, False: 589]
  |  Branch (1081:11): [True: 610, False: 7]
  |  Branch (1081:30): [True: 601, False: 9]
  |  Branch (1081:63): [True: 596, False: 5]
  ------------------
 1082|    617|          W_obj.getArrayItem(1).isInteger() && W_obj.getArrayItem(2).isInteger())) {
  ------------------
  |  Branch (1082:11): [True: 591, False: 5]
  |  Branch (1082:48): [True: 589, False: 2]
  ------------------
 1083|     28|        throw damaged("Cross-reference stream does not have a proper /W key");
 1084|     28|    }
 1085|       |
 1086|    589|    std::array<int, 3> W;
 1087|    589|    int entry_size = 0;
 1088|    589|    auto w_vector = W_obj.getArrayAsVector();
 1089|    589|    int max_bytes = sizeof(qpdf_offset_t);
 1090|  2.34k|    for (size_t i = 0; i < 3; ++i) {
  ------------------
  |  Branch (1090:24): [True: 1.75k, False: 584]
  ------------------
 1091|  1.75k|        W[i] = w_vector[i].getIntValueAsInt();
 1092|  1.75k|        if (W[i] > max_bytes) {
  ------------------
  |  Branch (1092:13): [True: 3, False: 1.75k]
  ------------------
 1093|      3|            throw damaged("Cross-reference stream's /W contains impossibly large values");
 1094|      3|        }
 1095|  1.75k|        if (W[i] < 0) {
  ------------------
  |  Branch (1095:13): [True: 2, False: 1.75k]
  ------------------
 1096|      2|            throw damaged("Cross-reference stream's /W contains negative values");
 1097|      2|        }
 1098|  1.75k|        entry_size += W[i];
 1099|  1.75k|    }
 1100|    584|    if (entry_size == 0) {
  ------------------
  |  Branch (1100:9): [True: 1, False: 583]
  ------------------
 1101|      1|        throw damaged("Cross-reference stream's /W indicates entry size of 0");
 1102|      1|    }
 1103|    583|    return {entry_size, W};
 1104|    584|}
_ZN4QPDF15processXRefSizeER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS2_17basic_string_viewIcNS2_11char_traitsIcEEEEEEE:
 1110|    583|{
 1111|       |    // Number of entries is limited by the highest possible object id and stream size.
 1112|    583|    auto max_num_entries = std::numeric_limits<int>::max();
 1113|    583|    if (max_num_entries > (std::numeric_limits<qpdf_offset_t>::max() / entry_size)) {
  ------------------
  |  Branch (1113:9): [True: 0, False: 583]
  ------------------
 1114|      0|        max_num_entries = toI(std::numeric_limits<qpdf_offset_t>::max() / entry_size);
 1115|      0|    }
 1116|       |
 1117|    583|    auto Size_obj = dict.getKey("/Size");
 1118|    583|    long long size;
 1119|    583|    if (!dict.getKey("/Size").getValueAsInt(size)) {
  ------------------
  |  Branch (1119:9): [True: 13, False: 570]
  ------------------
 1120|     13|        throw damaged("Cross-reference stream does not have a proper /Size key");
 1121|    570|    } else if (size < 0) {
  ------------------
  |  Branch (1121:16): [True: 1, False: 569]
  ------------------
 1122|      1|        throw damaged("Cross-reference stream has a negative /Size key");
 1123|    569|    } else if (size >= max_num_entries) {
  ------------------
  |  Branch (1123:16): [True: 1, False: 568]
  ------------------
 1124|      1|        throw damaged("Cross-reference stream has an impossibly large /Size key");
 1125|      1|    }
 1126|       |    // We are not validating that Size <= (Size key of parent xref / trailer).
 1127|    568|    return max_num_entries;
 1128|    583|}
_ZN4QPDF16processXRefIndexER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS2_17basic_string_viewIcNS2_11char_traitsIcEEEEEEE:
 1134|    568|{
 1135|    568|    auto size = dict.getKey("/Size").getIntValueAsInt();
 1136|    568|    auto Index_obj = dict.getKey("/Index");
 1137|       |
 1138|    568|    if (Index_obj.isArray()) {
  ------------------
  |  Branch (1138:9): [True: 173, False: 395]
  ------------------
 1139|    173|        std::vector<std::pair<int, int>> indx;
 1140|    173|        int num_entries = 0;
 1141|    173|        auto index_vec = Index_obj.getArrayAsVector();
 1142|    173|        if ((index_vec.size() % 2) || index_vec.size() < 2) {
  ------------------
  |  Branch (1142:13): [True: 5, False: 168]
  |  Branch (1142:39): [True: 0, False: 168]
  ------------------
 1143|      5|            throw damaged("Cross-reference stream's /Index has an invalid number of values");
 1144|      5|        }
 1145|       |
 1146|    168|        int i = 0;
 1147|    168|        long long first = 0;
 1148|    582|        for (auto& val: index_vec) {
  ------------------
  |  Branch (1148:23): [True: 582, False: 149]
  ------------------
 1149|    582|            if (val.isInteger()) {
  ------------------
  |  Branch (1149:17): [True: 570, False: 12]
  ------------------
 1150|    570|                if (i % 2) {
  ------------------
  |  Branch (1150:21): [True: 282, False: 288]
  ------------------
 1151|    282|                    auto count = val.getIntValue();
 1152|    282|                    if (count <= 0) {
  ------------------
  |  Branch (1152:25): [True: 3, False: 279]
  ------------------
 1153|      3|                        throw damaged(
 1154|      3|                            "Cross-reference stream section claims to contain " +
 1155|      3|                            std::to_string(count) + " entries");
 1156|      3|                    }
 1157|       |                    // We are guarding against the possibility of num_entries * entry_size
 1158|       |                    // overflowing. We are not checking that entries are in ascending order as
 1159|       |                    // required by the spec, which probably should generate a warning. We are also
 1160|       |                    // not checking that for each subsection first object number + number of entries
 1161|       |                    // <= /Size. The spec requires us to ignore object number > /Size.
 1162|    279|                    if (first > (max_num_entries - count) ||
  ------------------
  |  Branch (1162:25): [True: 3, False: 276]
  ------------------
 1163|    279|                        count > (max_num_entries - num_entries)) {
  ------------------
  |  Branch (1163:25): [True: 0, False: 276]
  ------------------
 1164|      3|                        throw damaged(
 1165|      3|                            "Cross-reference stream claims to contain too many entries: " +
 1166|      3|                            std::to_string(first) + " " + std::to_string(max_num_entries) + " " +
 1167|      3|                            std::to_string(num_entries));
 1168|      3|                    }
 1169|    276|                    indx.emplace_back(static_cast<int>(first), static_cast<int>(count));
 1170|    276|                    num_entries += static_cast<int>(count);
 1171|    288|                } else {
 1172|    288|                    first = val.getIntValue();
 1173|    288|                    if (first < 0) {
  ------------------
  |  Branch (1173:25): [True: 1, False: 287]
  ------------------
 1174|      1|                        throw damaged(
 1175|      1|                            "Cross-reference stream's /Index contains a negative object id");
 1176|    287|                    } else if (first > max_num_entries) {
  ------------------
  |  Branch (1176:32): [True: 0, False: 287]
  ------------------
 1177|      0|                        throw damaged("Cross-reference stream's /Index contains an impossibly "
 1178|      0|                                      "large object id");
 1179|      0|                    }
 1180|    288|                }
 1181|    570|            } else {
 1182|     12|                throw damaged(
 1183|     12|                    "Cross-reference stream's /Index's item " + std::to_string(i) +
 1184|     12|                    " is not an integer");
 1185|     12|            }
 1186|    563|            i++;
 1187|    563|        }
 1188|    149|        QTC::TC("qpdf", "QPDF xref /Index is array", index_vec.size() == 2 ? 0 : 1);
  ------------------
  |  Branch (1188:54): [True: 143, False: 6]
  ------------------
 1189|    149|        return {num_entries, indx};
 1190|    395|    } else if (Index_obj.isNull()) {
  ------------------
  |  Branch (1190:16): [True: 392, False: 3]
  ------------------
 1191|    392|        QTC::TC("qpdf", "QPDF xref /Index is null");
 1192|    392|        return {size, {{0, size}}};
 1193|    392|    } else {
 1194|      3|        throw damaged("Cross-reference stream does not have a proper /Index key");
 1195|      3|    }
 1196|    568|}
_ZN4QPDF17processXRefStreamExR16QPDFObjectHandle:
 1200|    617|{
 1201|    617|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1202|    617|        return damagedPDF("xref stream", xref_offset, msg.data());
 1203|    617|    };
 1204|       |
 1205|    617|    auto dict = xref_obj.getDict();
 1206|       |
 1207|    617|    auto [entry_size, W] = processXRefW(dict, damaged);
 1208|    617|    int max_num_entries = processXRefSize(dict, entry_size, damaged);
 1209|    617|    auto [num_entries, indx] = processXRefIndex(dict, max_num_entries, damaged);
 1210|       |
 1211|    617|    std::shared_ptr<Buffer> bp = xref_obj.getStreamData(qpdf_dl_specialized);
 1212|    617|    size_t actual_size = bp->getSize();
 1213|    617|    auto expected_size = toS(entry_size) * toS(num_entries);
 1214|       |
 1215|    617|    if (expected_size != actual_size) {
  ------------------
  |  Branch (1215:9): [True: 191, False: 426]
  ------------------
 1216|    191|        QPDFExc x = damaged(
 1217|    191|            "Cross-reference stream data has the wrong size; expected = " +
 1218|    191|            std::to_string(expected_size) + "; actual = " + std::to_string(actual_size));
 1219|    191|        if (expected_size > actual_size) {
  ------------------
  |  Branch (1219:13): [True: 19, False: 172]
  ------------------
 1220|     19|            throw x;
 1221|    172|        } else {
 1222|    172|            warn(x);
 1223|    172|        }
 1224|    191|    }
 1225|       |
 1226|    598|    bool saw_first_compressed_object = false;
 1227|       |
 1228|       |    // Actual size vs. expected size check above ensures that we will not overflow any buffers here.
 1229|       |    // We know that entry_size * num_entries is less or equal to the size of the buffer.
 1230|    598|    auto p = bp->getBuffer();
 1231|    598|    for (auto [obj, sec_entries]: indx) {
  ------------------
  |  Branch (1231:33): [True: 483, False: 598]
  ------------------
 1232|       |        // Process a subsection.
 1233|  50.4k|        for (int i = 0; i < sec_entries; ++i) {
  ------------------
  |  Branch (1233:25): [True: 49.9k, False: 483]
  ------------------
 1234|       |            // Read this entry
 1235|  49.9k|            std::array<qpdf_offset_t, 3> fields{};
 1236|  49.9k|            if (W[0] == 0) {
  ------------------
  |  Branch (1236:17): [True: 442, False: 49.5k]
  ------------------
 1237|    442|                QTC::TC("qpdf", "QPDF default for xref stream field 0");
 1238|    442|                fields[0] = 1;
 1239|    442|            }
 1240|   199k|            for (size_t j = 0; j < 3; ++j) {
  ------------------
  |  Branch (1240:32): [True: 149k, False: 49.9k]
  ------------------
 1241|   349k|                for (int k = 0; k < W[j]; ++k) {
  ------------------
  |  Branch (1241:33): [True: 199k, False: 149k]
  ------------------
 1242|   199k|                    fields[j] <<= 8;
 1243|   199k|                    fields[j] |= *p++;
 1244|   199k|                }
 1245|   149k|            }
 1246|       |
 1247|       |            // Get the generation number.  The generation number is 0 unless this is an uncompressed
 1248|       |            // object record, in which case the generation number appears as the third field.
 1249|  49.9k|            if (saw_first_compressed_object) {
  ------------------
  |  Branch (1249:17): [True: 46.5k, False: 3.43k]
  ------------------
 1250|  46.5k|                if (fields[0] != 2) {
  ------------------
  |  Branch (1250:21): [True: 8.11k, False: 38.4k]
  ------------------
 1251|  8.11k|                    m->uncompressed_after_compressed = true;
 1252|  8.11k|                }
 1253|  46.5k|            } else if (fields[0] == 2) {
  ------------------
  |  Branch (1253:24): [True: 390, False: 3.04k]
  ------------------
 1254|    390|                saw_first_compressed_object = true;
 1255|    390|            }
 1256|  49.9k|            if (obj == 0) {
  ------------------
  |  Branch (1256:17): [True: 390, False: 49.5k]
  ------------------
 1257|       |                // This is needed by checkLinearization()
 1258|    390|                m->first_xref_item_offset = xref_offset;
 1259|  49.5k|            } else if (fields[0] == 0) {
  ------------------
  |  Branch (1259:24): [True: 6.99k, False: 42.5k]
  ------------------
 1260|       |                // Ignore fields[2], which we don't care about in this case. This works around the
 1261|       |                // issue of some PDF files that put invalid values, like -1, here for deleted
 1262|       |                // objects.
 1263|  6.99k|                insertFreeXrefEntry(QPDFObjGen(obj, 0));
 1264|  42.5k|            } else {
 1265|  42.5k|                insertXrefEntry(obj, toI(fields[0]), fields[1], toI(fields[2]));
 1266|  42.5k|            }
 1267|  49.9k|            ++obj;
 1268|  49.9k|        }
 1269|    483|    }
 1270|       |
 1271|    598|    if (!m->trailer.isInitialized()) {
  ------------------
  |  Branch (1271:9): [True: 48, False: 550]
  ------------------
 1272|     48|        setTrailer(dict);
 1273|     48|    }
 1274|       |
 1275|    598|    if (dict.hasKey("/Prev")) {
  ------------------
  |  Branch (1275:9): [True: 29, False: 569]
  ------------------
 1276|     29|        if (!dict.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (1276:13): [True: 1, False: 28]
  ------------------
 1277|      1|            throw damagedPDF(
 1278|      1|                "xref stream", "/Prev key in xref stream dictionary is not an integer");
 1279|      1|        }
 1280|     28|        QTC::TC("qpdf", "QPDF prev key in xref stream dictionary");
 1281|     28|        return dict.getKey("/Prev").getIntValue();
 1282|    569|    } else {
 1283|    569|        return 0;
 1284|    569|    }
 1285|    598|}
_ZN4QPDF15insertXrefEntryEiixi:
 1289|  47.5k|{
 1290|       |    // Populate the xref table in such a way that the first reference to an object that we see,
 1291|       |    // which is the one in the latest xref table in which it appears, is the one that gets stored.
 1292|       |    // This works because we are reading more recent appends before older ones.
 1293|       |
 1294|       |    // If there is already an entry for this object and generation in the table, it means that a
 1295|       |    // later xref table has registered this object.  Disregard this one.
 1296|       |
 1297|  47.5k|    if (obj > m->xref_table_max_id) {
  ------------------
  |  Branch (1297:9): [True: 14, False: 47.5k]
  ------------------
 1298|       |        // ignore impossibly large object ids or object ids > Size.
 1299|     14|        return;
 1300|     14|    }
 1301|       |
 1302|  47.5k|    if (m->deleted_objects.count(obj)) {
  ------------------
  |  Branch (1302:9): [True: 0, False: 47.5k]
  ------------------
 1303|      0|        QTC::TC("qpdf", "QPDF xref deleted object");
 1304|      0|        return;
 1305|      0|    }
 1306|       |
 1307|  47.5k|    if (f0 == 2 && static_cast<int>(f1) == obj) {
  ------------------
  |  Branch (1307:9): [True: 38.7k, False: 8.79k]
  |  Branch (1307:20): [True: 48, False: 38.7k]
  ------------------
 1308|     48|        warn(damagedPDF("xref stream", "self-referential object stream " + std::to_string(obj)));
 1309|     48|        return;
 1310|     48|    }
 1311|       |
 1312|  47.5k|    auto [iter, created] = m->xref_table.try_emplace(QPDFObjGen(obj, (f0 == 2 ? 0 : f2)));
  ------------------
  |  Branch (1312:71): [True: 38.7k, False: 8.79k]
  ------------------
 1313|  47.5k|    if (!created) {
  ------------------
  |  Branch (1313:9): [True: 6.41k, False: 41.1k]
  ------------------
 1314|  6.41k|        QTC::TC("qpdf", "QPDF xref reused object");
 1315|  6.41k|        return;
 1316|  6.41k|    }
 1317|       |
 1318|  41.1k|    switch (f0) {
 1319|  6.40k|    case 1:
  ------------------
  |  Branch (1319:5): [True: 6.40k, False: 34.7k]
  ------------------
 1320|       |        // f2 is generation
 1321|  6.40k|        QTC::TC("qpdf", "QPDF xref gen > 0", ((f2 > 0) ? 1 : 0));
  ------------------
  |  Branch (1321:47): [True: 619, False: 5.78k]
  ------------------
 1322|  6.40k|        iter->second = QPDFXRefEntry(f1);
 1323|  6.40k|        break;
 1324|       |
 1325|  34.6k|    case 2:
  ------------------
  |  Branch (1325:5): [True: 34.6k, False: 6.49k]
  ------------------
 1326|  34.6k|        iter->second = QPDFXRefEntry(toI(f1), f2);
 1327|  34.6k|        break;
 1328|       |
 1329|     93|    default:
  ------------------
  |  Branch (1329:5): [True: 93, False: 41.0k]
  ------------------
 1330|     93|        throw damagedPDF("xref stream", "unknown xref stream entry type " + std::to_string(f0));
 1331|      0|        break;
 1332|  41.1k|    }
 1333|  41.1k|}
_ZN4QPDF19insertFreeXrefEntryE10QPDFObjGen:
 1337|  7.05k|{
 1338|  7.05k|    if (!m->xref_table.count(og)) {
  ------------------
  |  Branch (1338:9): [True: 6.23k, False: 818]
  ------------------
 1339|  6.23k|        m->deleted_objects.insert(og.getObj());
 1340|  6.23k|    }
 1341|  7.05k|}
_ZN4QPDF28insertReconstructedXrefEntryEixi:
 1347|   252k|{
 1348|   252k|    if (!(obj > 0 && obj <= m->xref_table_max_id && 0 <= f2 && f2 < 65535)) {
  ------------------
  |  Branch (1348:11): [True: 252k, False: 267]
  |  Branch (1348:22): [True: 252k, False: 0]
  |  Branch (1348:53): [True: 252k, False: 6]
  |  Branch (1348:64): [True: 252k, False: 8]
  ------------------
 1349|    281|        QTC::TC("qpdf", "QPDF xref overwrite invalid objgen");
 1350|    281|        return;
 1351|    281|    }
 1352|       |
 1353|   252k|    QPDFObjGen og(obj, f2);
 1354|   252k|    if (!m->deleted_objects.count(obj)) {
  ------------------
  |  Branch (1354:9): [True: 252k, False: 135]
  ------------------
 1355|       |        // deleted_objects stores the uncompressed objects removed from the xref table at the start
 1356|       |        // of recovery.
 1357|   252k|        QTC::TC("qpdf", "QPDF xref overwrite object");
 1358|   252k|        m->xref_table[QPDFObjGen(obj, f2)] = QPDFXRefEntry(f1);
 1359|   252k|    }
 1360|   252k|}
_ZN4QPDF16resolveXRefTableEv:
 1393|  2.09k|{
 1394|  2.09k|    bool may_change = !m->reconstructed_xref;
 1395|   156k|    for (auto& iter: m->xref_table) {
  ------------------
  |  Branch (1395:20): [True: 156k, False: 2.08k]
  ------------------
 1396|   156k|        if (isUnresolved(iter.first)) {
  ------------------
  |  Branch (1396:13): [True: 63.5k, False: 92.7k]
  ------------------
 1397|  63.5k|            resolve(iter.first);
 1398|  63.5k|            if (may_change && m->reconstructed_xref) {
  ------------------
  |  Branch (1398:17): [True: 606, False: 62.9k]
  |  Branch (1398:31): [True: 15, False: 591]
  ------------------
 1399|     15|                return false;
 1400|     15|            }
 1401|  63.5k|        }
 1402|   156k|    }
 1403|  2.08k|    return true;
 1404|  2.09k|}
_ZN4QPDF21fixDanglingReferencesEb:
 1410|  8.92k|{
 1411|  8.92k|    if (m->fixed_dangling_refs) {
  ------------------
  |  Branch (1411:9): [True: 6.84k, False: 2.08k]
  ------------------
 1412|  6.84k|        return;
 1413|  6.84k|    }
 1414|  2.08k|    if (!resolveXRefTable()) {
  ------------------
  |  Branch (1414:9): [True: 15, False: 2.06k]
  ------------------
 1415|     15|        QTC::TC("qpdf", "QPDF fix dangling triggered xref reconstruction");
 1416|     15|        resolveXRefTable();
 1417|     15|    }
 1418|  2.08k|    m->fixed_dangling_refs = true;
 1419|  2.08k|}
_ZN4QPDF14getObjectCountEv:
 1423|  6.98k|{
 1424|       |    // This method returns the next available indirect object number. makeIndirectObject uses it for
 1425|       |    // this purpose. After fixDanglingReferences is called, all objects in the xref table will also
 1426|       |    // be in obj_cache.
 1427|  6.98k|    fixDanglingReferences();
 1428|  6.98k|    QPDFObjGen og;
 1429|  6.98k|    if (!m->obj_cache.empty()) {
  ------------------
  |  Branch (1429:9): [True: 6.93k, False: 42]
  ------------------
 1430|  6.93k|        og = (*(m->obj_cache.rbegin())).first;
 1431|  6.93k|    }
 1432|  6.98k|    return toS(og.getObj());
 1433|  6.98k|}
_ZN4QPDF24setLastObjectDescriptionERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERK10QPDFObjGen:
 1449|   293k|{
 1450|   293k|    m->last_object_description.clear();
 1451|   293k|    if (!description.empty()) {
  ------------------
  |  Branch (1451:9): [True: 3.04k, False: 290k]
  ------------------
 1452|  3.04k|        m->last_object_description += description;
 1453|  3.04k|        if (og.isIndirect()) {
  ------------------
  |  Branch (1453:13): [True: 1.00k, False: 2.03k]
  ------------------
 1454|  1.00k|            m->last_object_description += ": ";
 1455|  1.00k|        }
 1456|  3.04k|    }
 1457|   293k|    if (og.isIndirect()) {
  ------------------
  |  Branch (1457:9): [True: 291k, False: 2.03k]
  ------------------
 1458|   291k|        m->last_object_description += "object " + og.unparse(' ');
 1459|   291k|    }
 1460|   293k|}
_ZN4QPDF11readTrailerEv:
 1464|  4.25k|{
 1465|  4.25k|    qpdf_offset_t offset = m->file->tell();
 1466|  4.25k|    bool empty = false;
 1467|  4.25k|    auto object =
 1468|  4.25k|        QPDFParser(m->file, "trailer", m->tokenizer, nullptr, this, true).parse(empty, false);
 1469|  4.25k|    if (empty) {
  ------------------
  |  Branch (1469:9): [True: 0, False: 4.25k]
  ------------------
 1470|       |        // Nothing in the PDF spec appears to allow empty objects, but they have been encountered in
 1471|       |        // actual PDF files and Adobe Reader appears to ignore them.
 1472|      0|        warn(damagedPDF("trailer", "empty object treated as null"));
 1473|  4.25k|    } else if (object.isDictionary() && readToken(m->file).isWord("stream")) {
  ------------------
  |  Branch (1473:16): [True: 2.10k, False: 2.14k]
  |  Branch (1473:16): [True: 13, False: 4.24k]
  |  Branch (1473:41): [True: 13, False: 2.09k]
  ------------------
 1474|     13|        warn(damagedPDF("trailer", m->file->tell(), "stream keyword found in trailer"));
 1475|     13|    }
 1476|       |    // Override last_offset so that it points to the beginning of the object we just read
 1477|  4.25k|    m->file->setLastOffset(offset);
 1478|  4.25k|    return object;
 1479|  4.25k|}
_ZN4QPDF10readObjectERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE10QPDFObjGen:
 1483|   145k|{
 1484|   145k|    setLastObjectDescription(description, og);
 1485|   145k|    qpdf_offset_t offset = m->file->tell();
 1486|   145k|    bool empty = false;
 1487|       |
 1488|   145k|    StringDecrypter decrypter{this, og};
 1489|   145k|    StringDecrypter* decrypter_ptr = m->encp->encrypted ? &decrypter : nullptr;
  ------------------
  |  Branch (1489:38): [True: 0, False: 145k]
  ------------------
 1490|   145k|    auto object =
 1491|   145k|        QPDFParser(m->file, m->last_object_description, m->tokenizer, decrypter_ptr, this, true)
 1492|   145k|            .parse(empty, false);
 1493|   145k|    if (empty) {
  ------------------
  |  Branch (1493:9): [True: 71, False: 145k]
  ------------------
 1494|       |        // Nothing in the PDF spec appears to allow empty objects, but they have been encountered in
 1495|       |        // actual PDF files and Adobe Reader appears to ignore them.
 1496|     71|        warn(damagedPDF(m->file, m->file->getLastOffset(), "empty object treated as null"));
 1497|     71|        return object;
 1498|     71|    }
 1499|   145k|    auto token = readToken(m->file);
 1500|   145k|    if (object.isDictionary() && token.isWord("stream")) {
  ------------------
  |  Branch (1500:9): [True: 100k, False: 45.7k]
  |  Branch (1500:9): [True: 47.6k, False: 98.1k]
  |  Branch (1500:34): [True: 47.6k, False: 52.4k]
  ------------------
 1501|  47.6k|        readStream(object, og, offset);
 1502|  47.6k|        token = readToken(m->file);
 1503|  47.6k|    }
 1504|   145k|    if (!token.isWord("endobj")) {
  ------------------
  |  Branch (1504:9): [True: 8.86k, False: 136k]
  ------------------
 1505|  8.86k|        QTC::TC("qpdf", "QPDF err expected endobj");
 1506|  8.86k|        warn(damagedPDF("expected endobj"));
 1507|  8.86k|    }
 1508|   145k|    return object;
 1509|   145k|}
_ZN4QPDF10readStreamER16QPDFObjectHandle10QPDFObjGenx:
 1514|  47.6k|{
 1515|  47.6k|    validateStreamLineEnd(object, og, offset);
 1516|       |
 1517|       |    // Must get offset before accessing any additional objects since resolving a previously
 1518|       |    // unresolved indirect object will change file position.
 1519|  47.6k|    qpdf_offset_t stream_offset = m->file->tell();
 1520|  47.6k|    size_t length = 0;
 1521|       |
 1522|  47.6k|    try {
 1523|  47.6k|        auto length_obj = object.getKey("/Length");
 1524|       |
 1525|  47.6k|        if (!length_obj.isInteger()) {
  ------------------
  |  Branch (1525:13): [True: 2.39k, False: 45.2k]
  ------------------
 1526|  2.39k|            if (length_obj.isNull()) {
  ------------------
  |  Branch (1526:17): [True: 1.91k, False: 477]
  ------------------
 1527|  1.91k|                QTC::TC("qpdf", "QPDF stream without length");
 1528|  1.91k|                throw damagedPDF(offset, "stream dictionary lacks /Length key");
 1529|  1.91k|            }
 1530|    477|            QTC::TC("qpdf", "QPDF stream length not integer");
 1531|    477|            throw damagedPDF(offset, "/Length key in stream dictionary is not an integer");
 1532|  2.39k|        }
 1533|       |
 1534|  45.2k|        length = toS(length_obj.getUIntValue());
 1535|       |        // Seek in two steps to avoid potential integer overflow
 1536|  45.2k|        m->file->seek(stream_offset, SEEK_SET);
 1537|  45.2k|        m->file->seek(toO(length), SEEK_CUR);
 1538|  45.2k|        if (!readToken(m->file).isWord("endstream")) {
  ------------------
  |  Branch (1538:13): [True: 5.53k, False: 39.6k]
  ------------------
 1539|  5.53k|            QTC::TC("qpdf", "QPDF missing endstream");
 1540|  5.53k|            throw damagedPDF("expected endstream");
 1541|  5.53k|        }
 1542|  45.2k|    } catch (QPDFExc& e) {
 1543|  7.95k|        if (m->attempt_recovery) {
  ------------------
  |  Branch (1543:13): [True: 7.95k, False: 0]
  ------------------
 1544|  7.95k|            warn(e);
 1545|  7.95k|            length = recoverStreamLength(m->file, og, stream_offset);
 1546|  7.95k|        } else {
 1547|      0|            throw;
 1548|      0|        }
 1549|  7.95k|    }
 1550|  47.4k|    object = newIndirect(og, QPDF_Stream::create(this, og, object, stream_offset, length));
 1551|  47.4k|}
_ZN4QPDF21validateStreamLineEndER16QPDFObjectHandle10QPDFObjGenx:
 1555|  47.6k|{
 1556|       |    // The PDF specification states that the word "stream" should be followed by either a carriage
 1557|       |    // return and a newline or by a newline alone.  It specifically disallowed following it by a
 1558|       |    // carriage return alone since, in that case, there would be no way to tell whether the NL in a
 1559|       |    // CR NL sequence was part of the stream data.  However, some readers, including Adobe reader,
 1560|       |    // accept a carriage return by itself when followed by a non-newline character, so that's what
 1561|       |    // we do here. We have also seen files that have extraneous whitespace between the stream
 1562|       |    // keyword and the newline.
 1563|  48.1k|    while (true) {
  ------------------
  |  Branch (1563:12): [Folded - Ignored]
  ------------------
 1564|  48.1k|        char ch;
 1565|  48.1k|        if (m->file->read(&ch, 1) == 0) {
  ------------------
  |  Branch (1565:13): [True: 2, False: 48.1k]
  ------------------
 1566|       |            // A premature EOF here will result in some other problem that will get reported at
 1567|       |            // another time.
 1568|      2|            return;
 1569|      2|        }
 1570|  48.1k|        if (ch == '\n') {
  ------------------
  |  Branch (1570:13): [True: 10.9k, False: 37.2k]
  ------------------
 1571|       |            // ready to read stream data
 1572|  10.9k|            QTC::TC("qpdf", "QPDF stream with NL only");
 1573|  10.9k|            return;
 1574|  10.9k|        }
 1575|  37.2k|        if (ch == '\r') {
  ------------------
  |  Branch (1575:13): [True: 36.5k, False: 643]
  ------------------
 1576|       |            // Read another character
 1577|  36.5k|            if (m->file->read(&ch, 1) != 0) {
  ------------------
  |  Branch (1577:17): [True: 36.5k, False: 1]
  ------------------
 1578|  36.5k|                if (ch == '\n') {
  ------------------
  |  Branch (1578:21): [True: 36.5k, False: 50]
  ------------------
 1579|       |                    // Ready to read stream data
 1580|  36.5k|                    QTC::TC("qpdf", "QPDF stream with CRNL");
 1581|  36.5k|                } else {
 1582|       |                    // Treat the \r by itself as the whitespace after endstream and start reading
 1583|       |                    // stream data in spite of not having seen a newline.
 1584|     50|                    QTC::TC("qpdf", "QPDF stream with CR only");
 1585|     50|                    m->file->unreadCh(ch);
 1586|     50|                    warn(damagedPDF(
 1587|     50|                        m->file->tell(), "stream keyword followed by carriage return only"));
 1588|     50|                }
 1589|  36.5k|            }
 1590|  36.5k|            return;
 1591|  36.5k|        }
 1592|    643|        if (!QUtil::is_space(ch)) {
  ------------------
  |  Branch (1592:13): [True: 90, False: 553]
  ------------------
 1593|     90|            QTC::TC("qpdf", "QPDF stream without newline");
 1594|     90|            m->file->unreadCh(ch);
 1595|     90|            warn(damagedPDF(
 1596|     90|                m->file->tell(), "stream keyword not followed by proper line terminator"));
 1597|     90|            return;
 1598|     90|        }
 1599|    553|        warn(damagedPDF(m->file->tell(), "stream keyword followed by extraneous whitespace"));
 1600|    553|    }
 1601|  47.6k|}
_ZN4QPDF18readObjectInStreamERNSt3__110shared_ptrI11InputSourceEEi:
 1605|  20.1k|{
 1606|  20.1k|    m->last_object_description.erase(7); // last_object_description starts with "object "
 1607|  20.1k|    m->last_object_description += std::to_string(obj);
 1608|  20.1k|    m->last_object_description += " 0";
 1609|       |
 1610|  20.1k|    bool empty = false;
 1611|  20.1k|    auto object = QPDFParser(input, m->last_object_description, m->tokenizer, nullptr, this, true)
 1612|  20.1k|                      .parse(empty, false);
 1613|  20.1k|    if (empty) {
  ------------------
  |  Branch (1613:9): [True: 0, False: 20.1k]
  ------------------
 1614|       |        // Nothing in the PDF spec appears to allow empty objects, but they have been encountered in
 1615|       |        // actual PDF files and Adobe Reader appears to ignore them.
 1616|      0|        warn(damagedPDF(input, input->getLastOffset(), "empty object treated as null"));
 1617|      0|    }
 1618|  20.1k|    return object;
 1619|  20.1k|}
_ZN4QPDF13findEndstreamEv:
 1623|  8.90k|{
 1624|       |    // Find endstream or endobj. Position the input at that token.
 1625|  8.90k|    auto t = readToken(m->file, 20);
 1626|  8.90k|    if (t.isWord("endobj") || t.isWord("endstream")) {
  ------------------
  |  Branch (1626:9): [True: 2.05k, False: 6.85k]
  |  Branch (1626:9): [True: 7.51k, False: 1.39k]
  |  Branch (1626:31): [True: 5.45k, False: 1.39k]
  ------------------
 1627|  7.51k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1628|  7.51k|        return true;
 1629|  7.51k|    }
 1630|  1.39k|    return false;
 1631|  8.90k|}
_ZN4QPDF19recoverStreamLengthENSt3__110shared_ptrI11InputSourceEERK10QPDFObjGenx:
 1636|  7.78k|{
 1637|       |    // Try to reconstruct stream length by looking for endstream or endobj
 1638|  7.78k|    warn(damagedPDF(input, stream_offset, "attempting to recover stream length"));
 1639|       |
 1640|  7.78k|    PatternFinder ef(*this, &QPDF::findEndstream);
 1641|  7.78k|    size_t length = 0;
 1642|  7.78k|    if (m->file->findFirst("end", stream_offset, 0, ef)) {
  ------------------
  |  Branch (1642:9): [True: 7.51k, False: 267]
  ------------------
 1643|  7.51k|        length = toS(m->file->tell() - stream_offset);
 1644|       |        // Reread endstream but, if it was endobj, don't skip that.
 1645|  7.51k|        QPDFTokenizer::Token t = readToken(m->file);
 1646|  7.51k|        if (t.getValue() == "endobj") {
  ------------------
  |  Branch (1646:13): [True: 2.05k, False: 5.45k]
  ------------------
 1647|  2.05k|            m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1648|  2.05k|        }
 1649|  7.51k|    }
 1650|       |
 1651|  7.78k|    if (length) {
  ------------------
  |  Branch (1651:9): [True: 7.51k, False: 269]
  ------------------
 1652|  7.51k|        qpdf_offset_t this_obj_offset = 0;
 1653|  7.51k|        QPDFObjGen this_og;
 1654|       |
 1655|       |        // Make sure this is inside this object
 1656|   700k|        for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (1656:30): [True: 700k, False: 7.51k]
  ------------------
 1657|   700k|            QPDFXRefEntry const& entry = iter.second;
 1658|   700k|            if (entry.getType() == 1) {
  ------------------
  |  Branch (1658:17): [True: 699k, False: 1.20k]
  ------------------
 1659|   699k|                qpdf_offset_t obj_offset = entry.getOffset();
 1660|   699k|                if ((obj_offset > stream_offset) &&
  ------------------
  |  Branch (1660:21): [True: 293k, False: 405k]
  ------------------
 1661|   699k|                    ((this_obj_offset == 0) || (this_obj_offset > obj_offset))) {
  ------------------
  |  Branch (1661:22): [True: 6.85k, False: 286k]
  |  Branch (1661:48): [True: 6.27k, False: 280k]
  ------------------
 1662|  13.1k|                    this_obj_offset = obj_offset;
 1663|  13.1k|                    this_og = iter.first;
 1664|  13.1k|                }
 1665|   699k|            }
 1666|   700k|        }
 1667|  7.51k|        if (this_obj_offset && (this_og == og)) {
  ------------------
  |  Branch (1667:13): [True: 6.85k, False: 656]
  |  Branch (1667:32): [True: 0, False: 6.85k]
  ------------------
 1668|       |            // Well, we found endstream\nendobj within the space allowed for this object, so we're
 1669|       |            // probably in good shape.
 1670|  7.51k|        } else {
 1671|  7.51k|            QTC::TC("qpdf", "QPDF found wrong endstream in recovery");
 1672|  7.51k|        }
 1673|  7.51k|    }
 1674|       |
 1675|  7.78k|    if (length == 0) {
  ------------------
  |  Branch (1675:9): [True: 267, False: 7.51k]
  ------------------
 1676|    267|        warn(damagedPDF(
 1677|    267|            input, stream_offset, "unable to recover stream data; treating stream as empty"));
 1678|  7.51k|    } else {
 1679|  7.51k|        warn(
 1680|  7.51k|            damagedPDF(input, stream_offset, "recovered stream length: " + std::to_string(length)));
 1681|  7.51k|    }
 1682|       |
 1683|  7.78k|    QTC::TC("qpdf", "QPDF recovered stream length");
 1684|  7.78k|    return length;
 1685|  7.78k|}
_ZN4QPDF9readTokenENSt3__110shared_ptrI11InputSourceEEm:
 1689|  4.61M|{
 1690|  4.61M|    return m->tokenizer.readToken(input, m->last_object_description, true, max_len);
 1691|  4.61M|}
_ZN4QPDF18readObjectAtOffsetEbxRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE10QPDFObjGenRS9_b:
 1701|   147k|{
 1702|   147k|    bool check_og = true;
 1703|   147k|    if (exp_og.getObj() == 0) {
  ------------------
  |  Branch (1703:9): [True: 2.03k, False: 145k]
  ------------------
 1704|       |        // This method uses an expect object ID of 0 to indicate that we don't know or don't care
 1705|       |        // what the actual object ID is at this offset. This is true when we read the xref stream
 1706|       |        // and linearization hint streams. In this case, we don't verify the expect object
 1707|       |        // ID/generation against what was read from the file. There is also no reason to attempt
 1708|       |        // xref recovery if we get a failure in this case since the read attempt was not triggered
 1709|       |        // by an xref lookup.
 1710|  2.03k|        check_og = false;
 1711|  2.03k|        try_recovery = false;
 1712|  2.03k|    }
 1713|   147k|    setLastObjectDescription(description, exp_og);
 1714|       |
 1715|   147k|    if (!m->attempt_recovery) {
  ------------------
  |  Branch (1715:9): [True: 0, False: 147k]
  ------------------
 1716|      0|        try_recovery = false;
 1717|      0|    }
 1718|       |
 1719|       |    // Special case: if offset is 0, just return null.  Some PDF writers, in particular
 1720|       |    // "Mac OS X 10.7.5 Quartz PDFContext", may store deleted objects in the xref table as
 1721|       |    // "0000000000 00000 n", which is not correct, but it won't hurt anything for us to ignore
 1722|       |    // these.
 1723|   147k|    if (offset == 0) {
  ------------------
  |  Branch (1723:9): [True: 71, False: 147k]
  ------------------
 1724|     71|        QTC::TC("qpdf", "QPDF bogus 0 offset", 0);
 1725|     71|        warn(damagedPDF(0, "object has offset 0"));
 1726|     71|        return QPDFObjectHandle::newNull();
 1727|     71|    }
 1728|       |
 1729|   147k|    m->file->seek(offset, SEEK_SET);
 1730|   147k|    try {
 1731|   147k|        QPDFTokenizer::Token tobjid = readToken(m->file);
 1732|   147k|        bool objidok = tobjid.isInteger();
 1733|   147k|        QTC::TC("qpdf", "QPDF check objid", objidok ? 1 : 0);
  ------------------
  |  Branch (1733:45): [True: 146k, False: 1.34k]
  ------------------
 1734|   147k|        if (!objidok) {
  ------------------
  |  Branch (1734:13): [True: 1.34k, False: 146k]
  ------------------
 1735|  1.34k|            QTC::TC("qpdf", "QPDF expected n n obj");
 1736|  1.34k|            throw damagedPDF(offset, "expected n n obj");
 1737|  1.34k|        }
 1738|   146k|        QPDFTokenizer::Token tgen = readToken(m->file);
 1739|   146k|        bool genok = tgen.isInteger();
 1740|   146k|        QTC::TC("qpdf", "QPDF check generation", genok ? 1 : 0);
  ------------------
  |  Branch (1740:50): [True: 145k, False: 66]
  ------------------
 1741|   146k|        if (!genok) {
  ------------------
  |  Branch (1741:13): [True: 66, False: 145k]
  ------------------
 1742|     66|            throw damagedPDF(offset, "expected n n obj");
 1743|     66|        }
 1744|   145k|        QPDFTokenizer::Token tobj = readToken(m->file);
 1745|       |
 1746|   145k|        bool objok = tobj.isWord("obj");
 1747|   145k|        QTC::TC("qpdf", "QPDF check obj", objok ? 1 : 0);
  ------------------
  |  Branch (1747:43): [True: 145k, False: 57]
  ------------------
 1748|       |
 1749|   145k|        if (!objok) {
  ------------------
  |  Branch (1749:13): [True: 57, False: 145k]
  ------------------
 1750|     57|            throw damagedPDF(offset, "expected n n obj");
 1751|     57|        }
 1752|   145k|        int objid = QUtil::string_to_int(tobjid.getValue().c_str());
 1753|   145k|        int generation = QUtil::string_to_int(tgen.getValue().c_str());
 1754|   145k|        og = QPDFObjGen(objid, generation);
 1755|   145k|        if (objid == 0) {
  ------------------
  |  Branch (1755:13): [True: 4, False: 145k]
  ------------------
 1756|      4|            QTC::TC("qpdf", "QPDF object id 0");
 1757|      4|            throw damagedPDF(offset, "object with ID 0");
 1758|      4|        }
 1759|   145k|        if (check_og && (exp_og != og)) {
  ------------------
  |  Branch (1759:13): [True: 145k, False: 695]
  |  Branch (1759:25): [True: 8, False: 145k]
  ------------------
 1760|      8|            QTC::TC("qpdf", "QPDF err wrong objid/generation");
 1761|      8|            QPDFExc e = damagedPDF(offset, "expected " + exp_og.unparse(' ') + " obj");
 1762|      8|            if (try_recovery) {
  ------------------
  |  Branch (1762:17): [True: 8, False: 0]
  ------------------
 1763|       |                // Will be retried below
 1764|      8|                throw e;
 1765|      8|            } else {
 1766|       |                // We can try reading the object anyway even if the ID doesn't match.
 1767|      0|                warn(e);
 1768|      0|            }
 1769|      8|        }
 1770|   145k|    } catch (QPDFExc& e) {
 1771|  1.47k|        if (try_recovery) {
  ------------------
  |  Branch (1771:13): [True: 140, False: 1.33k]
  ------------------
 1772|       |            // Try again after reconstructing xref table
 1773|    140|            reconstruct_xref(e);
 1774|    140|            if (m->xref_table.count(exp_og) && (m->xref_table[exp_og].getType() == 1)) {
  ------------------
  |  Branch (1774:17): [True: 18, False: 122]
  |  Branch (1774:48): [True: 18, False: 0]
  ------------------
 1775|     18|                qpdf_offset_t new_offset = m->xref_table[exp_og].getOffset();
 1776|     18|                QPDFObjectHandle result =
 1777|     18|                    readObjectAtOffset(false, new_offset, description, exp_og, og, false);
 1778|     18|                QTC::TC("qpdf", "QPDF recovered in readObjectAtOffset");
 1779|     18|                return result;
 1780|    122|            } else {
 1781|    122|                QTC::TC("qpdf", "QPDF object gone after xref reconstruction");
 1782|    122|                warn(damagedPDF(
 1783|    122|                    "",
 1784|    122|                    0,
 1785|    122|                    ("object " + exp_og.unparse(' ') +
 1786|    122|                     " not found in file after regenerating cross reference "
 1787|    122|                     "table")));
 1788|    122|                return QPDFObjectHandle::newNull();
 1789|    122|            }
 1790|  1.33k|        } else {
 1791|  1.33k|            throw;
 1792|  1.33k|        }
 1793|  1.47k|    }
 1794|       |
 1795|   145k|    QPDFObjectHandle oh = readObject(description, og);
 1796|       |
 1797|   145k|    if (isUnresolved(og)) {
  ------------------
  |  Branch (1797:9): [True: 144k, False: 1.40k]
  ------------------
 1798|       |        // Store the object in the cache here so it gets cached whether we first know the offset or
 1799|       |        // whether we first know the object ID and generation (in which we case we would get here
 1800|       |        // through resolve).
 1801|       |
 1802|       |        // Determine the end offset of this object before and after white space.  We use these
 1803|       |        // numbers to validate linearization hint tables.  Offsets and lengths of objects may imply
 1804|       |        // the end of an object to be anywhere between these values.
 1805|   144k|        qpdf_offset_t end_before_space = m->file->tell();
 1806|       |
 1807|       |        // skip over spaces
 1808|   382k|        while (true) {
  ------------------
  |  Branch (1808:16): [Folded - Ignored]
  ------------------
 1809|   382k|            char ch;
 1810|   382k|            if (m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1810:17): [True: 380k, False: 1.28k]
  ------------------
 1811|   380k|                if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1811:21): [True: 143k, False: 237k]
  ------------------
 1812|   143k|                    m->file->seek(-1, SEEK_CUR);
 1813|   143k|                    break;
 1814|   143k|                }
 1815|   380k|            } else {
 1816|  1.28k|                throw damagedPDF(m->file->tell(), "EOF after endobj");
 1817|  1.28k|            }
 1818|   382k|        }
 1819|   143k|        qpdf_offset_t end_after_space = m->file->tell();
 1820|   143k|        if (skip_cache_if_in_xref && m->xref_table.count(og)) {
  ------------------
  |  Branch (1820:13): [True: 193, False: 143k]
  |  Branch (1820:38): [True: 2, False: 191]
  ------------------
 1821|       |            // Ordinarily, an object gets read here when resolved through xref table or stream. In
 1822|       |            // the special case of the xref stream and linearization hint tables, the offset comes
 1823|       |            // from another source. For the specific case of xref streams, the xref stream is read
 1824|       |            // and loaded into the object cache very early in parsing. Ordinarily, when a file is
 1825|       |            // updated by appending, items inserted into the xref table in later updates take
 1826|       |            // precedence over earlier items. In the special case of reusing the object number
 1827|       |            // previously used as the xref stream, we have the following order of events:
 1828|       |            //
 1829|       |            // * reused object gets loaded into the xref table
 1830|       |            // * old object is read here while reading xref streams
 1831|       |            // * original xref entry is ignored (since already in xref table)
 1832|       |            //
 1833|       |            // It is the second step that causes a problem. Even though the xref table is correct in
 1834|       |            // this case, the old object is already in the cache and so effectively prevails over
 1835|       |            // the reused object. To work around this issue, we have a special case for the xref
 1836|       |            // stream (via the skip_cache_if_in_xref): if the object is already in the xref stream,
 1837|       |            // don't cache what we read here.
 1838|       |            //
 1839|       |            // It is likely that the same bug may exist for linearization hint tables, but the
 1840|       |            // existing code uses end_before_space and end_after_space from the cache, so fixing
 1841|       |            // that would require more significant rework. The chances of a linearization hint
 1842|       |            // stream being reused seems smaller because the xref stream is probably the highest
 1843|       |            // object in the file and the linearization hint stream would be some random place in
 1844|       |            // the middle, so I'm leaving that bug unfixed for now. If the bug were to be fixed, we
 1845|       |            // could use !check_og in place of skip_cache_if_in_xref.
 1846|      2|            QTC::TC("qpdf", "QPDF skipping cache for known unchecked object");
 1847|   143k|        } else {
 1848|   143k|            updateCache(og, oh.getObj(), end_before_space, end_after_space);
 1849|   143k|        }
 1850|   143k|    }
 1851|       |
 1852|   144k|    return oh;
 1853|   145k|}
_ZN4QPDF7resolveE10QPDFObjGen:
 1857|   156k|{
 1858|   156k|    if (!isUnresolved(og)) {
  ------------------
  |  Branch (1858:9): [True: 0, False: 156k]
  ------------------
 1859|      0|        return m->obj_cache[og].object.get();
 1860|      0|    }
 1861|       |
 1862|   156k|    if (m->resolving.count(og)) {
  ------------------
  |  Branch (1862:9): [True: 42, False: 155k]
  ------------------
 1863|       |        // This can happen if an object references itself directly or indirectly in some key that
 1864|       |        // has to be resolved during object parsing, such as stream length.
 1865|     42|        QTC::TC("qpdf", "QPDF recursion loop in resolve");
 1866|     42|        warn(damagedPDF("", "loop detected resolving object " + og.unparse(' ')));
 1867|     42|        updateCache(og, QPDF_Null::create(), -1, -1);
 1868|     42|        return m->obj_cache[og].object.get();
 1869|     42|    }
 1870|   155k|    ResolveRecorder rr(this, og);
 1871|       |
 1872|   155k|    if (m->xref_table.count(og) != 0) {
  ------------------
  |  Branch (1872:9): [True: 152k, False: 3.70k]
  ------------------
 1873|   152k|        QPDFXRefEntry const& entry = m->xref_table[og];
 1874|   152k|        try {
 1875|   152k|            switch (entry.getType()) {
 1876|   145k|            case 1:
  ------------------
  |  Branch (1876:13): [True: 145k, False: 6.87k]
  ------------------
 1877|   145k|                {
 1878|   145k|                    qpdf_offset_t offset = entry.getOffset();
 1879|       |                    // Object stored in cache by readObjectAtOffset
 1880|   145k|                    QPDFObjGen a_og;
 1881|   145k|                    QPDFObjectHandle oh = readObjectAtOffset(true, offset, "", og, a_og, false);
 1882|   145k|                }
 1883|   145k|                break;
 1884|       |
 1885|  6.86k|            case 2:
  ------------------
  |  Branch (1885:13): [True: 6.86k, False: 145k]
  ------------------
 1886|  6.86k|                resolveObjectsInStream(entry.getObjStreamNumber());
 1887|  6.86k|                break;
 1888|       |
 1889|      3|            default:
  ------------------
  |  Branch (1889:13): [True: 3, False: 152k]
  ------------------
 1890|      3|                throw damagedPDF(
 1891|      3|                    "", 0, ("object " + og.unparse('/') + " has unexpected xref entry type"));
 1892|   152k|            }
 1893|   152k|        } catch (QPDFExc& e) {
 1894|  2.31k|            warn(e);
 1895|  2.31k|        } catch (std::exception& e) {
 1896|    158|            warn(damagedPDF(
 1897|    158|                "", 0, ("object " + og.unparse('/') + ": error reading object: " + e.what())));
 1898|    158|        }
 1899|   152k|    }
 1900|       |
 1901|   155k|    if (isUnresolved(og)) {
  ------------------
  |  Branch (1901:9): [True: 11.3k, False: 143k]
  ------------------
 1902|       |        // PDF spec says unknown objects resolve to the null object.
 1903|  11.3k|        QTC::TC("qpdf", "QPDF resolve failure to null");
 1904|  11.3k|        updateCache(og, QPDF_Null::create(), -1, -1);
 1905|  11.3k|    }
 1906|       |
 1907|   155k|    auto result(m->obj_cache[og].object);
 1908|   155k|    result->setDefaultDescription(this, og);
 1909|   155k|    return result.get();
 1910|   155k|}
_ZN4QPDF22resolveObjectsInStreamEi:
 1914|  6.86k|{
 1915|  6.86k|    if (m->resolved_object_streams.count(obj_stream_number)) {
  ------------------
  |  Branch (1915:9): [True: 5.87k, False: 991]
  ------------------
 1916|  5.87k|        return;
 1917|  5.87k|    }
 1918|    991|    m->resolved_object_streams.insert(obj_stream_number);
 1919|       |    // Force resolution of object stream
 1920|    991|    QPDFObjectHandle obj_stream = getObjectByID(obj_stream_number, 0);
 1921|    991|    if (!obj_stream.isStream()) {
  ------------------
  |  Branch (1921:9): [True: 93, False: 898]
  ------------------
 1922|     93|        throw damagedPDF(
 1923|     93|            "supposed object stream " + std::to_string(obj_stream_number) + " is not a stream");
 1924|     93|    }
 1925|       |
 1926|       |    // For linearization data in the object, use the data from the object stream for the objects in
 1927|       |    // the stream.
 1928|    898|    QPDFObjGen stream_og(obj_stream_number, 0);
 1929|    898|    qpdf_offset_t end_before_space = m->obj_cache[stream_og].end_before_space;
 1930|    898|    qpdf_offset_t end_after_space = m->obj_cache[stream_og].end_after_space;
 1931|       |
 1932|    898|    QPDFObjectHandle dict = obj_stream.getDict();
 1933|    898|    if (!dict.isDictionaryOfType("/ObjStm")) {
  ------------------
  |  Branch (1933:9): [True: 25, False: 873]
  ------------------
 1934|     25|        QTC::TC("qpdf", "QPDF ERR object stream with wrong type");
 1935|     25|        warn(damagedPDF(
 1936|     25|            "supposed object stream " + std::to_string(obj_stream_number) + " has wrong type"));
 1937|     25|    }
 1938|       |
 1939|    898|    if (!(dict.getKey("/N").isInteger() && dict.getKey("/First").isInteger())) {
  ------------------
  |  Branch (1939:9): [True: 14, False: 884]
  |  Branch (1939:11): [True: 883, False: 15]
  |  Branch (1939:44): [True: 881, False: 2]
  ------------------
 1940|     14|        throw damagedPDF(
 1941|     14|            ("object stream " + std::to_string(obj_stream_number) + " has incorrect keys"));
 1942|     14|    }
 1943|       |
 1944|    884|    int n = dict.getKey("/N").getIntValueAsInt();
 1945|    884|    int first = dict.getKey("/First").getIntValueAsInt();
 1946|       |
 1947|    884|    std::map<int, int> offsets;
 1948|       |
 1949|    884|    std::shared_ptr<Buffer> bp = obj_stream.getStreamData(qpdf_dl_specialized);
 1950|    884|    auto input = std::shared_ptr<InputSource>(
 1951|       |        // line-break
 1952|    884|        new BufferInputSource(
 1953|    884|            (m->file->getName() + " object stream " + std::to_string(obj_stream_number)),
 1954|    884|            bp.get()));
 1955|       |
 1956|  29.0k|    for (int i = 0; i < n; ++i) {
  ------------------
  |  Branch (1956:21): [True: 28.1k, False: 858]
  ------------------
 1957|  28.1k|        QPDFTokenizer::Token tnum = readToken(input);
 1958|  28.1k|        QPDFTokenizer::Token toffset = readToken(input);
 1959|  28.1k|        if (!(tnum.isInteger() && toffset.isInteger())) {
  ------------------
  |  Branch (1959:15): [True: 28.1k, False: 11]
  |  Branch (1959:35): [True: 28.1k, False: 15]
  ------------------
 1960|     26|            throw damagedPDF(
 1961|     26|                input,
 1962|     26|                m->last_object_description,
 1963|     26|                input->getLastOffset(),
 1964|     26|                "expected integer in object stream header");
 1965|     26|        }
 1966|       |
 1967|  28.1k|        int num = QUtil::string_to_int(tnum.getValue().c_str());
 1968|  28.1k|        long long offset = QUtil::string_to_int(toffset.getValue().c_str());
 1969|  28.1k|        if (num > m->xref_table_max_id) {
  ------------------
  |  Branch (1969:13): [True: 317, False: 27.8k]
  ------------------
 1970|    317|            continue;
 1971|    317|        }
 1972|  27.8k|        if (num == obj_stream_number) {
  ------------------
  |  Branch (1972:13): [True: 0, False: 27.8k]
  ------------------
 1973|      0|            QTC::TC("qpdf", "QPDF ignore self-referential object stream");
 1974|      0|            warn(damagedPDF(
 1975|      0|                input,
 1976|      0|                m->last_object_description,
 1977|      0|                input->getLastOffset(),
 1978|      0|                "object stream claims to contain itself"));
 1979|      0|            continue;
 1980|      0|        }
 1981|  27.8k|        offsets[num] = toI(offset + first);
 1982|  27.8k|    }
 1983|       |
 1984|       |    // To avoid having to read the object stream multiple times, store all objects that would be
 1985|       |    // found here in the cache.  Remember that some objects stored here might have been overridden
 1986|       |    // by new objects appended to the file, so it is necessary to recheck the xref table and only
 1987|       |    // cache what would actually be resolved here.
 1988|    858|    m->last_object_description.clear();
 1989|    858|    m->last_object_description += "object ";
 1990|  22.4k|    for (auto const& iter: offsets) {
  ------------------
  |  Branch (1990:26): [True: 22.4k, False: 858]
  ------------------
 1991|  22.4k|        QPDFObjGen og(iter.first, 0);
 1992|  22.4k|        auto entry = m->xref_table.find(og);
 1993|  22.4k|        if (entry != m->xref_table.end() && entry->second.getType() == 2 &&
  ------------------
  |  Branch (1993:13): [True: 22.1k, False: 291]
  |  Branch (1993:13): [True: 20.1k, False: 2.28k]
  |  Branch (1993:45): [True: 20.1k, False: 1.97k]
  ------------------
 1994|  22.4k|            entry->second.getObjStreamNumber() == obj_stream_number) {
  ------------------
  |  Branch (1994:13): [True: 20.1k, False: 19]
  ------------------
 1995|  20.1k|            int offset = iter.second;
 1996|  20.1k|            input->seek(offset, SEEK_SET);
 1997|  20.1k|            QPDFObjectHandle oh = readObjectInStream(input, iter.first);
 1998|  20.1k|            updateCache(og, oh.getObj(), end_before_space, end_after_space);
 1999|  20.1k|        } else {
 2000|  2.28k|            QTC::TC("qpdf", "QPDF not caching overridden objstm object");
 2001|  2.28k|        }
 2002|  22.4k|    }
 2003|    858|}
_ZN4QPDF11newIndirectERK10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEE:
 2007|  50.4k|{
 2008|  50.4k|    obj->setDefaultDescription(this, og);
 2009|  50.4k|    return {obj};
 2010|  50.4k|}
_ZN4QPDF11updateCacheERK10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEExx:
 2018|   174k|{
 2019|   174k|    object->setObjGen(this, og);
 2020|   174k|    if (isCached(og)) {
  ------------------
  |  Branch (2020:9): [True: 144k, False: 30.3k]
  ------------------
 2021|   144k|        auto& cache = m->obj_cache[og];
 2022|   144k|        cache.object->assign(object);
 2023|   144k|        cache.end_before_space = end_before_space;
 2024|   144k|        cache.end_after_space = end_after_space;
 2025|   144k|    } else {
 2026|  30.3k|        m->obj_cache[og] = ObjCache(object, end_before_space, end_after_space);
 2027|  30.3k|    }
 2028|   174k|}
_ZN4QPDF8isCachedERK10QPDFObjGen:
 2032|   787k|{
 2033|   787k|    return m->obj_cache.count(og) != 0;
 2034|   787k|}
_ZN4QPDF12isUnresolvedERK10QPDFObjGen:
 2038|   612k|{
 2039|   612k|    return !isCached(og) || m->obj_cache[og].object->isUnresolved();
  ------------------
  |  Branch (2039:12): [True: 66.0k, False: 546k]
  |  Branch (2039:29): [True: 309k, False: 237k]
  ------------------
 2040|   612k|}
_ZN4QPDF10nextObjGenEv:
 2044|  3.03k|{
 2045|  3.03k|    int max_objid = toI(getObjectCount());
 2046|  3.03k|    if (max_objid == std::numeric_limits<int>::max()) {
  ------------------
  |  Branch (2046:9): [True: 0, False: 3.03k]
  ------------------
 2047|      0|        throw std::range_error("max object id is too high to create new objects");
 2048|      0|    }
 2049|  3.03k|    return QPDFObjGen(max_objid + 1, 0);
 2050|  3.03k|}
_ZN4QPDF26makeIndirectFromQPDFObjectERKNSt3__110shared_ptrI10QPDFObjectEE:
 2054|  3.03k|{
 2055|  3.03k|    QPDFObjGen next{nextObjGen()};
 2056|  3.03k|    m->obj_cache[next] = ObjCache(obj, -1, -1);
 2057|  3.03k|    return newIndirect(next, m->obj_cache[next].object);
 2058|  3.03k|}
_ZN4QPDF18makeIndirectObjectE16QPDFObjectHandle:
 2062|    989|{
 2063|    989|    if (!oh.isInitialized()) {
  ------------------
  |  Branch (2063:9): [True: 0, False: 989]
  ------------------
 2064|      0|        throw std::logic_error("attempted to make an uninitialized QPDFObjectHandle indirect");
 2065|      0|    }
 2066|    989|    return makeIndirectFromQPDFObject(oh.getObj());
 2067|    989|}
_ZN4QPDF15newIndirectNullEv:
 2077|  2.04k|{
 2078|  2.04k|    return makeIndirectFromQPDFObject(QPDF_Null::create());
 2079|  2.04k|}
_ZN4QPDF18getObjectForParserEiib:
 2112|   381k|{
 2113|       |    // This method is called by the parser and therefore must not resolve any objects.
 2114|   381k|    auto og = QPDFObjGen(id, gen);
 2115|   381k|    if (auto iter = m->obj_cache.find(og); iter != m->obj_cache.end()) {
  ------------------
  |  Branch (2115:44): [True: 190k, False: 191k]
  ------------------
 2116|   190k|        return iter->second.object;
 2117|   190k|    }
 2118|   191k|    if (m->xref_table.count(og) || !m->parsed) {
  ------------------
  |  Branch (2118:9): [True: 129k, False: 62.3k]
  |  Branch (2118:36): [True: 17.5k, False: 44.8k]
  ------------------
 2119|   147k|        return m->obj_cache.insert({og, QPDF_Unresolved::create(this, og)}).first->second.object;
 2120|   147k|    }
 2121|  44.8k|    if (parse_pdf) {
  ------------------
  |  Branch (2121:9): [True: 44.8k, False: 0]
  ------------------
 2122|  44.8k|        return QPDF_Null::create();
 2123|  44.8k|    }
 2124|      0|    return m->obj_cache.insert({og, QPDF_Null::create(this, og)}).first->second.object;
 2125|  44.8k|}
_ZN4QPDF9getObjectERK10QPDFObjGen:
 2142|   164k|{
 2143|   164k|    if (auto it = m->obj_cache.find(og); it != m->obj_cache.end()) {
  ------------------
  |  Branch (2143:42): [True: 155k, False: 8.79k]
  ------------------
 2144|   155k|        return {it->second.object};
 2145|   155k|    } else if (m->parsed && !m->xref_table.count(og)) {
  ------------------
  |  Branch (2145:16): [True: 90, False: 8.70k]
  |  Branch (2145:29): [True: 33, False: 57]
  ------------------
 2146|     33|        return QPDF_Null::create();
 2147|  8.75k|    } else {
 2148|  8.75k|        auto result = m->obj_cache.try_emplace(og, QPDF_Unresolved::create(this, og), -1, -1);
 2149|  8.75k|        return {result.first->second.object};
 2150|  8.75k|    }
 2151|   164k|}
_ZN4QPDF9getObjectEii:
 2155|  1.14k|{
 2156|  1.14k|    return getObject(QPDFObjGen(objid, generation));
 2157|  1.14k|}
_ZN4QPDF17getObjectByObjGenERK10QPDFObjGen:
 2161|  17.3k|{
 2162|  17.3k|    return getObject(og);
 2163|  17.3k|}
_ZN4QPDF13getObjectByIDEii:
 2167|    991|{
 2168|    991|    return getObject(QPDFObjGen(objid, generation));
 2169|    991|}
_ZN4QPDF12removeObjectE10QPDFObjGen:
 2189|    319|{
 2190|    319|    m->xref_table.erase(og);
 2191|    319|    if (auto cached = m->obj_cache.find(og); cached != m->obj_cache.end()) {
  ------------------
  |  Branch (2191:46): [True: 306, False: 13]
  ------------------
 2192|       |        // Take care of any object handles that may be floating around.
 2193|    306|        cached->second.object->assign(QPDF_Null::create());
 2194|    306|        cached->second.object->setObjGen(nullptr, QPDFObjGen());
 2195|    306|        m->obj_cache.erase(cached);
 2196|    306|    }
 2197|    319|}
_ZNK4QPDF11getFilenameEv:
 2493|  48.8k|{
 2494|  48.8k|    return m->file->getName();
 2495|  48.8k|}
_ZNK4QPDF13getPDFVersionEv:
 2516|  1.96k|{
 2517|  1.96k|    return m->pdf_version;
 2518|  1.96k|}
_ZN4QPDF17getExtensionLevelEv:
 2522|  1.96k|{
 2523|  1.96k|    int result = 0;
 2524|  1.96k|    QPDFObjectHandle obj = getRoot();
 2525|  1.96k|    if (obj.hasKey("/Extensions")) {
  ------------------
  |  Branch (2525:9): [True: 0, False: 1.96k]
  ------------------
 2526|      0|        obj = obj.getKey("/Extensions");
 2527|      0|        if (obj.isDictionary() && obj.hasKey("/ADBE")) {
  ------------------
  |  Branch (2527:13): [True: 0, False: 0]
  |  Branch (2527:13): [True: 0, False: 0]
  |  Branch (2527:35): [True: 0, False: 0]
  ------------------
 2528|      0|            obj = obj.getKey("/ADBE");
 2529|      0|            if (obj.isDictionary() && obj.hasKey("/ExtensionLevel")) {
  ------------------
  |  Branch (2529:17): [True: 0, False: 0]
  |  Branch (2529:17): [True: 0, False: 0]
  |  Branch (2529:39): [True: 0, False: 0]
  ------------------
 2530|      0|                obj = obj.getKey("/ExtensionLevel");
 2531|      0|                if (obj.isInteger()) {
  ------------------
  |  Branch (2531:21): [True: 0, False: 0]
  ------------------
 2532|      0|                    result = obj.getIntValueAsInt();
 2533|      0|                }
 2534|      0|            }
 2535|      0|        }
 2536|      0|    }
 2537|  1.96k|    return result;
 2538|  1.96k|}
_ZN4QPDF10getTrailerEv:
 2542|  12.1k|{
 2543|  12.1k|    return m->trailer;
 2544|  12.1k|}
_ZN4QPDF7getRootEv:
 2548|  19.2k|{
 2549|  19.2k|    QPDFObjectHandle root = m->trailer.getKey("/Root");
 2550|  19.2k|    if (!root.isDictionary()) {
  ------------------
  |  Branch (2550:9): [True: 191, False: 19.0k]
  ------------------
 2551|    191|        throw damagedPDF("", 0, "unable to find /Root dictionary");
 2552|  19.0k|    } else if (
 2553|       |        // Check_mode is an interim solution to request #810 pending a more comprehensive review of
 2554|       |        // the approach to more extensive checks and warning levels.
 2555|  19.0k|        m->check_mode && !root.getKey("/Type").isNameAndEquals("/Catalog")) {
  ------------------
  |  Branch (2555:9): [True: 0, False: 19.0k]
  |  Branch (2555:9): [True: 0, False: 19.0k]
  |  Branch (2555:26): [True: 0, False: 0]
  ------------------
 2556|      0|        warn(damagedPDF("", 0, "catalog /Type entry missing or invalid"));
 2557|      0|        root.replaceKey("/Type", "/Catalog"_qpdf);
 2558|      0|    }
 2559|  19.0k|    return root;
 2560|  19.2k|}
_ZN4QPDF9tableSizeEv:
 2580|  1.96k|{
 2581|       |    // If obj_cache is dense, accommodate all object in tables,else accommodate only original
 2582|       |    // objects.
 2583|  1.96k|    auto max_xref = m->xref_table.size() ? m->xref_table.crbegin()->first.getObj() : 0;
  ------------------
  |  Branch (2583:21): [True: 1.96k, False: 0]
  ------------------
 2584|  1.96k|    auto max_obj = m->obj_cache.size() ? m->obj_cache.crbegin()->first.getObj() : 0;
  ------------------
  |  Branch (2584:20): [True: 1.96k, False: 0]
  ------------------
 2585|  1.96k|    auto max_id = std::numeric_limits<int>::max() - 1;
 2586|  1.96k|    if (max_obj >= max_id || max_xref >= max_id) {
  ------------------
  |  Branch (2586:9): [True: 2, False: 1.96k]
  |  Branch (2586:30): [True: 0, False: 1.96k]
  ------------------
 2587|       |        // Temporary fix. Long-term solution is
 2588|       |        // - QPDFObjGen to enforce objgens are valid and sensible
 2589|       |        // - xref table and obj cache to protect against insertion of impossibly large obj ids
 2590|      2|        stopOnError("Impossibly large object id encountered.");
 2591|      2|    }
 2592|  1.96k|    if (max_obj < 1.1 * std::max(toI(m->obj_cache.size()), max_xref)) {
  ------------------
  |  Branch (2592:9): [True: 1.79k, False: 177]
  ------------------
 2593|  1.79k|        return toS(++max_obj);
 2594|  1.79k|    }
 2595|    177|    return toS(++max_xref);
 2596|  1.96k|}
_ZN4QPDF24getCompressibleObjVectorEv:
 2600|  2.00k|{
 2601|  2.00k|    return getCompressibleObjGens<QPDFObjGen>();
 2602|  2.00k|}
_ZN4QPDF14pipeStreamDataENSt3__110shared_ptrINS_20EncryptionParametersEEENS1_I11InputSourceEERS_RK10QPDFObjGenxm16QPDFObjectHandleP8Pipelinebb:
 2718|  83.3k|{
 2719|  83.3k|    std::unique_ptr<Pipeline> to_delete;
 2720|  83.3k|    if (encp->encrypted) {
  ------------------
  |  Branch (2720:9): [True: 0, False: 83.3k]
  ------------------
 2721|      0|        decryptStream(encp, file, qpdf_for_warning, pipeline, og, stream_dict, to_delete);
 2722|      0|    }
 2723|       |
 2724|  83.3k|    bool attempted_finish = false;
 2725|  83.3k|    try {
 2726|  83.3k|        file->seek(offset, SEEK_SET);
 2727|  83.3k|        auto buf = std::make_unique<char[]>(length);
 2728|  83.3k|        if (auto read = file->read(buf.get(), length); read != length) {
  ------------------
  |  Branch (2728:56): [True: 0, False: 83.3k]
  ------------------
 2729|      0|            throw damagedPDF(file, "", offset + toO(read), "unexpected EOF reading stream data");
 2730|      0|        }
 2731|  83.3k|        pipeline->write(buf.get(), length);
 2732|  83.3k|        attempted_finish = true;
 2733|  83.3k|        pipeline->finish();
 2734|  83.3k|        return true;
 2735|  83.3k|    } catch (QPDFExc& e) {
 2736|      0|        if (!suppress_warnings) {
  ------------------
  |  Branch (2736:13): [True: 0, False: 0]
  ------------------
 2737|      0|            qpdf_for_warning.warn(e);
 2738|      0|        }
 2739|  2.21k|    } catch (std::exception& e) {
 2740|  2.21k|        if (!suppress_warnings) {
  ------------------
  |  Branch (2740:13): [True: 2.21k, False: 0]
  ------------------
 2741|  2.21k|            QTC::TC("qpdf", "QPDF decoding error warning");
 2742|  2.21k|            qpdf_for_warning.warn(
 2743|       |                // line-break
 2744|  2.21k|                damagedPDF(
 2745|  2.21k|                    file,
 2746|  2.21k|                    "",
 2747|  2.21k|                    file->getLastOffset(),
 2748|  2.21k|                    ("error decoding stream data for object " + og.unparse(' ') + ": " +
 2749|  2.21k|                     e.what())));
 2750|  2.21k|            if (will_retry) {
  ------------------
  |  Branch (2750:17): [True: 2.09k, False: 119]
  ------------------
 2751|  2.09k|                qpdf_for_warning.warn(
 2752|       |                    // line-break
 2753|  2.09k|                    damagedPDF(
 2754|  2.09k|                        file,
 2755|  2.09k|                        "",
 2756|  2.09k|                        file->getLastOffset(),
 2757|  2.09k|                        "stream will be re-processed without filtering to avoid data loss"));
 2758|  2.09k|            }
 2759|  2.21k|        }
 2760|  2.21k|    }
 2761|  2.16k|    if (!attempted_finish) {
  ------------------
  |  Branch (2761:9): [True: 1.41k, False: 748]
  ------------------
 2762|  1.41k|        try {
 2763|  1.41k|            pipeline->finish();
 2764|  1.41k|        } catch (std::exception&) {
 2765|       |            // ignore
 2766|    655|        }
 2767|  1.41k|    }
 2768|  2.16k|    return false;
 2769|  2.16k|}
_ZN4QPDF14pipeStreamDataERK10QPDFObjGenxm16QPDFObjectHandleP8Pipelinebb:
 2780|  83.3k|{
 2781|  83.3k|    return pipeStreamData(
 2782|  83.3k|        m->encp,
 2783|  83.3k|        m->file,
 2784|  83.3k|        *this,
 2785|  83.3k|        og,
 2786|  83.3k|        offset,
 2787|  83.3k|        length,
 2788|  83.3k|        stream_dict,
 2789|  83.3k|        pipeline,
 2790|  83.3k|        suppress_warnings,
 2791|  83.3k|        will_retry);
 2792|  83.3k|}
_ZN4QPDF11stopOnErrorERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2821|  1.78k|{
 2822|  1.78k|    throw damagedPDF("", message);
 2823|  1.78k|}
_ZN4QPDF10damagedPDFERKNSt3__110shared_ptrI11InputSourceEERKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEExSD_:
 2832|  19.9k|{
 2833|  19.9k|    return {qpdf_e_damaged_pdf, input->getName(), object, offset, message};
 2834|  19.9k|}
_ZN4QPDF10damagedPDFERKNSt3__110shared_ptrI11InputSourceEExRKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2841|  15.6k|{
 2842|  15.6k|    return damagedPDF(input, m->last_object_description, offset, message);
 2843|  15.6k|}
_ZN4QPDF10damagedPDFERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEExS8_:
 2848|  34.7k|{
 2849|  34.7k|    return {qpdf_e_damaged_pdf, m->file->getName(), object, offset, message};
 2850|  34.7k|}
_ZN4QPDF10damagedPDFERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
 2856|  2.26k|{
 2857|  2.26k|    return damagedPDF(object, m->file->getLastOffset(), message);
 2858|  2.26k|}
_ZN4QPDF10damagedPDFExRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2864|  5.92k|{
 2865|  5.92k|    return damagedPDF(m->last_object_description, offset, message);
 2866|  5.92k|}
_ZN4QPDF10damagedPDFERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2872|  14.5k|{
 2873|  14.5k|    return damagedPDF(m->last_object_description, m->file->getLastOffset(), message);
 2874|  14.5k|}
QPDF.cc:_ZZN4QPDF16reconstruct_xrefER7QPDFExcENK3$_0clEv:
  547|  2.87M|    auto check_warnings = [this, max_warnings]() {
  548|  2.87M|        if (m->warnings.size() > max_warnings) {
  ------------------
  |  Branch (548:13): [True: 0, False: 2.87M]
  ------------------
  549|      0|            throw damagedPDF("", 0, "too many errors while reconstructing cross-reference table");
  550|      0|        }
  551|  2.87M|    };
QPDF.cc:_ZZN4QPDF17processXRefStreamExR16QPDFObjectHandleENK3$_0clENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
 1201|    267|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1202|    267|        return damagedPDF("xref stream", xref_offset, msg.data());
 1203|    267|    };
_ZN4QPDF22getCompressibleObjGensI10QPDFObjGenEENSt3__16vectorIT_NS2_9allocatorIS4_EEEEv:
 2613|  2.00k|{
 2614|       |    // Return a list of objects that are allowed to be in object streams.  Walk through the objects
 2615|       |    // by traversing the document from the root, including a traversal of the pages tree.  This
 2616|       |    // makes that objects that are on the same page are more likely to be in the same object stream,
 2617|       |    // which is slightly more efficient, particularly with linearized files.  This is better than
 2618|       |    // iterating through the xref table since it avoids preserving orphaned items.
 2619|       |
 2620|       |    // Exclude encryption dictionary, if any
 2621|  2.00k|    QPDFObjectHandle encryption_dict = m->trailer.getKey("/Encrypt");
 2622|  2.00k|    QPDFObjGen encryption_dict_og = encryption_dict.getObjGen();
 2623|       |
 2624|  2.00k|    const size_t max_obj = getObjectCount();
 2625|  2.00k|    std::vector<bool> visited(max_obj, false);
 2626|  2.00k|    std::vector<QPDFObjectHandle> queue;
 2627|  2.00k|    queue.reserve(512);
 2628|  2.00k|    queue.push_back(m->trailer);
 2629|  2.00k|    std::vector<T> result;
 2630|  2.00k|    if constexpr (std::is_same_v<T, QPDFObjGen>) {
  ------------------
  |  Branch (2630:19): [Folded - Ignored]
  ------------------
 2631|  1.96k|        result.reserve(m->obj_cache.size());
 2632|  1.96k|    } else if constexpr (std::is_same_v<T, bool>) {
 2633|  2.00k|        result.resize(max_obj + 1U, false);
 2634|  2.00k|    } else {
 2635|  2.00k|        throw std::logic_error("Unsupported type in QPDF::getCompressibleObjGens");
 2636|  2.00k|    }
 2637|   994k|    while (!queue.empty()) {
  ------------------
  |  Branch (2637:12): [True: 992k, False: 2.00k]
  ------------------
 2638|   992k|        auto obj = queue.back();
 2639|   992k|        queue.pop_back();
 2640|   992k|        if (obj.getObjectID() > 0) {
  ------------------
  |  Branch (2640:13): [True: 193k, False: 799k]
  ------------------
 2641|   193k|            QPDFObjGen og = obj.getObjGen();
 2642|   193k|            const size_t id = toS(og.getObj() - 1);
 2643|   193k|            if (id >= max_obj) {
  ------------------
  |  Branch (2643:17): [True: 0, False: 193k]
  ------------------
 2644|      0|                throw std::logic_error(
 2645|      0|                    "unexpected object id encountered in getCompressibleObjGens");
 2646|      0|            }
 2647|   193k|            if (visited[id]) {
  ------------------
  |  Branch (2647:17): [True: 104k, False: 88.3k]
  ------------------
 2648|   104k|                QTC::TC("qpdf", "QPDF loop detected traversing objects");
 2649|   104k|                continue;
 2650|   104k|            }
 2651|       |
 2652|       |            // Check whether this is the current object. If not, remove it (which changes it into a
 2653|       |            // direct null and therefore stops us from revisiting it) and move on to the next object
 2654|       |            // in the queue.
 2655|  88.3k|            auto upper = m->obj_cache.upper_bound(og);
 2656|  88.3k|            if (upper != m->obj_cache.end() && upper->first.getObj() == og.getObj()) {
  ------------------
  |  Branch (2656:17): [True: 87.7k, False: 609]
  |  Branch (2656:17): [True: 126, False: 88.2k]
  |  Branch (2656:48): [True: 126, False: 87.6k]
  ------------------
 2657|    126|                removeObject(og);
 2658|    126|                continue;
 2659|    126|            }
 2660|       |
 2661|  88.2k|            visited[id] = true;
 2662|       |
 2663|  88.2k|            if (og == encryption_dict_og) {
  ------------------
  |  Branch (2663:17): [True: 0, False: 88.2k]
  ------------------
 2664|      0|                QTC::TC("qpdf", "QPDF exclude encryption dictionary");
 2665|  88.2k|            } else if (!(obj.isStream() ||
  ------------------
  |  Branch (2665:24): [True: 57.1k, False: 31.1k]
  |  Branch (2665:26): [True: 31.1k, False: 57.1k]
  ------------------
 2666|  88.2k|                         (obj.isDictionaryOfType("/Sig") && obj.hasKey("/ByteRange") &&
  ------------------
  |  Branch (2666:27): [True: 0, False: 57.1k]
  |  Branch (2666:61): [True: 0, False: 0]
  ------------------
 2667|  57.1k|                          obj.hasKey("/Contents")))) {
  ------------------
  |  Branch (2667:27): [True: 0, False: 0]
  ------------------
 2668|  57.1k|                if constexpr (std::is_same_v<T, QPDFObjGen>) {
  ------------------
  |  Branch (2668:31): [Folded - Ignored]
  ------------------
 2669|  57.1k|                    result.push_back(og);
 2670|  57.1k|                } else if constexpr (std::is_same_v<T, bool>) {
 2671|  57.1k|                    result[id + 1U] = true;
 2672|  57.1k|                }
 2673|  57.1k|            }
 2674|  88.2k|        }
 2675|   887k|        if (obj.isStream()) {
  ------------------
  |  Branch (2675:13): [True: 31.1k, False: 856k]
  ------------------
 2676|  31.1k|            QPDFObjectHandle dict = obj.getDict();
 2677|  31.1k|            std::set<std::string> keys = dict.getKeys();
 2678|   151k|            for (auto iter = keys.rbegin(); iter != keys.rend(); ++iter) {
  ------------------
  |  Branch (2678:45): [True: 120k, False: 31.1k]
  ------------------
 2679|   120k|                std::string const& key = *iter;
 2680|   120k|                QPDFObjectHandle value = dict.getKey(key);
 2681|   120k|                if (key == "/Length") {
  ------------------
  |  Branch (2681:21): [True: 30.1k, False: 90.5k]
  ------------------
 2682|       |                    // omit stream lengths
 2683|  30.1k|                    if (value.isIndirect()) {
  ------------------
  |  Branch (2683:25): [True: 24.5k, False: 5.65k]
  ------------------
 2684|  24.5k|                        QTC::TC("qpdf", "QPDF exclude indirect length");
 2685|  24.5k|                    }
 2686|  90.5k|                } else {
 2687|  90.5k|                    queue.push_back(value);
 2688|  90.5k|                }
 2689|   120k|            }
 2690|   856k|        } else if (obj.isDictionary()) {
  ------------------
  |  Branch (2690:20): [True: 111k, False: 745k]
  ------------------
 2691|   111k|            std::set<std::string> keys = obj.getKeys();
 2692|   491k|            for (auto iter = keys.rbegin(); iter != keys.rend(); ++iter) {
  ------------------
  |  Branch (2692:45): [True: 379k, False: 111k]
  ------------------
 2693|   379k|                queue.push_back(obj.getKey(*iter));
 2694|   379k|            }
 2695|   745k|        } else if (obj.isArray()) {
  ------------------
  |  Branch (2695:20): [True: 71.6k, False: 673k]
  ------------------
 2696|  71.6k|            int n = obj.getArrayNItems();
 2697|   592k|            for (int i = 1; i <= n; ++i) {
  ------------------
  |  Branch (2697:29): [True: 520k, False: 71.6k]
  ------------------
 2698|   520k|                queue.push_back(obj.getArrayItem(n - i));
 2699|   520k|            }
 2700|  71.6k|        }
 2701|   887k|    }
 2702|       |
 2703|  2.00k|    return result;
 2704|  2.00k|}

_ZN18QPDFCryptoProvider7getImplEv:
   19|  94.6k|{
   20|  94.6k|    QPDFCryptoProvider& p = getInstance();
   21|  94.6k|    if (p.m->default_provider.empty()) {
  ------------------
  |  Branch (21:9): [True: 0, False: 94.6k]
  ------------------
   22|      0|        throw std::logic_error("QPDFCryptoProvider::getImpl called with no default provider.");
   23|      0|    }
   24|  94.6k|    return p.getImpl_internal(p.m->default_provider);
   25|  94.6k|}
_ZN18QPDFCryptoProviderC2Ev:
   48|      1|{
   49|      1|#ifdef USE_CRYPTO_NATIVE
   50|      1|    registerImpl_internal<QPDFCrypto_native>("native");
   51|      1|#endif
   52|       |#ifdef USE_CRYPTO_GNUTLS
   53|       |    registerImpl_internal<QPDFCrypto_gnutls>("gnutls");
   54|       |#endif
   55|       |#ifdef USE_CRYPTO_OPENSSL
   56|       |    registerImpl_internal<QPDFCrypto_openssl>("openssl");
   57|       |#endif
   58|      1|    std::string default_crypto;
   59|      1|    if (!QUtil::get_env("QPDF_CRYPTO_PROVIDER", &default_crypto)) {
  ------------------
  |  Branch (59:9): [True: 1, False: 0]
  ------------------
   60|      1|        default_crypto = DEFAULT_CRYPTO;
  ------------------
  |  |    3|      1|#define DEFAULT_CRYPTO "native"
  ------------------
   61|      1|    }
   62|      1|    setDefaultProvider_internal(default_crypto);
   63|      1|}
_ZN18QPDFCryptoProvider11getInstanceEv:
   67|  94.6k|{
   68|  94.6k|    static QPDFCryptoProvider instance;
   69|  94.6k|    return instance;
   70|  94.6k|}
_ZNK18QPDFCryptoProvider16getImpl_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   74|  94.6k|{
   75|  94.6k|    auto iter = m->providers.find(name);
   76|  94.6k|    if (iter == m->providers.end()) {
  ------------------
  |  Branch (76:9): [True: 0, False: 94.6k]
  ------------------
   77|      0|        throw std::logic_error(
   78|      0|            "QPDFCryptoProvider requested unknown implementation \"" + name + "\"");
   79|      0|    }
   80|  94.6k|    return m->providers[name]();
   81|  94.6k|}
_ZN18QPDFCryptoProvider27setDefaultProvider_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   92|      1|{
   93|      1|    if (!m->providers.count(name)) {
  ------------------
  |  Branch (93:9): [True: 0, False: 1]
  ------------------
   94|      0|        throw std::logic_error(
   95|      0|            "QPDFCryptoProvider: request to set default provider to unknown implementation \"" +
   96|      0|            name + "\"");
   97|      0|    }
   98|      1|    m->default_provider = name;
   99|      1|}
_ZN18QPDFCryptoProvider21registerImpl_internalI17QPDFCrypto_nativeEEvRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
   86|      1|{
   87|      1|    m->providers[name] = std::make_shared<T>;
   88|      1|}

_ZN17QPDFCrypto_native8MD5_initEv:
   42|  96.0k|{
   43|  96.0k|    this->md5 = std::make_shared<MD5_native>();
   44|  96.0k|}
_ZN17QPDFCrypto_native10MD5_updateEPKhm:
   48|  2.32M|{
   49|  2.32M|    this->md5->update(const_cast<unsigned char*>(data), len);
   50|  2.32M|}
_ZN17QPDFCrypto_native12MD5_finalizeEv:
   54|  95.3k|{
   55|  95.3k|    this->md5->finalize();
   56|  95.3k|}
_ZN17QPDFCrypto_native10MD5_digestEPh:
   60|  92.4k|{
   61|  92.4k|    this->md5->digest(d);
   62|  92.4k|}

_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_:
   15|   243k|{
   16|   243k|}
_ZN7QPDFExc10createWhatERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_xS8_:
   24|   243k|{
   25|   243k|    std::string result;
   26|   243k|    if (!filename.empty()) {
  ------------------
  |  Branch (26:9): [True: 229k, False: 14.0k]
  ------------------
   27|   229k|        result += filename;
   28|   229k|    }
   29|   243k|    if (!(object.empty() && offset == 0)) {
  ------------------
  |  Branch (29:11): [True: 19.5k, False: 223k]
  |  Branch (29:29): [True: 10.7k, False: 8.72k]
  ------------------
   30|   232k|        if (!filename.empty()) {
  ------------------
  |  Branch (30:13): [True: 218k, False: 13.6k]
  ------------------
   31|   218k|            result += " (";
   32|   218k|        }
   33|   232k|        if (!object.empty()) {
  ------------------
  |  Branch (33:13): [True: 223k, False: 8.72k]
  ------------------
   34|   223k|            result += object;
   35|   223k|            if (offset > 0) {
  ------------------
  |  Branch (35:17): [True: 209k, False: 14.0k]
  ------------------
   36|   209k|                result += ", ";
   37|   209k|            }
   38|   223k|        }
   39|   232k|        if (offset > 0) {
  ------------------
  |  Branch (39:13): [True: 218k, False: 14.0k]
  ------------------
   40|   218k|            result += "offset " + std::to_string(offset);
   41|   218k|        }
   42|   232k|        if (!filename.empty()) {
  ------------------
  |  Branch (42:13): [True: 218k, False: 13.6k]
  ------------------
   43|   218k|            result += ")";
   44|   218k|        }
   45|   232k|    }
   46|   243k|    if (!result.empty()) {
  ------------------
  |  Branch (46:9): [True: 242k, False: 401]
  ------------------
   47|   242k|        result += ": ";
   48|   242k|    }
   49|   243k|    result += message;
   50|   243k|    return result;
   51|   243k|}

_ZN10QPDFLogger7MembersC2Ev:
   52|      1|{
   53|      1|}
_ZN10QPDFLogger7MembersD2Ev:
   56|      1|{
   57|      1|    p_stdout->finish();
   58|      1|    p_stderr->finish();
   59|      1|}
_ZN10QPDFLoggerC2Ev:
   63|      1|{
   64|      1|}
_ZN10QPDFLogger6createEv:
   68|      1|{
   69|      1|    return std::shared_ptr<QPDFLogger>(new QPDFLogger);
   70|      1|}
_ZN10QPDFLogger13defaultLoggerEv:
   74|  11.7k|{
   75|  11.7k|    static auto l = create();
   76|  11.7k|    return l;
   77|  11.7k|}
_ZN10QPDFLogger7getWarnEb:
  111|   237k|{
  112|   237k|    if (m->p_warn) {
  ------------------
  |  Branch (112:9): [True: 0, False: 237k]
  ------------------
  113|      0|        return m->p_warn;
  114|      0|    }
  115|   237k|    return getError(null_okay);
  116|   237k|}
_ZN10QPDFLogger8getErrorEb:
  132|   245k|{
  133|   245k|    return throwIfNull(m->p_error, null_okay);
  134|   245k|}
_ZN10QPDFLogger11throwIfNullENSt3__110shared_ptrI8PipelineEEb:
  250|   245k|{
  251|   245k|    if (!(null_okay || p)) {
  ------------------
  |  Branch (251:11): [True: 0, False: 245k]
  |  Branch (251:24): [True: 245k, False: 0]
  ------------------
  252|      0|        throw std::logic_error("QPDFLogger: requested a null pipeline without null_okay == true");
  253|      0|    }
  254|   245k|    return p;
  255|   245k|}
QPDFLogger.cc:_ZN12_GLOBAL__N_18Pl_TrackC2EPKcP8Pipeline:
   16|      1|        {
   17|      1|        }
QPDFLogger.cc:_ZN12_GLOBAL__N_18Pl_Track6finishEv:
   28|      1|        {
   29|      1|            getNext()->finish();
   30|      1|        }

_ZNK10QPDFObjGen7unparseEc:
   20|   344k|{
   21|   344k|    return std::to_string(obj) + separator + std::to_string(gen);
   22|   344k|}
_ZN10QPDFObjGen3set3addERK16QPDFObjectHandle:
   26|  23.8k|{
   27|  23.8k|    if (auto* ptr = oh.getObjectPtr()) {
  ------------------
  |  Branch (27:15): [True: 23.8k, False: 0]
  ------------------
   28|  23.8k|        return add(ptr->getObjGen());
   29|  23.8k|    } else {
   30|      0|        throw std::logic_error(
   31|      0|            "attempt to retrieve QPDFObjGen from uninitialized QPDFObjectHandle");
   32|      0|        return false;
   33|      0|    }
   34|  23.8k|}

_ZN10QPDFObject7destroyEv:
    8|   168k|{
    9|   168k|    value = QPDF_Destroyed::getInstance();
   10|   168k|}

_ZN16QPDFObjectHandle10disconnectEv:
  239|   737k|{
  240|       |    // Recursively remove association with any QPDF object. This method may only be called during
  241|       |    // final destruction. QPDF::~QPDF() calls it for indirect objects using the object pointer
  242|       |    // itself, so we don't do that here. Other objects call it through this method.
  243|   737k|    if (obj && !isIndirect()) {
  ------------------
  |  Branch (243:9): [True: 737k, False: 0]
  |  Branch (243:16): [True: 571k, False: 165k]
  ------------------
  244|   571k|        this->obj->disconnect();
  245|   571k|    }
  246|   737k|}
_ZN16QPDFObjectHandle11getTypeCodeEv:
  255|  2.11M|{
  256|  2.11M|    return obj ? obj->getResolvedTypeCode() : ::ot_uninitialized;
  ------------------
  |  Branch (256:12): [True: 2.11M, False: 0]
  ------------------
  257|  2.11M|}
_ZN16QPDFObjectHandle11getTypeNameEv:
  266|  1.21k|{
  267|  1.21k|    static constexpr std::array<char const*, 15> tn{
  268|  1.21k|        "uninitialized",
  269|  1.21k|        "reserved",
  270|  1.21k|        "null",
  271|  1.21k|        "boolean",
  272|  1.21k|        "integer",
  273|  1.21k|        "real",
  274|  1.21k|        "string",
  275|  1.21k|        "name",
  276|  1.21k|        "array",
  277|  1.21k|        "dictionary",
  278|  1.21k|        "stream",
  279|  1.21k|        "operator",
  280|  1.21k|        "inline-image",
  281|  1.21k|        "unresolved",
  282|  1.21k|        "destroyed"};
  283|  1.21k|    return obj ? tn[getTypeCode()] : "uninitialized";
  ------------------
  |  Branch (283:12): [True: 1.21k, False: 0]
  ------------------
  284|  1.21k|}
_ZNK16QPDFObjectHandle7asArrayEv:
  288|  1.81M|{
  289|  1.81M|    return obj ? obj->as<QPDF_Array>() : nullptr;
  ------------------
  |  Branch (289:12): [True: 1.81M, False: 0]
  ------------------
  290|  1.81M|}
_ZNK16QPDFObjectHandle12asDictionaryEv:
  300|  2.91M|{
  301|  2.91M|    return obj ? obj->as<QPDF_Dictionary>() : nullptr;
  ------------------
  |  Branch (301:12): [True: 2.91M, False: 0]
  ------------------
  302|  2.91M|}
_ZNK16QPDFObjectHandle9asIntegerEv:
  312|  53.7k|{
  313|  53.7k|    return obj ? obj->as<QPDF_Integer>() : nullptr;
  ------------------
  |  Branch (313:12): [True: 53.7k, False: 0]
  ------------------
  314|  53.7k|}
_ZNK16QPDFObjectHandle8asStreamEv:
  348|   534k|{
  349|   534k|    return obj ? obj->as<QPDF_Stream>() : nullptr;
  ------------------
  |  Branch (349:12): [True: 534k, False: 0]
  ------------------
  350|   534k|}
_ZNK16QPDFObjectHandle18asStreamWithAssertEv:
  354|   534k|{
  355|   534k|    auto stream = asStream();
  356|   534k|    assertType("stream", stream);
  357|   534k|    return stream;
  358|   534k|}
_ZN16QPDFObjectHandle6isBoolEv:
  384|    447|{
  385|    447|    return obj && obj->getResolvedTypeCode() == ::ot_boolean;
  ------------------
  |  Branch (385:12): [True: 447, False: 0]
  |  Branch (385:19): [True: 0, False: 447]
  ------------------
  386|    447|}
_ZN16QPDFObjectHandle6isNullEv:
  403|  2.51M|{
  404|  2.51M|    return obj && obj->getResolvedTypeCode() == ::ot_null;
  ------------------
  |  Branch (404:12): [True: 2.51M, False: 0]
  |  Branch (404:19): [True: 190k, False: 2.32M]
  ------------------
  405|  2.51M|}
_ZN16QPDFObjectHandle9isIntegerEv:
  414|   127k|{
  415|   127k|    return obj && obj->getResolvedTypeCode() == ::ot_integer;
  ------------------
  |  Branch (415:12): [True: 127k, False: 0]
  |  Branch (415:19): [True: 122k, False: 4.59k]
  ------------------
  416|   127k|}
_ZN16QPDFObjectHandle6isRealEv:
  425|  2.12k|{
  426|  2.12k|    return obj && obj->getResolvedTypeCode() == ::ot_real;
  ------------------
  |  Branch (426:12): [True: 2.12k, False: 0]
  |  Branch (426:19): [True: 1.41k, False: 704]
  ------------------
  427|  2.12k|}
_ZN16QPDFObjectHandle8isNumberEv:
  436|  74.4k|{
  437|  74.4k|    return (isInteger() || isReal());
  ------------------
  |  Branch (437:13): [True: 72.7k, False: 1.69k]
  |  Branch (437:28): [True: 1.41k, False: 274]
  ------------------
  438|  74.4k|}
_ZN16QPDFObjectHandle6isNameEv:
  481|  1.05M|{
  482|  1.05M|    return obj && obj->getResolvedTypeCode() == ::ot_name;
  ------------------
  |  Branch (482:12): [True: 1.05M, False: 0]
  |  Branch (482:19): [True: 781k, False: 270k]
  ------------------
  483|  1.05M|}
_ZN16QPDFObjectHandle8isStringEv:
  492|  7.90k|{
  493|  7.90k|    return obj && obj->getResolvedTypeCode() == ::ot_string;
  ------------------
  |  Branch (493:12): [True: 7.90k, False: 0]
  |  Branch (493:19): [True: 6.92k, False: 981]
  ------------------
  494|  7.90k|}
_ZN16QPDFObjectHandle7isArrayEv:
  525|  2.20M|{
  526|  2.20M|    return obj && obj->getResolvedTypeCode() == ::ot_array;
  ------------------
  |  Branch (526:12): [True: 2.20M, False: 0]
  |  Branch (526:19): [True: 195k, False: 2.00M]
  ------------------
  527|  2.20M|}
_ZN16QPDFObjectHandle12isDictionaryEv:
  536|  3.88M|{
  537|  3.88M|    return obj && obj->getResolvedTypeCode() == ::ot_dictionary;
  ------------------
  |  Branch (537:12): [True: 3.88M, False: 0]
  |  Branch (537:19): [True: 924k, False: 2.96M]
  ------------------
  538|  3.88M|}
_ZN16QPDFObjectHandle8isStreamEv:
  547|  2.34M|{
  548|  2.34M|    return obj && obj->getResolvedTypeCode() == ::ot_stream;
  ------------------
  |  Branch (548:12): [True: 2.34M, False: 1.35k]
  |  Branch (548:19): [True: 175k, False: 2.16M]
  ------------------
  549|  2.34M|}
_ZN16QPDFObjectHandle8isScalarEv:
  569|    447|{
  570|    447|    return isBool() || isInteger() || isName() || isNull() || isReal() || isString();
  ------------------
  |  Branch (570:12): [True: 0, False: 447]
  |  Branch (570:24): [True: 15, False: 432]
  |  Branch (570:39): [True: 2, False: 430]
  |  Branch (570:51): [True: 0, False: 430]
  |  Branch (570:63): [True: 0, False: 430]
  |  Branch (570:75): [True: 28, False: 402]
  ------------------
  571|    447|}
_ZN16QPDFObjectHandle15isNameAndEqualsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  580|   501k|{
  581|   501k|    return isName() && (getName() == name);
  ------------------
  |  Branch (581:12): [True: 293k, False: 208k]
  |  Branch (581:24): [True: 104k, False: 188k]
  ------------------
  582|   501k|}
_ZN16QPDFObjectHandle18isDictionaryOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  591|  1.60M|{
  592|  1.60M|    return isDictionary() && (type.empty() || getKey("/Type").isNameAndEquals(type)) &&
  ------------------
  |  Branch (592:12): [True: 467k, False: 1.13M]
  |  Branch (592:31): [True: 0, False: 467k]
  |  Branch (592:47): [True: 104k, False: 363k]
  ------------------
  593|  1.60M|        (subtype.empty() || getKey("/Subtype").isNameAndEquals(subtype));
  ------------------
  |  Branch (593:10): [True: 104k, False: 0]
  |  Branch (593:29): [True: 0, False: 0]
  ------------------
  594|  1.60M|}
_ZN16QPDFObjectHandle14isStreamOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  603|  19.3k|{
  604|  19.3k|    return isStream() && getDict().isDictionaryOfType(type, subtype);
  ------------------
  |  Branch (604:12): [True: 6.65k, False: 12.7k]
  |  Branch (604:26): [True: 1.16k, False: 5.48k]
  ------------------
  605|  19.3k|}
_ZN16QPDFObjectHandle11getIntValueEv:
  652|  53.1k|{
  653|  53.1k|    auto integer = asInteger();
  654|  53.1k|    if (integer) {
  ------------------
  |  Branch (654:9): [True: 53.1k, False: 19]
  ------------------
  655|  53.1k|        return integer->getVal();
  656|  53.1k|    } else {
  657|     19|        typeWarning("integer", "returning 0");
  658|     19|        QTC::TC("qpdf", "QPDFObjectHandle integer returning 0");
  659|     19|        return 0;
  660|     19|    }
  661|  53.1k|}
_ZN16QPDFObjectHandle13getValueAsIntERx:
  670|    583|{
  671|    583|    auto integer = asInteger();
  672|    583|    if (integer == nullptr) {
  ------------------
  |  Branch (672:9): [True: 13, False: 570]
  ------------------
  673|     13|        return false;
  674|     13|    }
  675|    570|    value = integer->getVal();
  676|    570|    return true;
  677|    583|}
_ZN16QPDFObjectHandle16getIntValueAsIntEv:
  686|  5.05k|{
  687|  5.05k|    int result = 0;
  688|  5.05k|    long long v = getIntValue();
  689|  5.05k|    if (v < INT_MIN) {
  ------------------
  |  Branch (689:9): [True: 2, False: 5.04k]
  ------------------
  690|      2|        QTC::TC("qpdf", "QPDFObjectHandle int returning INT_MIN");
  691|      2|        warnIfPossible("requested value of integer is too small; returning INT_MIN");
  692|      2|        result = INT_MIN;
  693|  5.04k|    } else if (v > INT_MAX) {
  ------------------
  |  Branch (693:16): [True: 5, False: 5.04k]
  ------------------
  694|      5|        QTC::TC("qpdf", "QPDFObjectHandle int returning INT_MAX");
  695|      5|        warnIfPossible("requested value of integer is too big; returning INT_MAX");
  696|      5|        result = INT_MAX;
  697|  5.04k|    } else {
  698|  5.04k|        result = static_cast<int>(v);
  699|  5.04k|    }
  700|  5.05k|    return result;
  701|  5.05k|}
_ZN16QPDFObjectHandle12getUIntValueEv:
  725|  47.4k|{
  726|  47.4k|    long long v = getIntValue();
  727|  47.4k|    if (v < 0) {
  ------------------
  |  Branch (727:9): [True: 6, False: 47.4k]
  ------------------
  728|      6|        QTC::TC("qpdf", "QPDFObjectHandle uint returning 0");
  729|      6|        warnIfPossible("unsigned value request for negative number; returning 0");
  730|      6|        return 0;
  731|  47.4k|    } else {
  732|  47.4k|        return static_cast<unsigned long long>(v);
  733|  47.4k|    }
  734|  47.4k|}
_ZN16QPDFObjectHandle7getNameEv:
  831|   391k|{
  832|   391k|    if (isName()) {
  ------------------
  |  Branch (832:9): [True: 391k, False: 0]
  ------------------
  833|   391k|        return obj->getStringValue();
  834|   391k|    } else {
  835|      0|        typeWarning("name", "returning dummy name");
  836|      0|        QTC::TC("qpdf", "QPDFObjectHandle name returning dummy name");
  837|      0|        return "/QPDFFakeName";
  838|      0|    }
  839|   391k|}
_ZN16QPDFObjectHandle14getStringValueEv:
  865|  5.70k|{
  866|  5.70k|    if (isString()) {
  ------------------
  |  Branch (866:9): [True: 5.32k, False: 383]
  ------------------
  867|  5.32k|        return obj->getStringValue();
  868|  5.32k|    } else {
  869|    383|        typeWarning("string", "returning empty string");
  870|    383|        QTC::TC("qpdf", "QPDFObjectHandle string returning empty string");
  871|    383|        return "";
  872|    383|    }
  873|  5.70k|}
_ZN16QPDFObjectHandle6aitemsEv:
  994|  2.28k|{
  995|  2.28k|    return *this;
  996|  2.28k|}
_ZN16QPDFObjectHandle14getArrayNItemsEv:
 1005|   270k|{
 1006|   270k|    if (auto array = asArray()) {
  ------------------
  |  Branch (1006:14): [True: 270k, False: 15]
  ------------------
 1007|   270k|        return array->size();
 1008|   270k|    } else {
 1009|     15|        typeWarning("array", "treating as empty");
 1010|     15|        QTC::TC("qpdf", "QPDFObjectHandle array treating as empty");
 1011|     15|        return 0;
 1012|     15|    }
 1013|   270k|}
_ZN16QPDFObjectHandle12getArrayItemEi:
 1022|  1.39M|{
 1023|  1.39M|    if (auto array = asArray()) {
  ------------------
  |  Branch (1023:14): [True: 1.39M, False: 24]
  ------------------
 1024|  1.39M|        if (auto result = array->at(n); result.obj != nullptr) {
  ------------------
  |  Branch (1024:41): [True: 1.39M, False: 0]
  ------------------
 1025|  1.39M|            return result;
 1026|  1.39M|        } else {
 1027|      0|            objectWarning("returning null for out of bounds array access");
 1028|      0|            QTC::TC("qpdf", "QPDFObjectHandle array bounds");
 1029|      0|        }
 1030|  1.39M|    } else {
 1031|     24|        typeWarning("array", "returning null");
 1032|     24|        QTC::TC("qpdf", "QPDFObjectHandle array null for non-array");
 1033|     24|    }
 1034|     24|    static auto constexpr msg = " -> null returned from invalid array access"sv;
 1035|     24|    return QPDF_Null::create(obj, msg, "");
 1036|  1.39M|}
_ZN16QPDFObjectHandle11isRectangleEv:
 1045|  22.7k|{
 1046|  22.7k|    if (auto array = asArray()) {
  ------------------
  |  Branch (1046:14): [True: 18.7k, False: 4.02k]
  ------------------
 1047|  92.8k|        for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1047:25): [True: 74.4k, False: 18.4k]
  ------------------
 1048|  74.4k|            if (auto item = array->at(i); !(item.obj && item.isNumber())) {
  ------------------
  |  Branch (1048:45): [True: 74.4k, False: 8]
  |  Branch (1048:57): [True: 74.1k, False: 274]
  ------------------
 1049|    282|                return false;
 1050|    282|            }
 1051|  74.4k|        }
 1052|  18.4k|        return array->size() == 4;
 1053|  18.7k|    }
 1054|  4.02k|    return false;
 1055|  22.7k|}
_ZN16QPDFObjectHandle16getArrayAsVectorEv:
 1133|   134k|{
 1134|   134k|    auto array = asArray();
 1135|   134k|    if (array) {
  ------------------
  |  Branch (1135:9): [True: 134k, False: 0]
  ------------------
 1136|   134k|        return array->getAsVector();
 1137|   134k|    } else {
 1138|      0|        typeWarning("array", "treating as empty");
 1139|      0|        QTC::TC("qpdf", "QPDFObjectHandle array treating as empty vector");
 1140|      0|    }
 1141|      0|    return {};
 1142|   134k|}
_ZN16QPDFObjectHandle12setArrayItemEiRKS_:
 1148|    580|{
 1149|    580|    if (auto array = asArray()) {
  ------------------
  |  Branch (1149:14): [True: 580, False: 0]
  ------------------
 1150|    580|        if (!array->setAt(n, item)) {
  ------------------
  |  Branch (1150:13): [True: 0, False: 580]
  ------------------
 1151|      0|            objectWarning("ignoring attempt to set out of bounds array item");
 1152|      0|            QTC::TC("qpdf", "QPDFObjectHandle set array bounds");
 1153|      0|        }
 1154|    580|    } else {
 1155|      0|        typeWarning("array", "ignoring attempt to set item");
 1156|      0|        QTC::TC("qpdf", "QPDFObjectHandle array ignoring set item");
 1157|      0|    }
 1158|    580|}
_ZN16QPDFObjectHandle9eraseItemEi:
 1211|      2|{
 1212|      2|    if (auto array = asArray()) {
  ------------------
  |  Branch (1212:14): [True: 1, False: 1]
  ------------------
 1213|      1|        if (!array->erase(at)) {
  ------------------
  |  Branch (1213:13): [True: 0, False: 1]
  ------------------
 1214|      0|            objectWarning("ignoring attempt to erase out of bounds array item");
 1215|      0|            QTC::TC("qpdf", "QPDFObjectHandle erase array bounds");
 1216|      0|        }
 1217|      1|    } else {
 1218|      1|        typeWarning("array", "ignoring attempt to erase item");
 1219|      1|        QTC::TC("qpdf", "QPDFObjectHandle array ignoring erase item");
 1220|      1|    }
 1221|      2|}
_ZN16QPDFObjectHandle6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1247|  42.8k|{
 1248|  42.8k|    auto dict = asDictionary();
 1249|  42.8k|    if (dict) {
  ------------------
  |  Branch (1249:9): [True: 42.4k, False: 422]
  ------------------
 1250|  42.4k|        return dict->hasKey(key);
 1251|  42.4k|    } else {
 1252|    422|        typeWarning("dictionary", "returning false for a key containment request");
 1253|    422|        QTC::TC("qpdf", "QPDFObjectHandle dictionary false for hasKey");
 1254|    422|        return false;
 1255|    422|    }
 1256|  42.8k|}
_ZN16QPDFObjectHandle6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1265|  2.05M|{
 1266|  2.05M|    if (auto dict = asDictionary()) {
  ------------------
  |  Branch (1266:14): [True: 2.05M, False: 0]
  ------------------
 1267|  2.05M|        return dict->getKey(key);
 1268|  2.05M|    } else {
 1269|      0|        typeWarning("dictionary", "returning null for attempted key retrieval");
 1270|      0|        QTC::TC("qpdf", "QPDFObjectHandle dictionary null for getKey");
 1271|      0|        static auto constexpr msg = " -> null returned from getting key $VD from non-Dictionary"sv;
 1272|      0|        return QPDF_Null::create(obj, msg, "");
 1273|      0|    }
 1274|  2.05M|}
_ZN16QPDFObjectHandle7getKeysEv:
 1294|   346k|{
 1295|   346k|    std::set<std::string> result;
 1296|   346k|    auto dict = asDictionary();
 1297|   346k|    if (dict) {
  ------------------
  |  Branch (1297:9): [True: 346k, False: 17]
  ------------------
 1298|   346k|        result = dict->getKeys();
 1299|   346k|    } else {
 1300|     17|        typeWarning("dictionary", "treating as empty");
 1301|     17|        QTC::TC("qpdf", "QPDFObjectHandle dictionary empty set for getKeys");
 1302|     17|    }
 1303|   346k|    return result;
 1304|   346k|}
_ZN16QPDFObjectHandle12getDictAsMapEv:
 1313|   294k|{
 1314|   294k|    std::map<std::string, QPDFObjectHandle> result;
 1315|   294k|    auto dict = asDictionary();
 1316|   294k|    if (dict) {
  ------------------
  |  Branch (1316:9): [True: 294k, False: 0]
  ------------------
 1317|   294k|        result = dict->getAsMap();
 1318|   294k|    } else {
 1319|      0|        typeWarning("dictionary", "treating as empty");
 1320|      0|        QTC::TC("qpdf", "QPDFObjectHandle dictionary empty map for asMap");
 1321|      0|    }
 1322|   294k|    return result;
 1323|   294k|}
_ZN16QPDFObjectHandle11isOrHasNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1333|  28.4k|{
 1334|  28.4k|    if (isNameAndEquals(value)) {
  ------------------
  |  Branch (1334:9): [True: 0, False: 28.4k]
  ------------------
 1335|      0|        return true;
 1336|  28.4k|    } else if (isArray()) {
  ------------------
  |  Branch (1336:16): [True: 2.61k, False: 25.8k]
  ------------------
 1337|  5.49k|        for (auto& item: getArrayAsVector()) {
  ------------------
  |  Branch (1337:24): [True: 5.49k, False: 2.61k]
  ------------------
 1338|  5.49k|            if (item.isNameAndEquals(value)) {
  ------------------
  |  Branch (1338:17): [True: 1, False: 5.48k]
  ------------------
 1339|      1|                return true;
 1340|      1|            }
 1341|  5.49k|        }
 1342|  2.61k|    }
 1343|  28.4k|    return false;
 1344|  28.4k|}
_ZN16QPDFObjectHandle10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
 1517|  23.6k|{
 1518|  23.6k|    auto dict = asDictionary();
 1519|  23.6k|    if (dict) {
  ------------------
  |  Branch (1519:9): [True: 23.3k, False: 331]
  ------------------
 1520|  23.3k|        checkOwnership(value);
 1521|  23.3k|        dict->replaceKey(key, value);
 1522|  23.3k|    } else {
 1523|    331|        typeWarning("dictionary", "ignoring key replacement request");
 1524|    331|        QTC::TC("qpdf", "QPDFObjectHandle dictionary ignoring replaceKey");
 1525|    331|    }
 1526|  23.6k|}
_ZN16QPDFObjectHandle9removeKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1545|   154k|{
 1546|   154k|    auto dict = asDictionary();
 1547|   154k|    if (dict) {
  ------------------
  |  Branch (1547:9): [True: 154k, False: 0]
  ------------------
 1548|   154k|        dict->removeKey(key);
 1549|   154k|    } else {
 1550|      0|        typeWarning("dictionary", "ignoring key removal request");
 1551|      0|        QTC::TC("qpdf", "QPDFObjectHandle dictionary ignoring removeKey");
 1552|      0|    }
 1553|   154k|}
_ZN16QPDFObjectHandle7getDictEv:
 1581|   214k|{
 1582|   214k|    return asStreamWithAssert()->getDict();
 1583|   214k|}
_ZN16QPDFObjectHandle16setFilterOnWriteEb:
 1587|  2.63k|{
 1588|  2.63k|    asStreamWithAssert()->setFilterOnWrite(val);
 1589|  2.63k|}
_ZN16QPDFObjectHandle16getFilterOnWriteEv:
 1593|  79.2k|{
 1594|  79.2k|    return asStreamWithAssert()->getFilterOnWrite();
 1595|  79.2k|}
_ZN16QPDFObjectHandle14isDataModifiedEv:
 1599|   154k|{
 1600|   154k|    return asStreamWithAssert()->isDataModified();
 1601|   154k|}
_ZN16QPDFObjectHandle13getStreamDataE26qpdf_stream_decode_level_e:
 1611|  1.42k|{
 1612|  1.42k|    return asStreamWithAssert()->getStreamData(level);
 1613|  1.42k|}
_ZN16QPDFObjectHandle14pipeStreamDataEP8Pipelinei26qpdf_stream_decode_level_ebb:
 1641|  81.9k|{
 1642|  81.9k|    bool filtering_attempted;
 1643|  81.9k|    asStreamWithAssert()->pipeStreamData(
 1644|  81.9k|        p, &filtering_attempted, encode_flags, decode_level, suppress_warnings, will_retry);
 1645|  81.9k|    return filtering_attempted;
 1646|  81.9k|}
_ZN16QPDFObjectHandle7unparseEv:
 1902|     48|{
 1903|     48|    if (this->isIndirect()) {
  ------------------
  |  Branch (1903:9): [True: 48, False: 0]
  ------------------
 1904|     48|        return getObjGen().unparse(' ') + " R";
 1905|     48|    } else {
 1906|      0|        return unparseResolved();
 1907|      0|    }
 1908|     48|}
_ZN16QPDFObjectHandle15unparseResolvedEv:
 1917|  1.64M|{
 1918|  1.64M|    if (!obj) {
  ------------------
  |  Branch (1918:9): [True: 0, False: 1.64M]
  ------------------
 1919|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1920|      0|    }
 1921|  1.64M|    return obj->unparse();
 1922|  1.64M|}
_ZN16QPDFObjectHandle5parseERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
 2027|  2.43k|{
 2028|  2.43k|    return parse(nullptr, object_str, object_description);
 2029|  2.43k|}
_ZN16QPDFObjectHandle5parseEP4QPDFRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
 2034|  2.43k|{
 2035|  2.43k|    auto input = std::shared_ptr<InputSource>(new BufferInputSource("parsed object", object_str));
 2036|  2.43k|    QPDFTokenizer tokenizer;
 2037|  2.43k|    bool empty = false;
 2038|  2.43k|    QPDFObjectHandle result = parse(input, object_description, tokenizer, empty, nullptr, context);
 2039|  2.43k|    size_t offset = QIntC::to_size(input->tell());
 2040|  2.43k|    while (offset < object_str.length()) {
  ------------------
  |  Branch (2040:12): [True: 0, False: 2.43k]
  ------------------
 2041|      0|        if (!isspace(object_str.at(offset))) {
  ------------------
  |  Branch (2041:13): [True: 0, False: 0]
  ------------------
 2042|      0|            QTC::TC("qpdf", "QPDFObjectHandle trailing data in parse");
 2043|      0|            throw QPDFExc(
 2044|      0|                qpdf_e_damaged_pdf,
 2045|      0|                input->getName(),
 2046|      0|                object_description,
 2047|      0|                input->getLastOffset(),
 2048|      0|                "trailing data found parsing object from string");
 2049|      0|        }
 2050|      0|        ++offset;
 2051|      0|    }
 2052|  2.43k|    return result;
 2053|  2.43k|}
_ZN16QPDFObjectHandle5parseENSt3__110shared_ptrI11InputSourceEERKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEER13QPDFTokenizerRbPNS_15StringDecrypterEP4QPDF:
 2225|  2.43k|{
 2226|  2.43k|    return QPDFParser(input, object_description, tokenizer, decrypter, context, false)
 2227|  2.43k|        .parse(empty, false);
 2228|  2.43k|}
_ZN16QPDFObjectHandle7newNullEv:
 2249|     90|{
 2250|     90|    return {QPDF_Null::create()};
 2251|     90|}
_ZN16QPDFObjectHandle10newIntegerEx:
 2255|  1.09k|{
 2256|  1.09k|    return {QPDF_Integer::create(value)};
 2257|  1.09k|}
_ZN16QPDFObjectHandle7newRealEdib:
 2267|  8.99k|{
 2268|  8.99k|    return {QPDF_Real::create(value, decimal_places, trim_trailing_zeroes)};
 2269|  8.99k|}
_ZN16QPDFObjectHandle8newArrayERKNSt3__16vectorIS_NS0_9allocatorIS_EEEE:
 2309|  3.37k|{
 2310|  3.37k|    return {QPDF_Array::create(items)};
 2311|  3.37k|}
_ZN16QPDFObjectHandle8newArrayERKNS_9RectangleE:
 2315|  2.24k|{
 2316|  2.24k|    return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)});
 2317|  2.24k|}
_ZN16QPDFObjectHandle20hasObjectDescriptionEv:
 2428|  47.4k|{
 2429|  47.4k|    return obj && obj->hasDescription();
  ------------------
  |  Branch (2429:12): [True: 47.4k, False: 0]
  |  Branch (2429:19): [True: 47.4k, False: 0]
  ------------------
 2430|  47.4k|}
_ZN16QPDFObjectHandle11shallowCopyEv:
 2434|  5.33k|{
 2435|  5.33k|    if (!obj) {
  ------------------
  |  Branch (2435:9): [True: 0, False: 5.33k]
  ------------------
 2436|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2437|      0|    }
 2438|  5.33k|    return {obj->copy()};
 2439|  5.33k|}
_ZN16QPDFObjectHandle17unsafeShallowCopyEv:
 2443|   300k|{
 2444|   300k|    if (!obj) {
  ------------------
  |  Branch (2444:9): [True: 0, False: 300k]
  ------------------
 2445|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2446|      0|    }
 2447|   300k|    return {obj->copy(true)};
 2448|   300k|}
_ZNK16QPDFObjectHandle11typeWarningEPKcRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2530|  1.21k|{
 2531|  1.21k|    QPDF* context = nullptr;
 2532|  1.21k|    std::string description;
 2533|       |    // Type checks above guarantee that the object has been dereferenced. Nevertheless, dereference
 2534|       |    // throws exceptions in the test suite
 2535|  1.21k|    if (!obj) {
  ------------------
  |  Branch (2535:9): [True: 0, False: 1.21k]
  ------------------
 2536|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 2537|      0|    }
 2538|  1.21k|    obj->getDescription(context, description);
 2539|       |    // Null context handled by warn
 2540|  1.21k|    warn(
 2541|  1.21k|        context,
 2542|  1.21k|        QPDFExc(
 2543|  1.21k|            qpdf_e_object,
 2544|  1.21k|            "",
 2545|  1.21k|            description,
 2546|  1.21k|            0,
 2547|  1.21k|            std::string("operation for ") + expected_type + " attempted on object of type " +
 2548|  1.21k|                QPDFObjectHandle(*this).getTypeName() + ": " + warning));
 2549|  1.21k|}
_ZN16QPDFObjectHandle14warnIfPossibleERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2558|  21.2k|{
 2559|  21.2k|    QPDF* context = nullptr;
 2560|  21.2k|    std::string description;
 2561|  21.2k|    if (obj && obj->getDescription(context, description)) {
  ------------------
  |  Branch (2561:9): [True: 21.2k, False: 0]
  |  Branch (2561:16): [True: 12.8k, False: 8.37k]
  ------------------
 2562|  12.8k|        warn(context, QPDFExc(qpdf_e_damaged_pdf, "", description, 0, warning));
 2563|  12.8k|    } else {
 2564|  8.37k|        *QPDFLogger::defaultLogger()->getError() << warning << "\n";
 2565|  8.37k|    }
 2566|  21.2k|}
_ZNK16QPDFObjectHandle10assertTypeEPKcb:
 2581|   534k|{
 2582|   534k|    if (!istype) {
  ------------------
  |  Branch (2582:9): [True: 0, False: 534k]
  ------------------
 2583|      0|        throw std::runtime_error(
 2584|      0|            std::string("operation for ") + type_name + " attempted on object of type " +
 2585|      0|            QPDFObjectHandle(*this).getTypeName());
 2586|      0|    }
 2587|   534k|}
_ZNK16QPDFObjectHandle14checkOwnershipERKS_:
 2817|  23.3k|{
 2818|  23.3k|    auto qpdf = getOwningQPDF();
 2819|  23.3k|    auto item_qpdf = item.getOwningQPDF();
 2820|  23.3k|    if ((qpdf != nullptr) && (item_qpdf != nullptr) && (qpdf != item_qpdf)) {
  ------------------
  |  Branch (2820:9): [True: 23.3k, False: 0]
  |  Branch (2820:30): [True: 16.4k, False: 6.90k]
  |  Branch (2820:56): [True: 0, False: 16.4k]
  ------------------
 2821|      0|        QTC::TC("qpdf", "QPDFObjectHandle check ownership");
 2822|      0|        throw std::logic_error("Attempting to add an object from a different QPDF. Use "
 2823|      0|                               "QPDF::copyForeignObject to add objects from another file.");
 2824|      0|    }
 2825|  23.3k|}
_ZN16QPDFObjectHandle4warnEP4QPDFRK7QPDFExc:
 2842|  14.0k|{
 2843|       |    // If parsing on behalf of a QPDF object and want to give a warning, we can warn through the
 2844|       |    // object. If parsing for some other reason, such as an explicit creation of an object from a
 2845|       |    // string, then just throw the exception.
 2846|  14.0k|    if (qpdf) {
  ------------------
  |  Branch (2846:9): [True: 13.6k, False: 402]
  ------------------
 2847|  13.6k|        qpdf->warn(e);
 2848|  13.6k|    } else {
 2849|    402|        throw e;
 2850|    402|    }
 2851|  14.0k|}
_ZN16QPDFObjectHandle14QPDFArrayItemsC2ERKS_:
 2940|  2.28k|{
 2941|  2.28k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorppEv:
 2945|  34.2k|{
 2946|  34.2k|    if (!m->is_end) {
  ------------------
  |  Branch (2946:9): [True: 34.2k, False: 0]
  ------------------
 2947|  34.2k|        ++m->item_number;
 2948|  34.2k|        updateIValue();
 2949|  34.2k|    }
 2950|  34.2k|    return *this;
 2951|  34.2k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratordeEv:
 2965|  34.2k|{
 2966|  34.2k|    updateIValue();
 2967|  34.2k|    return this->ivalue;
 2968|  34.2k|}
_ZNK16QPDFObjectHandle14QPDFArrayItems8iteratoreqERKS1_:
 2979|  36.5k|{
 2980|  36.5k|    return (m->item_number == other.m->item_number);
 2981|  36.5k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorC2ERS_b:
 2985|  4.56k|{
 2986|  4.56k|    updateIValue();
 2987|  4.56k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iterator12updateIValueEv:
 2991|  73.0k|{
 2992|  73.0k|    m->is_end = (m->item_number >= m->oh.getArrayNItems());
 2993|  73.0k|    if (m->is_end) {
  ------------------
  |  Branch (2993:9): [True: 4.51k, False: 68.5k]
  ------------------
 2994|  4.51k|        this->ivalue = QPDFObjectHandle();
 2995|  68.5k|    } else {
 2996|  68.5k|        this->ivalue = m->oh.getArrayItem(m->item_number);
 2997|  68.5k|    }
 2998|  73.0k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iterator7MembersC2ERS_b:
 3002|  4.56k|{
 3003|  4.56k|    this->item_number = for_begin ? 0 : oh.getArrayNItems();
  ------------------
  |  Branch (3003:25): [True: 2.28k, False: 2.28k]
  ------------------
 3004|  4.56k|}
_ZN16QPDFObjectHandle14QPDFArrayItems5beginEv:
 3008|  2.28k|{
 3009|  2.28k|    return {oh, true};
 3010|  2.28k|}
_ZN16QPDFObjectHandle14QPDFArrayItems3endEv:
 3014|  2.28k|{
 3015|  2.28k|    return {oh, false};
 3016|  2.28k|}
_ZNK16QPDFObjectHandle9getObjGenEv:
 3020|  9.45M|{
 3021|  9.45M|    return isInitialized() ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (3021:12): [True: 9.45M, False: 0]
  ------------------
 3022|  9.45M|}
_ZNK16QPDFObjectHandle13getOwningQPDFEv:
 3027|  95.6k|{
 3028|  95.6k|    return isInitialized() ? this->obj->getQPDF() : nullptr;
  ------------------
  |  Branch (3028:12): [True: 95.6k, False: 0]
  ------------------
 3029|  95.6k|}
_Zli5_qpdfPKcm:
 3054|  2.43k|{
 3055|  2.43k|    return QPDFObjectHandle::parse(std::string(v, len), "QPDFObjectHandle literal");
 3056|  2.43k|}

_ZN10QPDFParser5parseERbb:
   28|   172k|{
   29|       |    // This method must take care not to resolve any objects. Don't check the type of any object
   30|       |    // without first ensuring that it is a direct object. Otherwise, doing so may have the side
   31|       |    // effect of reading the object and changing the file pointer. If you do this, it will cause a
   32|       |    // logic error to be thrown from QPDF::inParse().
   33|       |
   34|   172k|    QPDF::ParseGuard pg(context);
   35|   172k|    empty = false;
   36|   172k|    start = input->tell();
   37|       |
   38|   172k|    if (!tokenizer.nextToken(*input, object_description)) {
  ------------------
  |  Branch (38:9): [True: 1.20k, False: 171k]
  ------------------
   39|  1.20k|        warn(tokenizer.getErrorMessage());
   40|  1.20k|    }
   41|       |
   42|   172k|    switch (tokenizer.getType()) {
   43|  1.25k|    case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (43:5): [True: 1.25k, False: 171k]
  ------------------
   44|  1.25k|        if (content_stream) {
  ------------------
  |  Branch (44:13): [True: 0, False: 1.25k]
  ------------------
   45|       |            // In content stream mode, leave object uninitialized to indicate EOF
   46|      0|            return {};
   47|      0|        }
   48|  1.25k|        QTC::TC("qpdf", "QPDFParser eof in parse");
   49|  1.25k|        warn("unexpected EOF");
   50|  1.25k|        return {QPDF_Null::create()};
   51|       |
   52|  1.20k|    case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (52:5): [True: 1.20k, False: 171k]
  ------------------
   53|  1.20k|        QTC::TC("qpdf", "QPDFParser bad token in parse");
   54|  1.20k|        return {QPDF_Null::create()};
   55|       |
   56|      6|    case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (56:5): [True: 6, False: 172k]
  ------------------
   57|      9|    case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (57:5): [True: 3, False: 172k]
  ------------------
   58|      9|        QTC::TC("qpdf", "QPDFParser bad brace");
   59|      9|        warn("treating unexpected brace token as null");
   60|      9|        return {QPDF_Null::create()};
   61|       |
   62|     92|    case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (62:5): [True: 92, False: 172k]
  ------------------
   63|     92|        QTC::TC("qpdf", "QPDFParser bad array close");
   64|     92|        warn("treating unexpected array close token as null");
   65|     92|        return {QPDF_Null::create()};
   66|       |
   67|    232|    case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (67:5): [True: 232, False: 172k]
  ------------------
   68|    232|        QTC::TC("qpdf", "QPDFParser bad dictionary close");
   69|    232|        warn("unexpected dictionary close token");
   70|    232|        return {QPDF_Null::create()};
   71|       |
   72|  2.19k|    case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (72:5): [True: 2.19k, False: 170k]
  ------------------
   73|   122k|    case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (73:5): [True: 120k, False: 52.1k]
  ------------------
   74|   122k|        stack.clear();
   75|   122k|        stack.emplace_back(
   76|   122k|            input,
   77|   122k|            (tokenizer.getType() == QPDFTokenizer::tt_array_open) ? st_array : st_dictionary_key);
  ------------------
  |  Branch (77:13): [True: 2.19k, False: 120k]
  ------------------
   78|   122k|        frame = &stack.back();
   79|   122k|        return parseRemainder(content_stream);
   80|       |
   81|      3|    case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (81:5): [True: 3, False: 172k]
  ------------------
   82|      3|        return withDescription<QPDF_Bool>(tokenizer.getValue() == "true");
   83|       |
   84|    259|    case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (84:5): [True: 259, False: 172k]
  ------------------
   85|    259|        return {QPDF_Null::create()};
   86|       |
   87|  38.6k|    case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (87:5): [True: 38.6k, False: 134k]
  ------------------
   88|  38.6k|        return withDescription<QPDF_Integer>(QUtil::string_to_ll(tokenizer.getValue().c_str()));
   89|       |
   90|    258|    case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (90:5): [True: 258, False: 172k]
  ------------------
   91|    258|        return withDescription<QPDF_Real>(tokenizer.getValue());
   92|       |
   93|  3.23k|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (93:5): [True: 3.23k, False: 169k]
  ------------------
   94|  3.23k|        return withDescription<QPDF_Name>(tokenizer.getValue());
   95|       |
   96|  4.50k|    case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (96:5): [True: 4.50k, False: 168k]
  ------------------
   97|  4.50k|        {
   98|  4.50k|            auto const& value = tokenizer.getValue();
   99|  4.50k|            if (content_stream) {
  ------------------
  |  Branch (99:17): [True: 0, False: 4.50k]
  ------------------
  100|      0|                return withDescription<QPDF_Operator>(value);
  101|  4.50k|            } else if (value == "endobj") {
  ------------------
  |  Branch (101:24): [True: 71, False: 4.43k]
  ------------------
  102|       |                // We just saw endobj without having read anything.  Treat this as a null and do
  103|       |                // not move the input source's offset.
  104|     71|                input->seek(input->getLastOffset(), SEEK_SET);
  105|     71|                empty = true;
  106|     71|                return {QPDF_Null::create()};
  107|  4.43k|            } else {
  108|  4.43k|                QTC::TC("qpdf", "QPDFParser treat word as string");
  109|  4.43k|                warn("unknown token while reading object; treating as string");
  110|  4.43k|                return withDescription<QPDF_String>(value);
  111|  4.43k|            }
  112|  4.50k|        }
  113|       |
  114|    181|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (114:5): [True: 181, False: 172k]
  ------------------
  115|    181|        if (decrypter) {
  ------------------
  |  Branch (115:13): [True: 0, False: 181]
  ------------------
  116|      0|            std::string s{tokenizer.getValue()};
  117|      0|            decrypter->decryptString(s);
  118|      0|            return withDescription<QPDF_String>(s);
  119|    181|        } else {
  120|    181|            return withDescription<QPDF_String>(tokenizer.getValue());
  121|    181|        }
  122|       |
  123|      0|    default:
  ------------------
  |  Branch (123:5): [True: 0, False: 172k]
  ------------------
  124|      0|        warn("treating unknown token type as null while reading object");
  125|      0|        return {QPDF_Null::create()};
  126|   172k|    }
  127|   172k|}
_ZN10QPDFParser14parseRemainderEb:
  131|   122k|{
  132|       |    // This method must take care not to resolve any objects. Don't check the type of any object
  133|       |    // without first ensuring that it is a direct object. Otherwise, doing so may have the side
  134|       |    // effect of reading the object and changing the file pointer. If you do this, it will cause a
  135|       |    // logic error to be thrown from QPDF::inParse().
  136|       |
  137|   122k|    bad_count = 0;
  138|   122k|    bool b_contents = false;
  139|       |
  140|  4.45M|    while (true) {
  ------------------
  |  Branch (140:12): [Folded - Ignored]
  ------------------
  141|  4.45M|        if (!tokenizer.nextToken(*input, object_description)) {
  ------------------
  |  Branch (141:13): [True: 11.3k, False: 4.44M]
  ------------------
  142|  11.3k|            warn(tokenizer.getErrorMessage());
  143|  11.3k|        }
  144|  4.45M|        ++good_count; // optimistically
  145|       |
  146|  4.45M|        if (int_count != 0) {
  ------------------
  |  Branch (146:13): [True: 1.23M, False: 3.21M]
  ------------------
  147|       |            // Special handling of indirect references. Treat integer tokens as part of an indirect
  148|       |            // reference until proven otherwise.
  149|  1.23M|            if (tokenizer.getType() == QPDFTokenizer::tt_integer) {
  ------------------
  |  Branch (149:17): [True: 622k, False: 614k]
  ------------------
  150|   622k|                if (++int_count > 2) {
  ------------------
  |  Branch (150:21): [True: 159k, False: 462k]
  ------------------
  151|       |                    // Process the oldest buffered integer.
  152|   159k|                    addInt(int_count);
  153|   159k|                }
  154|   622k|                last_offset_buffer[int_count % 2] = input->getLastOffset();
  155|   622k|                int_buffer[int_count % 2] = QUtil::string_to_ll(tokenizer.getValue().c_str());
  156|   622k|                continue;
  157|       |
  158|   622k|            } else if (
  159|   614k|                int_count >= 2 && tokenizer.getType() == QPDFTokenizer::tt_word &&
  ------------------
  |  Branch (159:17): [True: 462k, False: 152k]
  |  Branch (159:35): [True: 406k, False: 55.9k]
  ------------------
  160|   614k|                tokenizer.getValue() == "R") {
  ------------------
  |  Branch (160:17): [True: 383k, False: 22.4k]
  ------------------
  161|   383k|                if (context == nullptr) {
  ------------------
  |  Branch (161:21): [True: 0, False: 383k]
  ------------------
  162|      0|                    QTC::TC("qpdf", "QPDFParser indirect without context");
  163|      0|                    throw std::logic_error("QPDFParser::parse called without context on an object "
  164|      0|                                           "with indirect references");
  165|      0|                }
  166|   383k|                auto id = QIntC::to_int(int_buffer[(int_count - 1) % 2]);
  167|   383k|                auto gen = QIntC::to_int(int_buffer[(int_count) % 2]);
  168|   383k|                if (!(id < 1 || gen < 0 || gen >= 65535)) {
  ------------------
  |  Branch (168:23): [True: 1.97k, False: 381k]
  |  Branch (168:33): [True: 82, False: 381k]
  |  Branch (168:44): [True: 25, False: 381k]
  ------------------
  169|   381k|                    add(QPDF::ParseGuard::getObject(context, id, gen, parse_pdf));
  170|   381k|                } else {
  171|  2.08k|                    QTC::TC("qpdf", "QPDFParser invalid objgen");
  172|  2.08k|                    addNull();
  173|  2.08k|                }
  174|   383k|                int_count = 0;
  175|   383k|                continue;
  176|       |
  177|   383k|            } else if (int_count > 0) {
  ------------------
  |  Branch (177:24): [True: 230k, False: 0]
  ------------------
  178|       |                // Process the buffered integers before processing the current token.
  179|   230k|                if (int_count > 1) {
  ------------------
  |  Branch (179:21): [True: 78.4k, False: 152k]
  ------------------
  180|  78.4k|                    addInt(int_count - 1);
  181|  78.4k|                }
  182|   230k|                addInt(int_count);
  183|   230k|                int_count = 0;
  184|   230k|            }
  185|  1.23M|        }
  186|       |
  187|  3.44M|        switch (tokenizer.getType()) {
  188|  1.36k|        case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (188:9): [True: 1.36k, False: 3.44M]
  ------------------
  189|  1.36k|            warn("parse error while reading object");
  190|  1.36k|            if (content_stream) {
  ------------------
  |  Branch (190:17): [True: 0, False: 1.36k]
  ------------------
  191|       |                // In content stream mode, leave object uninitialized to indicate EOF
  192|      0|                return {};
  193|      0|            }
  194|  1.36k|            QTC::TC("qpdf", "QPDFParser eof in parseRemainder");
  195|  1.36k|            warn("unexpected EOF");
  196|  1.36k|            return {QPDF_Null::create()};
  197|       |
  198|  10.9k|        case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (198:9): [True: 10.9k, False: 3.43M]
  ------------------
  199|  10.9k|            QTC::TC("qpdf", "QPDFParser bad token in parseRemainder");
  200|  10.9k|            if (tooManyBadTokens()) {
  ------------------
  |  Branch (200:17): [True: 674, False: 10.2k]
  ------------------
  201|    674|                return {QPDF_Null::create()};
  202|    674|            }
  203|  10.2k|            addNull();
  204|  10.2k|            continue;
  205|       |
  206|    710|        case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (206:9): [True: 710, False: 3.44M]
  ------------------
  207|  1.08k|        case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (207:9): [True: 370, False: 3.44M]
  ------------------
  208|  1.08k|            QTC::TC("qpdf", "QPDFParser bad brace in parseRemainder");
  209|  1.08k|            warn("treating unexpected brace token as null");
  210|  1.08k|            if (tooManyBadTokens()) {
  ------------------
  |  Branch (210:17): [True: 124, False: 956]
  ------------------
  211|    124|                return {QPDF_Null::create()};
  212|    124|            }
  213|    956|            addNull();
  214|    956|            continue;
  215|       |
  216|   109k|        case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (216:9): [True: 109k, False: 3.34M]
  ------------------
  217|   109k|            if (frame->state == st_array) {
  ------------------
  |  Branch (217:17): [True: 106k, False: 3.20k]
  ------------------
  218|   106k|                auto object = QPDF_Array::create(std::move(frame->olist), frame->null_count > 100);
  219|   106k|                setDescription(object, frame->offset - 1);
  220|       |                // The `offset` points to the next of "[".  Set the rewind offset to point to the
  221|       |                // beginning of "[". This has been explicitly tested with whitespace surrounding the
  222|       |                // array start delimiter. getLastOffset points to the array end token and therefore
  223|       |                // can't be used here.
  224|   106k|                if (stack.size() <= 1) {
  ------------------
  |  Branch (224:21): [True: 1.88k, False: 104k]
  ------------------
  225|  1.88k|                    return object;
  226|  1.88k|                }
  227|   104k|                stack.pop_back();
  228|   104k|                frame = &stack.back();
  229|   104k|                add(std::move(object));
  230|   104k|            } else {
  231|  3.20k|                QTC::TC("qpdf", "QPDFParser bad array close in parseRemainder");
  232|  3.20k|                warn("treating unexpected array close token as null");
  233|  3.20k|                if (tooManyBadTokens()) {
  ------------------
  |  Branch (233:21): [True: 164, False: 3.03k]
  ------------------
  234|    164|                    return {QPDF_Null::create()};
  235|    164|                }
  236|  3.03k|                addNull();
  237|  3.03k|            }
  238|   107k|            continue;
  239|       |
  240|   214k|        case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (240:9): [True: 214k, False: 3.23M]
  ------------------
  241|   214k|            if (frame->state <= st_dictionary_value) {
  ------------------
  |  Branch (241:17): [True: 211k, False: 2.30k]
  ------------------
  242|       |                // Attempt to recover more or less gracefully from invalid dictionaries.
  243|   211k|                auto& dict = frame->dict;
  244|       |
  245|   211k|                if (frame->state == st_dictionary_value) {
  ------------------
  |  Branch (245:21): [True: 1.20k, False: 210k]
  ------------------
  246|  1.20k|                    QTC::TC("qpdf", "QPDFParser no val for last key");
  247|  1.20k|                    warn(
  248|  1.20k|                        frame->offset,
  249|  1.20k|                        "dictionary ended prematurely; using null as value for last key");
  250|  1.20k|                    dict[frame->key] = QPDF_Null::create();
  251|  1.20k|                }
  252|       |
  253|   211k|                if (!frame->olist.empty()) {
  ------------------
  |  Branch (253:21): [True: 12.3k, False: 199k]
  ------------------
  254|  12.3k|                    fixMissingKeys();
  255|  12.3k|                }
  256|       |
  257|   211k|                if (!frame->contents_string.empty() && dict.count("/Type") &&
  ------------------
  |  Branch (257:21): [True: 0, False: 211k]
  |  Branch (257:21): [True: 0, False: 211k]
  |  Branch (257:56): [True: 0, False: 0]
  ------------------
  258|   211k|                    dict["/Type"].isNameAndEquals("/Sig") && dict.count("/ByteRange") &&
  ------------------
  |  Branch (258:21): [True: 0, False: 0]
  |  Branch (258:62): [True: 0, False: 0]
  ------------------
  259|   211k|                    dict.count("/Contents") && dict["/Contents"].isString()) {
  ------------------
  |  Branch (259:21): [True: 0, False: 0]
  |  Branch (259:48): [True: 0, False: 0]
  ------------------
  260|      0|                    dict["/Contents"] = QPDFObjectHandle::newString(frame->contents_string);
  261|      0|                    dict["/Contents"].setParsedOffset(frame->contents_offset);
  262|      0|                }
  263|   211k|                auto object = QPDF_Dictionary::create(std::move(dict));
  264|   211k|                setDescription(object, frame->offset - 2);
  265|       |                // The `offset` points to the next of "<<". Set the rewind offset to point to the
  266|       |                // beginning of "<<". This has been explicitly tested with whitespace surrounding
  267|       |                // the dictionary start delimiter. getLastOffset points to the dictionary end token
  268|       |                // and therefore can't be used here.
  269|   211k|                if (stack.size() <= 1) {
  ------------------
  |  Branch (269:21): [True: 113k, False: 98.3k]
  ------------------
  270|   113k|                    return object;
  271|   113k|                }
  272|  98.3k|                stack.pop_back();
  273|  98.3k|                frame = &stack.back();
  274|  98.3k|                add(std::move(object));
  275|  98.3k|            } else {
  276|  2.30k|                QTC::TC("qpdf", "QPDFParser bad dictionary close in parseRemainder");
  277|  2.30k|                warn("unexpected dictionary close token");
  278|  2.30k|                if (tooManyBadTokens()) {
  ------------------
  |  Branch (278:21): [True: 44, False: 2.26k]
  ------------------
  279|     44|                    return {QPDF_Null::create()};
  280|     44|                }
  281|  2.26k|                addNull();
  282|  2.26k|            }
  283|   100k|            continue;
  284|       |
  285|   131k|        case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (285:9): [True: 131k, False: 3.31M]
  ------------------
  286|   243k|        case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (286:9): [True: 112k, False: 3.33M]
  ------------------
  287|   243k|            if (stack.size() > 499) {
  ------------------
  |  Branch (287:17): [True: 46, False: 243k]
  ------------------
  288|     46|                QTC::TC("qpdf", "QPDFParser too deep");
  289|     46|                warn("ignoring excessively deeply nested data structure");
  290|     46|                return {QPDF_Null::create()};
  291|   243k|            } else {
  292|   243k|                b_contents = false;
  293|   243k|                stack.emplace_back(
  294|   243k|                    input,
  295|   243k|                    (tokenizer.getType() == QPDFTokenizer::tt_array_open) ? st_array
  ------------------
  |  Branch (295:21): [True: 131k, False: 112k]
  ------------------
  296|   243k|                                                                          : st_dictionary_key);
  297|   243k|                frame = &stack.back();
  298|   243k|                continue;
  299|   243k|            }
  300|       |
  301|  2.10k|        case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (301:9): [True: 2.10k, False: 3.44M]
  ------------------
  302|  2.10k|            addScalar<QPDF_Bool>(tokenizer.getValue() == "true");
  303|  2.10k|            continue;
  304|       |
  305|   344k|        case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (305:9): [True: 344k, False: 3.10M]
  ------------------
  306|   344k|            addNull();
  307|   344k|            continue;
  308|       |
  309|   614k|        case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (309:9): [True: 614k, False: 2.83M]
  ------------------
  310|   614k|            if (!content_stream) {
  ------------------
  |  Branch (310:17): [True: 614k, False: 0]
  ------------------
  311|       |                // Buffer token in case it is part of an indirect reference.
  312|   614k|                last_offset_buffer[1] = input->getLastOffset();
  313|   614k|                int_buffer[1] = QUtil::string_to_ll(tokenizer.getValue().c_str());
  314|   614k|                int_count = 1;
  315|   614k|            } else {
  316|      0|                addScalar<QPDF_Integer>(QUtil::string_to_ll(tokenizer.getValue().c_str()));
  317|      0|            }
  318|   614k|            continue;
  319|       |
  320|  31.4k|        case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (320:9): [True: 31.4k, False: 3.41M]
  ------------------
  321|  31.4k|            addScalar<QPDF_Real>(tokenizer.getValue());
  322|  31.4k|            continue;
  323|       |
  324|  1.75M|        case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (324:9): [True: 1.75M, False: 1.69M]
  ------------------
  325|  1.75M|            if (frame->state == st_dictionary_key) {
  ------------------
  |  Branch (325:17): [True: 788k, False: 967k]
  ------------------
  326|   788k|                frame->key = tokenizer.getValue();
  327|   788k|                frame->state = st_dictionary_value;
  328|   788k|                b_contents = decrypter && frame->key == "/Contents";
  ------------------
  |  Branch (328:30): [True: 0, False: 788k]
  |  Branch (328:43): [True: 0, False: 0]
  ------------------
  329|   788k|                continue;
  330|   967k|            } else {
  331|   967k|                addScalar<QPDF_Name>(tokenizer.getValue());
  332|   967k|            }
  333|   967k|            continue;
  334|       |
  335|   967k|        case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (335:9): [True: 84.6k, False: 3.36M]
  ------------------
  336|  84.6k|            if (content_stream) {
  ------------------
  |  Branch (336:17): [True: 0, False: 84.6k]
  ------------------
  337|      0|                addScalar<QPDF_Operator>(tokenizer.getValue());
  338|  84.6k|            } else {
  339|  84.6k|                QTC::TC("qpdf", "QPDFParser treat word as string in parseRemainder");
  340|  84.6k|                warn("unknown token while reading object; treating as string");
  341|  84.6k|                if (tooManyBadTokens()) {
  ------------------
  |  Branch (341:21): [True: 4.28k, False: 80.3k]
  ------------------
  342|  4.28k|                    return {QPDF_Null::create()};
  343|  4.28k|                }
  344|  80.3k|                addScalar<QPDF_String>(tokenizer.getValue());
  345|  80.3k|            }
  346|  80.3k|            continue;
  347|       |
  348|  80.3k|        case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (348:9): [True: 35.6k, False: 3.41M]
  ------------------
  349|  35.6k|            {
  350|  35.6k|                auto const& val = tokenizer.getValue();
  351|  35.6k|                if (decrypter) {
  ------------------
  |  Branch (351:21): [True: 0, False: 35.6k]
  ------------------
  352|      0|                    if (b_contents) {
  ------------------
  |  Branch (352:25): [True: 0, False: 0]
  ------------------
  353|      0|                        frame->contents_string = val;
  354|      0|                        frame->contents_offset = input->getLastOffset();
  355|      0|                        b_contents = false;
  356|      0|                    }
  357|      0|                    std::string s{val};
  358|      0|                    decrypter->decryptString(s);
  359|      0|                    addScalar<QPDF_String>(s);
  360|  35.6k|                } else {
  361|  35.6k|                    addScalar<QPDF_String>(val);
  362|  35.6k|                }
  363|  35.6k|            }
  364|  35.6k|            continue;
  365|       |
  366|      0|        default:
  ------------------
  |  Branch (366:9): [True: 0, False: 3.44M]
  ------------------
  367|      0|            warn("treating unknown token type as null while reading object");
  368|      0|            if (tooManyBadTokens()) {
  ------------------
  |  Branch (368:17): [True: 0, False: 0]
  ------------------
  369|      0|                return {QPDF_Null::create()};
  370|      0|            }
  371|      0|            addNull();
  372|  3.44M|        }
  373|  3.44M|    }
  374|   122k|}
_ZN10QPDFParser3addEONSt3__110shared_ptrI10QPDFObjectEE:
  378|  2.17M|{
  379|  2.17M|    if (frame->state != st_dictionary_value) {
  ------------------
  |  Branch (379:9): [True: 1.39M, False: 778k]
  ------------------
  380|       |        // If state is st_dictionary_key then there is a missing key. Push onto olist for
  381|       |        // processing once the tt_dict_close token has been found.
  382|  1.39M|        frame->olist.emplace_back(std::move(obj));
  383|  1.39M|    } else {
  384|   778k|        if (auto res = frame->dict.insert_or_assign(frame->key, std::move(obj)); !res.second) {
  ------------------
  |  Branch (384:82): [True: 3.65k, False: 774k]
  ------------------
  385|  3.65k|            warnDuplicateKey();
  386|  3.65k|        }
  387|   778k|        frame->state = st_dictionary_key;
  388|   778k|    }
  389|  2.17M|}
_ZN10QPDFParser7addNullEv:
  393|   363k|{
  394|   363k|    const static ObjectPtr null_obj = QPDF_Null::create();
  395|       |
  396|   363k|    if (frame->state != st_dictionary_value) {
  ------------------
  |  Branch (396:9): [True: 359k, False: 3.63k]
  ------------------
  397|       |        // If state is st_dictionary_key then there is a missing key. Push onto olist for
  398|       |        // processing once the tt_dict_close token has been found.
  399|   359k|        frame->olist.emplace_back(null_obj);
  400|   359k|    } else {
  401|  3.63k|        if (auto res = frame->dict.insert_or_assign(frame->key, null_obj); !res.second) {
  ------------------
  |  Branch (401:76): [True: 49, False: 3.58k]
  ------------------
  402|     49|            warnDuplicateKey();
  403|     49|        }
  404|  3.63k|        frame->state = st_dictionary_key;
  405|  3.63k|    }
  406|   363k|    ++frame->null_count;
  407|   363k|}
_ZN10QPDFParser6addIntEi:
  411|   469k|{
  412|   469k|    auto obj = QPDF_Integer::create(int_buffer[count % 2]);
  413|   469k|    obj->setDescription(context, description, last_offset_buffer[count % 2]);
  414|   469k|    add(std::move(obj));
  415|   469k|}
_ZN10QPDFParser14setDescriptionERNSt3__110shared_ptrI10QPDFObjectEEx:
  437|   318k|{
  438|   318k|    if (obj) {
  ------------------
  |  Branch (438:9): [True: 318k, False: 0]
  ------------------
  439|   318k|        obj->setDescription(context, description, parsed_offset);
  440|   318k|    }
  441|   318k|}
_ZN10QPDFParser14fixMissingKeysEv:
  445|  12.3k|{
  446|  12.3k|    std::set<std::string> names;
  447|  69.0k|    for (auto& obj: frame->olist) {
  ------------------
  |  Branch (447:19): [True: 69.0k, False: 12.3k]
  ------------------
  448|  69.0k|        if (obj->getTypeCode() == ::ot_name) {
  ------------------
  |  Branch (448:13): [True: 9, False: 69.0k]
  ------------------
  449|      9|            names.insert(obj->getStringValue());
  450|      9|        }
  451|  69.0k|    }
  452|  12.3k|    int next_fake_key = 1;
  453|  50.0k|    for (auto const& item: frame->olist) {
  ------------------
  |  Branch (453:26): [True: 50.0k, False: 12.3k]
  ------------------
  454|  50.0k|        while (true) {
  ------------------
  |  Branch (454:16): [Folded - Ignored]
  ------------------
  455|  50.0k|            const std::string key = "/QPDFFake" + std::to_string(next_fake_key++);
  456|  50.0k|            const bool found_fake = frame->dict.count(key) == 0 && names.count(key) == 0;
  ------------------
  |  Branch (456:37): [True: 50.0k, False: 40]
  |  Branch (456:68): [True: 50.0k, False: 0]
  ------------------
  457|  50.0k|            QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1));
  ------------------
  |  Branch (457:55): [True: 50.0k, False: 40]
  ------------------
  458|  50.0k|            if (found_fake) {
  ------------------
  |  Branch (458:17): [True: 50.0k, False: 40]
  ------------------
  459|  50.0k|                warn(
  460|  50.0k|                    frame->offset,
  461|  50.0k|                    "expected dictionary key but found non-name object; inserting key " + key);
  462|  50.0k|                frame->dict[key] = item;
  463|  50.0k|                break;
  464|  50.0k|            }
  465|  50.0k|        }
  466|  50.0k|    }
  467|  12.3k|}
_ZN10QPDFParser16tooManyBadTokensEv:
  471|   101k|{
  472|   101k|    if (good_count <= 4) {
  ------------------
  |  Branch (472:9): [True: 63.8k, False: 37.9k]
  ------------------
  473|  63.8k|        if (++bad_count > 5) {
  ------------------
  |  Branch (473:13): [True: 5.29k, False: 58.5k]
  ------------------
  474|  5.29k|            warn("too many errors; giving up on reading object");
  475|  5.29k|            return true;
  476|  5.29k|        }
  477|  63.8k|    } else {
  478|  37.9k|        bad_count = 1;
  479|  37.9k|    }
  480|  96.5k|    good_count = 0;
  481|  96.5k|    return false;
  482|   101k|}
_ZNK10QPDFParser4warnERK7QPDFExc:
  486|   172k|{
  487|       |    // If parsing on behalf of a QPDF object and want to give a warning, we can warn through the
  488|       |    // object. If parsing for some other reason, such as an explicit creation of an object from a
  489|       |    // string, then just throw the exception.
  490|   172k|    if (context) {
  ------------------
  |  Branch (490:9): [True: 172k, False: 0]
  ------------------
  491|   172k|        context->warn(e);
  492|   172k|    } else {
  493|      0|        throw e;
  494|      0|    }
  495|   172k|}
_ZN10QPDFParser16warnDuplicateKeyEv:
  499|  3.70k|{
  500|  3.70k|    QTC::TC("qpdf", "QPDFParser duplicate dict key");
  501|  3.70k|    warn(
  502|  3.70k|        frame->offset,
  503|  3.70k|        "dictionary has duplicated key " + frame->key + "; last occurrence overrides earlier ones");
  504|  3.70k|}
_ZNK10QPDFParser4warnExRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  508|   172k|{
  509|   172k|    warn(QPDFExc(qpdf_e_damaged_pdf, input->getName(), object_description, offset, msg));
  510|   172k|}
_ZNK10QPDFParser4warnERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  514|   117k|{
  515|   117k|    warn(input->getLastOffset(), msg);
  516|   117k|}
_ZN10QPDFParser15withDescriptionI9QPDF_BoolJbEEE16QPDFObjectHandleDpOT0_:
  429|      3|{
  430|      3|    auto obj = T::create(args...);
  431|      3|    obj->setDescription(context, description, start);
  432|      3|    return {obj};
  433|      3|}
_ZN10QPDFParser15withDescriptionI12QPDF_IntegerJxEEE16QPDFObjectHandleDpOT0_:
  429|  38.6k|{
  430|  38.6k|    auto obj = T::create(args...);
  431|  38.6k|    obj->setDescription(context, description, start);
  432|  38.6k|    return {obj};
  433|  38.6k|}
_ZN10QPDFParser15withDescriptionI9QPDF_RealJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  429|    258|{
  430|    258|    auto obj = T::create(args...);
  431|    258|    obj->setDescription(context, description, start);
  432|    258|    return {obj};
  433|    258|}
_ZN10QPDFParser15withDescriptionI9QPDF_NameJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  429|  3.23k|{
  430|  3.23k|    auto obj = T::create(args...);
  431|  3.23k|    obj->setDescription(context, description, start);
  432|  3.23k|    return {obj};
  433|  3.23k|}
_ZN10QPDFParser15withDescriptionI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  429|  4.60k|{
  430|  4.60k|    auto obj = T::create(args...);
  431|  4.60k|    obj->setDescription(context, description, start);
  432|  4.60k|    return {obj};
  433|  4.60k|}
_ZN10QPDFParser9addScalarI9QPDF_BoolJbEEEvDpOT0_:
  420|  2.10k|{
  421|  2.10k|    auto obj = T::create(args...);
  422|  2.10k|    obj->setDescription(context, description, input->getLastOffset());
  423|  2.10k|    add(std::move(obj));
  424|  2.10k|}
_ZN10QPDFParser9addScalarI9QPDF_RealJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEEvDpOT0_:
  420|  31.4k|{
  421|  31.4k|    auto obj = T::create(args...);
  422|  31.4k|    obj->setDescription(context, description, input->getLastOffset());
  423|  31.4k|    add(std::move(obj));
  424|  31.4k|}
_ZN10QPDFParser9addScalarI9QPDF_NameJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEEvDpOT0_:
  420|   967k|{
  421|   967k|    auto obj = T::create(args...);
  422|   967k|    obj->setDescription(context, description, input->getLastOffset());
  423|   967k|    add(std::move(obj));
  424|   967k|}
_ZN10QPDFParser9addScalarI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEEvDpOT0_:
  420|   115k|{
  421|   115k|    auto obj = T::create(args...);
  422|   115k|    obj->setDescription(context, description, input->getLastOffset());
  423|   115k|    add(std::move(obj));
  424|   115k|}

_ZN16QPDFStreamFilter14setDecodeParmsE16QPDFObjectHandle:
    5|  26.9k|{
    6|  26.9k|    return decode_parms.isNull();
    7|  26.9k|}
_ZN16QPDFStreamFilter24isSpecializedCompressionEv:
   11|  50.0k|{
   12|  50.0k|    return false;
   13|  50.0k|}
_ZN16QPDFStreamFilter18isLossyCompressionEv:
   17|  51.5k|{
   18|  51.5k|    return false;
   19|  51.5k|}

_ZN13QPDFTokenizer5resetEv:
   78|  13.8M|{
   79|  13.8M|    state = st_before_token;
   80|  13.8M|    type = tt_bad;
   81|  13.8M|    val.clear();
   82|  13.8M|    raw_val.clear();
   83|  13.8M|    error_message = "";
   84|  13.8M|    before_token = true;
   85|  13.8M|    in_token = false;
   86|  13.8M|    char_to_unread = '\0';
   87|  13.8M|    inline_image_bytes = 0;
   88|  13.8M|    string_depth = 0;
   89|  13.8M|    bad = false;
   90|  13.8M|}
_ZN13QPDFTokenizerC2Ev:
  107|  5.77k|{
  108|  5.77k|    reset();
  109|  5.77k|}
_ZN13QPDFTokenizer8allowEOFEv:
  113|  3.33k|{
  114|  3.33k|    this->allow_eof = true;
  115|  3.33k|}
_ZN13QPDFTokenizer7isSpaceEc:
  125|  37.6M|{
  126|  37.6M|    return ((ch == '\0') || QUtil::is_space(ch));
  ------------------
  |  Branch (126:13): [True: 16.4M, False: 21.2M]
  |  Branch (126:29): [True: 11.8M, False: 9.44M]
  ------------------
  127|  37.6M|}
_ZN13QPDFTokenizer11isDelimiterEc:
  131|  50.9M|{
  132|  50.9M|    return is_delimiter(ch);
  133|  50.9M|}
_ZN13QPDFTokenizer16presentCharacterEc:
  137|  3.62k|{
  138|  3.62k|    handleCharacter(ch);
  139|       |
  140|  3.62k|    if (this->in_token) {
  ------------------
  |  Branch (140:9): [True: 0, False: 3.62k]
  ------------------
  141|      0|        this->raw_val += ch;
  142|      0|    }
  143|  3.62k|}
_ZN13QPDFTokenizer15handleCharacterEc:
  147|   142M|{
  148|       |    // In some cases, functions called below may call a second handler. This happens whenever you
  149|       |    // have to use a character from the next token to detect the end of the current token.
  150|       |
  151|   142M|    switch (this->state) {
  152|      0|    case st_top:
  ------------------
  |  Branch (152:5): [True: 0, False: 142M]
  ------------------
  153|      0|        inTop(ch);
  154|      0|        return;
  155|       |
  156|      0|    case st_in_space:
  ------------------
  |  Branch (156:5): [True: 0, False: 142M]
  ------------------
  157|      0|        inSpace(ch);
  158|      0|        return;
  159|       |
  160|  3.20M|    case st_in_comment:
  ------------------
  |  Branch (160:5): [True: 3.20M, False: 139M]
  ------------------
  161|  3.20M|        inComment(ch);
  162|  3.20M|        return;
  163|       |
  164|   515k|    case st_lt:
  ------------------
  |  Branch (164:5): [True: 515k, False: 142M]
  ------------------
  165|   515k|        inLt(ch);
  166|   515k|        return;
  167|       |
  168|   351k|    case st_gt:
  ------------------
  |  Branch (168:5): [True: 351k, False: 142M]
  ------------------
  169|   351k|        inGt(ch);
  170|   351k|        return;
  171|       |
  172|  43.8M|    case st_in_string:
  ------------------
  |  Branch (172:5): [True: 43.8M, False: 98.8M]
  ------------------
  173|  43.8M|        inString(ch);
  174|  43.8M|        return;
  175|       |
  176|  12.1M|    case st_name:
  ------------------
  |  Branch (176:5): [True: 12.1M, False: 130M]
  ------------------
  177|  12.1M|        inName(ch);
  178|  12.1M|        return;
  179|       |
  180|  7.92M|    case st_number:
  ------------------
  |  Branch (180:5): [True: 7.92M, False: 134M]
  ------------------
  181|  7.92M|        inNumber(ch);
  182|  7.92M|        return;
  183|       |
  184|   212k|    case st_real:
  ------------------
  |  Branch (184:5): [True: 212k, False: 142M]
  ------------------
  185|   212k|        inReal(ch);
  186|   212k|        return;
  187|       |
  188|   368k|    case st_string_after_cr:
  ------------------
  |  Branch (188:5): [True: 368k, False: 142M]
  ------------------
  189|   368k|        inStringAfterCR(ch);
  190|   368k|        return;
  191|       |
  192|  78.0k|    case st_string_escape:
  ------------------
  |  Branch (192:5): [True: 78.0k, False: 142M]
  ------------------
  193|  78.0k|        inStringEscape(ch);
  194|  78.0k|        return;
  195|       |
  196|  3.40k|    case st_char_code:
  ------------------
  |  Branch (196:5): [True: 3.40k, False: 142M]
  ------------------
  197|  3.40k|        inCharCode(ch);
  198|  3.40k|        return;
  199|       |
  200|  35.9M|    case st_literal:
  ------------------
  |  Branch (200:5): [True: 35.9M, False: 106M]
  ------------------
  201|  35.9M|        inLiteral(ch);
  202|  35.9M|        return;
  203|       |
  204|      0|    case st_inline_image:
  ------------------
  |  Branch (204:5): [True: 0, False: 142M]
  ------------------
  205|      0|        inInlineImage(ch);
  206|      0|        return;
  207|       |
  208|   384k|    case st_in_hexstring:
  ------------------
  |  Branch (208:5): [True: 384k, False: 142M]
  ------------------
  209|   384k|        inHexstring(ch);
  210|   384k|        return;
  211|       |
  212|   272k|    case st_in_hexstring_2nd:
  ------------------
  |  Branch (212:5): [True: 272k, False: 142M]
  ------------------
  213|   272k|        inHexstring2nd(ch);
  214|   272k|        return;
  215|       |
  216|  2.61k|    case st_name_hex1:
  ------------------
  |  Branch (216:5): [True: 2.61k, False: 142M]
  ------------------
  217|  2.61k|        inNameHex1(ch);
  218|  2.61k|        return;
  219|       |
  220|    424|    case st_name_hex2:
  ------------------
  |  Branch (220:5): [True: 424, False: 142M]
  ------------------
  221|    424|        inNameHex2(ch);
  222|    424|        return;
  223|       |
  224|  6.94k|    case st_sign:
  ------------------
  |  Branch (224:5): [True: 6.94k, False: 142M]
  ------------------
  225|  6.94k|        inSign(ch);
  226|  6.94k|        return;
  227|       |
  228|  3.97k|    case st_decimal:
  ------------------
  |  Branch (228:5): [True: 3.97k, False: 142M]
  ------------------
  229|  3.97k|        inDecimal(ch);
  230|  3.97k|        return;
  231|       |
  232|  37.4M|    case (st_before_token):
  ------------------
  |  Branch (232:5): [True: 37.4M, False: 105M]
  ------------------
  233|  37.4M|        inBeforeToken(ch);
  234|  37.4M|        return;
  235|       |
  236|      0|    case (st_token_ready):
  ------------------
  |  Branch (236:5): [True: 0, False: 142M]
  ------------------
  237|      0|        inTokenReady(ch);
  238|      0|        return;
  239|       |
  240|      0|    default:
  ------------------
  |  Branch (240:5): [True: 0, False: 142M]
  ------------------
  241|      0|        throw std::logic_error("INTERNAL ERROR: invalid state while reading token");
  242|   142M|    }
  243|   142M|}
_ZN13QPDFTokenizer13inBeforeTokenEc:
  254|  37.4M|{
  255|       |    // Note: we specifically do not use ctype here.  It is locale-dependent.
  256|  37.4M|    if (isSpace(ch)) {
  ------------------
  |  Branch (256:9): [True: 28.0M, False: 9.36M]
  ------------------
  257|  28.0M|        this->before_token = !this->include_ignorable;
  258|  28.0M|        this->in_token = this->include_ignorable;
  259|  28.0M|        if (this->include_ignorable) {
  ------------------
  |  Branch (259:13): [True: 0, False: 28.0M]
  ------------------
  260|      0|            this->state = st_in_space;
  261|      0|        }
  262|  28.0M|    } else if (ch == '%') {
  ------------------
  |  Branch (262:16): [True: 127k, False: 9.23M]
  ------------------
  263|   127k|        this->before_token = !this->include_ignorable;
  264|   127k|        this->in_token = this->include_ignorable;
  265|   127k|        this->state = st_in_comment;
  266|  9.23M|    } else {
  267|  9.23M|        this->before_token = false;
  268|  9.23M|        this->in_token = true;
  269|  9.23M|        inTop(ch);
  270|  9.23M|    }
  271|  37.4M|}
_ZN13QPDFTokenizer5inTopEc:
  275|  9.23M|{
  276|  9.23M|    switch (ch) {
  277|  34.7k|    case '(':
  ------------------
  |  Branch (277:5): [True: 34.7k, False: 9.20M]
  ------------------
  278|  34.7k|        this->string_depth = 1;
  279|  34.7k|        this->state = st_in_string;
  280|  34.7k|        return;
  281|       |
  282|   515k|    case '<':
  ------------------
  |  Branch (282:5): [True: 515k, False: 8.72M]
  ------------------
  283|   515k|        this->state = st_lt;
  284|   515k|        return;
  285|       |
  286|   351k|    case '>':
  ------------------
  |  Branch (286:5): [True: 351k, False: 8.88M]
  ------------------
  287|   351k|        this->state = st_gt;
  288|   351k|        return;
  289|       |
  290|  4.03k|    case (')'):
  ------------------
  |  Branch (290:5): [True: 4.03k, False: 9.23M]
  ------------------
  291|  4.03k|        this->type = tt_bad;
  292|  4.03k|        QTC::TC("qpdf", "QPDFTokenizer bad )");
  293|  4.03k|        this->error_message = "unexpected )";
  294|  4.03k|        this->state = st_token_ready;
  295|  4.03k|        return;
  296|       |
  297|   138k|    case '[':
  ------------------
  |  Branch (297:5): [True: 138k, False: 9.09M]
  ------------------
  298|   138k|        this->type = tt_array_open;
  299|   138k|        this->state = st_token_ready;
  300|   138k|        return;
  301|       |
  302|   171k|    case ']':
  ------------------
  |  Branch (302:5): [True: 171k, False: 9.06M]
  ------------------
  303|   171k|        this->type = tt_array_close;
  304|   171k|        this->state = st_token_ready;
  305|   171k|        return;
  306|       |
  307|  1.83k|    case '{':
  ------------------
  |  Branch (307:5): [True: 1.83k, False: 9.23M]
  ------------------
  308|  1.83k|        this->type = tt_brace_open;
  309|  1.83k|        this->state = st_token_ready;
  310|  1.83k|        return;
  311|       |
  312|  1.23k|    case '}':
  ------------------
  |  Branch (312:5): [True: 1.23k, False: 9.23M]
  ------------------
  313|  1.23k|        this->type = tt_brace_close;
  314|  1.23k|        this->state = st_token_ready;
  315|  1.23k|        return;
  316|       |
  317|  2.39M|    case '/':
  ------------------
  |  Branch (317:5): [True: 2.39M, False: 6.84M]
  ------------------
  318|  2.39M|        this->state = st_name;
  319|  2.39M|        this->val += ch;
  320|  2.39M|        return;
  321|       |
  322|  1.30M|    case '0':
  ------------------
  |  Branch (322:5): [True: 1.30M, False: 7.93M]
  ------------------
  323|  1.82M|    case '1':
  ------------------
  |  Branch (323:5): [True: 520k, False: 8.71M]
  ------------------
  324|  2.01M|    case '2':
  ------------------
  |  Branch (324:5): [True: 184k, False: 9.05M]
  ------------------
  325|  2.13M|    case '3':
  ------------------
  |  Branch (325:5): [True: 124k, False: 9.11M]
  ------------------
  326|  2.24M|    case '4':
  ------------------
  |  Branch (326:5): [True: 110k, False: 9.12M]
  ------------------
  327|  2.44M|    case '5':
  ------------------
  |  Branch (327:5): [True: 197k, False: 9.04M]
  ------------------
  328|  2.62M|    case '6':
  ------------------
  |  Branch (328:5): [True: 183k, False: 9.05M]
  ------------------
  329|  2.81M|    case '7':
  ------------------
  |  Branch (329:5): [True: 190k, False: 9.04M]
  ------------------
  330|  2.95M|    case '8':
  ------------------
  |  Branch (330:5): [True: 138k, False: 9.09M]
  ------------------
  331|  3.03M|    case '9':
  ------------------
  |  Branch (331:5): [True: 75.1k, False: 9.16M]
  ------------------
  332|  3.03M|        this->state = st_number;
  333|  3.03M|        return;
  334|       |
  335|  1.27k|    case '+':
  ------------------
  |  Branch (335:5): [True: 1.27k, False: 9.23M]
  ------------------
  336|  6.94k|    case '-':
  ------------------
  |  Branch (336:5): [True: 5.67k, False: 9.23M]
  ------------------
  337|  6.94k|        this->state = st_sign;
  338|  6.94k|        return;
  339|       |
  340|  3.96k|    case '.':
  ------------------
  |  Branch (340:5): [True: 3.96k, False: 9.23M]
  ------------------
  341|  3.96k|        this->state = st_decimal;
  342|  3.96k|        return;
  343|       |
  344|  2.58M|    default:
  ------------------
  |  Branch (344:5): [True: 2.58M, False: 6.65M]
  ------------------
  345|  2.58M|        this->state = st_literal;
  346|  2.58M|        return;
  347|  9.23M|    }
  348|  9.23M|}
_ZN13QPDFTokenizer9inCommentEc:
  364|  3.20M|{
  365|  3.20M|    if ((ch == '\r') || (ch == '\n')) {
  ------------------
  |  Branch (365:9): [True: 85.1k, False: 3.11M]
  |  Branch (365:25): [True: 42.2k, False: 3.07M]
  ------------------
  366|   127k|        if (this->include_ignorable) {
  ------------------
  |  Branch (366:13): [True: 0, False: 127k]
  ------------------
  367|      0|            this->type = tt_comment;
  368|      0|            this->in_token = false;
  369|      0|            this->char_to_unread = ch;
  370|      0|            this->state = st_token_ready;
  371|   127k|        } else {
  372|   127k|            this->state = st_before_token;
  373|   127k|        }
  374|   127k|    }
  375|  3.20M|}
_ZN13QPDFTokenizer8inStringEc:
  379|  44.1M|{
  380|  44.1M|    switch (ch) {
  381|  78.0k|    case '\\':
  ------------------
  |  Branch (381:5): [True: 78.0k, False: 44.0M]
  ------------------
  382|  78.0k|        this->state = st_string_escape;
  383|  78.0k|        return;
  384|       |
  385|   155k|    case '(':
  ------------------
  |  Branch (385:5): [True: 155k, False: 44.0M]
  ------------------
  386|   155k|        this->val += ch;
  387|   155k|        ++this->string_depth;
  388|   155k|        return;
  389|       |
  390|   158k|    case ')':
  ------------------
  |  Branch (390:5): [True: 158k, False: 44.0M]
  ------------------
  391|   158k|        if (--this->string_depth == 0) {
  ------------------
  |  Branch (391:13): [True: 28.4k, False: 129k]
  ------------------
  392|  28.4k|            this->type = tt_string;
  393|  28.4k|            this->state = st_token_ready;
  394|  28.4k|            return;
  395|  28.4k|        }
  396|       |
  397|   129k|        this->val += ch;
  398|   129k|        return;
  399|       |
  400|   367k|    case '\r':
  ------------------
  |  Branch (400:5): [True: 367k, False: 43.8M]
  ------------------
  401|       |        // CR by itself is converted to LF
  402|   367k|        this->val += '\n';
  403|   367k|        this->state = st_string_after_cr;
  404|   367k|        return;
  405|       |
  406|   498k|    case '\n':
  ------------------
  |  Branch (406:5): [True: 498k, False: 43.6M]
  ------------------
  407|   498k|        this->val += ch;
  408|   498k|        return;
  409|       |
  410|  42.9M|    default:
  ------------------
  |  Branch (410:5): [True: 42.9M, False: 1.25M]
  ------------------
  411|  42.9M|        this->val += ch;
  412|  42.9M|        return;
  413|  44.1M|    }
  414|  44.1M|}
_ZN13QPDFTokenizer6inNameEc:
  418|  12.1M|{
  419|  12.1M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (419:9): [True: 2.31M, False: 9.80M]
  ------------------
  420|       |        // A C-locale whitespace character or delimiter terminates token.  It is important to unread
  421|       |        // the whitespace character even though it is ignored since it may be the newline after a
  422|       |        // stream keyword.  Removing it here could make the stream-reading code break on some files,
  423|       |        // though not on any files in the test suite as of this
  424|       |        // writing.
  425|       |
  426|  2.31M|        this->type = this->bad ? tt_bad : tt_name;
  ------------------
  |  Branch (426:22): [True: 8, False: 2.31M]
  ------------------
  427|  2.31M|        this->in_token = false;
  428|  2.31M|        this->char_to_unread = ch;
  429|  2.31M|        this->state = st_token_ready;
  430|  9.80M|    } else if (ch == '#') {
  ------------------
  |  Branch (430:16): [True: 2.61k, False: 9.80M]
  ------------------
  431|  2.61k|        this->char_code = 0;
  432|  2.61k|        this->state = st_name_hex1;
  433|  9.80M|    } else {
  434|  9.80M|        this->val += ch;
  435|  9.80M|    }
  436|  12.1M|}
_ZN13QPDFTokenizer10inNameHex1Ec:
  440|  2.61k|{
  441|  2.61k|    this->hex_char = ch;
  442|       |
  443|  2.61k|    if (char hval = QUtil::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (443:49): [True: 424, False: 2.18k]
  ------------------
  444|    424|        this->char_code = int(hval) << 4;
  445|    424|        this->state = st_name_hex2;
  446|  2.18k|    } else {
  447|  2.18k|        QTC::TC("qpdf", "QPDFTokenizer bad name 1");
  448|  2.18k|        this->error_message = "name with stray # will not work with PDF >= 1.2";
  449|       |        // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName.
  450|  2.18k|        this->val += '\0';
  451|  2.18k|        this->state = st_name;
  452|  2.18k|        inName(ch);
  453|  2.18k|    }
  454|  2.61k|}
_ZN13QPDFTokenizer10inNameHex2Ec:
  458|    424|{
  459|    424|    if (char hval = QUtil::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (459:49): [True: 220, False: 204]
  ------------------
  460|    220|        this->char_code |= int(hval);
  461|    220|    } else {
  462|    204|        QTC::TC("qpdf", "QPDFTokenizer bad name 2");
  463|    204|        this->error_message = "name with stray # will not work with PDF >= 1.2";
  464|       |        // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName.
  465|    204|        this->val += '\0';
  466|    204|        this->val += this->hex_char;
  467|    204|        this->state = st_name;
  468|    204|        inName(ch);
  469|    204|        return;
  470|    204|    }
  471|    220|    if (this->char_code == 0) {
  ------------------
  |  Branch (471:9): [True: 32, False: 188]
  ------------------
  472|     32|        QTC::TC("qpdf", "QPDFTokenizer null in name");
  473|     32|        this->error_message = "null character not allowed in name token";
  474|     32|        this->val += "#00";
  475|     32|        this->state = st_name;
  476|     32|        this->bad = true;
  477|    188|    } else {
  478|    188|        this->val += char(this->char_code);
  479|    188|        this->state = st_name;
  480|    188|    }
  481|    220|}
_ZN13QPDFTokenizer6inSignEc:
  485|  6.94k|{
  486|  6.94k|    if (QUtil::is_digit(ch)) {
  ------------------
  |  Branch (486:9): [True: 4.53k, False: 2.41k]
  ------------------
  487|  4.53k|        this->state = st_number;
  488|  4.53k|    } else if (ch == '.') {
  ------------------
  |  Branch (488:16): [True: 5, False: 2.41k]
  ------------------
  489|      5|        this->state = st_decimal;
  490|  2.41k|    } else {
  491|  2.41k|        this->state = st_literal;
  492|  2.41k|        inLiteral(ch);
  493|  2.41k|    }
  494|  6.94k|}
_ZN13QPDFTokenizer9inDecimalEc:
  498|  3.97k|{
  499|  3.97k|    if (QUtil::is_digit(ch)) {
  ------------------
  |  Branch (499:9): [True: 457, False: 3.51k]
  ------------------
  500|    457|        this->state = st_real;
  501|  3.51k|    } else {
  502|  3.51k|        this->state = st_literal;
  503|  3.51k|        inLiteral(ch);
  504|  3.51k|    }
  505|  3.97k|}
_ZN13QPDFTokenizer8inNumberEc:
  509|  7.92M|{
  510|  7.92M|    if (QUtil::is_digit(ch)) {
  ------------------
  |  Branch (510:9): [True: 5.09M, False: 2.83M]
  ------------------
  511|  5.09M|    } else if (ch == '.') {
  ------------------
  |  Branch (511:16): [True: 70.0k, False: 2.76M]
  ------------------
  512|  70.0k|        this->state = st_real;
  513|  2.76M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (513:16): [True: 2.71M, False: 51.8k]
  ------------------
  514|  2.71M|        this->type = tt_integer;
  515|  2.71M|        this->state = st_token_ready;
  516|  2.71M|        this->in_token = false;
  517|  2.71M|        this->char_to_unread = ch;
  518|  2.71M|    } else {
  519|  51.8k|        this->state = st_literal;
  520|  51.8k|    }
  521|  7.92M|}
_ZN13QPDFTokenizer6inRealEc:
  525|   212k|{
  526|   212k|    if (QUtil::is_digit(ch)) {
  ------------------
  |  Branch (526:9): [True: 141k, False: 70.4k]
  ------------------
  527|   141k|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (527:16): [True: 69.9k, False: 522]
  ------------------
  528|  69.9k|        this->type = tt_real;
  529|  69.9k|        this->state = st_token_ready;
  530|  69.9k|        this->in_token = false;
  531|  69.9k|        this->char_to_unread = ch;
  532|  69.9k|    } else {
  533|    522|        this->state = st_literal;
  534|    522|    }
  535|   212k|}
_ZN13QPDFTokenizer14inStringEscapeEc:
  538|  78.0k|{
  539|  78.0k|    this->state = st_in_string;
  540|  78.0k|    switch (ch) {
  541|    326|    case '0':
  ------------------
  |  Branch (541:5): [True: 326, False: 77.6k]
  ------------------
  542|    643|    case '1':
  ------------------
  |  Branch (542:5): [True: 317, False: 77.6k]
  ------------------
  543|    911|    case '2':
  ------------------
  |  Branch (543:5): [True: 268, False: 77.7k]
  ------------------
  544|  1.12k|    case '3':
  ------------------
  |  Branch (544:5): [True: 216, False: 77.7k]
  ------------------
  545|  2.02k|    case '4':
  ------------------
  |  Branch (545:5): [True: 899, False: 77.1k]
  ------------------
  546|  2.24k|    case '5':
  ------------------
  |  Branch (546:5): [True: 215, False: 77.7k]
  ------------------
  547|  2.58k|    case '6':
  ------------------
  |  Branch (547:5): [True: 342, False: 77.6k]
  ------------------
  548|  2.92k|    case '7':
  ------------------
  |  Branch (548:5): [True: 346, False: 77.6k]
  ------------------
  549|  2.92k|        this->state = st_char_code;
  550|  2.92k|        this->char_code = 0;
  551|  2.92k|        this->digit_count = 0;
  552|  2.92k|        inCharCode(ch);
  553|  2.92k|        return;
  554|       |
  555|    191|    case 'n':
  ------------------
  |  Branch (555:5): [True: 191, False: 77.8k]
  ------------------
  556|    191|        this->val += '\n';
  557|    191|        return;
  558|       |
  559|    593|    case 'r':
  ------------------
  |  Branch (559:5): [True: 593, False: 77.4k]
  ------------------
  560|    593|        this->val += '\r';
  561|    593|        return;
  562|       |
  563|    222|    case 't':
  ------------------
  |  Branch (563:5): [True: 222, False: 77.7k]
  ------------------
  564|    222|        this->val += '\t';
  565|    222|        return;
  566|       |
  567|    484|    case 'b':
  ------------------
  |  Branch (567:5): [True: 484, False: 77.5k]
  ------------------
  568|    484|        this->val += '\b';
  569|    484|        return;
  570|       |
  571|    480|    case 'f':
  ------------------
  |  Branch (571:5): [True: 480, False: 77.5k]
  ------------------
  572|    480|        this->val += '\f';
  573|    480|        return;
  574|       |
  575|  1.47k|    case '\n':
  ------------------
  |  Branch (575:5): [True: 1.47k, False: 76.5k]
  ------------------
  576|  1.47k|        return;
  577|       |
  578|    932|    case '\r':
  ------------------
  |  Branch (578:5): [True: 932, False: 77.0k]
  ------------------
  579|    932|        this->state = st_string_after_cr;
  580|    932|        return;
  581|       |
  582|  70.6k|    default:
  ------------------
  |  Branch (582:5): [True: 70.6k, False: 7.31k]
  ------------------
  583|       |        // PDF spec says backslash is ignored before anything else
  584|  70.6k|        this->val += ch;
  585|  70.6k|        return;
  586|  78.0k|    }
  587|  78.0k|}
_ZN13QPDFTokenizer15inStringAfterCREc:
  591|   368k|{
  592|   368k|    this->state = st_in_string;
  593|   368k|    if (ch != '\n') {
  ------------------
  |  Branch (593:9): [True: 316k, False: 51.7k]
  ------------------
  594|   316k|        inString(ch);
  595|   316k|    }
  596|   368k|}
_ZN13QPDFTokenizer4inLtEc:
  600|   515k|{
  601|   515k|    if (ch == '<') {
  ------------------
  |  Branch (601:9): [True: 422k, False: 92.8k]
  ------------------
  602|   422k|        this->type = tt_dict_open;
  603|   422k|        this->state = st_token_ready;
  604|   422k|        return;
  605|   422k|    }
  606|       |
  607|  92.8k|    this->state = st_in_hexstring;
  608|  92.8k|    inHexstring(ch);
  609|  92.8k|}
_ZN13QPDFTokenizer4inGtEc:
  613|   351k|{
  614|   351k|    if (ch == '>') {
  ------------------
  |  Branch (614:9): [True: 345k, False: 6.46k]
  ------------------
  615|   345k|        this->type = tt_dict_close;
  616|   345k|        this->state = st_token_ready;
  617|   345k|    } else {
  618|  6.46k|        this->type = tt_bad;
  619|  6.46k|        QTC::TC("qpdf", "QPDFTokenizer bad >");
  620|  6.46k|        this->error_message = "unexpected >";
  621|  6.46k|        this->in_token = false;
  622|  6.46k|        this->char_to_unread = ch;
  623|  6.46k|        this->state = st_token_ready;
  624|  6.46k|    }
  625|   351k|}
_ZN13QPDFTokenizer9inLiteralEc:
  629|  36.0M|{
  630|  36.0M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (630:9): [True: 2.43M, False: 33.5M]
  ------------------
  631|       |        // A C-locale whitespace character or delimiter terminates token.  It is important to unread
  632|       |        // the whitespace character even though it is ignored since it may be the newline after a
  633|       |        // stream keyword.  Removing it here could make the stream-reading code break on some files,
  634|       |        // though not on any files in the test suite as of this writing.
  635|       |
  636|  2.43M|        this->in_token = false;
  637|  2.43M|        this->char_to_unread = ch;
  638|  2.43M|        this->state = st_token_ready;
  639|  2.43M|        this->type = (this->raw_val == "true") || (this->raw_val == "false")
  ------------------
  |  Branch (639:22): [True: 1.39k, False: 2.43M]
  |  Branch (639:51): [True: 792, False: 2.43M]
  ------------------
  640|  2.43M|            ? tt_bool
  641|  2.43M|            : (this->raw_val == "null" ? tt_null : tt_word);
  ------------------
  |  Branch (641:16): [True: 348k, False: 2.08M]
  ------------------
  642|  2.43M|    }
  643|  36.0M|}
_ZN13QPDFTokenizer11inHexstringEc:
  647|   477k|{
  648|   477k|    if (char hval = QUtil::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (648:49): [True: 241k, False: 235k]
  ------------------
  649|   241k|        this->char_code = int(hval) << 4;
  650|   241k|        this->state = st_in_hexstring_2nd;
  651|       |
  652|   241k|    } else if (ch == '>') {
  ------------------
  |  Branch (652:16): [True: 13.3k, False: 222k]
  ------------------
  653|  13.3k|        this->type = tt_string;
  654|  13.3k|        this->state = st_token_ready;
  655|       |
  656|   222k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (656:16): [True: 148k, False: 74.0k]
  ------------------
  657|       |        // ignore
  658|       |
  659|   148k|    } else {
  660|  74.0k|        this->type = tt_bad;
  661|  74.0k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
  662|  74.0k|        this->error_message = std::string("invalid character (") + ch + ") in hexstring";
  663|  74.0k|        this->state = st_token_ready;
  664|  74.0k|    }
  665|   477k|}
_ZN13QPDFTokenizer14inHexstring2ndEc:
  669|   272k|{
  670|   272k|    if (char hval = QUtil::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (670:49): [True: 236k, False: 36.0k]
  ------------------
  671|   236k|        this->val += char(this->char_code) | hval;
  672|   236k|        this->state = st_in_hexstring;
  673|       |
  674|   236k|    } else if (ch == '>') {
  ------------------
  |  Branch (674:16): [True: 604, False: 35.4k]
  ------------------
  675|       |        // PDF spec says odd hexstrings have implicit trailing 0.
  676|    604|        this->val += char(this->char_code);
  677|    604|        this->type = tt_string;
  678|    604|        this->state = st_token_ready;
  679|       |
  680|  35.4k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (680:16): [True: 34.2k, False: 1.22k]
  ------------------
  681|       |        // ignore
  682|       |
  683|  34.2k|    } else {
  684|  1.22k|        this->type = tt_bad;
  685|  1.22k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
  686|  1.22k|        this->error_message = std::string("invalid character (") + ch + ") in hexstring";
  687|  1.22k|        this->state = st_token_ready;
  688|  1.22k|    }
  689|   272k|}
_ZN13QPDFTokenizer10inCharCodeEc:
  693|  6.33k|{
  694|  6.33k|    bool handled = false;
  695|  6.33k|    if (('0' <= ch) && (ch <= '7')) {
  ------------------
  |  Branch (695:9): [True: 4.83k, False: 1.49k]
  |  Branch (695:24): [True: 3.45k, False: 1.38k]
  ------------------
  696|  3.45k|        this->char_code = 8 * this->char_code + (int(ch) - int('0'));
  697|  3.45k|        if (++(this->digit_count) < 3) {
  ------------------
  |  Branch (697:13): [True: 3.40k, False: 52]
  ------------------
  698|  3.40k|            return;
  699|  3.40k|        }
  700|     52|        handled = true;
  701|     52|    }
  702|       |    // We've accumulated \ddd or we have \d or \dd followed by other than an octal digit. The PDF
  703|       |    // Spec says to ignore high-order overflow.
  704|  2.92k|    this->val += char(this->char_code % 256);
  705|  2.92k|    this->state = st_in_string;
  706|  2.92k|    if (!handled) {
  ------------------
  |  Branch (706:9): [True: 2.87k, False: 52]
  ------------------
  707|  2.87k|        inString(ch);
  708|  2.87k|    }
  709|  2.92k|}
_ZN13QPDFTokenizer10presentEOFEv:
  724|  12.3k|{
  725|  12.3k|    switch (this->state) {
  726|  2.61k|    case st_name:
  ------------------
  |  Branch (726:5): [True: 2.61k, False: 9.73k]
  ------------------
  727|  2.61k|    case st_name_hex1:
  ------------------
  |  Branch (727:5): [True: 0, False: 12.3k]
  ------------------
  728|  2.61k|    case st_name_hex2:
  ------------------
  |  Branch (728:5): [True: 4, False: 12.3k]
  ------------------
  729|  3.07k|    case st_number:
  ------------------
  |  Branch (729:5): [True: 464, False: 11.8k]
  ------------------
  730|  3.08k|    case st_real:
  ------------------
  |  Branch (730:5): [True: 3, False: 12.3k]
  ------------------
  731|  3.08k|    case st_sign:
  ------------------
  |  Branch (731:5): [True: 7, False: 12.3k]
  ------------------
  732|  3.08k|    case st_decimal:
  ------------------
  |  Branch (732:5): [True: 1, False: 12.3k]
  ------------------
  733|  3.62k|    case st_literal:
  ------------------
  |  Branch (733:5): [True: 531, False: 11.8k]
  ------------------
  734|  3.62k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
  735|       |        // Push any delimiter to the state machine to finish off the final token.
  736|  3.62k|        presentCharacter('\f');
  737|  3.62k|        this->in_token = true;
  738|  3.62k|        break;
  739|       |
  740|      0|    case st_top:
  ------------------
  |  Branch (740:5): [True: 0, False: 12.3k]
  ------------------
  741|  7.28k|    case st_before_token:
  ------------------
  |  Branch (741:5): [True: 7.28k, False: 5.05k]
  ------------------
  742|  7.28k|        this->type = tt_eof;
  743|  7.28k|        break;
  744|       |
  745|      0|    case st_in_space:
  ------------------
  |  Branch (745:5): [True: 0, False: 12.3k]
  ------------------
  746|      0|        this->type = this->include_ignorable ? tt_space : tt_eof;
  ------------------
  |  Branch (746:22): [True: 0, False: 0]
  ------------------
  747|      0|        break;
  748|       |
  749|    453|    case st_in_comment:
  ------------------
  |  Branch (749:5): [True: 453, False: 11.8k]
  ------------------
  750|    453|        this->type = this->include_ignorable ? tt_comment : tt_bad;
  ------------------
  |  Branch (750:22): [True: 0, False: 453]
  ------------------
  751|    453|        break;
  752|       |
  753|      0|    case st_token_ready:
  ------------------
  |  Branch (753:5): [True: 0, False: 12.3k]
  ------------------
  754|      0|        break;
  755|       |
  756|    979|    default:
  ------------------
  |  Branch (756:5): [True: 979, False: 11.3k]
  ------------------
  757|    979|        QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
  758|    979|        this->type = tt_bad;
  759|    979|        this->error_message = "EOF while reading token";
  760|  12.3k|    }
  761|  12.3k|    this->state = st_token_ready;
  762|  12.3k|}
_ZN13QPDFTokenizer8getTokenERNS_5TokenERbRc:
  869|  4.61M|{
  870|  4.61M|    bool ready = (this->state == st_token_ready);
  871|  4.61M|    unread_char = !this->in_token && !this->before_token;
  ------------------
  |  Branch (871:19): [True: 3.65M, False: 966k]
  |  Branch (871:38): [True: 3.64M, False: 5.07k]
  ------------------
  872|  4.61M|    ch = this->char_to_unread;
  873|  4.61M|    if (ready) {
  ------------------
  |  Branch (873:9): [True: 4.61M, False: 0]
  ------------------
  874|  4.61M|        token = (!(this->type == tt_name || this->type == tt_string))
  ------------------
  |  Branch (874:20): [True: 551k, False: 4.06M]
  |  Branch (874:45): [True: 6.57k, False: 4.05M]
  ------------------
  875|  4.61M|            ? Token(this->type, this->raw_val, this->raw_val, this->error_message)
  876|  4.61M|            : Token(this->type, this->val, this->raw_val, this->error_message);
  877|       |
  878|  4.61M|        this->reset();
  879|  4.61M|    }
  880|  4.61M|    return ready;
  881|  4.61M|}
_ZN13QPDFTokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbm:
  892|  4.61M|{
  893|  4.61M|    nextToken(input, context, max_len);
  894|       |
  895|  4.61M|    Token token;
  896|  4.61M|    bool unread_char;
  897|  4.61M|    char char_to_unread;
  898|  4.61M|    getToken(token, unread_char, char_to_unread);
  899|       |
  900|  4.61M|    if (token.getType() == tt_bad) {
  ------------------
  |  Branch (900:9): [True: 572k, False: 4.04M]
  ------------------
  901|   572k|        if (allow_bad) {
  ------------------
  |  Branch (901:13): [True: 572k, False: 0]
  ------------------
  902|   572k|            QTC::TC("qpdf", "QPDFTokenizer allowing bad token");
  903|   572k|        } else {
  904|      0|            throw QPDFExc(
  905|      0|                qpdf_e_damaged_pdf,
  906|      0|                input.getName(),
  907|      0|                context.empty() ? "offset " + std::to_string(input.getLastOffset()) : context,
  ------------------
  |  Branch (907:17): [True: 0, False: 0]
  ------------------
  908|      0|                input.getLastOffset(),
  909|      0|                token.getErrorMessage());
  910|      0|        }
  911|   572k|    }
  912|  4.61M|    return token;
  913|  4.61M|}
_ZN13QPDFTokenizer9readTokenENSt3__110shared_ptrI11InputSourceEERKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEbm:
  918|  4.61M|{
  919|  4.61M|    return readToken(*input, context, allow_bad, max_len);
  920|  4.61M|}
_ZN13QPDFTokenizer9nextTokenER11InputSourceRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEm:
  924|  9.24M|{
  925|  9.24M|    if (this->state != st_inline_image) {
  ------------------
  |  Branch (925:9): [True: 9.24M, False: 0]
  ------------------
  926|  9.24M|        reset();
  927|  9.24M|    }
  928|  9.24M|    qpdf_offset_t offset = input.fastTell();
  929|       |
  930|   151M|    while (this->state != st_token_ready) {
  ------------------
  |  Branch (930:12): [True: 142M, False: 9.24M]
  ------------------
  931|   142M|        char ch;
  932|   142M|        if (!input.fastRead(ch)) {
  ------------------
  |  Branch (932:13): [True: 12.3k, False: 142M]
  ------------------
  933|  12.3k|            presentEOF();
  934|       |
  935|  12.3k|            if ((this->type == tt_eof) && (!this->allow_eof)) {
  ------------------
  |  Branch (935:17): [True: 7.28k, False: 5.05k]
  |  Branch (935:43): [True: 0, False: 7.28k]
  ------------------
  936|       |                // Nothing in the qpdf library calls readToken without allowEOF anymore, so this
  937|       |                // case is not exercised.
  938|      0|                this->type = tt_bad;
  939|      0|                this->error_message = "unexpected EOF";
  940|      0|                offset = input.getLastOffset();
  941|      0|            }
  942|   142M|        } else {
  943|   142M|            handleCharacter(ch);
  944|   142M|            if (this->before_token) {
  ------------------
  |  Branch (944:17): [True: 31.4M, False: 111M]
  ------------------
  945|  31.4M|                ++offset;
  946|  31.4M|            }
  947|   142M|            if (this->in_token) {
  ------------------
  |  Branch (947:17): [True: 103M, False: 38.9M]
  ------------------
  948|   103M|                this->raw_val += ch;
  949|   103M|            }
  950|   142M|            if (max_len && (this->raw_val.length() >= max_len) && (this->state != st_token_ready)) {
  ------------------
  |  Branch (950:17): [True: 34.0M, False: 108M]
  |  Branch (950:28): [True: 499k, False: 33.5M]
  |  Branch (950:67): [True: 497k, False: 2.64k]
  ------------------
  951|       |                // terminate this token now
  952|   497k|                QTC::TC("qpdf", "QPDFTokenizer block long token");
  953|   497k|                this->type = tt_bad;
  954|   497k|                this->state = st_token_ready;
  955|   497k|                this->error_message = "exceeded allowable length while reading token";
  956|   497k|            }
  957|   142M|        }
  958|   142M|    }
  959|       |
  960|  9.24M|    input.fastUnread(!this->in_token && !this->before_token);
  ------------------
  |  Branch (960:22): [True: 7.54M, False: 1.70M]
  |  Branch (960:41): [True: 7.53M, False: 7.74k]
  ------------------
  961|       |
  962|  9.24M|    if (this->type != tt_eof) {
  ------------------
  |  Branch (962:9): [True: 9.23M, False: 7.28k]
  ------------------
  963|  9.23M|        input.setLastOffset(offset);
  964|  9.23M|    }
  965|       |
  966|  9.24M|    return this->error_message.empty();
  967|  9.24M|}
QPDFTokenizer.cc:_ZL12is_delimiterc:
   18|  50.9M|{
   19|  50.9M|    return (
   20|  50.9M|        ch == ' ' || ch == '\n' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (20:9): [True: 4.30M, False: 46.6M]
  |  Branch (20:22): [True: 1.12M, False: 45.5M]
  |  Branch (20:36): [True: 887k, False: 44.6M]
  |  Branch (20:49): [True: 16.5k, False: 44.6M]
  |  Branch (20:62): [True: 10.6k, False: 44.6M]
  |  Branch (20:75): [True: 7.98k, False: 44.6M]
  |  Branch (20:88): [True: 3.60k, False: 44.5M]
  ------------------
   21|  50.9M|        ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch == '\t' || ch == '\r' ||
  ------------------
  |  Branch (21:9): [True: 23.0k, False: 44.5M]
  |  Branch (21:22): [True: 45.4k, False: 44.5M]
  |  Branch (21:35): [True: 26.1k, False: 44.5M]
  |  Branch (21:48): [True: 52.5k, False: 44.4M]
  |  Branch (21:61): [True: 15.5k, False: 44.4M]
  |  Branch (21:74): [True: 25.3k, False: 44.4M]
  |  Branch (21:88): [True: 846k, False: 43.5M]
  ------------------
   22|  50.9M|        ch == '\v' || ch == '\f' || ch == 0);
  ------------------
  |  Branch (22:9): [True: 21.0k, False: 43.5M]
  |  Branch (22:23): [True: 43.0k, False: 43.4M]
  |  Branch (22:37): [True: 77.2k, False: 43.4M]
  ------------------
   23|  50.9M|}

_ZN9QPDFValue9do_createEPS_:
    7|  2.90M|{
    8|  2.90M|    std::shared_ptr<QPDFObject> obj(new QPDFObject());
    9|  2.90M|    obj->value = std::shared_ptr<QPDFValue>(object);
   10|  2.90M|    return obj;
   11|  2.90M|}
_ZN9QPDFValue14getDescriptionEv:
   15|  22.5k|{
   16|  22.5k|    if (object_description) {
  ------------------
  |  Branch (16:9): [True: 10.5k, False: 11.9k]
  ------------------
   17|  10.5k|        switch (object_description->index()) {
  ------------------
  |  Branch (17:17): [True: 0, False: 10.5k]
  ------------------
   18|  10.4k|        case 0:
  ------------------
  |  Branch (18:9): [True: 10.4k, False: 63]
  ------------------
   19|  10.4k|            {
   20|       |                // Simple template string
   21|  10.4k|                auto description = std::get<0>(*object_description);
   22|       |
   23|  10.4k|                if (auto pos = description.find("$OG"); pos != std::string::npos) {
  ------------------
  |  Branch (23:57): [True: 0, False: 10.4k]
  ------------------
   24|      0|                    description.replace(pos, 3, og.unparse(' '));
   25|      0|                }
   26|  10.4k|                if (auto pos = description.find("$PO"); pos != std::string::npos) {
  ------------------
  |  Branch (26:57): [True: 9.12k, False: 1.37k]
  ------------------
   27|  9.12k|                    qpdf_offset_t shift = (type_code == ::ot_dictionary) ? 2
  ------------------
  |  Branch (27:43): [True: 5.37k, False: 3.75k]
  ------------------
   28|  9.12k|                        : (type_code == ::ot_array)                      ? 1
  ------------------
  |  Branch (28:27): [True: 62, False: 3.69k]
  ------------------
   29|  3.75k|                                                                         : 0;
   30|       |
   31|  9.12k|                    description.replace(pos, 3, std::to_string(parsed_offset + shift));
   32|  9.12k|                }
   33|  10.4k|                return description;
   34|      0|            }
   35|      0|        case 1:
  ------------------
  |  Branch (35:9): [True: 0, False: 10.5k]
  ------------------
   36|      0|            {
   37|       |                // QPDF::JSONReactor generated description
   38|      0|                auto j_descr = std::get<1>(*object_description);
   39|      0|                return (
   40|      0|                    *j_descr.input + (j_descr.object.empty() ? "" : ", " + j_descr.object) +
  ------------------
  |  Branch (40:39): [True: 0, False: 0]
  ------------------
   41|      0|                    " at offset " + std::to_string(parsed_offset));
   42|      0|            }
   43|     63|        case 2:
  ------------------
  |  Branch (43:9): [True: 63, False: 10.4k]
  ------------------
   44|     63|            {
   45|       |                // Child object description
   46|     63|                auto j_descr = std::get<2>(*object_description);
   47|     63|                std::string result;
   48|     63|                if (auto p = j_descr.parent.lock()) {
  ------------------
  |  Branch (48:26): [True: 63, False: 0]
  ------------------
   49|     63|                    result = p->getDescription();
   50|     63|                }
   51|     63|                result += j_descr.static_descr;
   52|     63|                if (auto pos = result.find("$VD"); pos != std::string::npos) {
  ------------------
  |  Branch (52:52): [True: 40, False: 23]
  ------------------
   53|     40|                    result.replace(pos, 3, j_descr.var_descr);
   54|     40|                }
   55|     63|                return result;
   56|      0|            }
   57|  10.5k|        }
   58|  11.9k|    } else if (og.isIndirect()) {
  ------------------
  |  Branch (58:16): [True: 3.17k, False: 8.77k]
  ------------------
   59|  3.17k|        return "object " + og.unparse(' ');
   60|  3.17k|    }
   61|  8.77k|    return {};
   62|  22.5k|}

_ZN10QPDFWriter7MembersC2ER4QPDF:
   54|  2.01k|{
   55|  2.01k|}
_ZN10QPDFWriter7MembersD2Ev:
   58|  2.00k|{
   59|  2.00k|    if (file && close_file) {
  ------------------
  |  Branch (59:9): [True: 0, False: 2.00k]
  |  Branch (59:17): [True: 0, False: 0]
  ------------------
   60|      0|        fclose(file);
   61|      0|    }
   62|  2.00k|    delete output_buffer;
   63|  2.00k|}
_ZN10QPDFWriterC2ER4QPDF:
   67|  2.01k|{
   68|  2.01k|}
_ZN10QPDFWriter17setOutputPipelineEP8Pipeline:
  137|  2.00k|{
  138|  2.00k|    m->filename = "custom pipeline";
  139|  2.00k|    initializePipelineStack(p);
  140|  2.00k|}
_ZN10QPDFWriter19setObjectStreamModeE20qpdf_object_stream_e:
  144|  2.00k|{
  145|  2.00k|    m->object_stream_mode = mode;
  146|  2.00k|}
_ZN10QPDFWriter14setDecodeLevelE26qpdf_stream_decode_level_e:
  180|  2.00k|{
  181|  2.00k|    m->stream_decode_level = val;
  182|  2.00k|    m->stream_decode_level_set = true;
  183|  2.00k|}
_ZN10QPDFWriter20setMinimumPDFVersionERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEi:
  218|  3.88k|{
  219|  3.88k|    bool set_version = false;
  220|  3.88k|    bool set_extension_level = false;
  221|  3.88k|    if (m->min_pdf_version.empty()) {
  ------------------
  |  Branch (221:9): [True: 1.95k, False: 1.93k]
  ------------------
  222|  1.95k|        set_version = true;
  223|  1.95k|        set_extension_level = true;
  224|  1.95k|    } else {
  225|  1.93k|        int old_major = 0;
  226|  1.93k|        int old_minor = 0;
  227|  1.93k|        int min_major = 0;
  228|  1.93k|        int min_minor = 0;
  229|  1.93k|        parseVersion(version, old_major, old_minor);
  230|  1.93k|        parseVersion(m->min_pdf_version, min_major, min_minor);
  231|  1.93k|        int compare = compareVersions(old_major, old_minor, min_major, min_minor);
  232|  1.93k|        if (compare > 0) {
  ------------------
  |  Branch (232:13): [True: 227, False: 1.70k]
  ------------------
  233|    227|            QTC::TC("qpdf", "QPDFWriter increasing minimum version", extension_level == 0 ? 0 : 1);
  ------------------
  |  Branch (233:70): [True: 227, False: 0]
  ------------------
  234|    227|            set_version = true;
  235|    227|            set_extension_level = true;
  236|  1.70k|        } else if (compare == 0) {
  ------------------
  |  Branch (236:20): [True: 44, False: 1.66k]
  ------------------
  237|     44|            if (extension_level > m->min_extension_level) {
  ------------------
  |  Branch (237:17): [True: 0, False: 44]
  ------------------
  238|      0|                QTC::TC("qpdf", "QPDFWriter increasing extension level");
  239|      0|                set_extension_level = true;
  240|      0|            }
  241|     44|        }
  242|  1.93k|    }
  243|       |
  244|  3.88k|    if (set_version) {
  ------------------
  |  Branch (244:9): [True: 2.17k, False: 1.70k]
  ------------------
  245|  2.17k|        m->min_pdf_version = version;
  246|  2.17k|    }
  247|  3.88k|    if (set_extension_level) {
  ------------------
  |  Branch (247:9): [True: 2.17k, False: 1.70k]
  ------------------
  248|  2.17k|        m->min_extension_level = extension_level;
  249|  2.17k|    }
  250|  3.88k|}
_ZN10QPDFWriter18setDeterministicIDEb:
  288|  2.00k|{
  289|  2.00k|    m->deterministic_id = val;
  290|  2.00k|}
_ZN10QPDFWriter16setLinearizationEb:
  314|  2.00k|{
  315|  2.00k|    m->linearized = val;
  316|  2.00k|    if (val) {
  ------------------
  |  Branch (316:9): [True: 2.00k, False: 0]
  ------------------
  317|  2.00k|        m->pclm = false;
  318|  2.00k|    }
  319|  2.00k|}
_ZNK10QPDFWriter12parseVersionERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERiS9_:
  745|  3.87k|{
  746|  3.87k|    major = QUtil::string_to_int(version.c_str());
  747|  3.87k|    minor = 0;
  748|  3.87k|    size_t p = version.find('.');
  749|  3.87k|    if ((p != std::string::npos) && (version.length() > p)) {
  ------------------
  |  Branch (749:9): [True: 3.87k, False: 0]
  |  Branch (749:37): [True: 3.87k, False: 0]
  ------------------
  750|  3.87k|        minor = QUtil::string_to_int(version.substr(p + 1).c_str());
  751|  3.87k|    }
  752|  3.87k|    std::string tmp = std::to_string(major) + "." + std::to_string(minor);
  753|  3.87k|    if (tmp != version) {
  ------------------
  |  Branch (753:9): [True: 1, False: 3.86k]
  ------------------
  754|       |        // The version number in the input is probably invalid. This happens with some files that
  755|       |        // are designed to exercise bugs, such as files in the fuzzer corpus. Unfortunately
  756|       |        // QPDFWriter doesn't have a way to give a warning, so we just ignore this case.
  757|      1|    }
  758|  3.87k|}
_ZNK10QPDFWriter15compareVersionsEiiii:
  762|  1.93k|{
  763|  1.93k|    if (major1 < major2) {
  ------------------
  |  Branch (763:9): [True: 9, False: 1.92k]
  ------------------
  764|      9|        return -1;
  765|  1.92k|    } else if (major1 > major2) {
  ------------------
  |  Branch (765:16): [True: 1, False: 1.92k]
  ------------------
  766|      1|        return 1;
  767|  1.92k|    } else if (minor1 < minor2) {
  ------------------
  |  Branch (767:16): [True: 1.65k, False: 270]
  ------------------
  768|  1.65k|        return -1;
  769|  1.65k|    } else if (minor1 > minor2) {
  ------------------
  |  Branch (769:16): [True: 226, False: 44]
  ------------------
  770|    226|        return 1;
  771|    226|    } else {
  772|     44|        return 0;
  773|     44|    }
  774|  1.93k|}
_ZN10QPDFWriter10setDataKeyEi:
  844|  89.6k|{
  845|  89.6k|    m->cur_data_key = QPDF::compute_data_key(
  846|  89.6k|        m->encryption_key, objid, 0, m->encrypt_use_aes, m->encryption_V, m->encryption_R);
  847|  89.6k|}
_ZN10QPDFWriter11bytesNeededEx:
  851|  18.2k|{
  852|  18.2k|    unsigned int bytes = 0;
  853|  45.8k|    while (n) {
  ------------------
  |  Branch (853:12): [True: 27.5k, False: 18.2k]
  ------------------
  854|  27.5k|        ++bytes;
  855|  27.5k|        n >>= 8;
  856|  27.5k|    }
  857|  18.2k|    return bytes;
  858|  18.2k|}
_ZN10QPDFWriter11writeBinaryEyj:
  862|   500k|{
  863|   500k|    if (bytes > sizeof(unsigned long long)) {
  ------------------
  |  Branch (863:9): [True: 0, False: 500k]
  ------------------
  864|      0|        throw std::logic_error("QPDFWriter::writeBinary called with too many bytes");
  865|      0|    }
  866|   500k|    unsigned char data[sizeof(unsigned long long)];
  867|  1.24M|    for (unsigned int i = 0; i < bytes; ++i) {
  ------------------
  |  Branch (867:30): [True: 747k, False: 500k]
  ------------------
  868|   747k|        data[bytes - i - 1] = static_cast<unsigned char>(val & 0xff);
  869|   747k|        val >>= 8;
  870|   747k|    }
  871|   500k|    m->pipeline->write(data, bytes);
  872|   500k|}
_ZN10QPDFWriter11writeStringENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  876|  9.59M|{
  877|  9.59M|    m->pipeline->write(reinterpret_cast<unsigned char const*>(str.data()), str.size());
  878|  9.59M|}
_ZN10QPDFWriter11writeBufferERNSt3__110shared_ptrI6BufferEE:
  882|  61.6k|{
  883|  61.6k|    m->pipeline->write(b->getBuffer(), b->getSize());
  884|  61.6k|}
_ZN10QPDFWriter14writeStringQDFENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  888|  2.70M|{
  889|  2.70M|    if (m->qdf_mode) {
  ------------------
  |  Branch (889:9): [True: 0, False: 2.70M]
  ------------------
  890|      0|        m->pipeline->write(reinterpret_cast<unsigned char const*>(str.data()), str.size());
  891|      0|    }
  892|  2.70M|}
_ZN10QPDFWriter16writeStringNoQDFENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  896|   137k|{
  897|   137k|    if (!m->qdf_mode) {
  ------------------
  |  Branch (897:9): [True: 137k, False: 0]
  ------------------
  898|   137k|        m->pipeline->write(reinterpret_cast<unsigned char const*>(str.data()), str.size());
  899|   137k|    }
  900|   137k|}
_ZN10QPDFWriter8writePadEm:
  904|  11.9k|{
  905|  11.9k|    writeString(std::string(nspaces, ' '));
  906|  11.9k|}
_ZN10QPDFWriter12pushPipelineEP8Pipeline:
  910|   114k|{
  911|   114k|    qpdf_assert_debug(dynamic_cast<Pl_Count*>(p) == nullptr);
  ------------------
  |  |   16|   114k|# define qpdf_assert_debug assert
  ------------------
  912|   114k|    m->pipeline_stack.push_back(p);
  913|   114k|    return p;
  914|   114k|}
_ZN10QPDFWriter23initializePipelineStackEP8Pipeline:
  918|  2.00k|{
  919|  2.00k|    m->pipeline = new Pl_Count("pipeline stack base", p);
  920|  2.00k|    m->to_delete.push_back(std::shared_ptr<Pipeline>(m->pipeline));
  921|  2.00k|    m->pipeline_stack.push_back(m->pipeline);
  922|  2.00k|}
_ZN10QPDFWriter21activatePipelineStackERNS_14PipelinePopperE:
  926|   156k|{
  927|   156k|    std::string stack_id("stack " + std::to_string(m->next_stack_id));
  928|   156k|    auto* c = new Pl_Count(stack_id.c_str(), m->pipeline_stack.back());
  929|   156k|    ++m->next_stack_id;
  930|   156k|    m->pipeline_stack.push_back(c);
  931|   156k|    m->pipeline = c;
  932|   156k|    pp.stack_id = stack_id;
  933|   156k|}
_ZN10QPDFWriter14PipelinePopperD2Ev:
  936|   156k|{
  937|   156k|    if (stack_id.empty()) {
  ------------------
  |  Branch (937:9): [True: 0, False: 156k]
  ------------------
  938|      0|        return;
  939|      0|    }
  940|   156k|    qpdf_assert_debug(qw->m->pipeline_stack.size() >= 2);
  ------------------
  |  |   16|   156k|# define qpdf_assert_debug assert
  ------------------
  941|   156k|    qw->m->pipeline->finish();
  942|   156k|    qpdf_assert_debug(dynamic_cast<Pl_Count*>(qw->m->pipeline_stack.back()) == qw->m->pipeline);
  ------------------
  |  |   16|   156k|# define qpdf_assert_debug assert
  ------------------
  943|       |    // It might be possible for this assertion to fail if writeLinearized exits by exception when
  944|       |    // deterministic ID, but I don't think so. As of this writing, this is the only case in which
  945|       |    // two dynamically allocated PipelinePopper objects ever exist at the same time, so the
  946|       |    // assertion will fail if they get popped out of order from automatic destruction.
  947|   156k|    qpdf_assert_debug(qw->m->pipeline->getIdentifier() == stack_id);
  ------------------
  |  |   16|   156k|# define qpdf_assert_debug assert
  ------------------
  948|   156k|    delete qw->m->pipeline_stack.back();
  949|   156k|    qw->m->pipeline_stack.pop_back();
  950|   270k|    while (dynamic_cast<Pl_Count*>(qw->m->pipeline_stack.back()) == nullptr) {
  ------------------
  |  Branch (950:12): [True: 114k, False: 156k]
  ------------------
  951|   114k|        Pipeline* p = qw->m->pipeline_stack.back();
  952|   114k|        if (dynamic_cast<Pl_MD5*>(p) == qw->m->md5_pipeline) {
  ------------------
  |  Branch (952:13): [True: 76.2k, False: 37.9k]
  ------------------
  953|  76.2k|            qw->m->md5_pipeline = nullptr;
  954|  76.2k|        }
  955|   114k|        qw->m->pipeline_stack.pop_back();
  956|   114k|        auto* buf = dynamic_cast<Pl_Buffer*>(p);
  957|   114k|        if (bp && buf) {
  ------------------
  |  Branch (957:13): [True: 75.6k, False: 38.4k]
  |  Branch (957:19): [True: 60.6k, False: 15.0k]
  ------------------
  958|  60.6k|            *bp = buf->getBufferSharedPointer();
  959|  60.6k|        }
  960|   114k|        delete p;
  961|   114k|    }
  962|   156k|    qw->m->pipeline = dynamic_cast<Pl_Count*>(qw->m->pipeline_stack.back());
  963|   156k|}
_ZN10QPDFWriter21adjustAESStreamLengthERm:
  967|  54.5k|{
  968|  54.5k|    if (m->encrypted && (!m->cur_data_key.empty()) && m->encrypt_use_aes) {
  ------------------
  |  Branch (968:9): [True: 0, False: 54.5k]
  |  Branch (968:25): [True: 0, False: 0]
  |  Branch (968:55): [True: 0, False: 0]
  ------------------
  969|       |        // Stream length will be padded with 1 to 16 bytes to end up as a multiple of 16.  It will
  970|       |        // also be prepended by 16 bits of random data.
  971|      0|        length += 32 - (length & 0xf);
  972|      0|    }
  973|  54.5k|}
_ZN10QPDFWriter20pushEncryptionFilterERNS_14PipelinePopperE:
  977|  54.5k|{
  978|  54.5k|    if (m->encrypted && (!m->cur_data_key.empty())) {
  ------------------
  |  Branch (978:9): [True: 0, False: 54.5k]
  |  Branch (978:25): [True: 0, False: 0]
  ------------------
  979|      0|        Pipeline* p = nullptr;
  980|      0|        if (m->encrypt_use_aes) {
  ------------------
  |  Branch (980:13): [True: 0, False: 0]
  ------------------
  981|      0|            p = new Pl_AES_PDF(
  982|      0|                "aes stream encryption",
  983|      0|                m->pipeline,
  984|      0|                true,
  985|      0|                QUtil::unsigned_char_pointer(m->cur_data_key),
  986|      0|                m->cur_data_key.length());
  987|      0|        } else {
  988|      0|            p = new Pl_RC4(
  989|      0|                "rc4 stream encryption",
  990|      0|                m->pipeline,
  991|      0|                QUtil::unsigned_char_pointer(m->cur_data_key),
  992|      0|                QIntC::to_int(m->cur_data_key.length()));
  993|      0|        }
  994|      0|        pushPipeline(p);
  995|      0|    }
  996|       |    // Must call this unconditionally so we can call popPipelineStack to balance
  997|       |    // pushEncryptionFilter().
  998|  54.5k|    activatePipelineStack(pp);
  999|  54.5k|}
_ZN10QPDFWriter17pushDiscardFilterERNS_14PipelinePopperE:
 1003|  7.89k|{
 1004|  7.89k|    pushPipeline(new Pl_Discard());
 1005|  7.89k|    activatePipelineStack(pp);
 1006|  7.89k|}
_ZN10QPDFWriter15pushMD5PipelineERNS_14PipelinePopperE:
 1010|  1.80k|{
 1011|  1.80k|    if (!m->id2.empty()) {
  ------------------
  |  Branch (1011:9): [True: 0, False: 1.80k]
  ------------------
 1012|       |        // Can't happen in the code
 1013|      0|        throw std::logic_error("Deterministic ID computation enabled after ID"
 1014|      0|                               " generation has already occurred.");
 1015|      0|    }
 1016|  1.80k|    qpdf_assert_debug(m->deterministic_id);
  ------------------
  |  |   16|  1.80k|# define qpdf_assert_debug assert
  ------------------
 1017|  1.80k|    qpdf_assert_debug(m->md5_pipeline == nullptr);
  ------------------
  |  |   16|  1.80k|# define qpdf_assert_debug assert
  ------------------
 1018|  1.80k|    qpdf_assert_debug(m->pipeline->getCount() == 0);
  ------------------
  |  |   16|  1.80k|# define qpdf_assert_debug assert
  ------------------
 1019|  1.80k|    m->md5_pipeline = new Pl_MD5("qpdf md5", m->pipeline);
 1020|  1.80k|    m->md5_pipeline->persistAcrossFinish(true);
 1021|       |    // Special case code in popPipelineStack clears m->md5_pipeline upon deletion.
 1022|  1.80k|    pushPipeline(m->md5_pipeline);
 1023|  1.80k|    activatePipelineStack(pp);
 1024|  1.80k|}
_ZN10QPDFWriter26computeDeterministicIDDataEv:
 1028|  1.43k|{
 1029|  1.43k|    qpdf_assert_debug(m->md5_pipeline != nullptr);
  ------------------
  |  |   16|  1.43k|# define qpdf_assert_debug assert
  ------------------
 1030|  1.43k|    qpdf_assert_debug(m->deterministic_id_data.empty());
  ------------------
  |  |   16|  1.43k|# define qpdf_assert_debug assert
  ------------------
 1031|  1.43k|    m->deterministic_id_data = m->md5_pipeline->getHexDigest();
 1032|  1.43k|    m->md5_pipeline->enable(false);
 1033|  1.43k|}
_ZN10QPDFWriter10openObjectEi:
 1037|  98.9k|{
 1038|  98.9k|    if (objid == 0) {
  ------------------
  |  Branch (1038:9): [True: 0, False: 98.9k]
  ------------------
 1039|      0|        objid = m->next_objid++;
 1040|      0|    }
 1041|  98.9k|    m->new_obj[objid].xref = QPDFXRefEntry(m->pipeline->getCount());
 1042|  98.9k|    writeString(std::to_string(objid));
 1043|  98.9k|    writeString(" 0 obj\n");
 1044|  98.9k|    return objid;
 1045|  98.9k|}
_ZN10QPDFWriter11closeObjectEi:
 1049|  98.5k|{
 1050|       |    // Write a newline before endobj as it makes the file easier to repair.
 1051|  98.5k|    writeString("\nendobj\n");
 1052|  98.5k|    writeStringQDF("\n");
 1053|  98.5k|    auto& new_obj = m->new_obj[objid];
 1054|  98.5k|    new_obj.length = m->pipeline->getCount() - new_obj.xref.getOffset();
 1055|  98.5k|}
_ZN10QPDFWriter29assignCompressedObjectNumbersERK10QPDFObjGen:
 1059|  48.9k|{
 1060|  48.9k|    int objid = og.getObj();
 1061|  48.9k|    if ((og.getGen() != 0) || (m->object_stream_to_objects.count(objid) == 0)) {
  ------------------
  |  Branch (1061:9): [True: 14, False: 48.9k]
  |  Branch (1061:31): [True: 47.0k, False: 1.89k]
  ------------------
 1062|       |        // This is not an object stream.
 1063|  47.0k|        return;
 1064|  47.0k|    }
 1065|       |
 1066|       |    // Reserve numbers for the objects that belong to this object stream.
 1067|  33.0k|    for (auto const& iter: m->object_stream_to_objects[objid]) {
  ------------------
  |  Branch (1067:26): [True: 33.0k, False: 1.89k]
  ------------------
 1068|  33.0k|        m->obj[iter].renumber = m->next_objid++;
 1069|  33.0k|    }
 1070|  1.89k|}
_ZN10QPDFWriter13enqueueObjectE16QPDFObjectHandle:
 1074|  48.9k|{
 1075|  48.9k|    if (object.isIndirect()) {
  ------------------
  |  Branch (1075:9): [True: 48.9k, False: 0]
  ------------------
 1076|       |        // This owner check can only be done for indirect objects. It is possible for a direct
 1077|       |        // object to have an owning QPDF that is from another file if a direct QPDFObjectHandle from
 1078|       |        // one file was insert into another file without copying. Doing that is safe even if the
 1079|       |        // original QPDF gets destroyed, which just disconnects the QPDFObjectHandle from its owner.
 1080|  48.9k|        if (object.getOwningQPDF() != &(m->pdf)) {
  ------------------
  |  Branch (1080:13): [True: 0, False: 48.9k]
  ------------------
 1081|      0|            QTC::TC("qpdf", "QPDFWriter foreign object");
 1082|      0|            throw std::logic_error("QPDFObjectHandle from different QPDF found while writing.  Use "
 1083|      0|                                   "QPDF::copyForeignObject to add objects from another file.");
 1084|      0|        }
 1085|       |
 1086|  48.9k|        if (m->qdf_mode && object.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (1086:13): [True: 0, False: 48.9k]
  |  Branch (1086:13): [True: 0, False: 48.9k]
  |  Branch (1086:28): [True: 0, False: 0]
  ------------------
 1087|       |            // As a special case, do not output any extraneous XRef streams in QDF mode. Doing so
 1088|       |            // will confuse fix-qdf, which expects to see only one XRef stream at the end of the
 1089|       |            // file. This case can occur when creating a QDF from a file with object streams when
 1090|       |            // preserving unreferenced objects since the old cross reference streams are not
 1091|       |            // actually referenced by object number.
 1092|      0|            QTC::TC("qpdf", "QPDFWriter ignore XRef in qdf mode");
 1093|      0|            return;
 1094|      0|        }
 1095|       |
 1096|  48.9k|        QPDFObjGen og = object.getObjGen();
 1097|  48.9k|        auto& obj = m->obj[og];
 1098|       |
 1099|  48.9k|        if (obj.renumber == 0) {
  ------------------
  |  Branch (1099:13): [True: 48.9k, False: 0]
  ------------------
 1100|  48.9k|            if (obj.object_stream > 0) {
  ------------------
  |  Branch (1100:17): [True: 0, False: 48.9k]
  ------------------
 1101|       |                // This is in an object stream.  Don't process it here.  Instead, enqueue the object
 1102|       |                // stream.  Object streams always have generation 0.
 1103|       |                // Detect loops by storing invalid object ID -1, which will get overwritten later.
 1104|      0|                obj.renumber = -1;
 1105|      0|                enqueueObject(m->pdf.getObject(obj.object_stream, 0));
 1106|  48.9k|            } else {
 1107|  48.9k|                m->object_queue.push_back(object);
 1108|  48.9k|                obj.renumber = m->next_objid++;
 1109|       |
 1110|  48.9k|                if ((og.getGen() == 0) && m->object_stream_to_objects.count(og.getObj())) {
  ------------------
  |  Branch (1110:21): [True: 48.9k, False: 14]
  |  Branch (1110:21): [True: 1.89k, False: 47.0k]
  |  Branch (1110:43): [True: 1.89k, False: 47.0k]
  ------------------
 1111|       |                    // For linearized files, uncompressed objects go at end, and we take care of
 1112|       |                    // assigning numbers to them elsewhere.
 1113|  1.89k|                    if (!m->linearized) {
  ------------------
  |  Branch (1113:25): [True: 0, False: 1.89k]
  ------------------
 1114|      0|                        assignCompressedObjectNumbers(og);
 1115|      0|                    }
 1116|  47.0k|                } else if ((!m->direct_stream_lengths) && object.isStream()) {
  ------------------
  |  Branch (1116:28): [True: 0, False: 47.0k]
  |  Branch (1116:59): [True: 0, False: 0]
  ------------------
 1117|       |                    // reserve next object ID for length
 1118|      0|                    ++m->next_objid;
 1119|      0|                }
 1120|  48.9k|            }
 1121|  48.9k|        } else if (obj.renumber == -1) {
  ------------------
  |  Branch (1121:20): [True: 0, False: 0]
  ------------------
 1122|       |            // This can happen if a specially constructed file indicates that an object stream is
 1123|       |            // inside itself.
 1124|      0|        }
 1125|  48.9k|        return;
 1126|  48.9k|    } else if (!m->linearized) {
  ------------------
  |  Branch (1126:16): [True: 0, False: 0]
  ------------------
 1127|      0|        if (object.isArray()) {
  ------------------
  |  Branch (1127:13): [True: 0, False: 0]
  ------------------
 1128|      0|            for (auto& item: object.getArrayAsVector()) {
  ------------------
  |  Branch (1128:28): [True: 0, False: 0]
  ------------------
 1129|      0|                enqueueObject(item);
 1130|      0|            }
 1131|      0|        } else if (object.isDictionary()) {
  ------------------
  |  Branch (1131:20): [True: 0, False: 0]
  ------------------
 1132|      0|            for (auto& item: object.getDictAsMap()) {
  ------------------
  |  Branch (1132:28): [True: 0, False: 0]
  ------------------
 1133|      0|                if (!item.second.isNull()) {
  ------------------
  |  Branch (1133:21): [True: 0, False: 0]
  ------------------
 1134|      0|                    enqueueObject(item.second);
 1135|      0|                }
 1136|      0|            }
 1137|      0|        }
 1138|      0|    } else {
 1139|       |        // ignore
 1140|      0|    }
 1141|  48.9k|}
_ZN10QPDFWriter12unparseChildE16QPDFObjectHandleii:
 1145|  2.34M|{
 1146|  2.34M|    if (!m->linearized) {
  ------------------
  |  Branch (1146:9): [True: 0, False: 2.34M]
  ------------------
 1147|      0|        enqueueObject(child);
 1148|      0|    }
 1149|  2.34M|    if (child.isIndirect()) {
  ------------------
  |  Branch (1149:9): [True: 480k, False: 1.86M]
  ------------------
 1150|   480k|        writeString(std::to_string(m->obj[child].renumber));
 1151|   480k|        writeString(" 0 R");
 1152|  1.86M|    } else {
 1153|  1.86M|        unparseObject(child, level, flags);
 1154|  1.86M|    }
 1155|  2.34M|}
_ZN10QPDFWriter12writeTrailerENS_9trailer_eEibxi:
 1160|  6.08k|{
 1161|  6.08k|    QPDFObjectHandle trailer = getTrimmedTrailer();
 1162|  6.08k|    if (xref_stream) {
  ------------------
  |  Branch (1162:9): [True: 6.08k, False: 0]
  ------------------
 1163|  6.08k|        m->cur_data_key.clear();
 1164|  6.08k|    } else {
 1165|      0|        writeString("trailer <<");
 1166|      0|    }
 1167|  6.08k|    writeStringQDF("\n");
 1168|  6.08k|    if (which == t_lin_second) {
  ------------------
  |  Branch (1168:9): [True: 2.84k, False: 3.23k]
  ------------------
 1169|  2.84k|        writeString(" /Size ");
 1170|  2.84k|        writeString(std::to_string(size));
 1171|  3.23k|    } else {
 1172|  12.2k|        for (auto const& key: trailer.getKeys()) {
  ------------------
  |  Branch (1172:29): [True: 12.2k, False: 3.23k]
  ------------------
 1173|  12.2k|            writeStringQDF("  ");
 1174|  12.2k|            writeStringNoQDF(" ");
 1175|  12.2k|            writeString(QPDF_Name::normalizeName(key));
 1176|  12.2k|            writeString(" ");
 1177|  12.2k|            if (key == "/Size") {
  ------------------
  |  Branch (1177:17): [True: 3.03k, False: 9.25k]
  ------------------
 1178|  3.03k|                writeString(std::to_string(size));
 1179|  3.03k|                if (which == t_lin_first) {
  ------------------
  |  Branch (1179:21): [True: 3.03k, False: 0]
  ------------------
 1180|  3.03k|                    writeString(" /Prev ");
 1181|  3.03k|                    qpdf_offset_t pos = m->pipeline->getCount();
 1182|  3.03k|                    writeString(std::to_string(prev));
 1183|  3.03k|                    writePad(QIntC::to_size(pos - m->pipeline->getCount() + 21));
 1184|  3.03k|                }
 1185|  9.25k|            } else {
 1186|  9.25k|                unparseChild(trailer.getKey(key), 1, 0);
 1187|  9.25k|            }
 1188|  12.2k|            writeStringQDF("\n");
 1189|  12.2k|        }
 1190|  3.23k|    }
 1191|       |
 1192|       |    // Write ID
 1193|  6.08k|    writeStringQDF(" ");
 1194|  6.08k|    writeString(" /ID [");
 1195|  6.08k|    if (linearization_pass == 1) {
  ------------------
  |  Branch (1195:9): [True: 3.23k, False: 2.84k]
  ------------------
 1196|  3.23k|        std::string original_id1 = getOriginalID1();
 1197|  3.23k|        if (original_id1.empty()) {
  ------------------
  |  Branch (1197:13): [True: 368, False: 2.86k]
  ------------------
 1198|    368|            writeString("<00000000000000000000000000000000>");
 1199|  2.86k|        } else {
 1200|       |            // Write a string of zeroes equal in length to the representation of the original ID.
 1201|       |            // While writing the original ID would have the same number of bytes, it would cause a
 1202|       |            // change to the deterministic ID generated by older versions of the software that
 1203|       |            // hard-coded the length of the ID to 16 bytes.
 1204|  2.86k|            writeString("<");
 1205|  2.86k|            size_t len = QPDF_String(original_id1).unparse(true).length() - 2;
 1206|  83.3k|            for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (1206:32): [True: 80.4k, False: 2.86k]
  ------------------
 1207|  80.4k|                writeString("0");
 1208|  80.4k|            }
 1209|  2.86k|            writeString(">");
 1210|  2.86k|        }
 1211|  3.23k|        writeString("<00000000000000000000000000000000>");
 1212|  3.23k|    } else {
 1213|  2.84k|        if ((linearization_pass == 0) && (m->deterministic_id)) {
  ------------------
  |  Branch (1213:13): [True: 0, False: 2.84k]
  |  Branch (1213:42): [True: 0, False: 0]
  ------------------
 1214|      0|            computeDeterministicIDData();
 1215|      0|        }
 1216|  2.84k|        generateID();
 1217|  2.84k|        writeString(QPDF_String(m->id1).unparse(true));
 1218|  2.84k|        writeString(QPDF_String(m->id2).unparse(true));
 1219|  2.84k|    }
 1220|  6.08k|    writeString("]");
 1221|       |
 1222|  6.08k|    if (which != t_lin_second) {
  ------------------
  |  Branch (1222:9): [True: 2.87k, False: 3.21k]
  ------------------
 1223|       |        // Write reference to encryption dictionary
 1224|  2.87k|        if (m->encrypted) {
  ------------------
  |  Branch (1224:13): [True: 0, False: 2.87k]
  ------------------
 1225|      0|            writeString(" /Encrypt ");
 1226|      0|            writeString(std::to_string(m->encryption_dict_objid));
 1227|      0|            writeString(" 0 R");
 1228|      0|        }
 1229|  2.87k|    }
 1230|       |
 1231|  6.08k|    writeStringQDF("\n");
 1232|  6.08k|    writeStringNoQDF(" ");
 1233|  6.08k|    writeString(">>");
 1234|  6.08k|}
_ZN10QPDFWriter16willFilterStreamE16QPDFObjectHandleRbS1_PNSt3__110shared_ptrI6BufferEE:
 1242|  79.2k|{
 1243|  79.2k|    compress_stream = false;
 1244|  79.2k|    is_metadata = false;
 1245|       |
 1246|  79.2k|    QPDFObjGen old_og = stream.getObjGen();
 1247|  79.2k|    QPDFObjectHandle stream_dict = stream.getDict();
 1248|       |
 1249|  79.2k|    if (stream_dict.isDictionaryOfType("/Metadata")) {
  ------------------
  |  Branch (1249:9): [True: 2.11k, False: 77.1k]
  ------------------
 1250|  2.11k|        is_metadata = true;
 1251|  2.11k|    }
 1252|  79.2k|    bool filter = (stream.isDataModified() || m->compress_streams || m->stream_decode_level);
  ------------------
  |  Branch (1252:20): [True: 0, False: 79.2k]
  |  Branch (1252:47): [True: 79.2k, False: 0]
  |  Branch (1252:70): [True: 0, False: 0]
  ------------------
 1253|  79.2k|    bool filter_on_write = stream.getFilterOnWrite();
 1254|  79.2k|    if (!filter_on_write) {
  ------------------
  |  Branch (1254:9): [True: 4.22k, False: 75.0k]
  ------------------
 1255|  4.22k|        QTC::TC("qpdf", "QPDFWriter getFilterOnWrite false");
 1256|  4.22k|        filter = false;
 1257|  4.22k|    }
 1258|  79.2k|    if (filter_on_write && m->compress_streams) {
  ------------------
  |  Branch (1258:9): [True: 75.0k, False: 4.22k]
  |  Branch (1258:28): [True: 75.0k, False: 0]
  ------------------
 1259|       |        // Don't filter if the stream is already compressed with FlateDecode. This way we don't make
 1260|       |        // it worse if the original file used a better Flate algorithm, and we don't spend time and
 1261|       |        // CPU cycles uncompressing and recompressing stuff. This can be overridden with
 1262|       |        // setRecompressFlate(true).
 1263|  75.0k|        QPDFObjectHandle filter_obj = stream_dict.getKey("/Filter");
 1264|  75.0k|        if ((!m->recompress_flate) && (!stream.isDataModified()) && filter_obj.isName() &&
  ------------------
  |  Branch (1264:13): [True: 75.0k, False: 0]
  |  Branch (1264:13): [True: 38.2k, False: 36.8k]
  |  Branch (1264:39): [True: 75.0k, False: 0]
  |  Branch (1264:69): [True: 41.1k, False: 33.8k]
  ------------------
 1265|  75.0k|            ((filter_obj.getName() == "/FlateDecode") || (filter_obj.getName() == "/Fl"))) {
  ------------------
  |  Branch (1265:14): [True: 38.2k, False: 2.93k]
  |  Branch (1265:58): [True: 7, False: 2.93k]
  ------------------
 1266|  38.2k|            QTC::TC("qpdf", "QPDFWriter not recompressing /FlateDecode");
 1267|  38.2k|            filter = false;
 1268|  38.2k|        }
 1269|  75.0k|    }
 1270|  79.2k|    bool normalize = false;
 1271|  79.2k|    bool uncompress = false;
 1272|  79.2k|    if (filter_on_write && is_metadata && ((!m->encrypted) || (m->encrypt_metadata == false))) {
  ------------------
  |  Branch (1272:9): [True: 75.0k, False: 4.22k]
  |  Branch (1272:28): [True: 2.11k, False: 72.9k]
  |  Branch (1272:44): [True: 2.11k, False: 0]
  |  Branch (1272:63): [True: 0, False: 0]
  ------------------
 1273|  2.11k|        QTC::TC("qpdf", "QPDFWriter not compressing metadata");
 1274|  2.11k|        filter = true;
 1275|  2.11k|        compress_stream = false;
 1276|  2.11k|        uncompress = true;
 1277|  77.1k|    } else if (filter_on_write && m->normalize_content && m->normalized_streams.count(old_og)) {
  ------------------
  |  Branch (1277:16): [True: 72.9k, False: 4.22k]
  |  Branch (1277:35): [True: 0, False: 72.9k]
  |  Branch (1277:59): [True: 0, False: 0]
  ------------------
 1278|      0|        normalize = true;
 1279|      0|        filter = true;
 1280|  77.1k|    } else if (filter_on_write && filter && m->compress_streams) {
  ------------------
  |  Branch (1280:16): [True: 72.9k, False: 4.22k]
  |  Branch (1280:35): [True: 34.6k, False: 38.2k]
  |  Branch (1280:45): [True: 34.6k, False: 0]
  ------------------
 1281|  34.6k|        compress_stream = true;
 1282|  34.6k|        QTC::TC("qpdf", "QPDFWriter compressing uncompressed stream");
 1283|  34.6k|    }
 1284|       |
 1285|  79.2k|    bool filtered = false;
 1286|  81.9k|    for (int attempt = 1; attempt <= 2; ++attempt) {
  ------------------
  |  Branch (1286:27): [True: 81.9k, False: 0]
  ------------------
 1287|  81.9k|        pushPipeline(new Pl_Buffer("stream data"));
 1288|  81.9k|        PipelinePopper pp_stream_data(this, stream_data);
 1289|  81.9k|        activatePipelineStack(pp_stream_data);
 1290|  81.9k|        try {
 1291|  81.9k|            filtered = stream.pipeStreamData(
 1292|  81.9k|                m->pipeline,
 1293|  81.9k|                (((filter && normalize) ? qpdf_ef_normalize : 0) |
  ------------------
  |  Branch (1293:20): [True: 36.8k, False: 45.1k]
  |  Branch (1293:30): [True: 0, False: 36.8k]
  ------------------
 1294|  81.9k|                 ((filter && compress_stream) ? qpdf_ef_compress : 0)),
  ------------------
  |  Branch (1294:20): [True: 36.8k, False: 45.1k]
  |  Branch (1294:30): [True: 34.6k, False: 2.11k]
  ------------------
 1295|  81.9k|                (filter ? (uncompress ? qpdf_dl_all : m->stream_decode_level) : qpdf_dl_none),
  ------------------
  |  Branch (1295:18): [True: 36.8k, False: 45.1k]
  |  Branch (1295:28): [True: 2.11k, False: 34.6k]
  ------------------
 1296|  81.9k|                false,
 1297|  81.9k|                (attempt == 1));
 1298|  81.9k|        } catch (std::runtime_error& e) {
 1299|     48|            throw std::runtime_error(
 1300|     48|                "error while getting stream data for " + stream.unparse() + ": " + e.what());
 1301|     48|        }
 1302|  81.8k|        if (filter && !filtered) {
  ------------------
  |  Branch (1302:13): [True: 36.7k, False: 45.1k]
  |  Branch (1302:23): [True: 2.63k, False: 34.1k]
  ------------------
 1303|       |            // Try again
 1304|  2.63k|            filter = false;
 1305|  2.63k|            stream.setFilterOnWrite(false);
 1306|  79.2k|        } else {
 1307|  79.2k|            break;
 1308|  79.2k|        }
 1309|  81.8k|    }
 1310|  79.2k|    if (!filtered) {
  ------------------
  |  Branch (1310:9): [True: 45.1k, False: 34.1k]
  ------------------
 1311|  45.1k|        compress_stream = false;
 1312|  45.1k|    }
 1313|  79.2k|    return filtered;
 1314|  79.2k|}
_ZN10QPDFWriter13unparseObjectE16QPDFObjectHandleiimb:
 1319|  2.11M|{
 1320|  2.11M|    QPDFObjGen old_og = object.getObjGen();
 1321|  2.11M|    int child_flags = flags & ~f_stream;
 1322|  2.11M|    if (level < 0) {
  ------------------
  |  Branch (1322:9): [True: 0, False: 2.11M]
  ------------------
 1323|      0|        throw std::logic_error("invalid level in QPDFWriter::unparseObject");
 1324|      0|    }
 1325|       |    // For non-qdf, "indent" is a single space between tokens. For qdf, indent includes the
 1326|       |    // preceding newline.
 1327|  2.11M|    std::string indent = " ";
 1328|  2.11M|    if (m->qdf_mode) {
  ------------------
  |  Branch (1328:9): [True: 0, False: 2.11M]
  ------------------
 1329|      0|        indent.append(static_cast<size_t>(2 * level), ' ');
 1330|      0|        indent[0] = '\n';
 1331|      0|    }
 1332|       |
 1333|  2.11M|    if (auto const tc = object.getTypeCode(); tc == ::ot_array) {
  ------------------
  |  Branch (1333:47): [True: 130k, False: 1.98M]
  ------------------
 1334|       |        // Note: PDF spec 1.4 implementation note 121 states that Acrobat requires a space after the
 1335|       |        // [ in the /H key of the linearization parameter dictionary.  We'll do this unconditionally
 1336|       |        // for all arrays because it looks nicer and doesn't make the files that much bigger.
 1337|   130k|        writeString("[");
 1338|  1.33M|        for (auto const& item: object.getArrayAsVector()) {
  ------------------
  |  Branch (1338:30): [True: 1.33M, False: 130k]
  ------------------
 1339|  1.33M|            writeString(indent);
 1340|  1.33M|            writeStringQDF("  ");
 1341|  1.33M|            unparseChild(item, level + 1, child_flags);
 1342|  1.33M|        }
 1343|   130k|        writeString(indent);
 1344|   130k|        writeString("]");
 1345|  1.98M|    } else if (tc == ::ot_dictionary) {
  ------------------
  |  Branch (1345:16): [True: 294k, False: 1.69M]
  ------------------
 1346|       |        // Make a shallow copy of this object so we can modify it safely without affecting the
 1347|       |        // original. This code has logic to skip certain keys in agreement with prepareFileForWrite
 1348|       |        // and with skip_stream_parameters so that replacing them doesn't leave unreferenced objects
 1349|       |        // in the output. We can use unsafeShallowCopy here because all we are doing is removing or
 1350|       |        // replacing top-level keys.
 1351|   294k|        object = object.unsafeShallowCopy();
 1352|       |
 1353|       |        // Handle special cases for specific dictionaries.
 1354|       |
 1355|       |        // Extensions dictionaries.
 1356|       |
 1357|       |        // We have one of several cases:
 1358|       |        //
 1359|       |        // * We need ADBE
 1360|       |        //    - We already have Extensions
 1361|       |        //       - If it has the right ADBE, preserve it
 1362|       |        //       - Otherwise, replace ADBE
 1363|       |        //    - We don't have Extensions: create one from scratch
 1364|       |        // * We don't want ADBE
 1365|       |        //    - We already have Extensions
 1366|       |        //       - If it only has ADBE, remove it
 1367|       |        //       - If it has other things, keep those and remove ADBE
 1368|       |        //    - We have no extensions: no action required
 1369|       |        //
 1370|       |        // Before writing, we guarantee that /Extensions, if present, is direct through the ADBE
 1371|       |        // dictionary, so we can modify in place.
 1372|       |
 1373|   294k|        const bool is_root = (old_og == m->root_og);
 1374|   294k|        bool have_extensions_other = false;
 1375|   294k|        bool have_extensions_adbe = false;
 1376|       |
 1377|   294k|        QPDFObjectHandle extensions;
 1378|   294k|        if (is_root) {
  ------------------
  |  Branch (1378:13): [True: 2.87k, False: 291k]
  ------------------
 1379|  2.87k|            if (object.hasKey("/Extensions") && object.getKey("/Extensions").isDictionary()) {
  ------------------
  |  Branch (1379:17): [True: 0, False: 2.87k]
  |  Branch (1379:17): [True: 0, False: 2.87k]
  |  Branch (1379:49): [True: 0, False: 0]
  ------------------
 1380|      0|                extensions = object.getKey("/Extensions");
 1381|      0|            }
 1382|  2.87k|        }
 1383|       |
 1384|   294k|        if (extensions.isInitialized()) {
  ------------------
  |  Branch (1384:13): [True: 0, False: 294k]
  ------------------
 1385|      0|            std::set<std::string> keys = extensions.getKeys();
 1386|      0|            if (keys.count("/ADBE") > 0) {
  ------------------
  |  Branch (1386:17): [True: 0, False: 0]
  ------------------
 1387|      0|                have_extensions_adbe = true;
 1388|      0|                keys.erase("/ADBE");
 1389|      0|            }
 1390|      0|            if (keys.size() > 0) {
  ------------------
  |  Branch (1390:17): [True: 0, False: 0]
  ------------------
 1391|      0|                have_extensions_other = true;
 1392|      0|            }
 1393|      0|        }
 1394|       |
 1395|   294k|        bool need_extensions_adbe = (m->final_extension_level > 0);
 1396|       |
 1397|   294k|        if (is_root) {
  ------------------
  |  Branch (1397:13): [True: 2.87k, False: 291k]
  ------------------
 1398|  2.87k|            if (need_extensions_adbe) {
  ------------------
  |  Branch (1398:17): [True: 0, False: 2.87k]
  ------------------
 1399|      0|                if (!(have_extensions_other || have_extensions_adbe)) {
  ------------------
  |  Branch (1399:23): [True: 0, False: 0]
  |  Branch (1399:48): [True: 0, False: 0]
  ------------------
 1400|       |                    // We need Extensions and don't have it.  Create it here.
 1401|      0|                    QTC::TC("qpdf", "QPDFWriter create Extensions", m->qdf_mode ? 0 : 1);
  ------------------
  |  Branch (1401:69): [True: 0, False: 0]
  ------------------
 1402|      0|                    extensions = object.replaceKeyAndGetNew(
 1403|      0|                        "/Extensions", QPDFObjectHandle::newDictionary());
 1404|      0|                }
 1405|  2.87k|            } else if (!have_extensions_other) {
  ------------------
  |  Branch (1405:24): [True: 2.87k, False: 0]
  ------------------
 1406|       |                // We have Extensions dictionary and don't want one.
 1407|  2.87k|                if (have_extensions_adbe) {
  ------------------
  |  Branch (1407:21): [True: 0, False: 2.87k]
  ------------------
 1408|      0|                    QTC::TC("qpdf", "QPDFWriter remove existing Extensions");
 1409|      0|                    object.removeKey("/Extensions");
 1410|      0|                    extensions = QPDFObjectHandle(); // uninitialized
 1411|      0|                }
 1412|  2.87k|            }
 1413|  2.87k|        }
 1414|       |
 1415|   294k|        if (extensions.isInitialized()) {
  ------------------
  |  Branch (1415:13): [True: 0, False: 294k]
  ------------------
 1416|      0|            QTC::TC("qpdf", "QPDFWriter preserve Extensions");
 1417|      0|            QPDFObjectHandle adbe = extensions.getKey("/ADBE");
 1418|      0|            if (adbe.isDictionary() &&
  ------------------
  |  Branch (1418:17): [True: 0, False: 0]
  |  Branch (1418:17): [True: 0, False: 0]
  ------------------
 1419|      0|                adbe.getKey("/BaseVersion").isNameAndEquals("/" + m->final_pdf_version) &&
  ------------------
  |  Branch (1419:17): [True: 0, False: 0]
  ------------------
 1420|      0|                adbe.getKey("/ExtensionLevel").isInteger() &&
  ------------------
  |  Branch (1420:17): [True: 0, False: 0]
  ------------------
 1421|      0|                (adbe.getKey("/ExtensionLevel").getIntValue() == m->final_extension_level)) {
  ------------------
  |  Branch (1421:17): [True: 0, False: 0]
  ------------------
 1422|      0|                QTC::TC("qpdf", "QPDFWriter preserve ADBE");
 1423|      0|            } else {
 1424|      0|                if (need_extensions_adbe) {
  ------------------
  |  Branch (1424:21): [True: 0, False: 0]
  ------------------
 1425|      0|                    extensions.replaceKey(
 1426|      0|                        "/ADBE",
 1427|      0|                        QPDFObjectHandle::parse(
 1428|      0|                            "<< /BaseVersion /" + m->final_pdf_version + " /ExtensionLevel " +
 1429|      0|                            std::to_string(m->final_extension_level) + " >>"));
 1430|      0|                } else {
 1431|      0|                    QTC::TC("qpdf", "QPDFWriter remove ADBE");
 1432|      0|                    extensions.removeKey("/ADBE");
 1433|      0|                }
 1434|      0|            }
 1435|      0|        }
 1436|       |
 1437|       |        // Stream dictionaries.
 1438|       |
 1439|   294k|        if (flags & f_stream) {
  ------------------
  |  Branch (1439:13): [True: 50.0k, False: 244k]
  ------------------
 1440|       |            // Suppress /Length since we will write it manually
 1441|  50.0k|            object.removeKey("/Length");
 1442|       |
 1443|       |            // If /DecodeParms is an empty list, remove it.
 1444|  50.0k|            if (object.getKey("/DecodeParms").isArray() &&
  ------------------
  |  Branch (1444:17): [True: 0, False: 50.0k]
  |  Branch (1444:17): [True: 0, False: 50.0k]
  ------------------
 1445|  50.0k|                (0 == object.getKey("/DecodeParms").getArrayNItems())) {
  ------------------
  |  Branch (1445:17): [True: 0, False: 0]
  ------------------
 1446|      0|                QTC::TC("qpdf", "QPDFWriter remove empty DecodeParms");
 1447|      0|                object.removeKey("/DecodeParms");
 1448|      0|            }
 1449|       |
 1450|  50.0k|            if (flags & f_filtered) {
  ------------------
  |  Branch (1450:17): [True: 21.5k, False: 28.4k]
  ------------------
 1451|       |                // We will supply our own filter and decode
 1452|       |                // parameters.
 1453|  21.5k|                object.removeKey("/Filter");
 1454|  21.5k|                object.removeKey("/DecodeParms");
 1455|  28.4k|            } else {
 1456|       |                // Make sure, no matter what else we have, that we don't have /Crypt in the output
 1457|       |                // filters.
 1458|  28.4k|                QPDFObjectHandle filter = object.getKey("/Filter");
 1459|  28.4k|                QPDFObjectHandle decode_parms = object.getKey("/DecodeParms");
 1460|  28.4k|                if (filter.isOrHasName("/Crypt")) {
  ------------------
  |  Branch (1460:21): [True: 1, False: 28.4k]
  ------------------
 1461|      1|                    if (filter.isName()) {
  ------------------
  |  Branch (1461:25): [True: 0, False: 1]
  ------------------
 1462|      0|                        object.removeKey("/Filter");
 1463|      0|                        object.removeKey("/DecodeParms");
 1464|      1|                    } else {
 1465|      1|                        int idx = -1;
 1466|      1|                        for (int i = 0; i < filter.getArrayNItems(); ++i) {
  ------------------
  |  Branch (1466:41): [True: 1, False: 0]
  ------------------
 1467|      1|                            QPDFObjectHandle item = filter.getArrayItem(i);
 1468|      1|                            if (item.isNameAndEquals("/Crypt")) {
  ------------------
  |  Branch (1468:33): [True: 1, False: 0]
  ------------------
 1469|      1|                                idx = i;
 1470|      1|                                break;
 1471|      1|                            }
 1472|      1|                        }
 1473|      1|                        if (idx >= 0) {
  ------------------
  |  Branch (1473:29): [True: 1, False: 0]
  ------------------
 1474|       |                            // If filter is an array, then the code in QPDF_Stream has already
 1475|       |                            // verified that DecodeParms and Filters are arrays of the same length,
 1476|       |                            // but if they weren't for some reason, eraseItem does type and bounds
 1477|       |                            // checking.
 1478|      1|                            QTC::TC("qpdf", "QPDFWriter remove Crypt");
 1479|      1|                            filter.eraseItem(idx);
 1480|      1|                            decode_parms.eraseItem(idx);
 1481|      1|                        }
 1482|      1|                    }
 1483|      1|                }
 1484|  28.4k|            }
 1485|  50.0k|        }
 1486|       |
 1487|   294k|        writeString("<<");
 1488|       |
 1489|  1.04M|        for (auto& item: object.getDictAsMap()) {
  ------------------
  |  Branch (1489:24): [True: 1.04M, False: 294k]
  ------------------
 1490|  1.04M|            if (!item.second.isNull()) {
  ------------------
  |  Branch (1490:17): [True: 993k, False: 51.2k]
  ------------------
 1491|   993k|                auto const& key = item.first;
 1492|   993k|                writeString(indent);
 1493|   993k|                writeStringQDF("  ");
 1494|   993k|                writeString(QPDF_Name::normalizeName(key));
 1495|   993k|                writeString(" ");
 1496|   993k|                if (key == "/Contents" && object.isDictionaryOfType("/Sig") &&
  ------------------
  |  Branch (1496:21): [True: 31.4k, False: 962k]
  |  Branch (1496:21): [True: 0, False: 993k]
  |  Branch (1496:43): [True: 0, False: 31.4k]
  ------------------
 1497|   993k|                    object.hasKey("/ByteRange")) {
  ------------------
  |  Branch (1497:21): [True: 0, False: 0]
  ------------------
 1498|      0|                    QTC::TC("qpdf", "QPDFWriter no encryption sig contents");
 1499|      0|                    unparseChild(
 1500|      0|                        item.second, level + 1, child_flags | f_hex_string | f_no_encryption);
 1501|   993k|                } else {
 1502|   993k|                    unparseChild(item.second, level + 1, child_flags);
 1503|   993k|                }
 1504|   993k|            }
 1505|  1.04M|        }
 1506|       |
 1507|   294k|        if (flags & f_stream) {
  ------------------
  |  Branch (1507:13): [True: 50.0k, False: 244k]
  ------------------
 1508|  50.0k|            writeString(indent);
 1509|  50.0k|            writeStringQDF("  ");
 1510|  50.0k|            writeString("/Length ");
 1511|       |
 1512|  50.0k|            if (m->direct_stream_lengths) {
  ------------------
  |  Branch (1512:17): [True: 50.0k, False: 0]
  ------------------
 1513|  50.0k|                writeString(std::to_string(stream_length));
 1514|  50.0k|            } else {
 1515|      0|                writeString(std::to_string(m->cur_stream_length_id));
 1516|      0|                writeString(" 0 R");
 1517|      0|            }
 1518|  50.0k|            if (compress && (flags & f_filtered)) {
  ------------------
  |  Branch (1518:17): [True: 20.2k, False: 29.8k]
  |  Branch (1518:29): [True: 20.2k, False: 0]
  ------------------
 1519|  20.2k|                writeString(indent);
 1520|  20.2k|                writeStringQDF("  ");
 1521|  20.2k|                writeString("/Filter /FlateDecode");
 1522|  20.2k|            }
 1523|  50.0k|        }
 1524|       |
 1525|   294k|        writeString(indent);
 1526|   294k|        writeString(">>");
 1527|  1.69M|    } else if (tc == ::ot_stream) {
  ------------------
  |  Branch (1527:16): [True: 50.0k, False: 1.64M]
  ------------------
 1528|       |        // Write stream data to a buffer.
 1529|  50.0k|        if (!m->direct_stream_lengths) {
  ------------------
  |  Branch (1529:13): [True: 0, False: 50.0k]
  ------------------
 1530|      0|            m->cur_stream_length_id = m->obj[old_og].renumber + 1;
 1531|      0|        }
 1532|       |
 1533|  50.0k|        flags |= f_stream;
 1534|  50.0k|        bool compress_stream = false;
 1535|  50.0k|        bool is_metadata = false;
 1536|  50.0k|        std::shared_ptr<Buffer> stream_data;
 1537|  50.0k|        if (willFilterStream(object, compress_stream, is_metadata, &stream_data)) {
  ------------------
  |  Branch (1537:13): [True: 21.5k, False: 28.4k]
  ------------------
 1538|  21.5k|            flags |= f_filtered;
 1539|  21.5k|        }
 1540|  50.0k|        QPDFObjectHandle stream_dict = object.getDict();
 1541|       |
 1542|  50.0k|        m->cur_stream_length = stream_data->getSize();
 1543|  50.0k|        if (is_metadata && m->encrypted && (!m->encrypt_metadata)) {
  ------------------
  |  Branch (1543:13): [True: 1.37k, False: 48.7k]
  |  Branch (1543:28): [True: 0, False: 1.37k]
  |  Branch (1543:44): [True: 0, False: 0]
  ------------------
 1544|       |            // Don't encrypt stream data for the metadata stream
 1545|      0|            m->cur_data_key.clear();
 1546|      0|        }
 1547|  50.0k|        adjustAESStreamLength(m->cur_stream_length);
 1548|  50.0k|        unparseObject(stream_dict, 0, flags, m->cur_stream_length, compress_stream);
 1549|  50.0k|        unsigned char last_char = '\0';
 1550|  50.0k|        writeString("\nstream\n");
 1551|  50.0k|        {
 1552|  50.0k|            PipelinePopper pp_enc(this);
 1553|  50.0k|            pushEncryptionFilter(pp_enc);
 1554|  50.0k|            writeBuffer(stream_data);
 1555|  50.0k|            last_char = m->pipeline->getLastChar();
 1556|  50.0k|        }
 1557|       |
 1558|  50.0k|        if (m->newline_before_endstream || (m->qdf_mode && (last_char != '\n'))) {
  ------------------
  |  Branch (1558:13): [True: 21, False: 50.0k]
  |  Branch (1558:45): [True: 0, False: 50.0k]
  |  Branch (1558:60): [True: 0, False: 0]
  ------------------
 1559|      0|            writeString("\n");
 1560|      0|            m->added_newline = true;
 1561|  50.0k|        } else {
 1562|  50.0k|            m->added_newline = false;
 1563|  50.0k|        }
 1564|  50.0k|        writeString("endstream");
 1565|  1.64M|    } else if (tc == ::ot_string) {
  ------------------
  |  Branch (1565:16): [True: 75.8k, False: 1.56M]
  ------------------
 1566|  75.8k|        std::string val;
 1567|  75.8k|        if (m->encrypted && (!(flags & f_in_ostream)) && (!(flags & f_no_encryption)) &&
  ------------------
  |  Branch (1567:13): [True: 0, False: 75.8k]
  |  Branch (1567:29): [True: 0, False: 0]
  |  Branch (1567:58): [True: 0, False: 0]
  ------------------
 1568|  75.8k|            (!m->cur_data_key.empty())) {
  ------------------
  |  Branch (1568:13): [True: 0, False: 0]
  ------------------
 1569|      0|            val = object.getStringValue();
 1570|      0|            if (m->encrypt_use_aes) {
  ------------------
  |  Branch (1570:17): [True: 0, False: 0]
  ------------------
 1571|      0|                Pl_Buffer bufpl("encrypted string");
 1572|      0|                Pl_AES_PDF pl(
 1573|      0|                    "aes encrypt string",
 1574|      0|                    &bufpl,
 1575|      0|                    true,
 1576|      0|                    QUtil::unsigned_char_pointer(m->cur_data_key),
 1577|      0|                    m->cur_data_key.length());
 1578|      0|                pl.writeString(val);
 1579|      0|                pl.finish();
 1580|      0|                val = QPDF_String(bufpl.getString()).unparse(true);
 1581|      0|            } else {
 1582|      0|                auto tmp_ph = QUtil::make_unique_cstr(val);
 1583|      0|                char* tmp = tmp_ph.get();
 1584|      0|                size_t vlen = val.length();
 1585|      0|                RC4 rc4(
 1586|      0|                    QUtil::unsigned_char_pointer(m->cur_data_key),
 1587|      0|                    QIntC::to_int(m->cur_data_key.length()));
 1588|      0|                auto data = QUtil::unsigned_char_pointer(tmp);
 1589|      0|                rc4.process(data, vlen, data);
 1590|      0|                val = QPDF_String(std::string(tmp, vlen)).unparse();
 1591|      0|            }
 1592|  75.8k|        } else if (flags & f_hex_string) {
  ------------------
  |  Branch (1592:20): [True: 0, False: 75.8k]
  ------------------
 1593|      0|            val = QPDF_String(object.getStringValue()).unparse(true);
 1594|  75.8k|        } else {
 1595|  75.8k|            val = object.unparseResolved();
 1596|  75.8k|        }
 1597|  75.8k|        writeString(val);
 1598|  1.56M|    } else {
 1599|  1.56M|        writeString(object.unparseResolved());
 1600|  1.56M|    }
 1601|  2.11M|}
_ZN10QPDFWriter24writeObjectStreamOffsetsERNSt3__16vectorIxNS0_9allocatorIxEEEEi:
 1605|  6.09k|{
 1606|   128k|    for (size_t i = 0; i < offsets.size(); ++i) {
  ------------------
  |  Branch (1606:24): [True: 122k, False: 6.09k]
  ------------------
 1607|   122k|        if (i != 0) {
  ------------------
  |  Branch (1607:13): [True: 116k, False: 6.09k]
  ------------------
 1608|   116k|            writeStringQDF("\n");
 1609|   116k|            writeStringNoQDF(" ");
 1610|   116k|        }
 1611|   122k|        writeString(std::to_string(i + QIntC::to_size(first_obj)));
 1612|   122k|        writeString(" ");
 1613|   122k|        writeString(std::to_string(offsets.at(i)));
 1614|   122k|    }
 1615|  6.09k|    writeString("\n");
 1616|  6.09k|}
_ZN10QPDFWriter17writeObjectStreamE16QPDFObjectHandle:
 1620|  3.04k|{
 1621|       |    // Note: object might be null if this is a place-holder for an object stream that we are
 1622|       |    // generating from scratch.
 1623|       |
 1624|  3.04k|    QPDFObjGen old_og = object.getObjGen();
 1625|  3.04k|    qpdf_assert_debug(old_og.getGen() == 0);
  ------------------
  |  |   16|  3.04k|# define qpdf_assert_debug assert
  ------------------
 1626|  3.04k|    int old_id = old_og.getObj();
 1627|  3.04k|    int new_stream_id = m->obj[old_og].renumber;
 1628|       |
 1629|  3.04k|    std::vector<qpdf_offset_t> offsets;
 1630|  3.04k|    qpdf_offset_t first = 0;
 1631|       |
 1632|       |    // Generate stream itself.  We have to do this in two passes so we can calculate offsets in the
 1633|       |    // first pass.
 1634|  3.04k|    std::shared_ptr<Buffer> stream_buffer;
 1635|  3.04k|    int first_obj = -1;
 1636|  3.04k|    bool compressed = false;
 1637|  9.14k|    for (int pass = 1; pass <= 2; ++pass) {
  ------------------
  |  Branch (1637:24): [True: 6.09k, False: 3.04k]
  ------------------
 1638|       |        // stream_buffer will be initialized only for pass 2
 1639|  6.09k|        PipelinePopper pp_ostream(this, &stream_buffer);
 1640|  6.09k|        if (pass == 1) {
  ------------------
  |  Branch (1640:13): [True: 3.04k, False: 3.04k]
  ------------------
 1641|  3.04k|            pushDiscardFilter(pp_ostream);
 1642|  3.04k|        } else {
 1643|       |            // Adjust offsets to skip over comment before first object
 1644|  3.04k|            first = offsets.at(0);
 1645|  61.0k|            for (auto& iter: offsets) {
  ------------------
  |  Branch (1645:28): [True: 61.0k, False: 3.04k]
  ------------------
 1646|  61.0k|                iter -= first;
 1647|  61.0k|            }
 1648|       |
 1649|       |            // Take one pass at writing pairs of numbers so we can get their size information
 1650|  3.04k|            {
 1651|  3.04k|                PipelinePopper pp_discard(this);
 1652|  3.04k|                pushDiscardFilter(pp_discard);
 1653|  3.04k|                writeObjectStreamOffsets(offsets, first_obj);
 1654|  3.04k|                first += m->pipeline->getCount();
 1655|  3.04k|            }
 1656|       |
 1657|       |            // Set up a stream to write the stream data into a buffer.
 1658|  3.04k|            Pipeline* next = pushPipeline(new Pl_Buffer("object stream"));
 1659|  3.04k|            if (m->compress_streams && !m->qdf_mode) {
  ------------------
  |  Branch (1659:17): [True: 3.04k, False: 0]
  |  Branch (1659:40): [True: 3.04k, False: 0]
  ------------------
 1660|  3.04k|                compressed = true;
 1661|  3.04k|                next =
 1662|  3.04k|                    pushPipeline(new Pl_Flate("compress object stream", next, Pl_Flate::a_deflate));
 1663|  3.04k|            }
 1664|  3.04k|            activatePipelineStack(pp_ostream);
 1665|  3.04k|            writeObjectStreamOffsets(offsets, first_obj);
 1666|  3.04k|        }
 1667|       |
 1668|  6.09k|        int count = -1;
 1669|   122k|        for (auto const& obj: m->object_stream_to_objects[old_id]) {
  ------------------
  |  Branch (1669:29): [True: 122k, False: 6.09k]
  ------------------
 1670|   122k|            ++count;
 1671|   122k|            int new_obj = m->obj[obj].renumber;
 1672|   122k|            if (first_obj == -1) {
  ------------------
  |  Branch (1672:17): [True: 3.04k, False: 119k]
  ------------------
 1673|  3.04k|                first_obj = new_obj;
 1674|  3.04k|            }
 1675|   122k|            if (m->qdf_mode) {
  ------------------
  |  Branch (1675:17): [True: 0, False: 122k]
  ------------------
 1676|      0|                writeString(
 1677|      0|                    "%% Object stream: object " + std::to_string(new_obj) + ", index " +
 1678|      0|                    std::to_string(count));
 1679|      0|                if (!m->suppress_original_object_ids) {
  ------------------
  |  Branch (1679:21): [True: 0, False: 0]
  ------------------
 1680|      0|                    writeString("; original object ID: " + std::to_string(obj.getObj()));
 1681|       |                    // For compatibility, only write the generation if non-zero.  While object
 1682|       |                    // streams only allow objects with generation 0, if we are generating object
 1683|       |                    // streams, the old object could have a non-zero generation.
 1684|      0|                    if (obj.getGen() != 0) {
  ------------------
  |  Branch (1684:25): [True: 0, False: 0]
  ------------------
 1685|      0|                        QTC::TC("qpdf", "QPDFWriter original obj non-zero gen");
 1686|      0|                        writeString(" " + std::to_string(obj.getGen()));
 1687|      0|                    }
 1688|      0|                }
 1689|      0|                writeString("\n");
 1690|      0|            }
 1691|   122k|            if (pass == 1) {
  ------------------
  |  Branch (1691:17): [True: 61.0k, False: 61.0k]
  ------------------
 1692|  61.0k|                offsets.push_back(m->pipeline->getCount());
 1693|       |                // To avoid double-counting objects being written in object streams for progress
 1694|       |                // reporting, decrement in pass 1.
 1695|  61.0k|                indicateProgress(true, false);
 1696|  61.0k|            }
 1697|   122k|            QPDFObjectHandle obj_to_write = m->pdf.getObject(obj);
 1698|   122k|            if (obj_to_write.isStream()) {
  ------------------
  |  Branch (1698:17): [True: 0, False: 122k]
  ------------------
 1699|       |                // This condition occurred in a fuzz input. Ideally we should block it at parse
 1700|       |                // time, but it's not clear to me how to construct a case for this.
 1701|      0|                QTC::TC("qpdf", "QPDFWriter stream in ostream");
 1702|      0|                obj_to_write.warnIfPossible("stream found inside object stream; treating as null");
 1703|      0|                obj_to_write = QPDFObjectHandle::newNull();
 1704|      0|            }
 1705|   122k|            writeObject(obj_to_write, count);
 1706|       |
 1707|   122k|            m->new_obj[new_obj].xref = QPDFXRefEntry(new_stream_id, count);
 1708|   122k|        }
 1709|  6.09k|    }
 1710|       |
 1711|       |    // Write the object
 1712|  3.04k|    openObject(new_stream_id);
 1713|  3.04k|    setDataKey(new_stream_id);
 1714|  3.04k|    writeString("<<");
 1715|  3.04k|    writeStringQDF("\n ");
 1716|  3.04k|    writeString(" /Type /ObjStm");
 1717|  3.04k|    writeStringQDF("\n ");
 1718|  3.04k|    size_t length = stream_buffer->getSize();
 1719|  3.04k|    adjustAESStreamLength(length);
 1720|  3.04k|    writeString(" /Length " + std::to_string(length));
 1721|  3.04k|    writeStringQDF("\n ");
 1722|  3.04k|    if (compressed) {
  ------------------
  |  Branch (1722:9): [True: 3.04k, False: 0]
  ------------------
 1723|  3.04k|        writeString(" /Filter /FlateDecode");
 1724|  3.04k|    }
 1725|  3.04k|    writeString(" /N " + std::to_string(offsets.size()));
 1726|  3.04k|    writeStringQDF("\n ");
 1727|  3.04k|    writeString(" /First " + std::to_string(first));
 1728|  3.04k|    if (!object.isNull()) {
  ------------------
  |  Branch (1728:9): [True: 0, False: 3.04k]
  ------------------
 1729|       |        // If the original object has an /Extends key, preserve it.
 1730|      0|        QPDFObjectHandle dict = object.getDict();
 1731|      0|        QPDFObjectHandle extends = dict.getKey("/Extends");
 1732|      0|        if (extends.isIndirect()) {
  ------------------
  |  Branch (1732:13): [True: 0, False: 0]
  ------------------
 1733|      0|            QTC::TC("qpdf", "QPDFWriter copy Extends");
 1734|      0|            writeStringQDF("\n ");
 1735|      0|            writeString(" /Extends ");
 1736|      0|            unparseChild(extends, 1, f_in_ostream);
 1737|      0|        }
 1738|      0|    }
 1739|  3.04k|    writeStringQDF("\n");
 1740|  3.04k|    writeStringNoQDF(" ");
 1741|  3.04k|    writeString(">>\nstream\n");
 1742|  3.04k|    if (m->encrypted) {
  ------------------
  |  Branch (1742:9): [True: 0, False: 3.04k]
  ------------------
 1743|      0|        QTC::TC("qpdf", "QPDFWriter encrypt object stream");
 1744|      0|    }
 1745|  3.04k|    {
 1746|  3.04k|        PipelinePopper pp_enc(this);
 1747|  3.04k|        pushEncryptionFilter(pp_enc);
 1748|  3.04k|        writeBuffer(stream_buffer);
 1749|  3.04k|    }
 1750|  3.04k|    if (m->newline_before_endstream) {
  ------------------
  |  Branch (1750:9): [True: 0, False: 3.04k]
  ------------------
 1751|      0|        writeString("\n");
 1752|      0|    }
 1753|  3.04k|    writeString("endstream");
 1754|  3.04k|    m->cur_data_key.clear();
 1755|  3.04k|    closeObject(new_stream_id);
 1756|  3.04k|}
_ZN10QPDFWriter11writeObjectE16QPDFObjectHandlei:
 1760|   210k|{
 1761|   210k|    QPDFObjGen old_og = object.getObjGen();
 1762|       |
 1763|   210k|    if ((object_stream_index == -1) && (old_og.getGen() == 0) &&
  ------------------
  |  Branch (1763:9): [True: 88.1k, False: 122k]
  |  Branch (1763:9): [True: 3.04k, False: 207k]
  |  Branch (1763:40): [True: 88.1k, False: 28]
  ------------------
 1764|   210k|        (m->object_stream_to_objects.count(old_og.getObj()))) {
  ------------------
  |  Branch (1764:9): [True: 3.04k, False: 85.1k]
  ------------------
 1765|  3.04k|        writeObjectStream(object);
 1766|  3.04k|        return;
 1767|  3.04k|    }
 1768|       |
 1769|   207k|    indicateProgress(false, false);
 1770|   207k|    auto new_id = m->obj[old_og].renumber;
 1771|   207k|    if (m->qdf_mode) {
  ------------------
  |  Branch (1771:9): [True: 0, False: 207k]
  ------------------
 1772|      0|        if (m->page_object_to_seq.count(old_og)) {
  ------------------
  |  Branch (1772:13): [True: 0, False: 0]
  ------------------
 1773|      0|            writeString("%% Page ");
 1774|      0|            writeString(std::to_string(m->page_object_to_seq[old_og]));
 1775|      0|            writeString("\n");
 1776|      0|        }
 1777|      0|        if (m->contents_to_page_seq.count(old_og)) {
  ------------------
  |  Branch (1777:13): [True: 0, False: 0]
  ------------------
 1778|      0|            writeString("%% Contents for page ");
 1779|      0|            writeString(std::to_string(m->contents_to_page_seq[old_og]));
 1780|      0|            writeString("\n");
 1781|      0|        }
 1782|      0|    }
 1783|   207k|    if (object_stream_index == -1) {
  ------------------
  |  Branch (1783:9): [True: 85.1k, False: 122k]
  ------------------
 1784|  85.1k|        if (m->qdf_mode && (!m->suppress_original_object_ids)) {
  ------------------
  |  Branch (1784:13): [True: 0, False: 85.1k]
  |  Branch (1784:28): [True: 0, False: 0]
  ------------------
 1785|      0|            writeString("%% Original object ID: " + object.getObjGen().unparse(' ') + "\n");
 1786|      0|        }
 1787|  85.1k|        openObject(new_id);
 1788|  85.1k|        setDataKey(new_id);
 1789|  85.1k|        unparseObject(object, 0, 0);
 1790|  85.1k|        m->cur_data_key.clear();
 1791|  85.1k|        closeObject(new_id);
 1792|   122k|    } else {
 1793|   122k|        unparseObject(object, 0, f_in_ostream);
 1794|   122k|        writeString("\n");
 1795|   122k|    }
 1796|       |
 1797|   207k|    if ((!m->direct_stream_lengths) && object.isStream()) {
  ------------------
  |  Branch (1797:9): [True: 0, False: 207k]
  |  Branch (1797:40): [True: 0, False: 0]
  ------------------
 1798|      0|        if (m->qdf_mode) {
  ------------------
  |  Branch (1798:13): [True: 0, False: 0]
  ------------------
 1799|      0|            if (m->added_newline) {
  ------------------
  |  Branch (1799:17): [True: 0, False: 0]
  ------------------
 1800|      0|                writeString("%QDF: ignore_newline\n");
 1801|      0|            }
 1802|      0|        }
 1803|      0|        openObject(new_id + 1);
 1804|      0|        writeString(std::to_string(m->cur_stream_length));
 1805|      0|        closeObject(new_id + 1);
 1806|      0|    }
 1807|   207k|}
_ZN10QPDFWriter14getOriginalID1Ev:
 1811|  4.65k|{
 1812|  4.65k|    QPDFObjectHandle trailer = m->pdf.getTrailer();
 1813|  4.65k|    if (trailer.hasKey("/ID")) {
  ------------------
  |  Branch (1813:9): [True: 4.13k, False: 525]
  ------------------
 1814|  4.13k|        return trailer.getKey("/ID").getArrayItem(0).getStringValue();
 1815|  4.13k|    } else {
 1816|    525|        return "";
 1817|    525|    }
 1818|  4.65k|}
_ZN10QPDFWriter10generateIDEv:
 1822|  2.84k|{
 1823|       |    // Generate the ID lazily so that we can handle the user's preference to use static or
 1824|       |    // deterministic ID generation.
 1825|       |
 1826|  2.84k|    if (!m->id2.empty()) {
  ------------------
  |  Branch (1826:9): [True: 1.41k, False: 1.43k]
  ------------------
 1827|  1.41k|        return;
 1828|  1.41k|    }
 1829|       |
 1830|  1.43k|    QPDFObjectHandle trailer = m->pdf.getTrailer();
 1831|       |
 1832|  1.43k|    std::string result;
 1833|       |
 1834|  1.43k|    if (m->static_id) {
  ------------------
  |  Branch (1834:9): [True: 0, False: 1.43k]
  ------------------
 1835|       |        // For test suite use only...
 1836|      0|        static unsigned char tmp[] = {
 1837|      0|            0x31,
 1838|      0|            0x41,
 1839|      0|            0x59,
 1840|      0|            0x26,
 1841|      0|            0x53,
 1842|      0|            0x58,
 1843|      0|            0x97,
 1844|      0|            0x93,
 1845|      0|            0x23,
 1846|      0|            0x84,
 1847|      0|            0x62,
 1848|      0|            0x64,
 1849|      0|            0x33,
 1850|      0|            0x83,
 1851|      0|            0x27,
 1852|      0|            0x95,
 1853|      0|            0x00};
 1854|      0|        result = reinterpret_cast<char*>(tmp);
 1855|  1.43k|    } else {
 1856|       |        // The PDF specification has guidelines for creating IDs, but it states clearly that the
 1857|       |        // only thing that's really important is that it is very likely to be unique.  We can't
 1858|       |        // really follow the guidelines in the spec exactly because we haven't written the file yet.
 1859|       |        // This scheme should be fine though.  The deterministic ID case uses a digest of a
 1860|       |        // sufficient portion of the file's contents such no two non-matching files would match in
 1861|       |        // the subsets used for this computation.  Note that we explicitly omit the filename from
 1862|       |        // the digest calculation for deterministic ID so that the same file converted with qpdf, in
 1863|       |        // that case, would have the same ID regardless of the output file's name.
 1864|       |
 1865|  1.43k|        std::string seed;
 1866|  1.43k|        if (m->deterministic_id) {
  ------------------
  |  Branch (1866:13): [True: 1.43k, False: 0]
  ------------------
 1867|  1.43k|            if (m->deterministic_id_data.empty()) {
  ------------------
  |  Branch (1867:17): [True: 0, False: 1.43k]
  ------------------
 1868|      0|                QTC::TC("qpdf", "QPDFWriter deterministic with no data");
 1869|      0|                throw std::logic_error("INTERNAL ERROR: QPDFWriter::generateID has no data for "
 1870|      0|                                       "deterministic ID.  This may happen if deterministic ID and "
 1871|      0|                                       "file encryption are requested together.");
 1872|      0|            }
 1873|  1.43k|            seed += m->deterministic_id_data;
 1874|  1.43k|        } else {
 1875|      0|            seed += std::to_string(QUtil::get_current_time());
 1876|      0|            seed += m->filename;
 1877|      0|            seed += " ";
 1878|      0|        }
 1879|  1.43k|        seed += " QPDF ";
 1880|  1.43k|        if (trailer.hasKey("/Info")) {
  ------------------
  |  Branch (1880:13): [True: 634, False: 797]
  ------------------
 1881|    634|            QPDFObjectHandle info = trailer.getKey("/Info");
 1882|  1.76k|            for (auto const& key: info.getKeys()) {
  ------------------
  |  Branch (1882:33): [True: 1.76k, False: 634]
  ------------------
 1883|  1.76k|                QPDFObjectHandle obj = info.getKey(key);
 1884|  1.76k|                if (obj.isString()) {
  ------------------
  |  Branch (1884:21): [True: 1.57k, False: 196]
  ------------------
 1885|  1.57k|                    seed += " ";
 1886|  1.57k|                    seed += obj.getStringValue();
 1887|  1.57k|                }
 1888|  1.76k|            }
 1889|    634|        }
 1890|       |
 1891|  1.43k|        MD5 m;
 1892|  1.43k|        m.encodeString(seed.c_str());
 1893|  1.43k|        MD5::Digest digest;
 1894|  1.43k|        m.digest(digest);
 1895|  1.43k|        result = std::string(reinterpret_cast<char*>(digest), sizeof(MD5::Digest));
 1896|  1.43k|    }
 1897|       |
 1898|       |    // If /ID already exists, follow the spec: use the original first word and generate a new second
 1899|       |    // word.  Otherwise, we'll use the generated ID for both.
 1900|       |
 1901|  1.43k|    m->id2 = result;
 1902|       |    // Note: keep /ID from old file even if --static-id was given.
 1903|  1.43k|    m->id1 = getOriginalID1();
 1904|  1.43k|    if (m->id1.empty()) {
  ------------------
  |  Branch (1904:9): [True: 183, False: 1.24k]
  ------------------
 1905|    183|        m->id1 = m->id2;
 1906|    183|    }
 1907|  1.43k|}
_ZN10QPDFWriter24initializeSpecialStreamsEv:
 1911|  2.00k|{
 1912|       |    // Mark all page content streams in case we are filtering or
 1913|       |    // normalizing.
 1914|  2.00k|    std::vector<QPDFObjectHandle> pages = m->pdf.getAllPages();
 1915|  2.00k|    int num = 0;
 1916|  20.1k|    for (auto& page: pages) {
  ------------------
  |  Branch (1916:20): [True: 20.1k, False: 2.00k]
  ------------------
 1917|  20.1k|        m->page_object_to_seq[page.getObjGen()] = ++num;
 1918|  20.1k|        QPDFObjectHandle contents = page.getKey("/Contents");
 1919|  20.1k|        std::vector<QPDFObjGen> contents_objects;
 1920|  20.1k|        if (contents.isArray()) {
  ------------------
  |  Branch (1920:13): [True: 59, False: 20.0k]
  ------------------
 1921|     59|            int n = contents.getArrayNItems();
 1922|    801|            for (int i = 0; i < n; ++i) {
  ------------------
  |  Branch (1922:29): [True: 742, False: 59]
  ------------------
 1923|    742|                contents_objects.push_back(contents.getArrayItem(i).getObjGen());
 1924|    742|            }
 1925|  20.0k|        } else if (contents.isStream()) {
  ------------------
  |  Branch (1925:20): [True: 14.5k, False: 5.52k]
  ------------------
 1926|  14.5k|            contents_objects.push_back(contents.getObjGen());
 1927|  14.5k|        }
 1928|       |
 1929|  20.1k|        for (auto const& c: contents_objects) {
  ------------------
  |  Branch (1929:27): [True: 15.3k, False: 20.1k]
  ------------------
 1930|  15.3k|            m->contents_to_page_seq[c] = num;
 1931|  15.3k|            m->normalized_streams.insert(c);
 1932|  15.3k|        }
 1933|  20.1k|    }
 1934|  2.00k|}
_ZN10QPDFWriter21generateObjectStreamsEv:
 1988|  2.00k|{
 1989|       |    // Basic strategy: make a list of objects that can go into an object stream.  Then figure out
 1990|       |    // how many object streams are needed so that we can distribute objects approximately evenly
 1991|       |    // without having any object stream exceed 100 members.  We don't have to worry about linearized
 1992|       |    // files here -- if the file is linearized, we take care of excluding things that aren't allowed
 1993|       |    // here later.
 1994|       |
 1995|       |    // This code doesn't do anything with /Extends.
 1996|       |
 1997|  2.00k|    std::vector<QPDFObjGen> eligible = QPDF::Writer::getCompressibleObjGens(m->pdf);
 1998|  2.00k|    size_t n_object_streams = (eligible.size() + 99U) / 100U;
 1999|       |
 2000|  2.00k|    initializeTables(2U * n_object_streams);
 2001|  2.00k|    if (n_object_streams == 0) {
  ------------------
  |  Branch (2001:9): [True: 18, False: 1.98k]
  ------------------
 2002|     18|        m->obj.streams_empty = true;
 2003|     18|        return;
 2004|     18|    }
 2005|  1.98k|    size_t n_per = eligible.size() / n_object_streams;
 2006|  1.98k|    if (n_per * n_object_streams < eligible.size()) {
  ------------------
  |  Branch (2006:9): [True: 47, False: 1.93k]
  ------------------
 2007|     47|        ++n_per;
 2008|     47|    }
 2009|  1.98k|    unsigned int n = 0;
 2010|  1.98k|    int cur_ostream = m->pdf.newIndirectNull().getObjectID();
 2011|  57.1k|    for (auto const& item: eligible) {
  ------------------
  |  Branch (2011:26): [True: 57.1k, False: 1.98k]
  ------------------
 2012|  57.1k|        if (n == n_per) {
  ------------------
  |  Branch (2012:13): [True: 94, False: 57.0k]
  ------------------
 2013|     94|            QTC::TC("qpdf", "QPDFWriter generate >1 ostream");
 2014|     94|            n = 0;
 2015|       |            // Construct a new null object as the "original" object stream.  The rest of the code
 2016|       |            // knows that this means we're creating the object stream from scratch.
 2017|     94|            cur_ostream = m->pdf.newIndirectNull().getObjectID();
 2018|     94|        }
 2019|  57.1k|        auto& obj = m->obj[item];
 2020|  57.1k|        obj.object_stream = cur_ostream;
 2021|  57.1k|        obj.gen = item.getGen();
 2022|  57.1k|        ++n;
 2023|  57.1k|    }
 2024|  1.98k|}
_ZN10QPDFWriter17getTrimmedTrailerEv:
 2028|  6.08k|{
 2029|       |    // Remove keys from the trailer that necessarily have to be replaced when writing the file.
 2030|       |
 2031|  6.08k|    QPDFObjectHandle trailer = m->pdf.getTrailer().unsafeShallowCopy();
 2032|       |
 2033|       |    // Remove encryption keys
 2034|  6.08k|    trailer.removeKey("/ID");
 2035|  6.08k|    trailer.removeKey("/Encrypt");
 2036|       |
 2037|       |    // Remove modification information
 2038|  6.08k|    trailer.removeKey("/Prev");
 2039|       |
 2040|       |    // Remove all trailer keys that potentially come from a cross-reference stream
 2041|  6.08k|    trailer.removeKey("/Index");
 2042|  6.08k|    trailer.removeKey("/W");
 2043|  6.08k|    trailer.removeKey("/Length");
 2044|  6.08k|    trailer.removeKey("/Filter");
 2045|  6.08k|    trailer.removeKey("/DecodeParms");
 2046|  6.08k|    trailer.removeKey("/Type");
 2047|  6.08k|    trailer.removeKey("/XRefStm");
 2048|       |
 2049|  6.08k|    return trailer;
 2050|  6.08k|}
_ZN10QPDFWriter19prepareFileForWriteEv:
 2055|  1.94k|{
 2056|  1.94k|    m->pdf.fixDanglingReferences();
 2057|  1.94k|    auto root = m->pdf.getRoot();
 2058|  1.94k|    auto oh = root.getKey("/Extensions");
 2059|  1.94k|    if (oh.isDictionary()) {
  ------------------
  |  Branch (2059:9): [True: 0, False: 1.94k]
  ------------------
 2060|      0|        const bool extensions_indirect = oh.isIndirect();
 2061|      0|        if (extensions_indirect) {
  ------------------
  |  Branch (2061:13): [True: 0, False: 0]
  ------------------
 2062|      0|            QTC::TC("qpdf", "QPDFWriter make Extensions direct");
 2063|      0|            oh = root.replaceKeyAndGetNew("/Extensions", oh.shallowCopy());
 2064|      0|        }
 2065|      0|        if (oh.hasKey("/ADBE")) {
  ------------------
  |  Branch (2065:13): [True: 0, False: 0]
  ------------------
 2066|      0|            auto adbe = oh.getKey("/ADBE");
 2067|      0|            if (adbe.isIndirect()) {
  ------------------
  |  Branch (2067:17): [True: 0, False: 0]
  ------------------
 2068|      0|                QTC::TC("qpdf", "QPDFWriter make ADBE direct", extensions_indirect ? 0 : 1);
  ------------------
  |  Branch (2068:64): [True: 0, False: 0]
  ------------------
 2069|      0|                adbe.makeDirect();
 2070|      0|                oh.replaceKey("/ADBE", adbe);
 2071|      0|            }
 2072|      0|        }
 2073|      0|    }
 2074|  1.94k|}
_ZN10QPDFWriter16initializeTablesEm:
 2078|  1.96k|{
 2079|  1.96k|    auto size = QIntC::to_size(QPDF::Writer::tableSize(m->pdf) + 100) + extra;
 2080|  1.96k|    m->obj.resize(size);
 2081|  1.96k|    m->new_obj.resize(size);
 2082|  1.96k|}
_ZN10QPDFWriter12doWriteSetupEv:
 2086|  2.00k|{
 2087|  2.00k|    if (m->did_write_setup) {
  ------------------
  |  Branch (2087:9): [True: 0, False: 2.00k]
  ------------------
 2088|      0|        return;
 2089|      0|    }
 2090|  2.00k|    m->did_write_setup = true;
 2091|       |
 2092|       |    // Do preliminary setup
 2093|       |
 2094|  2.00k|    if (m->linearized) {
  ------------------
  |  Branch (2094:9): [True: 2.00k, False: 0]
  ------------------
 2095|  2.00k|        m->qdf_mode = false;
 2096|  2.00k|    }
 2097|       |
 2098|  2.00k|    if (m->pclm) {
  ------------------
  |  Branch (2098:9): [True: 0, False: 2.00k]
  ------------------
 2099|      0|        m->stream_decode_level = qpdf_dl_none;
 2100|      0|        m->compress_streams = false;
 2101|      0|        m->encrypted = false;
 2102|      0|    }
 2103|       |
 2104|  2.00k|    if (m->qdf_mode) {
  ------------------
  |  Branch (2104:9): [True: 0, False: 2.00k]
  ------------------
 2105|      0|        if (!m->normalize_content_set) {
  ------------------
  |  Branch (2105:13): [True: 0, False: 0]
  ------------------
 2106|      0|            m->normalize_content = true;
 2107|      0|        }
 2108|      0|        if (!m->compress_streams_set) {
  ------------------
  |  Branch (2108:13): [True: 0, False: 0]
  ------------------
 2109|      0|            m->compress_streams = false;
 2110|      0|        }
 2111|      0|        if (!m->stream_decode_level_set) {
  ------------------
  |  Branch (2111:13): [True: 0, False: 0]
  ------------------
 2112|      0|            m->stream_decode_level = qpdf_dl_generalized;
 2113|      0|        }
 2114|      0|    }
 2115|       |
 2116|  2.00k|    if (m->encrypted) {
  ------------------
  |  Branch (2116:9): [True: 0, False: 2.00k]
  ------------------
 2117|       |        // Encryption has been explicitly set
 2118|      0|        m->preserve_encryption = false;
 2119|  2.00k|    } else if (m->normalize_content || m->stream_decode_level || m->pclm || m->qdf_mode) {
  ------------------
  |  Branch (2119:16): [True: 0, False: 2.00k]
  |  Branch (2119:40): [True: 2.00k, False: 0]
  |  Branch (2119:66): [True: 0, False: 0]
  |  Branch (2119:77): [True: 0, False: 0]
  ------------------
 2120|       |        // Encryption makes looking at contents pretty useless.  If the user explicitly encrypted
 2121|       |        // though, we still obey that.
 2122|  2.00k|        m->preserve_encryption = false;
 2123|  2.00k|    }
 2124|       |
 2125|  2.00k|    if (m->preserve_encryption) {
  ------------------
  |  Branch (2125:9): [True: 0, False: 2.00k]
  ------------------
 2126|      0|        copyEncryptionParameters(m->pdf);
 2127|      0|    }
 2128|       |
 2129|  2.00k|    if (!m->forced_pdf_version.empty()) {
  ------------------
  |  Branch (2129:9): [True: 0, False: 2.00k]
  ------------------
 2130|      0|        int major = 0;
 2131|      0|        int minor = 0;
 2132|      0|        parseVersion(m->forced_pdf_version, major, minor);
 2133|      0|        disableIncompatibleEncryption(major, minor, m->forced_extension_level);
 2134|      0|        if (compareVersions(major, minor, 1, 5) < 0) {
  ------------------
  |  Branch (2134:13): [True: 0, False: 0]
  ------------------
 2135|      0|            QTC::TC("qpdf", "QPDFWriter forcing object stream disable");
 2136|      0|            m->object_stream_mode = qpdf_o_disable;
 2137|      0|        }
 2138|      0|    }
 2139|       |
 2140|  2.00k|    if (m->qdf_mode || m->normalize_content || m->stream_decode_level) {
  ------------------
  |  Branch (2140:9): [True: 0, False: 2.00k]
  |  Branch (2140:24): [True: 0, False: 2.00k]
  |  Branch (2140:48): [True: 2.00k, False: 0]
  ------------------
 2141|  2.00k|        initializeSpecialStreams();
 2142|  2.00k|    }
 2143|       |
 2144|  2.00k|    if (m->qdf_mode) {
  ------------------
  |  Branch (2144:9): [True: 0, False: 2.00k]
  ------------------
 2145|       |        // Generate indirect stream lengths for qdf mode since fix-qdf uses them for storing
 2146|       |        // recomputed stream length data. Certain streams such as object streams, xref streams, and
 2147|       |        // hint streams always get direct stream lengths.
 2148|      0|        m->direct_stream_lengths = false;
 2149|      0|    }
 2150|       |
 2151|  2.00k|    switch (m->object_stream_mode) {
  ------------------
  |  Branch (2151:13): [True: 5, False: 2.00k]
  ------------------
 2152|      0|    case qpdf_o_disable:
  ------------------
  |  Branch (2152:5): [True: 0, False: 2.00k]
  ------------------
 2153|      0|        initializeTables();
 2154|      0|        m->obj.streams_empty = true;
 2155|      0|        break;
 2156|       |
 2157|      0|    case qpdf_o_preserve:
  ------------------
  |  Branch (2157:5): [True: 0, False: 2.00k]
  ------------------
 2158|      0|        initializeTables();
 2159|      0|        preserveObjectStreams();
 2160|      0|        break;
 2161|       |
 2162|  2.00k|    case qpdf_o_generate:
  ------------------
  |  Branch (2162:5): [True: 2.00k, False: 5]
  ------------------
 2163|  2.00k|        generateObjectStreams();
 2164|  2.00k|        break;
 2165|       |
 2166|       |        // no default so gcc will warn for missing case tag
 2167|  2.00k|    }
 2168|       |
 2169|  1.96k|    if (!m->obj.streams_empty) {
  ------------------
  |  Branch (2169:9): [True: 1.94k, False: 18]
  ------------------
 2170|  1.94k|        if (m->linearized) {
  ------------------
  |  Branch (2170:13): [True: 1.94k, False: 0]
  ------------------
 2171|       |            // Page dictionaries are not allowed to be compressed objects.
 2172|  20.0k|            for (auto& page: m->pdf.getAllPages()) {
  ------------------
  |  Branch (2172:28): [True: 20.0k, False: 1.94k]
  ------------------
 2173|  20.0k|                if (m->obj[page].object_stream > 0) {
  ------------------
  |  Branch (2173:21): [True: 19.8k, False: 125]
  ------------------
 2174|  19.8k|                    QTC::TC("qpdf", "QPDFWriter uncompressing page dictionary");
 2175|  19.8k|                    m->obj[page].object_stream = 0;
 2176|  19.8k|                }
 2177|  20.0k|            }
 2178|  1.94k|        }
 2179|       |
 2180|  1.94k|        if (m->linearized || m->encrypted) {
  ------------------
  |  Branch (2180:13): [True: 1.94k, False: 0]
  |  Branch (2180:30): [True: 0, False: 0]
  ------------------
 2181|       |            // The document catalog is not allowed to be compressed in linearized files either.  It
 2182|       |            // also appears that Adobe Reader 8.0.0 has a bug that prevents it from being able to
 2183|       |            // handle encrypted files with compressed document catalogs, so we disable them in that
 2184|       |            // case as well.
 2185|  1.94k|            if (m->obj[m->root_og].object_stream > 0) {
  ------------------
  |  Branch (2185:17): [True: 1.93k, False: 13]
  ------------------
 2186|  1.93k|                QTC::TC("qpdf", "QPDFWriter uncompressing root");
 2187|  1.93k|                m->obj[m->root_og].object_stream = 0;
 2188|  1.93k|            }
 2189|  1.94k|        }
 2190|       |
 2191|       |        // Generate reverse mapping from object stream to objects
 2192|  1.94k|        m->obj.forEach([this](auto id, auto const& item) -> void {
 2193|  1.94k|            if (item.object_stream > 0) {
 2194|  1.94k|                auto& vec = m->object_stream_to_objects[item.object_stream];
 2195|  1.94k|                vec.emplace_back(id, item.gen);
 2196|  1.94k|                if (m->max_ostream_index < vec.size()) {
 2197|  1.94k|                    ++m->max_ostream_index;
 2198|  1.94k|                }
 2199|  1.94k|            }
 2200|  1.94k|        });
 2201|  1.94k|        --m->max_ostream_index;
 2202|       |
 2203|  1.94k|        if (m->object_stream_to_objects.empty()) {
  ------------------
  |  Branch (2203:13): [True: 12, False: 1.93k]
  ------------------
 2204|     12|            m->obj.streams_empty = true;
 2205|  1.93k|        } else {
 2206|  1.93k|            setMinimumPDFVersion("1.5");
 2207|  1.93k|        }
 2208|  1.94k|    }
 2209|       |
 2210|  1.96k|    setMinimumPDFVersion(m->pdf.getPDFVersion(), m->pdf.getExtensionLevel());
 2211|  1.96k|    m->final_pdf_version = m->min_pdf_version;
 2212|  1.96k|    m->final_extension_level = m->min_extension_level;
 2213|  1.96k|    if (!m->forced_pdf_version.empty()) {
  ------------------
  |  Branch (2213:9): [True: 0, False: 1.96k]
  ------------------
 2214|      0|        QTC::TC("qpdf", "QPDFWriter using forced PDF version");
 2215|      0|        m->final_pdf_version = m->forced_pdf_version;
 2216|      0|        m->final_extension_level = m->forced_extension_level;
 2217|      0|    }
 2218|  1.96k|}
_ZN10QPDFWriter5writeEv:
 2222|  2.00k|{
 2223|  2.00k|    doWriteSetup();
 2224|       |
 2225|       |    // Set up progress reporting. For linearized files, we write two passes. events_expected is an
 2226|       |    // approximation, but it's good enough for progress reporting, which is mostly a guess anyway.
 2227|  2.00k|    m->events_expected = QIntC::to_int(m->pdf.getObjectCount() * (m->linearized ? 2 : 1));
  ------------------
  |  Branch (2227:67): [True: 1.94k, False: 58]
  ------------------
 2228|       |
 2229|  2.00k|    prepareFileForWrite();
 2230|       |
 2231|  2.00k|    if (m->linearized) {
  ------------------
  |  Branch (2231:9): [True: 1.94k, False: 60]
  ------------------
 2232|  1.94k|        writeLinearized();
 2233|  1.94k|    } else {
 2234|     60|        writeStandard();
 2235|     60|    }
 2236|       |
 2237|  2.00k|    m->pipeline->finish();
 2238|  2.00k|    if (m->close_file) {
  ------------------
  |  Branch (2238:9): [True: 0, False: 2.00k]
  ------------------
 2239|      0|        fclose(m->file);
 2240|      0|    }
 2241|  2.00k|    m->file = nullptr;
 2242|  2.00k|    if (m->buffer_pipeline) {
  ------------------
  |  Branch (2242:9): [True: 0, False: 2.00k]
  ------------------
 2243|      0|        m->output_buffer = m->buffer_pipeline->getBuffer();
 2244|      0|        m->buffer_pipeline = nullptr;
 2245|      0|    }
 2246|  2.00k|    indicateProgress(false, true);
 2247|  2.00k|}
_ZN10QPDFWriter11enqueuePartERNSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
 2271|  9.00k|{
 2272|  48.9k|    for (auto const& oh: part) {
  ------------------
  |  Branch (2272:24): [True: 48.9k, False: 9.00k]
  ------------------
 2273|  48.9k|        enqueueObject(oh);
 2274|  48.9k|    }
 2275|  9.00k|}
_ZN10QPDFWriter11writeHeaderEv:
 2301|  3.23k|{
 2302|  3.23k|    writeString("%PDF-");
 2303|  3.23k|    writeString(m->final_pdf_version);
 2304|  3.23k|    if (m->pclm) {
  ------------------
  |  Branch (2304:9): [True: 0, False: 3.23k]
  ------------------
 2305|       |        // PCLm version
 2306|      0|        writeString("\n%PCLm 1.0\n");
 2307|  3.23k|    } else {
 2308|       |        // This string of binary characters would not be valid UTF-8, so it really should be treated
 2309|       |        // as binary.
 2310|  3.23k|        writeString("\n%\xbf\xf7\xa2\xfe\n");
 2311|  3.23k|    }
 2312|  3.23k|    writeStringQDF("%QDF-1.0\n\n");
 2313|       |
 2314|       |    // Note: do not write extra header text here.  Linearized PDFs must include the entire
 2315|       |    // linearization parameter dictionary within the first 1024 characters of the PDF file, so for
 2316|       |    // linearized files, we have to write extra header text after the linearization parameter
 2317|       |    // dictionary.
 2318|  3.23k|}
_ZN10QPDFWriter15writeHintStreamEi:
 2322|  1.43k|{
 2323|  1.43k|    std::shared_ptr<Buffer> hint_buffer;
 2324|  1.43k|    int S = 0;
 2325|  1.43k|    int O = 0;
 2326|  1.43k|    bool compressed = (m->compress_streams && !m->qdf_mode);
  ------------------
  |  Branch (2326:24): [True: 1.43k, False: 0]
  |  Branch (2326:47): [True: 1.43k, False: 0]
  ------------------
 2327|  1.43k|    QPDF::Writer::generateHintStream(m->pdf, m->new_obj, m->obj, hint_buffer, S, O, compressed);
 2328|       |
 2329|  1.43k|    openObject(hint_id);
 2330|  1.43k|    setDataKey(hint_id);
 2331|       |
 2332|  1.43k|    size_t hlen = hint_buffer->getSize();
 2333|       |
 2334|  1.43k|    writeString("<< ");
 2335|  1.43k|    if (compressed) {
  ------------------
  |  Branch (2335:9): [True: 1.43k, False: 0]
  ------------------
 2336|  1.43k|        writeString("/Filter /FlateDecode ");
 2337|  1.43k|    }
 2338|  1.43k|    writeString("/S ");
 2339|  1.43k|    writeString(std::to_string(S));
 2340|  1.43k|    if (O) {
  ------------------
  |  Branch (2340:9): [True: 601, False: 830]
  ------------------
 2341|    601|        writeString(" /O ");
 2342|    601|        writeString(std::to_string(O));
 2343|    601|    }
 2344|  1.43k|    writeString(" /Length ");
 2345|  1.43k|    adjustAESStreamLength(hlen);
 2346|  1.43k|    writeString(std::to_string(hlen));
 2347|  1.43k|    writeString(" >>\nstream\n");
 2348|       |
 2349|  1.43k|    if (m->encrypted) {
  ------------------
  |  Branch (2349:9): [True: 0, False: 1.43k]
  ------------------
 2350|      0|        QTC::TC("qpdf", "QPDFWriter encrypted hint stream");
 2351|      0|    }
 2352|  1.43k|    unsigned char last_char = '\0';
 2353|  1.43k|    {
 2354|  1.43k|        PipelinePopper pp_enc(this);
 2355|  1.43k|        pushEncryptionFilter(pp_enc);
 2356|  1.43k|        writeBuffer(hint_buffer);
 2357|  1.43k|        last_char = m->pipeline->getLastChar();
 2358|  1.43k|    }
 2359|       |
 2360|  1.43k|    if (last_char != '\n') {
  ------------------
  |  Branch (2360:9): [True: 1.42k, False: 8]
  ------------------
 2361|  1.42k|        writeString("\n");
 2362|  1.42k|    }
 2363|  1.43k|    writeString("endstream");
 2364|  1.43k|    closeObject(hint_id);
 2365|  1.43k|}
_ZN10QPDFWriter15writeXRefStreamEiixNS_9trailer_eEiiixixxbi:
 2439|  6.08k|{
 2440|  6.08k|    qpdf_offset_t xref_offset = m->pipeline->getCount();
 2441|  6.08k|    qpdf_offset_t space_before_zero = xref_offset - 1;
 2442|       |
 2443|       |    // field 1 contains offsets and object stream identifiers
 2444|  6.08k|    unsigned int f1_size = std::max(bytesNeeded(max_offset + hint_length), bytesNeeded(max_id));
 2445|       |
 2446|       |    // field 2 contains object stream indices
 2447|  6.08k|    unsigned int f2_size = bytesNeeded(QIntC::to_longlong(m->max_ostream_index));
 2448|       |
 2449|  6.08k|    unsigned int esize = 1 + f1_size + f2_size;
 2450|       |
 2451|       |    // Must store in xref table in advance of writing the actual data rather than waiting for
 2452|       |    // openObject to do it.
 2453|  6.08k|    m->new_obj[xref_id].xref = QPDFXRefEntry(m->pipeline->getCount());
 2454|       |
 2455|  6.08k|    Pipeline* p = pushPipeline(new Pl_Buffer("xref stream"));
 2456|  6.08k|    bool compressed = false;
 2457|  6.08k|    if (m->compress_streams && !m->qdf_mode) {
  ------------------
  |  Branch (2457:9): [True: 6.08k, False: 0]
  |  Branch (2457:32): [True: 6.08k, False: 0]
  ------------------
 2458|  6.08k|        compressed = true;
 2459|  6.08k|        if (!skip_compression) {
  ------------------
  |  Branch (2459:13): [True: 2.84k, False: 3.23k]
  ------------------
 2460|       |            // Write the stream dictionary for compression but don't actually compress.  This helps
 2461|       |            // us with computation of padding for pass 1 of linearization.
 2462|  2.84k|            p = pushPipeline(new Pl_Flate("compress xref", p, Pl_Flate::a_deflate));
 2463|  2.84k|        }
 2464|  6.08k|        p = pushPipeline(new Pl_PNGFilter("pngify xref", p, Pl_PNGFilter::a_encode, esize));
 2465|  6.08k|    }
 2466|  6.08k|    std::shared_ptr<Buffer> xref_data;
 2467|  6.08k|    {
 2468|  6.08k|        PipelinePopper pp_xref(this, &xref_data);
 2469|  6.08k|        activatePipelineStack(pp_xref);
 2470|   173k|        for (int i = first; i <= last; ++i) {
  ------------------
  |  Branch (2470:29): [True: 166k, False: 6.08k]
  ------------------
 2471|   166k|            QPDFXRefEntry& e = m->new_obj[i].xref;
 2472|   166k|            switch (e.getType()) {
 2473|  38.4k|            case 0:
  ------------------
  |  Branch (2473:13): [True: 38.4k, False: 128k]
  ------------------
 2474|  38.4k|                writeBinary(0, 1);
 2475|  38.4k|                writeBinary(0, f1_size);
 2476|  38.4k|                writeBinary(0, f2_size);
 2477|  38.4k|                break;
 2478|       |
 2479|  90.9k|            case 1:
  ------------------
  |  Branch (2479:13): [True: 90.9k, False: 75.9k]
  ------------------
 2480|  90.9k|                {
 2481|  90.9k|                    qpdf_offset_t offset = e.getOffset();
 2482|  90.9k|                    if ((hint_id != 0) && (i != hint_id) && (offset >= hint_offset)) {
  ------------------
  |  Branch (2482:25): [True: 14.7k, False: 76.1k]
  |  Branch (2482:43): [True: 13.3k, False: 1.43k]
  |  Branch (2482:61): [True: 8.43k, False: 4.93k]
  ------------------
 2483|  8.43k|                        offset += hint_length;
 2484|  8.43k|                    }
 2485|  90.9k|                    writeBinary(1, 1);
 2486|  90.9k|                    writeBinary(QIntC::to_ulonglong(offset), f1_size);
 2487|  90.9k|                    writeBinary(0, f2_size);
 2488|  90.9k|                }
 2489|  90.9k|                break;
 2490|       |
 2491|  37.5k|            case 2:
  ------------------
  |  Branch (2491:13): [True: 37.5k, False: 129k]
  ------------------
 2492|  37.5k|                writeBinary(2, 1);
 2493|  37.5k|                writeBinary(QIntC::to_ulonglong(e.getObjStreamNumber()), f1_size);
 2494|  37.5k|                writeBinary(QIntC::to_ulonglong(e.getObjStreamIndex()), f2_size);
 2495|  37.5k|                break;
 2496|       |
 2497|      0|            default:
  ------------------
  |  Branch (2497:13): [True: 0, False: 166k]
  ------------------
 2498|      0|                throw std::logic_error("invalid type writing xref stream");
 2499|      0|                break;
 2500|   166k|            }
 2501|   166k|        }
 2502|  6.08k|    }
 2503|       |
 2504|  6.08k|    openObject(xref_id);
 2505|  6.08k|    writeString("<<");
 2506|  6.08k|    writeStringQDF("\n ");
 2507|  6.08k|    writeString(" /Type /XRef");
 2508|  6.08k|    writeStringQDF("\n ");
 2509|  6.08k|    writeString(" /Length " + std::to_string(xref_data->getSize()));
 2510|  6.08k|    if (compressed) {
  ------------------
  |  Branch (2510:9): [True: 6.08k, False: 0]
  ------------------
 2511|  6.08k|        writeStringQDF("\n ");
 2512|  6.08k|        writeString(" /Filter /FlateDecode");
 2513|  6.08k|        writeStringQDF("\n ");
 2514|  6.08k|        writeString(" /DecodeParms << /Columns " + std::to_string(esize) + " /Predictor 12 >>");
 2515|  6.08k|    }
 2516|  6.08k|    writeStringQDF("\n ");
 2517|  6.08k|    writeString(" /W [ 1 " + std::to_string(f1_size) + " " + std::to_string(f2_size) + " ]");
 2518|  6.08k|    if (!((first == 0) && (last == size - 1))) {
  ------------------
  |  Branch (2518:11): [True: 2.84k, False: 3.23k]
  |  Branch (2518:27): [True: 2.84k, False: 0]
  ------------------
 2519|  3.23k|        writeString(
 2520|  3.23k|            " /Index [ " + std::to_string(first) + " " + std::to_string(last - first + 1) + " ]");
 2521|  3.23k|    }
 2522|  6.08k|    writeTrailer(which, size, true, prev, linearization_pass);
 2523|  6.08k|    writeString("\nstream\n");
 2524|  6.08k|    writeBuffer(xref_data);
 2525|  6.08k|    writeString("\nendstream");
 2526|  6.08k|    closeObject(xref_id);
 2527|  6.08k|    return space_before_zero;
 2528|  6.08k|}
_ZN10QPDFWriter26calculateXrefStreamPaddingEx:
 2532|  2.87k|{
 2533|       |    // This routine is called right after a linearization first pass xref stream has been written
 2534|       |    // without compression.  Calculate the amount of padding that would be required in the worst
 2535|       |    // case, assuming the number of uncompressed bytes remains the same. The worst case for zlib is
 2536|       |    // that the output is larger than the input by 6 bytes plus 5 bytes per 16K, and then we'll add
 2537|       |    // 10 extra bytes for number length increases.
 2538|       |
 2539|  2.87k|    return QIntC::to_size(16 + (5 * ((xref_bytes + 16383) / 16384)));
 2540|  2.87k|}
_ZN10QPDFWriter15writeLinearizedEv:
 2544|  1.94k|{
 2545|       |    // Optimize file and enqueue objects in order
 2546|       |
 2547|  1.94k|    std::map<int, int> stream_cache;
 2548|       |
 2549|  1.94k|    auto skip_stream_parameters = [this, &stream_cache](QPDFObjectHandle& stream) {
 2550|  1.94k|        auto& result = stream_cache[stream.getObjectID()];
 2551|  1.94k|        if (result == 0) {
 2552|  1.94k|            bool compress_stream;
 2553|  1.94k|            bool is_metadata;
 2554|  1.94k|            if (willFilterStream(stream, compress_stream, is_metadata, nullptr)) {
 2555|  1.94k|                result = 2;
 2556|  1.94k|            } else {
 2557|  1.94k|                result = 1;
 2558|  1.94k|            }
 2559|  1.94k|        }
 2560|  1.94k|        return result;
 2561|  1.94k|    };
 2562|       |
 2563|  1.94k|    QPDF::Writer::optimize(m->pdf, m->obj, skip_stream_parameters);
 2564|       |
 2565|  1.94k|    std::vector<QPDFObjectHandle> part4;
 2566|  1.94k|    std::vector<QPDFObjectHandle> part6;
 2567|  1.94k|    std::vector<QPDFObjectHandle> part7;
 2568|  1.94k|    std::vector<QPDFObjectHandle> part8;
 2569|  1.94k|    std::vector<QPDFObjectHandle> part9;
 2570|  1.94k|    QPDF::Writer::getLinearizedParts(m->pdf, m->obj, part4, part6, part7, part8, part9);
 2571|       |
 2572|       |    // Object number sequence:
 2573|       |    //
 2574|       |    //  second half
 2575|       |    //    second half uncompressed objects
 2576|       |    //    second half xref stream, if any
 2577|       |    //    second half compressed objects
 2578|       |    //  first half
 2579|       |    //    linearization dictionary
 2580|       |    //    first half xref stream, if any
 2581|       |    //    part 4 uncompresesd objects
 2582|       |    //    encryption dictionary, if any
 2583|       |    //    hint stream
 2584|       |    //    part 6 uncompressed objects
 2585|       |    //    first half compressed objects
 2586|       |    //
 2587|       |
 2588|       |    // Second half objects
 2589|  1.94k|    int second_half_uncompressed = QIntC::to_int(part7.size() + part8.size() + part9.size());
 2590|  1.94k|    int second_half_first_obj = 1;
 2591|  1.94k|    int after_second_half = 1 + second_half_uncompressed;
 2592|  1.94k|    m->next_objid = after_second_half;
 2593|  1.94k|    int second_half_xref = 0;
 2594|  1.94k|    bool need_xref_stream = !m->obj.streams_empty;
 2595|  1.94k|    if (need_xref_stream) {
  ------------------
  |  Branch (2595:9): [True: 1.80k, False: 146]
  ------------------
 2596|  1.80k|        second_half_xref = m->next_objid++;
 2597|  1.80k|    }
 2598|       |    // Assign numbers to all compressed objects in the second half.
 2599|  1.94k|    std::vector<QPDFObjectHandle>* vecs2[] = {&part7, &part8, &part9};
 2600|  7.34k|    for (int i = 0; i < 3; ++i) {
  ------------------
  |  Branch (2600:21): [True: 5.40k, False: 1.94k]
  ------------------
 2601|  40.6k|        for (auto const& oh: *vecs2[i]) {
  ------------------
  |  Branch (2601:28): [True: 40.6k, False: 5.40k]
  ------------------
 2602|  40.6k|            assignCompressedObjectNumbers(oh.getObjGen());
 2603|  40.6k|        }
 2604|  5.40k|    }
 2605|  1.94k|    int second_half_end = m->next_objid - 1;
 2606|  1.94k|    int second_trailer_size = m->next_objid;
 2607|       |
 2608|       |    // First half objects
 2609|  1.94k|    int first_half_start = m->next_objid;
 2610|  1.94k|    int lindict_id = m->next_objid++;
 2611|  1.94k|    int first_half_xref = 0;
 2612|  1.94k|    if (need_xref_stream) {
  ------------------
  |  Branch (2612:9): [True: 1.80k, False: 146]
  ------------------
 2613|  1.80k|        first_half_xref = m->next_objid++;
 2614|  1.80k|    }
 2615|  1.94k|    int part4_first_obj = m->next_objid;
 2616|  1.94k|    m->next_objid += QIntC::to_int(part4.size());
 2617|  1.94k|    int after_part4 = m->next_objid;
 2618|  1.94k|    if (m->encrypted) {
  ------------------
  |  Branch (2618:9): [True: 0, False: 1.94k]
  ------------------
 2619|      0|        m->encryption_dict_objid = m->next_objid++;
 2620|      0|    }
 2621|  1.94k|    int hint_id = m->next_objid++;
 2622|  1.94k|    int part6_first_obj = m->next_objid;
 2623|  1.94k|    m->next_objid += QIntC::to_int(part6.size());
 2624|  1.94k|    int after_part6 = m->next_objid;
 2625|       |    // Assign numbers to all compressed objects in the first half
 2626|  1.94k|    std::vector<QPDFObjectHandle>* vecs1[] = {&part4, &part6};
 2627|  5.54k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (2627:21): [True: 3.60k, False: 1.94k]
  ------------------
 2628|  8.27k|        for (auto const& oh: *vecs1[i]) {
  ------------------
  |  Branch (2628:28): [True: 8.27k, False: 3.60k]
  ------------------
 2629|  8.27k|            assignCompressedObjectNumbers(oh.getObjGen());
 2630|  8.27k|        }
 2631|  3.60k|    }
 2632|  1.94k|    int first_half_end = m->next_objid - 1;
 2633|  1.94k|    int first_trailer_size = m->next_objid;
 2634|       |
 2635|  1.94k|    int part4_end_marker = part4.back().getObjectID();
 2636|  1.94k|    int part6_end_marker = part6.back().getObjectID();
 2637|  1.94k|    qpdf_offset_t space_before_zero = 0;
 2638|  1.94k|    qpdf_offset_t file_size = 0;
 2639|  1.94k|    qpdf_offset_t part6_end_offset = 0;
 2640|  1.94k|    qpdf_offset_t first_half_max_obj_offset = 0;
 2641|  1.94k|    qpdf_offset_t second_xref_offset = 0;
 2642|  1.94k|    qpdf_offset_t first_xref_end = 0;
 2643|  1.94k|    qpdf_offset_t second_xref_end = 0;
 2644|       |
 2645|  1.94k|    m->next_objid = part4_first_obj;
 2646|  1.94k|    enqueuePart(part4);
 2647|  1.94k|    if (m->next_objid != after_part4) {
  ------------------
  |  Branch (2647:9): [True: 0, False: 1.94k]
  ------------------
 2648|       |        // This can happen with very botched files as in the fuzzer test. There are likely some
 2649|       |        // faulty assumptions in calculateLinearizationData
 2650|      0|        throw std::runtime_error("error encountered after writing part 4 of linearized data");
 2651|      0|    }
 2652|  1.94k|    m->next_objid = part6_first_obj;
 2653|  1.94k|    enqueuePart(part6);
 2654|  1.94k|    if (m->next_objid != after_part6) {
  ------------------
  |  Branch (2654:9): [True: 0, False: 1.94k]
  ------------------
 2655|      0|        throw std::runtime_error("error encountered after writing part 6 of linearized data");
 2656|      0|    }
 2657|  1.94k|    m->next_objid = second_half_first_obj;
 2658|  1.94k|    enqueuePart(part7);
 2659|  1.94k|    enqueuePart(part8);
 2660|  1.94k|    enqueuePart(part9);
 2661|  1.94k|    if (m->next_objid != after_second_half) {
  ------------------
  |  Branch (2661:9): [True: 0, False: 1.94k]
  ------------------
 2662|      0|        throw std::runtime_error("error encountered after writing part 9 of linearized data");
 2663|      0|    }
 2664|       |
 2665|  1.94k|    qpdf_offset_t hint_length = 0;
 2666|  1.94k|    std::shared_ptr<Buffer> hint_buffer;
 2667|       |
 2668|       |    // Write file in two passes.  Part numbers refer to PDF spec 1.4.
 2669|       |
 2670|  1.94k|    FILE* lin_pass1_file = nullptr;
 2671|  1.94k|    auto pp_pass1 = std::make_shared<PipelinePopper>(this);
 2672|  1.94k|    auto pp_md5 = std::make_shared<PipelinePopper>(this);
 2673|  5.17k|    for (int pass = 1; pass <= 2; ++pass) {
  ------------------
  |  Branch (2673:24): [True: 3.23k, False: 1.94k]
  ------------------
 2674|  3.23k|        if (pass == 1) {
  ------------------
  |  Branch (2674:13): [True: 1.80k, False: 1.43k]
  ------------------
 2675|  1.80k|            if (!m->lin_pass1_filename.empty()) {
  ------------------
  |  Branch (2675:17): [True: 0, False: 1.80k]
  ------------------
 2676|      0|                lin_pass1_file = QUtil::safe_fopen(m->lin_pass1_filename.c_str(), "wb");
 2677|      0|                pushPipeline(new Pl_StdioFile("linearization pass1", lin_pass1_file));
 2678|      0|                activatePipelineStack(*pp_pass1);
 2679|  1.80k|            } else {
 2680|  1.80k|                pushDiscardFilter(*pp_pass1);
 2681|  1.80k|            }
 2682|  1.80k|            if (m->deterministic_id) {
  ------------------
  |  Branch (2682:17): [True: 1.80k, False: 0]
  ------------------
 2683|  1.80k|                pushMD5Pipeline(*pp_md5);
 2684|  1.80k|            }
 2685|  1.80k|        }
 2686|       |
 2687|       |        // Part 1: header
 2688|       |
 2689|  3.23k|        writeHeader();
 2690|       |
 2691|       |        // Part 2: linearization parameter dictionary.  Save enough space to write real dictionary.
 2692|       |        // 200 characters is enough space if all numerical values in the parameter dictionary that
 2693|       |        // contain offsets are 20 digits long plus a few extra characters for safety.  The entire
 2694|       |        // linearization parameter dictionary must appear within the first 1024 characters of the
 2695|       |        // file.
 2696|       |
 2697|  3.23k|        qpdf_offset_t pos = m->pipeline->getCount();
 2698|  3.23k|        openObject(lindict_id);
 2699|  3.23k|        writeString("<<");
 2700|  3.23k|        if (pass == 2) {
  ------------------
  |  Branch (2700:13): [True: 1.43k, False: 1.80k]
  ------------------
 2701|  1.43k|            std::vector<QPDFObjectHandle> const& pages = m->pdf.getAllPages();
 2702|  1.43k|            int first_page_object = m->obj[pages.at(0)].renumber;
 2703|  1.43k|            int npages = QIntC::to_int(pages.size());
 2704|       |
 2705|  1.43k|            writeString(" /Linearized 1 /L ");
 2706|  1.43k|            writeString(std::to_string(file_size + hint_length));
 2707|       |            // Implementation note 121 states that a space is mandatory after this open bracket.
 2708|  1.43k|            writeString(" /H [ ");
 2709|  1.43k|            writeString(std::to_string(m->new_obj[hint_id].xref.getOffset()));
 2710|  1.43k|            writeString(" ");
 2711|  1.43k|            writeString(std::to_string(hint_length));
 2712|  1.43k|            writeString(" ] /O ");
 2713|  1.43k|            writeString(std::to_string(first_page_object));
 2714|  1.43k|            writeString(" /E ");
 2715|  1.43k|            writeString(std::to_string(part6_end_offset + hint_length));
 2716|  1.43k|            writeString(" /N ");
 2717|  1.43k|            writeString(std::to_string(npages));
 2718|  1.43k|            writeString(" /T ");
 2719|  1.43k|            writeString(std::to_string(space_before_zero + hint_length));
 2720|  1.43k|        }
 2721|  3.23k|        writeString(" >>");
 2722|  3.23k|        closeObject(lindict_id);
 2723|  3.23k|        static int const pad = 200;
 2724|  3.23k|        writePad(QIntC::to_size(pos - m->pipeline->getCount() + pad));
 2725|  3.23k|        writeString("\n");
 2726|       |
 2727|       |        // If the user supplied any additional header text, write it here after the linearization
 2728|       |        // parameter dictionary.
 2729|  3.23k|        writeString(m->extra_header_text);
 2730|       |
 2731|       |        // Part 3: first page cross reference table and trailer.
 2732|       |
 2733|  3.23k|        qpdf_offset_t first_xref_offset = m->pipeline->getCount();
 2734|  3.23k|        qpdf_offset_t hint_offset = 0;
 2735|  3.23k|        if (pass == 2) {
  ------------------
  |  Branch (2735:13): [True: 1.43k, False: 1.80k]
  ------------------
 2736|  1.43k|            hint_offset = m->new_obj[hint_id].xref.getOffset();
 2737|  1.43k|        }
 2738|  3.23k|        if (need_xref_stream) {
  ------------------
  |  Branch (2738:13): [True: 3.23k, False: 0]
  ------------------
 2739|       |            // Must pad here too.
 2740|  3.23k|            if (pass == 1) {
  ------------------
  |  Branch (2740:17): [True: 1.80k, False: 1.43k]
  ------------------
 2741|       |                // Set first_half_max_obj_offset to a value large enough to force four bytes to be
 2742|       |                // reserved for each file offset.  This would provide adequate space for the xref
 2743|       |                // stream as long as the last object in page 1 starts with in the first 4 GB of the
 2744|       |                // file, which is extremely likely.  In the second pass, we will know the actual
 2745|       |                // value for this, but it's okay if it's smaller.
 2746|  1.80k|                first_half_max_obj_offset = 1 << 25;
 2747|  1.80k|            }
 2748|  3.23k|            pos = m->pipeline->getCount();
 2749|  3.23k|            writeXRefStream(
 2750|  3.23k|                first_half_xref,
 2751|  3.23k|                first_half_end,
 2752|  3.23k|                first_half_max_obj_offset,
 2753|  3.23k|                t_lin_first,
 2754|  3.23k|                first_half_start,
 2755|  3.23k|                first_half_end,
 2756|  3.23k|                first_trailer_size,
 2757|  3.23k|                hint_length + second_xref_offset,
 2758|  3.23k|                hint_id,
 2759|  3.23k|                hint_offset,
 2760|  3.23k|                hint_length,
 2761|  3.23k|                (pass == 1),
 2762|  3.23k|                pass);
 2763|  3.23k|            qpdf_offset_t endpos = m->pipeline->getCount();
 2764|  3.23k|            if (pass == 1) {
  ------------------
  |  Branch (2764:17): [True: 1.44k, False: 1.78k]
  ------------------
 2765|       |                // Pad so we have enough room for the real xref stream.
 2766|  1.44k|                writePad(calculateXrefStreamPadding(endpos - pos));
 2767|  1.44k|                first_xref_end = m->pipeline->getCount();
 2768|  1.78k|            } else {
 2769|       |                // Pad so that the next object starts at the same place as in pass 1.
 2770|  1.78k|                writePad(QIntC::to_size(first_xref_end - endpos));
 2771|       |
 2772|  1.78k|                if (m->pipeline->getCount() != first_xref_end) {
  ------------------
  |  Branch (2772:21): [True: 0, False: 1.78k]
  ------------------
 2773|      0|                    throw std::logic_error(
 2774|      0|                        "insufficient padding for first pass xref stream; "
 2775|      0|                        "first_xref_end=" +
 2776|      0|                        std::to_string(first_xref_end) + "; endpos=" + std::to_string(endpos));
 2777|      0|                }
 2778|  1.78k|            }
 2779|  3.23k|            writeString("\n");
 2780|  3.23k|        } else {
 2781|      0|            writeXRefTable(
 2782|      0|                t_lin_first,
 2783|      0|                first_half_start,
 2784|      0|                first_half_end,
 2785|      0|                first_trailer_size,
 2786|      0|                hint_length + second_xref_offset,
 2787|      0|                (pass == 1),
 2788|      0|                hint_id,
 2789|      0|                hint_offset,
 2790|      0|                hint_length,
 2791|      0|                pass);
 2792|      0|            writeString("startxref\n0\n%%EOF\n");
 2793|      0|        }
 2794|       |
 2795|       |        // Parts 4 through 9
 2796|       |
 2797|  88.1k|        for (auto const& cur_object: m->object_queue) {
  ------------------
  |  Branch (2797:36): [True: 88.1k, False: 3.23k]
  ------------------
 2798|  88.1k|            if (cur_object.getObjectID() == part6_end_marker) {
  ------------------
  |  Branch (2798:17): [True: 2.86k, False: 85.3k]
  ------------------
 2799|  2.86k|                first_half_max_obj_offset = m->pipeline->getCount();
 2800|  2.86k|            }
 2801|  88.1k|            writeObject(cur_object);
 2802|  88.1k|            if (cur_object.getObjectID() == part4_end_marker) {
  ------------------
  |  Branch (2802:17): [True: 2.87k, False: 85.3k]
  ------------------
 2803|  2.87k|                if (m->encrypted) {
  ------------------
  |  Branch (2803:21): [True: 0, False: 2.87k]
  ------------------
 2804|      0|                    writeEncryptionDictionary();
 2805|      0|                }
 2806|  2.87k|                if (pass == 1) {
  ------------------
  |  Branch (2806:21): [True: 1.44k, False: 1.42k]
  ------------------
 2807|  1.44k|                    m->new_obj[hint_id].xref = QPDFXRefEntry(m->pipeline->getCount());
 2808|  1.44k|                } else {
 2809|       |                    // Part 5: hint stream
 2810|  1.42k|                    writeBuffer(hint_buffer);
 2811|  1.42k|                }
 2812|  2.87k|            }
 2813|  88.1k|            if (cur_object.getObjectID() == part6_end_marker) {
  ------------------
  |  Branch (2813:17): [True: 2.86k, False: 85.3k]
  ------------------
 2814|  2.86k|                part6_end_offset = m->pipeline->getCount();
 2815|  2.86k|            }
 2816|  88.1k|        }
 2817|       |
 2818|       |        // Part 10: overflow hint stream -- not used
 2819|       |
 2820|       |        // Part 11: main cross reference table and trailer
 2821|       |
 2822|  3.23k|        second_xref_offset = m->pipeline->getCount();
 2823|  3.23k|        if (need_xref_stream) {
  ------------------
  |  Branch (2823:13): [True: 2.84k, False: 382]
  ------------------
 2824|  2.84k|            pos = m->pipeline->getCount();
 2825|  2.84k|            space_before_zero = writeXRefStream(
 2826|  2.84k|                second_half_xref,
 2827|  2.84k|                second_half_end,
 2828|  2.84k|                second_xref_offset,
 2829|  2.84k|                t_lin_second,
 2830|  2.84k|                0,
 2831|  2.84k|                second_half_end,
 2832|  2.84k|                second_trailer_size,
 2833|  2.84k|                0,
 2834|  2.84k|                0,
 2835|  2.84k|                0,
 2836|  2.84k|                0,
 2837|  2.84k|                (pass == 1),
 2838|  2.84k|                pass);
 2839|  2.84k|            qpdf_offset_t endpos = m->pipeline->getCount();
 2840|       |
 2841|  2.84k|            if (pass == 1) {
  ------------------
  |  Branch (2841:17): [True: 1.43k, False: 1.41k]
  ------------------
 2842|       |                // Pad so we have enough room for the real xref stream.  See comments for previous
 2843|       |                // xref stream on how we calculate the padding.
 2844|  1.43k|                writePad(calculateXrefStreamPadding(endpos - pos));
 2845|  1.43k|                writeString("\n");
 2846|  1.43k|                second_xref_end = m->pipeline->getCount();
 2847|  1.43k|            } else {
 2848|       |                // Make the file size the same.
 2849|  1.41k|                writePad(
 2850|  1.41k|                    QIntC::to_size(second_xref_end + hint_length - 1 - m->pipeline->getCount()));
 2851|  1.41k|                writeString("\n");
 2852|       |
 2853|       |                // If this assertion fails, maybe we didn't have enough padding above.
 2854|  1.41k|                if (m->pipeline->getCount() != second_xref_end + hint_length) {
  ------------------
  |  Branch (2854:21): [True: 0, False: 1.41k]
  ------------------
 2855|      0|                    throw std::logic_error(
 2856|      0|                        "count mismatch after xref stream; possible insufficient padding?");
 2857|      0|                }
 2858|  1.41k|            }
 2859|  2.84k|        } else {
 2860|    382|            space_before_zero = writeXRefTable(
 2861|    382|                t_lin_second, 0, second_half_end, second_trailer_size, 0, false, 0, 0, 0, pass);
 2862|    382|        }
 2863|  3.23k|        writeString("startxref\n");
 2864|  3.23k|        writeString(std::to_string(first_xref_offset));
 2865|  3.23k|        writeString("\n%%EOF\n");
 2866|       |
 2867|  3.23k|        if (pass == 1) {
  ------------------
  |  Branch (2867:13): [True: 1.43k, False: 1.80k]
  ------------------
 2868|  1.43k|            if (m->deterministic_id) {
  ------------------
  |  Branch (2868:17): [True: 1.43k, False: 0]
  ------------------
 2869|  1.43k|                QTC::TC("qpdf", "QPDFWriter linearized deterministic ID", need_xref_stream ? 0 : 1);
  ------------------
  |  Branch (2869:75): [True: 1.43k, False: 0]
  ------------------
 2870|  1.43k|                computeDeterministicIDData();
 2871|  1.43k|                pp_md5 = nullptr;
 2872|  1.43k|                qpdf_assert_debug(m->md5_pipeline == nullptr);
  ------------------
  |  |   16|  1.43k|# define qpdf_assert_debug assert
  ------------------
 2873|  1.43k|            }
 2874|       |
 2875|       |            // Close first pass pipeline
 2876|  1.43k|            file_size = m->pipeline->getCount();
 2877|  1.43k|            pp_pass1 = nullptr;
 2878|       |
 2879|       |            // Save hint offset since it will be set to zero by calling openObject.
 2880|  1.43k|            qpdf_offset_t hint_offset1 = m->new_obj[hint_id].xref.getOffset();
 2881|       |
 2882|       |            // Write hint stream to a buffer
 2883|  1.43k|            {
 2884|  1.43k|                pushPipeline(new Pl_Buffer("hint buffer"));
 2885|  1.43k|                PipelinePopper pp_hint(this, &hint_buffer);
 2886|  1.43k|                activatePipelineStack(pp_hint);
 2887|  1.43k|                writeHintStream(hint_id);
 2888|  1.43k|            }
 2889|  1.43k|            hint_length = QIntC::to_offset(hint_buffer->getSize());
 2890|       |
 2891|       |            // Restore hint offset
 2892|  1.43k|            m->new_obj[hint_id].xref = QPDFXRefEntry(hint_offset1);
 2893|  1.43k|            if (lin_pass1_file) {
  ------------------
  |  Branch (2893:17): [True: 0, False: 1.43k]
  ------------------
 2894|       |                // Write some debugging information
 2895|      0|                fprintf(
 2896|      0|                    lin_pass1_file, "%% hint_offset=%s\n", std::to_string(hint_offset1).c_str());
 2897|      0|                fprintf(lin_pass1_file, "%% hint_length=%s\n", std::to_string(hint_length).c_str());
 2898|      0|                fprintf(
 2899|      0|                    lin_pass1_file,
 2900|      0|                    "%% second_xref_offset=%s\n",
 2901|      0|                    std::to_string(second_xref_offset).c_str());
 2902|      0|                fprintf(
 2903|      0|                    lin_pass1_file,
 2904|      0|                    "%% second_xref_end=%s\n",
 2905|      0|                    std::to_string(second_xref_end).c_str());
 2906|      0|                fclose(lin_pass1_file);
 2907|      0|                lin_pass1_file = nullptr;
 2908|      0|            }
 2909|  1.43k|        }
 2910|  3.23k|    }
 2911|  1.94k|}
_ZN10QPDFWriter16indicateProgressEbb:
 2965|   269k|{
 2966|   269k|    if (decrement) {
  ------------------
  |  Branch (2966:9): [True: 61.0k, False: 208k]
  ------------------
 2967|  61.0k|        --m->events_seen;
 2968|  61.0k|        return;
 2969|  61.0k|    }
 2970|       |
 2971|   208k|    ++m->events_seen;
 2972|       |
 2973|   208k|    if (!m->progress_reporter.get()) {
  ------------------
  |  Branch (2973:9): [True: 208k, False: 0]
  ------------------
 2974|   208k|        return;
 2975|   208k|    }
 2976|       |
 2977|      0|    if (finished || (m->events_seen >= m->next_progress_report)) {
  ------------------
  |  Branch (2977:9): [True: 0, False: 0]
  |  Branch (2977:21): [True: 0, False: 0]
  ------------------
 2978|      0|        int percentage =
 2979|      0|            (finished ? 100
  ------------------
  |  Branch (2979:14): [True: 0, False: 0]
  ------------------
 2980|      0|                 : m->next_progress_report == 0
  ------------------
  |  Branch (2980:20): [True: 0, False: 0]
  ------------------
 2981|      0|                 ? 0
 2982|      0|                 : std::min(99, 1 + ((100 * m->events_seen) / m->events_expected)));
 2983|      0|        m->progress_reporter->reportProgress(percentage);
 2984|      0|    }
 2985|      0|    int increment = std::max(1, (m->events_expected / 100));
 2986|      0|    while (m->events_seen >= m->next_progress_report) {
  ------------------
  |  Branch (2986:12): [True: 0, False: 0]
  ------------------
 2987|      0|        m->next_progress_report += increment;
 2988|      0|    }
 2989|      0|}
QPDFWriter.cc:_ZZN10QPDFWriter12doWriteSetupEvENK3$_0clIiNS_6ObjectEEEvT_RKT0_:
 2192|   584k|        m->obj.forEach([this](auto id, auto const& item) -> void {
 2193|   584k|            if (item.object_stream > 0) {
  ------------------
  |  Branch (2193:17): [True: 35.3k, False: 548k]
  ------------------
 2194|  35.3k|                auto& vec = m->object_stream_to_objects[item.object_stream];
 2195|  35.3k|                vec.emplace_back(id, item.gen);
 2196|  35.3k|                if (m->max_ostream_index < vec.size()) {
  ------------------
  |  Branch (2196:21): [True: 29.5k, False: 5.74k]
  ------------------
 2197|  29.5k|                    ++m->max_ostream_index;
 2198|  29.5k|                }
 2199|  35.3k|            }
 2200|   584k|        });
QPDFWriter.cc:_ZZN10QPDFWriter15writeLinearizedEvENK3$_0clER16QPDFObjectHandle:
 2549|  45.3k|    auto skip_stream_parameters = [this, &stream_cache](QPDFObjectHandle& stream) {
 2550|  45.3k|        auto& result = stream_cache[stream.getObjectID()];
 2551|  45.3k|        if (result == 0) {
  ------------------
  |  Branch (2551:13): [True: 29.2k, False: 16.1k]
  ------------------
 2552|  29.2k|            bool compress_stream;
 2553|  29.2k|            bool is_metadata;
 2554|  29.2k|            if (willFilterStream(stream, compress_stream, is_metadata, nullptr)) {
  ------------------
  |  Branch (2554:17): [True: 12.5k, False: 16.6k]
  ------------------
 2555|  12.5k|                result = 2;
 2556|  16.6k|            } else {
 2557|  16.6k|                result = 1;
 2558|  16.6k|            }
 2559|  29.2k|        }
 2560|  45.3k|        return result;
 2561|  45.3k|    };

_ZN13QPDFXRefEntryC2Ev:
    7|   776k|{
    8|   776k|}
_ZNK13QPDFXRefEntry7getTypeEv:
   22|  1.06M|{
   23|  1.06M|    return this->type;
   24|  1.06M|}
_ZNK13QPDFXRefEntry9getOffsetEv:
   28|  1.04M|{
   29|  1.04M|    if (this->type != 1) {
  ------------------
  |  Branch (29:9): [True: 0, False: 1.04M]
  ------------------
   30|      0|        throw std::logic_error("getOffset called for xref entry of type != 1");
   31|      0|    }
   32|  1.04M|    return this->field1;
   33|  1.04M|}
_ZNK13QPDFXRefEntry18getObjStreamNumberEv:
   37|  64.5k|{
   38|  64.5k|    if (this->type != 2) {
  ------------------
  |  Branch (38:9): [True: 0, False: 64.5k]
  ------------------
   39|      0|        throw std::logic_error("getObjStreamNumber called for xref entry of type != 2");
   40|      0|    }
   41|  64.5k|    return QIntC::to_int(this->field1);
   42|  64.5k|}
_ZNK13QPDFXRefEntry17getObjStreamIndexEv:
   46|  37.5k|{
   47|  37.5k|    if (this->type != 2) {
  ------------------
  |  Branch (47:9): [True: 0, False: 37.5k]
  ------------------
   48|      0|        throw std::logic_error("getObjStreamIndex called for xref entry of type != 2");
   49|      0|    }
   50|  37.5k|    return this->field2;
   51|  37.5k|}

_ZN10QPDF_ArrayC2Ev:
   30|      7|{
   31|      7|}
_ZN10QPDF_ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
   41|  3.37k|{
   42|  3.37k|    setFromVector(v);
   43|  3.37k|}
_ZN10QPDF_ArrayC2EONSt3__16vectorINS0_10shared_ptrI10QPDFObjectEENS0_9allocatorIS4_EEEEb:
   47|   107k|{
   48|   107k|    if (sparse) {
  ------------------
  |  Branch (48:9): [True: 234, False: 107k]
  ------------------
   49|    234|        sp = std::make_unique<Sparse>();
   50|   309k|        for (auto&& item: v) {
  ------------------
  |  Branch (50:25): [True: 309k, False: 234]
  ------------------
   51|   309k|            if (item->getTypeCode() != ::ot_null || item->getObjGen().isIndirect()) {
  ------------------
  |  Branch (51:17): [True: 50.3k, False: 259k]
  |  Branch (51:17): [True: 50.4k, False: 259k]
  |  Branch (51:53): [True: 95, False: 259k]
  ------------------
   52|  50.4k|                sp->elements[sp->size] = std::move(item);
   53|  50.4k|            }
   54|   309k|            ++sp->size;
   55|   309k|        }
   56|   107k|    } else {
   57|   107k|        elements = std::move(v);
   58|   107k|    }
   59|   107k|}
_ZN10QPDF_Array6createERKNSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
   63|  3.37k|{
   64|  3.37k|    return do_create(new QPDF_Array(items));
   65|  3.37k|}
_ZN10QPDF_Array6createEONSt3__16vectorINS0_10shared_ptrI10QPDFObjectEENS0_9allocatorIS4_EEEEb:
   69|   107k|{
   70|   107k|    return do_create(new QPDF_Array(std::move(items), sparse));
   71|   107k|}
_ZN10QPDF_Array4copyEb:
   75|    900|{
   76|    900|    if (shallow) {
  ------------------
  |  Branch (76:9): [True: 0, False: 900]
  ------------------
   77|      0|        return do_create(new QPDF_Array(*this));
   78|    900|    } else {
   79|    900|        QTC::TC("qpdf", "QPDF_Array copy", sp ? 0 : 1);
  ------------------
  |  Branch (79:44): [True: 7, False: 893]
  ------------------
   80|    900|        if (sp) {
  ------------------
  |  Branch (80:13): [True: 7, False: 893]
  ------------------
   81|      7|            auto* result = new QPDF_Array();
   82|      7|            result->sp = std::make_unique<Sparse>();
   83|      7|            result->sp->size = sp->size;
   84|    166|            for (auto const& element: sp->elements) {
  ------------------
  |  Branch (84:37): [True: 166, False: 7]
  ------------------
   85|    166|                auto const& obj = element.second;
   86|    166|                result->sp->elements[element.first] =
   87|    166|                    obj->getObjGen().isIndirect() ? obj : obj->copy();
  ------------------
  |  Branch (87:21): [True: 109, False: 57]
  ------------------
   88|    166|            }
   89|      7|            return do_create(result);
   90|    893|        } else {
   91|    893|            std::vector<std::shared_ptr<QPDFObject>> result;
   92|    893|            result.reserve(elements.size());
   93|  3.99k|            for (auto const& element: elements) {
  ------------------
  |  Branch (93:37): [True: 3.99k, False: 893]
  ------------------
   94|  3.99k|                result.push_back(
   95|  3.99k|                    element ? (element->getObjGen().isIndirect() ? element : element->copy())
  ------------------
  |  Branch (95:21): [True: 3.99k, False: 0]
  |  Branch (95:32): [True: 765, False: 3.23k]
  ------------------
   96|  3.99k|                            : element);
   97|  3.99k|            }
   98|    893|            return create(std::move(result), false);
   99|    893|        }
  100|    900|    }
  101|    900|}
_ZN10QPDF_Array10disconnectEv:
  105|  91.6k|{
  106|  91.6k|    if (sp) {
  ------------------
  |  Branch (106:9): [True: 150, False: 91.5k]
  ------------------
  107|  45.8k|        for (auto& item: sp->elements) {
  ------------------
  |  Branch (107:24): [True: 45.8k, False: 150]
  ------------------
  108|  45.8k|            auto& obj = item.second;
  109|  45.8k|            if (!obj->getObjGen().isIndirect()) {
  ------------------
  |  Branch (109:17): [True: 41.5k, False: 4.34k]
  ------------------
  110|  41.5k|                obj->disconnect();
  111|  41.5k|            }
  112|  45.8k|        }
  113|  91.5k|    } else {
  114|  1.06M|        for (auto& obj: elements) {
  ------------------
  |  Branch (114:23): [True: 1.06M, False: 91.5k]
  ------------------
  115|  1.06M|            if (!obj->getObjGen().isIndirect()) {
  ------------------
  |  Branch (115:17): [True: 1.03M, False: 28.4k]
  ------------------
  116|  1.03M|                obj->disconnect();
  117|  1.03M|            }
  118|  1.06M|        }
  119|  91.5k|    }
  120|  91.6k|}
_ZNK10QPDF_Array2atEi:
  189|  1.46M|{
  190|  1.46M|    if (n < 0 || n >= size()) {
  ------------------
  |  Branch (190:9): [True: 0, False: 1.46M]
  |  Branch (190:18): [True: 8, False: 1.46M]
  ------------------
  191|      8|        return {};
  192|  1.46M|    } else if (sp) {
  ------------------
  |  Branch (192:16): [True: 450k, False: 1.01M]
  ------------------
  193|   450k|        auto const& iter = sp->elements.find(n);
  194|   450k|        return iter == sp->elements.end() ? null_oh : (*iter).second;
  ------------------
  |  Branch (194:16): [True: 429k, False: 21.5k]
  ------------------
  195|  1.01M|    } else {
  196|  1.01M|        return elements[size_t(n)];
  197|  1.01M|    }
  198|  1.46M|}
_ZNK10QPDF_Array11getAsVectorEv:
  202|   134k|{
  203|   134k|    if (sp) {
  ------------------
  |  Branch (203:9): [True: 294, False: 133k]
  ------------------
  204|    294|        std::vector<QPDFObjectHandle> v;
  205|    294|        v.reserve(size_t(size()));
  206|  21.6k|        for (auto const& item: sp->elements) {
  ------------------
  |  Branch (206:30): [True: 21.6k, False: 294]
  ------------------
  207|  21.6k|            v.resize(size_t(item.first), null_oh);
  208|  21.6k|            v.emplace_back(item.second);
  209|  21.6k|        }
  210|    294|        v.resize(size_t(size()), null_oh);
  211|    294|        return v;
  212|   133k|    } else {
  213|   133k|        return {elements.cbegin(), elements.cend()};
  214|   133k|    }
  215|   134k|}
_ZN10QPDF_Array5setAtEiRK16QPDFObjectHandle:
  219|    580|{
  220|    580|    if (at < 0 || at >= size()) {
  ------------------
  |  Branch (220:9): [True: 0, False: 580]
  |  Branch (220:19): [True: 0, False: 580]
  ------------------
  221|      0|        return false;
  222|      0|    }
  223|    580|    checkOwnership(oh);
  224|    580|    if (sp) {
  ------------------
  |  Branch (224:9): [True: 37, False: 543]
  ------------------
  225|     37|        sp->elements[at] = oh.getObj();
  226|    543|    } else {
  227|    543|        elements[size_t(at)] = oh.getObj();
  228|    543|    }
  229|    580|    return true;
  230|    580|}
_ZN10QPDF_Array13setFromVectorERKNSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
  234|  3.37k|{
  235|  3.37k|    elements.resize(0);
  236|  3.37k|    elements.reserve(v.size());
  237|  24.8k|    for (auto const& item: v) {
  ------------------
  |  Branch (237:26): [True: 24.8k, False: 3.37k]
  ------------------
  238|  24.8k|        checkOwnership(item);
  239|  24.8k|        elements.push_back(item.getObj());
  240|  24.8k|    }
  241|  3.37k|}
_ZN10QPDF_Array5eraseEi:
  288|      1|{
  289|      1|    if (at < 0 || at >= size()) {
  ------------------
  |  Branch (289:9): [True: 0, False: 1]
  |  Branch (289:19): [True: 0, False: 1]
  ------------------
  290|      0|        return false;
  291|      0|    }
  292|      1|    if (sp) {
  ------------------
  |  Branch (292:9): [True: 0, False: 1]
  ------------------
  293|      0|        auto end = sp->elements.end();
  294|      0|        if (auto iter = sp->elements.lower_bound(at); iter != end) {
  ------------------
  |  Branch (294:55): [True: 0, False: 0]
  ------------------
  295|      0|            if (iter->first == at) {
  ------------------
  |  Branch (295:17): [True: 0, False: 0]
  ------------------
  296|      0|                iter++;
  297|      0|                sp->elements.erase(at);
  298|      0|            }
  299|       |
  300|      0|            while (iter != end) {
  ------------------
  |  Branch (300:20): [True: 0, False: 0]
  ------------------
  301|      0|                auto nh = sp->elements.extract(iter++);
  302|      0|                --nh.key();
  303|      0|                sp->elements.insert(std::move(nh));
  304|      0|            }
  305|      0|        }
  306|      0|        --(sp->size);
  307|      1|    } else {
  308|      1|        elements.erase(elements.cbegin() + at);
  309|      1|    }
  310|      1|    return true;
  311|      1|}
_ZNK10QPDF_Array14checkOwnershipERK16QPDFObjectHandle:
   12|  25.4k|{
   13|  25.4k|    if (auto obj = item.getObjectPtr()) {
  ------------------
  |  Branch (13:14): [True: 25.4k, False: 0]
  ------------------
   14|  25.4k|        if (qpdf) {
  ------------------
  |  Branch (14:13): [True: 580, False: 24.8k]
  ------------------
   15|    580|            if (auto item_qpdf = obj->getQPDF()) {
  ------------------
  |  Branch (15:22): [True: 580, False: 0]
  ------------------
   16|    580|                if (qpdf != item_qpdf) {
  ------------------
  |  Branch (16:21): [True: 0, False: 580]
  ------------------
   17|      0|                    throw std::logic_error(
   18|      0|                        "Attempting to add an object from a different QPDF. Use "
   19|      0|                        "QPDF::copyForeignObject to add objects from another file.");
   20|      0|                }
   21|    580|            }
   22|    580|        }
   23|  25.4k|    } else {
   24|      0|        throw std::logic_error("Attempting to add an uninitialized object to a QPDF_Array.");
   25|      0|    }
   26|  25.4k|}

_ZN9QPDF_BoolC2Eb:
    8|  2.15k|{
    9|  2.15k|}
_ZN9QPDF_Bool6createEb:
   13|  2.15k|{
   14|  2.15k|    return do_create(new QPDF_Bool(value));
   15|  2.15k|}
_ZN9QPDF_Bool4copyEb:
   19|     54|{
   20|     54|    return create(val);
   21|     54|}
_ZN9QPDF_Bool7unparseEv:
   25|  3.74k|{
   26|  3.74k|    return (val ? "true" : "false");
  ------------------
  |  Branch (26:13): [True: 2.17k, False: 1.56k]
  ------------------
   27|  3.74k|}

_ZN14QPDF_DestroyedC2Ev:
    7|      1|{
    8|      1|}
_ZN14QPDF_Destroyed11getInstanceEv:
   12|   168k|{
   13|   168k|    static std::shared_ptr<QPDFValue> instance(new QPDF_Destroyed());
   14|   168k|    return instance;
   15|   168k|}

_ZN15QPDF_DictionaryC2ERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
   14|   513k|{
   15|   513k|}
_ZN15QPDF_Dictionary6createERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
   25|   302k|{
   26|   302k|    return do_create(new QPDF_Dictionary(items));
   27|   302k|}
_ZN15QPDF_Dictionary6createEONSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
   31|   211k|{
   32|   211k|    return do_create(new QPDF_Dictionary(items));
   33|   211k|}
_ZN15QPDF_Dictionary4copyEb:
   37|   302k|{
   38|   302k|    if (shallow) {
  ------------------
  |  Branch (38:9): [True: 300k, False: 1.57k]
  ------------------
   39|   300k|        return create(items);
   40|   300k|    } else {
   41|  1.57k|        std::map<std::string, QPDFObjectHandle> new_items;
   42|  6.11k|        for (auto const& item: this->items) {
  ------------------
  |  Branch (42:30): [True: 6.11k, False: 1.57k]
  ------------------
   43|  6.11k|            auto value = item.second;
   44|  6.11k|            new_items[item.first] = value.isIndirect() ? value : value.shallowCopy();
  ------------------
  |  Branch (44:37): [True: 1.29k, False: 4.82k]
  ------------------
   45|  6.11k|        }
   46|  1.57k|        return create(new_items);
   47|  1.57k|    }
   48|   302k|}
_ZN15QPDF_Dictionary10disconnectEv:
   52|   184k|{
   53|   690k|    for (auto& iter: this->items) {
  ------------------
  |  Branch (53:20): [True: 690k, False: 184k]
  ------------------
   54|   690k|        QPDFObjectHandle::DisconnectAccess::disconnect(iter.second);
   55|   690k|    }
   56|   184k|}
_ZN15QPDF_Dictionary6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   99|  42.4k|{
  100|  42.4k|    return ((this->items.count(key) > 0) && (!this->items[key].isNull()));
  ------------------
  |  Branch (100:13): [True: 9.58k, False: 32.8k]
  |  Branch (100:45): [True: 9.33k, False: 248]
  ------------------
  101|  42.4k|}
_ZN15QPDF_Dictionary6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  105|  2.05M|{
  106|       |    // PDF spec says fetching a non-existent key from a dictionary returns the null object.
  107|  2.05M|    auto item = this->items.find(key);
  108|  2.05M|    if (item != this->items.end()) {
  ------------------
  |  Branch (108:9): [True: 1.69M, False: 360k]
  ------------------
  109|       |        // May be a null object
  110|  1.69M|        return item->second;
  111|  1.69M|    } else {
  112|   360k|        static auto constexpr msg = " -> dictionary key $VD"sv;
  113|   360k|        return QPDF_Null::create(shared_from_this(), msg, key);
  114|   360k|    }
  115|  2.05M|}
_ZN15QPDF_Dictionary7getKeysEv:
  119|   346k|{
  120|   346k|    std::set<std::string> result;
  121|  1.31M|    for (auto& iter: this->items) {
  ------------------
  |  Branch (121:20): [True: 1.31M, False: 346k]
  ------------------
  122|  1.31M|        if (!iter.second.isNull()) {
  ------------------
  |  Branch (122:13): [True: 1.25M, False: 60.6k]
  ------------------
  123|  1.25M|            result.insert(iter.first);
  124|  1.25M|        }
  125|  1.31M|    }
  126|   346k|    return result;
  127|   346k|}
_ZNK15QPDF_Dictionary8getAsMapEv:
  131|   294k|{
  132|   294k|    return this->items;
  133|   294k|}
_ZN15QPDF_Dictionary10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandle:
  137|  23.3k|{
  138|  23.3k|    if (value.isNull() && !value.isIndirect()) {
  ------------------
  |  Branch (138:9): [True: 0, False: 23.3k]
  |  Branch (138:27): [True: 0, False: 0]
  ------------------
  139|       |        // The PDF spec doesn't distinguish between keys with null values and missing keys. Allow
  140|       |        // indirect nulls which are equivalent to a dangling reference, which is permitted by the
  141|       |        // spec.
  142|      0|        removeKey(key);
  143|  23.3k|    } else {
  144|       |        // add or replace value
  145|  23.3k|        this->items[key] = value;
  146|  23.3k|    }
  147|  23.3k|}
_ZN15QPDF_Dictionary9removeKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  151|   154k|{
  152|       |    // no-op if key does not exist
  153|   154k|    this->items.erase(key);
  154|   154k|}

_ZN12QPDF_IntegerC2Ex:
    9|   511k|{
   10|   511k|}
_ZN12QPDF_Integer6createEx:
   14|   511k|{
   15|   511k|    return do_create(new QPDF_Integer(value));
   16|   511k|}
_ZN12QPDF_Integer4copyEb:
   20|  2.71k|{
   21|  2.71k|    return create(val);
   22|  2.71k|}
_ZN12QPDF_Integer7unparseEv:
   26|   502k|{
   27|   502k|    return std::to_string(this->val);
   28|   502k|}
_ZNK12QPDF_Integer6getValEv:
   38|  53.6k|{
   39|  53.6k|    return this->val;
   40|  53.6k|}

_ZN9QPDF_NameC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
    9|   971k|{
   10|   971k|}
_ZN9QPDF_Name6createERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   14|   971k|{
   15|   971k|    return do_create(new QPDF_Name(name));
   16|   971k|}
_ZN9QPDF_Name4copyEb:
   20|  1.12k|{
   21|  1.12k|    return create(name);
   22|  1.12k|}
_ZN9QPDF_Name13normalizeNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   26|  1.32M|{
   27|  1.32M|    if (name.empty()) {
  ------------------
  |  Branch (27:9): [True: 0, False: 1.32M]
  ------------------
   28|      0|        return name;
   29|      0|    }
   30|  1.32M|    std::string result;
   31|  1.32M|    result += name.at(0);
   32|  8.61M|    for (size_t i = 1; i < name.length(); ++i) {
  ------------------
  |  Branch (32:24): [True: 7.29M, False: 1.32M]
  ------------------
   33|  7.29M|        char ch = name.at(i);
   34|       |        // Don't use locale/ctype here; follow PDF spec guidelines.
   35|  7.29M|        if (ch == '\0') {
  ------------------
  |  Branch (35:13): [True: 86, False: 7.29M]
  ------------------
   36|       |            // QPDFTokenizer embeds a null character to encode an invalid #.
   37|     86|            result += "#";
   38|  7.29M|        } else if (
   39|  7.29M|            ch < 33 || ch == '#' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (39:13): [True: 204k, False: 7.08M]
  |  Branch (39:24): [True: 0, False: 7.08M]
  |  Branch (39:37): [True: 26, False: 7.08M]
  |  Branch (39:50): [True: 0, False: 7.08M]
  |  Branch (39:63): [True: 0, False: 7.08M]
  |  Branch (39:76): [True: 0, False: 7.08M]
  |  Branch (39:89): [True: 0, False: 7.08M]
  ------------------
   40|  7.29M|            ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch > 126) {
  ------------------
  |  Branch (40:13): [True: 0, False: 7.08M]
  |  Branch (40:26): [True: 0, False: 7.08M]
  |  Branch (40:39): [True: 0, False: 7.08M]
  |  Branch (40:52): [True: 2, False: 7.08M]
  |  Branch (40:65): [True: 0, False: 7.08M]
  |  Branch (40:78): [True: 151, False: 7.08M]
  ------------------
   41|   204k|            result += QUtil::hex_encode_char(ch);
   42|  7.08M|        } else {
   43|  7.08M|            result += ch;
   44|  7.08M|        }
   45|  7.29M|    }
   46|  1.32M|    return result;
   47|  1.32M|}
_ZN9QPDF_Name7unparseEv:
   51|   316k|{
   52|   316k|    return normalizeName(this->name);
   53|   316k|}

_ZN9QPDF_NullC2EP4QPDF10QPDFObjGen:
    8|   431k|{
    9|   431k|}
_ZN9QPDF_Null6createEP4QPDF10QPDFObjGen:
   13|  70.6k|{
   14|  70.6k|    return do_create(new QPDF_Null(qpdf, og));
   15|  70.6k|}
_ZN9QPDF_Null6createENSt3__110shared_ptrI10QPDFObjectEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
   20|     23|{
   21|     23|    auto n = do_create(new QPDF_Null());
   22|     23|    n->setChildDescription(parent, static_descr, var_descr);
   23|     23|    return n;
   24|     23|}
_ZN9QPDF_Null6createENSt3__110shared_ptrI9QPDFValueEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
   29|   360k|{
   30|   360k|    auto n = do_create(new QPDF_Null());
   31|   360k|    n->setChildDescription(parent, static_descr, var_descr);
   32|   360k|    return n;
   33|   360k|}
_ZN9QPDF_Null4copyEb:
   37|    967|{
   38|    967|    return create();
   39|    967|}
_ZN9QPDF_Null7unparseEv:
   43|   694k|{
   44|   694k|    return "null";
   45|   694k|}

_ZN9QPDF_RealC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
    9|  32.2k|{
   10|  32.2k|}
_ZN9QPDF_RealC2Edib:
   15|  8.99k|{
   16|  8.99k|}
_ZN9QPDF_Real6createERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   20|  32.2k|{
   21|  32.2k|    return do_create(new QPDF_Real(val));
   22|  32.2k|}
_ZN9QPDF_Real6createEdib:
   26|  8.99k|{
   27|  8.99k|    return do_create(new QPDF_Real(value, decimal_places, trim_trailing_zeroes));
   28|  8.99k|}
_ZN9QPDF_Real4copyEb:
   32|    586|{
   33|    586|    return create(val);
   34|    586|}
_ZN9QPDF_Real7unparseEv:
   38|  51.0k|{
   39|  51.0k|    return this->val;
   40|  51.0k|}

_ZN11QPDF_StreamC2EP4QPDFRK10QPDFObjGen16QPDFObjectHandlexm:
  119|  47.4k|{
  120|  47.4k|    if (!stream_dict.isDictionary()) {
  ------------------
  |  Branch (120:9): [True: 0, False: 47.4k]
  ------------------
  121|      0|        throw std::logic_error(
  122|      0|            "stream object instantiated with non-dictionary object for dictionary");
  123|      0|    }
  124|  47.4k|    auto descr = std::make_shared<QPDFValue::Description>(
  125|  47.4k|        qpdf->getFilename() + ", stream object " + og.unparse(' '));
  126|  47.4k|    setDescription(qpdf, descr, offset);
  127|  47.4k|}
_ZN11QPDF_Stream6createEP4QPDFRK10QPDFObjGen16QPDFObjectHandlexm:
  136|  47.4k|{
  137|  47.4k|    return do_create(new QPDF_Stream(qpdf, og, stream_dict, offset, length));
  138|  47.4k|}
_ZN11QPDF_Stream16setFilterOnWriteEb:
  156|  2.63k|{
  157|  2.63k|    this->filter_on_write = val;
  158|  2.63k|}
_ZNK11QPDF_Stream16getFilterOnWriteEv:
  162|  79.2k|{
  163|  79.2k|    return this->filter_on_write;
  164|  79.2k|}
_ZN11QPDF_Stream10disconnectEv:
  168|  46.5k|{
  169|  46.5k|    this->stream_provider = nullptr;
  170|  46.5k|    QPDFObjectHandle::DisconnectAccess::disconnect(this->stream_dict);
  171|  46.5k|}
_ZN11QPDF_Stream14setDescriptionEP4QPDFRNSt3__110shared_ptrINS2_7variantIJNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEN9QPDFValue10JSON_DescrENSB_10ChildDescrEEEEEEx:
  301|  47.4k|{
  302|  47.4k|    this->QPDFValue::setDescription(qpdf, description, offset);
  303|  47.4k|    setDictDescription();
  304|  47.4k|}
_ZN11QPDF_Stream18setDictDescriptionEv:
  308|  47.4k|{
  309|  47.4k|    if (!this->stream_dict.hasObjectDescription()) {
  ------------------
  |  Branch (309:9): [True: 0, False: 47.4k]
  ------------------
  310|      0|        this->stream_dict.setObjectDescription(qpdf, getDescription() + " -> stream dictionary");
  311|      0|    }
  312|  47.4k|}
_ZNK11QPDF_Stream7getDictEv:
  316|   214k|{
  317|   214k|    return this->stream_dict;
  318|   214k|}
_ZNK11QPDF_Stream14isDataModifiedEv:
  322|   154k|{
  323|   154k|    return (!this->token_filters.empty());
  324|   154k|}
_ZN11QPDF_Stream13getStreamDataE26qpdf_stream_decode_level_e:
  346|  1.42k|{
  347|  1.42k|    Pl_Buffer buf("stream data buffer");
  348|  1.42k|    bool filtered;
  349|  1.42k|    pipeStreamData(&buf, &filtered, 0, decode_level, false, false);
  350|  1.42k|    if (!filtered) {
  ------------------
  |  Branch (350:9): [True: 94, False: 1.32k]
  ------------------
  351|     94|        throw QPDFExc(
  352|     94|            qpdf_e_unsupported,
  353|     94|            qpdf->getFilename(),
  354|     94|            "",
  355|     94|            this->parsed_offset,
  356|     94|            "getStreamData called on unfilterable stream");
  357|     94|    }
  358|  1.32k|    QTC::TC("qpdf", "QPDF_Stream getStreamData");
  359|  1.32k|    return buf.getBufferSharedPointer();
  360|  1.42k|}
_ZN11QPDF_Stream10filterableERNSt3__16vectorINS0_10shared_ptrI16QPDFStreamFilterEENS0_9allocatorIS4_EEEERbS9_:
  383|  38.2k|{
  384|       |    // Check filters
  385|       |
  386|  38.2k|    QPDFObjectHandle filter_obj = this->stream_dict.getKey("/Filter");
  387|  38.2k|    bool filters_okay = true;
  388|       |
  389|  38.2k|    std::vector<std::string> filter_names;
  390|       |
  391|  38.2k|    if (filter_obj.isNull()) {
  ------------------
  |  Branch (391:9): [True: 9.39k, False: 28.8k]
  ------------------
  392|       |        // No filters
  393|  28.8k|    } else if (filter_obj.isName()) {
  ------------------
  |  Branch (393:16): [True: 3.75k, False: 25.0k]
  ------------------
  394|       |        // One filter
  395|  3.75k|        filter_names.push_back(filter_obj.getName());
  396|  25.0k|    } else if (filter_obj.isArray()) {
  ------------------
  |  Branch (396:16): [True: 25.0k, False: 19]
  ------------------
  397|       |        // Potentially multiple filters
  398|  25.0k|        int n = filter_obj.getArrayNItems();
  399|  74.9k|        for (int i = 0; i < n; ++i) {
  ------------------
  |  Branch (399:25): [True: 49.9k, False: 25.0k]
  ------------------
  400|  49.9k|            QPDFObjectHandle item = filter_obj.getArrayItem(i);
  401|  49.9k|            if (item.isName()) {
  ------------------
  |  Branch (401:17): [True: 49.7k, False: 156]
  ------------------
  402|  49.7k|                filter_names.push_back(item.getName());
  403|  49.7k|            } else {
  404|    156|                filters_okay = false;
  405|    156|            }
  406|  49.9k|        }
  407|  25.0k|    } else {
  408|     19|        filters_okay = false;
  409|     19|    }
  410|       |
  411|  38.2k|    if (!filters_okay) {
  ------------------
  |  Branch (411:9): [True: 97, False: 38.1k]
  ------------------
  412|     97|        QTC::TC("qpdf", "QPDF_Stream invalid filter");
  413|     97|        warn("stream filter type is not name or array");
  414|     97|        return false;
  415|     97|    }
  416|       |
  417|  38.1k|    bool filterable = true;
  418|       |
  419|  53.3k|    for (auto& filter_name: filter_names) {
  ------------------
  |  Branch (419:27): [True: 53.3k, False: 38.1k]
  ------------------
  420|  53.3k|        if (filter_abbreviations.count(filter_name)) {
  ------------------
  |  Branch (420:13): [True: 82, False: 53.2k]
  ------------------
  421|     82|            QTC::TC("qpdf", "QPDF_Stream expand filter abbreviation");
  422|     82|            filter_name = filter_abbreviations[filter_name];
  423|     82|        }
  424|       |
  425|  53.3k|        auto ff = filter_factories.find(filter_name);
  426|  53.3k|        if (ff == filter_factories.end()) {
  ------------------
  |  Branch (426:13): [True: 541, False: 52.8k]
  ------------------
  427|    541|            filterable = false;
  428|  52.8k|        } else {
  429|  52.8k|            filters.push_back((ff->second)());
  430|  52.8k|        }
  431|  53.3k|    }
  432|       |
  433|  38.1k|    if (!filterable) {
  ------------------
  |  Branch (433:9): [True: 462, False: 37.6k]
  ------------------
  434|    462|        return false;
  435|    462|    }
  436|       |
  437|       |    // filters now contains a list of filters to be applied in order. See which ones we can support.
  438|       |
  439|       |    // See if we can support any decode parameters that are specified.
  440|       |
  441|  37.6k|    QPDFObjectHandle decode_obj = this->stream_dict.getKey("/DecodeParms");
  442|  37.6k|    std::vector<QPDFObjectHandle> decode_parms;
  443|  37.6k|    if (decode_obj.isArray() && (decode_obj.getArrayNItems() == 0)) {
  ------------------
  |  Branch (443:9): [True: 0, False: 37.6k]
  |  Branch (443:33): [True: 0, False: 0]
  ------------------
  444|      0|        decode_obj = QPDFObjectHandle::newNull();
  445|      0|    }
  446|  37.6k|    if (decode_obj.isArray()) {
  ------------------
  |  Branch (446:9): [True: 0, False: 37.6k]
  ------------------
  447|      0|        for (int i = 0; i < decode_obj.getArrayNItems(); ++i) {
  ------------------
  |  Branch (447:25): [True: 0, False: 0]
  ------------------
  448|      0|            decode_parms.push_back(decode_obj.getArrayItem(i));
  449|      0|        }
  450|  37.6k|    } else {
  451|  90.3k|        for (unsigned int i = 0; i < filter_names.size(); ++i) {
  ------------------
  |  Branch (451:34): [True: 52.6k, False: 37.6k]
  ------------------
  452|  52.6k|            decode_parms.push_back(decode_obj);
  453|  52.6k|        }
  454|  37.6k|    }
  455|       |
  456|       |    // Ignore /DecodeParms entirely if /Filters is empty.  At least one case of a file whose
  457|       |    // /DecodeParms was [ << >> ] when /Filters was empty has been seen in the wild.
  458|  37.6k|    if ((filters.size() != 0) && (decode_parms.size() != filters.size())) {
  ------------------
  |  Branch (458:9): [True: 28.2k, False: 9.39k]
  |  Branch (458:34): [True: 0, False: 28.2k]
  ------------------
  459|      0|        warn("stream /DecodeParms length is inconsistent with filters");
  460|      0|        filterable = false;
  461|      0|    }
  462|       |
  463|  37.6k|    if (!filterable) {
  ------------------
  |  Branch (463:9): [True: 0, False: 37.6k]
  ------------------
  464|      0|        return false;
  465|      0|    }
  466|       |
  467|  90.3k|    for (size_t i = 0; i < filters.size(); ++i) {
  ------------------
  |  Branch (467:24): [True: 52.6k, False: 37.6k]
  ------------------
  468|  52.6k|        auto filter = filters.at(i);
  469|  52.6k|        auto decode_item = decode_parms.at(i);
  470|       |
  471|  52.6k|        if (filter->setDecodeParms(decode_item)) {
  ------------------
  |  Branch (471:13): [True: 52.6k, False: 9]
  ------------------
  472|  52.6k|            if (filter->isSpecializedCompression()) {
  ------------------
  |  Branch (472:17): [True: 2.58k, False: 50.0k]
  ------------------
  473|  2.58k|                specialized_compression = true;
  474|  2.58k|            }
  475|  52.6k|            if (filter->isLossyCompression()) {
  ------------------
  |  Branch (475:17): [True: 1.11k, False: 51.5k]
  ------------------
  476|  1.11k|                specialized_compression = true;
  477|  1.11k|                lossy_compression = true;
  478|  1.11k|            }
  479|  52.6k|        } else {
  480|      9|            filterable = false;
  481|      9|        }
  482|  52.6k|    }
  483|       |
  484|  37.6k|    return filterable;
  485|  37.6k|}
_ZN11QPDF_Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebb:
  495|  83.3k|{
  496|  83.3k|    std::vector<std::shared_ptr<QPDFStreamFilter>> filters;
  497|  83.3k|    bool specialized_compression = false;
  498|  83.3k|    bool lossy_compression = false;
  499|  83.3k|    bool ignored;
  500|  83.3k|    if (filterp == nullptr) {
  ------------------
  |  Branch (500:9): [True: 0, False: 83.3k]
  ------------------
  501|      0|        filterp = &ignored;
  502|      0|    }
  503|  83.3k|    bool& filter = *filterp;
  504|  83.3k|    filter = (!((encode_flags == 0) && (decode_level == qpdf_dl_none)));
  ------------------
  |  Branch (504:17): [True: 48.6k, False: 34.6k]
  |  Branch (504:40): [True: 45.1k, False: 3.53k]
  ------------------
  505|  83.3k|    bool success = true;
  506|  83.3k|    if (filter) {
  ------------------
  |  Branch (506:9): [True: 38.2k, False: 45.1k]
  ------------------
  507|  38.2k|        filter = filterable(filters, specialized_compression, lossy_compression);
  508|  38.2k|        if ((decode_level < qpdf_dl_all) && lossy_compression) {
  ------------------
  |  Branch (508:13): [True: 1.42k, False: 36.8k]
  |  Branch (508:45): [True: 0, False: 1.42k]
  ------------------
  509|      0|            filter = false;
  510|      0|        }
  511|  38.2k|        if ((decode_level < qpdf_dl_specialized) && specialized_compression) {
  ------------------
  |  Branch (511:13): [True: 0, False: 38.2k]
  |  Branch (511:53): [True: 0, False: 0]
  ------------------
  512|      0|            filter = false;
  513|      0|        }
  514|  38.2k|        QTC::TC(
  515|  38.2k|            "qpdf",
  516|  38.2k|            "QPDF_Stream special filters",
  517|  38.2k|            (!filter)                     ? 0
  ------------------
  |  Branch (517:13): [True: 566, False: 37.6k]
  ------------------
  518|  38.2k|                : lossy_compression       ? 1
  ------------------
  |  Branch (518:19): [True: 1.11k, False: 36.5k]
  ------------------
  519|  37.6k|                : specialized_compression ? 2
  ------------------
  |  Branch (519:19): [True: 1.47k, False: 35.0k]
  ------------------
  520|  36.5k|                                          : 3);
  521|  38.2k|    }
  522|       |
  523|  83.3k|    if (pipeline == nullptr) {
  ------------------
  |  Branch (523:9): [True: 0, False: 83.3k]
  ------------------
  524|      0|        QTC::TC("qpdf", "QPDF_Stream pipeStreamData with null pipeline");
  525|       |        // Return value is whether we can filter in this case.
  526|      0|        return filter;
  527|      0|    }
  528|       |
  529|       |    // Construct the pipeline in reverse order. Force pipelines we create to be deleted when this
  530|       |    // function finishes. Pipelines created by QPDFStreamFilter objects will be deleted by those
  531|       |    // objects.
  532|  83.3k|    std::vector<std::shared_ptr<Pipeline>> to_delete;
  533|       |
  534|  83.3k|    std::shared_ptr<ContentNormalizer> normalizer;
  535|  83.3k|    std::shared_ptr<Pipeline> new_pipeline;
  536|  83.3k|    if (filter) {
  ------------------
  |  Branch (536:9): [True: 37.6k, False: 45.7k]
  ------------------
  537|  37.6k|        if (encode_flags & qpdf_ef_compress) {
  ------------------
  |  Branch (537:13): [True: 34.1k, False: 3.52k]
  ------------------
  538|  34.1k|            new_pipeline =
  539|  34.1k|                std::make_shared<Pl_Flate>("compress stream", pipeline, Pl_Flate::a_deflate);
  540|  34.1k|            to_delete.push_back(new_pipeline);
  541|  34.1k|            pipeline = new_pipeline.get();
  542|  34.1k|        }
  543|       |
  544|  37.6k|        if (encode_flags & qpdf_ef_normalize) {
  ------------------
  |  Branch (544:13): [True: 0, False: 37.6k]
  ------------------
  545|      0|            normalizer = std::make_shared<ContentNormalizer>();
  546|      0|            new_pipeline =
  547|      0|                std::make_shared<Pl_QPDFTokenizer>("normalizer", normalizer.get(), pipeline);
  548|      0|            to_delete.push_back(new_pipeline);
  549|      0|            pipeline = new_pipeline.get();
  550|      0|        }
  551|       |
  552|  37.6k|        for (auto iter = this->token_filters.rbegin(); iter != this->token_filters.rend(); ++iter) {
  ------------------
  |  Branch (552:56): [True: 0, False: 37.6k]
  ------------------
  553|      0|            new_pipeline =
  554|      0|                std::make_shared<Pl_QPDFTokenizer>("token filter", (*iter).get(), pipeline);
  555|      0|            to_delete.push_back(new_pipeline);
  556|      0|            pipeline = new_pipeline.get();
  557|      0|        }
  558|       |
  559|  90.3k|        for (auto f_iter = filters.rbegin(); f_iter != filters.rend(); ++f_iter) {
  ------------------
  |  Branch (559:46): [True: 52.6k, False: 37.6k]
  ------------------
  560|  52.6k|            auto decode_pipeline = (*f_iter)->getDecodePipeline(pipeline);
  561|  52.6k|            if (decode_pipeline) {
  ------------------
  |  Branch (561:17): [True: 52.6k, False: 6]
  ------------------
  562|  52.6k|                pipeline = decode_pipeline;
  563|  52.6k|            }
  564|  52.6k|            auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
  565|  52.6k|            if (flate != nullptr) {
  ------------------
  |  Branch (565:17): [True: 24.7k, False: 27.9k]
  ------------------
  566|  24.7k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });
  567|  24.7k|            }
  568|  52.6k|        }
  569|  37.6k|    }
  570|       |
  571|  83.3k|    if (this->stream_data.get()) {
  ------------------
  |  Branch (571:9): [True: 0, False: 83.3k]
  ------------------
  572|      0|        QTC::TC("qpdf", "QPDF_Stream pipe replaced stream data");
  573|      0|        pipeline->write(this->stream_data->getBuffer(), this->stream_data->getSize());
  574|      0|        pipeline->finish();
  575|  83.3k|    } else if (this->stream_provider.get()) {
  ------------------
  |  Branch (575:16): [True: 0, False: 83.3k]
  ------------------
  576|      0|        Pl_Count count("stream provider count", pipeline);
  577|      0|        if (this->stream_provider->supportsRetry()) {
  ------------------
  |  Branch (577:13): [True: 0, False: 0]
  ------------------
  578|      0|            if (!this->stream_provider->provideStreamData(
  ------------------
  |  Branch (578:17): [True: 0, False: 0]
  ------------------
  579|      0|                    og, &count, suppress_warnings, will_retry)) {
  580|      0|                filter = false;
  581|      0|                success = false;
  582|      0|            }
  583|      0|        } else {
  584|      0|            this->stream_provider->provideStreamData(og, &count);
  585|      0|        }
  586|      0|        qpdf_offset_t actual_length = count.getCount();
  587|      0|        qpdf_offset_t desired_length = 0;
  588|      0|        if (success && this->stream_dict.hasKey("/Length")) {
  ------------------
  |  Branch (588:13): [True: 0, False: 0]
  |  Branch (588:13): [True: 0, False: 0]
  |  Branch (588:24): [True: 0, False: 0]
  ------------------
  589|      0|            desired_length = this->stream_dict.getKey("/Length").getIntValue();
  590|      0|            if (actual_length == desired_length) {
  ------------------
  |  Branch (590:17): [True: 0, False: 0]
  ------------------
  591|      0|                QTC::TC("qpdf", "QPDF_Stream pipe use stream provider");
  592|      0|            } else {
  593|      0|                QTC::TC("qpdf", "QPDF_Stream provider length mismatch");
  594|       |                // This would be caused by programmer error on the part of a library user, not by
  595|       |                // invalid input data.
  596|      0|                throw std::runtime_error(
  597|      0|                    "stream data provider for " + og.unparse(' ') + " provided " +
  598|      0|                    std::to_string(actual_length) + " bytes instead of expected " +
  599|      0|                    std::to_string(desired_length) + " bytes");
  600|      0|            }
  601|      0|        } else if (success) {
  ------------------
  |  Branch (601:20): [True: 0, False: 0]
  ------------------
  602|      0|            QTC::TC("qpdf", "QPDF_Stream provider length not provided");
  603|      0|            this->stream_dict.replaceKey("/Length", QPDFObjectHandle::newInteger(actual_length));
  604|      0|        }
  605|  83.3k|    } else if (this->parsed_offset == 0) {
  ------------------
  |  Branch (605:16): [True: 0, False: 83.3k]
  ------------------
  606|      0|        QTC::TC("qpdf", "QPDF_Stream pipe no stream data");
  607|      0|        throw std::logic_error("pipeStreamData called for stream with no data");
  608|  83.3k|    } else {
  609|  83.3k|        QTC::TC("qpdf", "QPDF_Stream pipe original stream data");
  610|  83.3k|        if (!QPDF::Pipe::pipeStreamData(
  ------------------
  |  Branch (610:13): [True: 2.16k, False: 81.1k]
  ------------------
  611|  83.3k|                this->qpdf,
  612|  83.3k|                og,
  613|  83.3k|                this->parsed_offset,
  614|  83.3k|                this->length,
  615|  83.3k|                this->stream_dict,
  616|  83.3k|                pipeline,
  617|  83.3k|                suppress_warnings,
  618|  83.3k|                will_retry)) {
  619|  2.16k|            filter = false;
  620|  2.16k|            success = false;
  621|  2.16k|        }
  622|  83.3k|    }
  623|       |
  624|  83.3k|    if (filter && (!suppress_warnings) && normalizer.get() && normalizer->anyBadTokens()) {
  ------------------
  |  Branch (624:9): [True: 35.4k, False: 47.9k]
  |  Branch (624:19): [True: 35.4k, False: 0]
  |  Branch (624:43): [True: 0, False: 35.4k]
  |  Branch (624:63): [True: 0, False: 0]
  ------------------
  625|      0|        warn("content normalization encountered bad tokens");
  626|      0|        if (normalizer->lastTokenWasBad()) {
  ------------------
  |  Branch (626:13): [True: 0, False: 0]
  ------------------
  627|      0|            QTC::TC("qpdf", "QPDF_Stream bad token at end during normalize");
  628|      0|            warn("normalized content ended with a bad token; you may be able to resolve this by "
  629|      0|                 "coalescing content streams in combination with normalizing content. From the "
  630|      0|                 "command line, specify --coalesce-contents");
  631|      0|        }
  632|      0|        warn("Resulting stream data may be corrupted but is may still useful for manual "
  633|      0|             "inspection. For more information on this warning, search for content normalization "
  634|      0|             "in the manual.");
  635|      0|    }
  636|       |
  637|  83.3k|    return success;
  638|  83.3k|}
_ZN11QPDF_Stream4warnERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  696|  1.06k|{
  697|  1.06k|    this->qpdf->warn(qpdf_e_damaged_pdf, "", this->parsed_offset, message);
  698|  1.06k|}
QPDF_Stream.cc:_ZNK11QPDF_Stream3$_0clEv:
   87|      6|        {"/Crypt", []() { return std::make_shared<SF_Crypt>(); }},
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_CryptC2Ev:
   30|      6|        SF_Crypt() = default;
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt14setDecodeParmsE16QPDFObjectHandle:
   35|      6|        {
   36|      6|            if (decode_parms.isNull()) {
  ------------------
  |  Branch (36:17): [True: 5, False: 1]
  ------------------
   37|      5|                return true;
   38|      5|            }
   39|      1|            bool filterable = true;
   40|      2|            for (auto const& key: decode_parms.getKeys()) {
  ------------------
  |  Branch (40:33): [True: 2, False: 1]
  ------------------
   41|      2|                if (((key == "/Type") || (key == "/Name")) &&
  ------------------
  |  Branch (41:21): [True: 0, False: 2]
  |  Branch (41:22): [True: 0, False: 2]
  |  Branch (41:42): [True: 0, False: 2]
  ------------------
   42|      2|                    ((!decode_parms.hasKey("/Type")) ||
  ------------------
  |  Branch (42:22): [True: 0, False: 0]
  ------------------
   43|      0|                     decode_parms.isDictionaryOfType("/CryptFilterDecodeParms"))) {
  ------------------
  |  Branch (43:22): [True: 0, False: 0]
  ------------------
   44|       |                    // we handle this in decryptStream
   45|      2|                } else {
   46|      2|                    filterable = false;
   47|      2|                }
   48|      2|            }
   49|      1|            return filterable;
   50|      6|        }
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt17getDecodePipelineEP8Pipeline:
   54|      5|        {
   55|       |            // Not used -- handled by pipeStreamData
   56|      5|            return nullptr;
   57|      5|        }
QPDF_Stream.cc:_ZZN11QPDF_Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebbENK3$_0clEPKci:
  566|    966|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });

_ZN11QPDF_StringC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   18|   129k|{
   19|   129k|}
_ZN11QPDF_String6createERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   23|   120k|{
   24|   120k|    return do_create(new QPDF_String(val));
   25|   120k|}
_ZN11QPDF_String4copyEb:
   39|    694|{
   40|    694|    return create(val);
   41|    694|}
_ZN11QPDF_String7unparseEv:
   45|  75.8k|{
   46|  75.8k|    return unparse(false);
   47|  75.8k|}
_ZNK11QPDF_String12useHexStringEv:
   74|  75.8k|{
   75|       |    // Heuristic: use the hexadecimal representation of a string if there are any non-printable (in
   76|       |    // PDF Doc encoding) characters or if too large of a proportion of the string consists of
   77|       |    // non-ASCII characters.
   78|  75.8k|    unsigned int non_ascii = 0;
   79|  6.64M|    for (auto const ch: this->val) {
  ------------------
  |  Branch (79:23): [True: 6.64M, False: 67.3k]
  ------------------
   80|  6.64M|        if (ch > 126) {
  ------------------
  |  Branch (80:13): [True: 709, False: 6.64M]
  ------------------
   81|    709|            ++non_ascii;
   82|  6.64M|        } else if (ch >= 32) {
  ------------------
  |  Branch (82:20): [True: 6.45M, False: 189k]
  ------------------
   83|  6.45M|            continue;
   84|  6.45M|        } else if (ch < 0 || ch >= 24) {
  ------------------
  |  Branch (84:20): [True: 154k, False: 34.8k]
  |  Branch (84:30): [True: 5.02k, False: 29.8k]
  ------------------
   85|   159k|            ++non_ascii;
   86|   159k|        } else if (!(ch == '\n' || ch == '\r' || ch == '\t' || ch == '\b' || ch == '\f')) {
  ------------------
  |  Branch (86:22): [True: 20.4k, False: 9.38k]
  |  Branch (86:36): [True: 225, False: 9.16k]
  |  Branch (86:50): [True: 71, False: 9.08k]
  |  Branch (86:64): [True: 434, False: 8.65k]
  |  Branch (86:78): [True: 118, False: 8.53k]
  ------------------
   87|  8.53k|            return true;
   88|  8.53k|        }
   89|  6.64M|    }
   90|  67.3k|    return 5 * non_ascii > val.length();
   91|  75.8k|}
_ZN11QPDF_String7unparseEb:
   95|  84.0k|{
   96|  84.0k|    bool use_hexstring = force_binary || useHexString();
  ------------------
  |  Branch (96:26): [True: 8.19k, False: 75.8k]
  |  Branch (96:42): [True: 15.0k, False: 60.8k]
  ------------------
   97|  84.0k|    std::string result;
   98|  84.0k|    if (use_hexstring) {
  ------------------
  |  Branch (98:9): [True: 23.2k, False: 60.8k]
  ------------------
   99|  23.2k|        static auto constexpr hexchars = "0123456789abcdef";
  100|  23.2k|        result.reserve(2 * this->val.length() + 2);
  101|  23.2k|        result += '<';
  102|  1.44M|        for (const char c: this->val) {
  ------------------
  |  Branch (102:26): [True: 1.44M, False: 23.2k]
  ------------------
  103|  1.44M|            result += hexchars[static_cast<unsigned char>(c) >> 4];
  104|  1.44M|            result += hexchars[c & 0x0f];
  105|  1.44M|        }
  106|  23.2k|        result += '>';
  107|  60.8k|    } else {
  108|  60.8k|        result += "(";
  109|  6.36M|        for (unsigned int i = 0; i < this->val.length(); ++i) {
  ------------------
  |  Branch (109:34): [True: 6.30M, False: 60.8k]
  ------------------
  110|  6.30M|            char ch = this->val.at(i);
  111|  6.30M|            switch (ch) {
  112|  7.38k|            case '\n':
  ------------------
  |  Branch (112:13): [True: 7.38k, False: 6.29M]
  ------------------
  113|  7.38k|                result += "\\n";
  114|  7.38k|                break;
  115|       |
  116|    177|            case '\r':
  ------------------
  |  Branch (116:13): [True: 177, False: 6.30M]
  ------------------
  117|    177|                result += "\\r";
  118|    177|                break;
  119|       |
  120|     57|            case '\t':
  ------------------
  |  Branch (120:13): [True: 57, False: 6.30M]
  ------------------
  121|     57|                result += "\\t";
  122|     57|                break;
  123|       |
  124|    272|            case '\b':
  ------------------
  |  Branch (124:13): [True: 272, False: 6.30M]
  ------------------
  125|    272|                result += "\\b";
  126|    272|                break;
  127|       |
  128|     17|            case '\f':
  ------------------
  |  Branch (128:13): [True: 17, False: 6.30M]
  ------------------
  129|     17|                result += "\\f";
  130|     17|                break;
  131|       |
  132|  1.23k|            case '(':
  ------------------
  |  Branch (132:13): [True: 1.23k, False: 6.30M]
  ------------------
  133|  1.23k|                result += "\\(";
  134|  1.23k|                break;
  135|       |
  136|  1.23k|            case ')':
  ------------------
  |  Branch (136:13): [True: 1.23k, False: 6.30M]
  ------------------
  137|  1.23k|                result += "\\)";
  138|  1.23k|                break;
  139|       |
  140|    889|            case '\\':
  ------------------
  |  Branch (140:13): [True: 889, False: 6.30M]
  ------------------
  141|    889|                result += "\\\\";
  142|    889|                break;
  143|       |
  144|  6.29M|            default:
  ------------------
  |  Branch (144:13): [True: 6.29M, False: 11.2k]
  ------------------
  145|  6.29M|                if (is_iso_latin1_printable(ch)) {
  ------------------
  |  Branch (145:21): [True: 6.29M, False: 3.16k]
  ------------------
  146|  6.29M|                    result += this->val.at(i);
  147|  6.29M|                } else {
  148|  3.16k|                    result += "\\" +
  149|  3.16k|                        QUtil::int_to_string_base(
  150|  3.16k|                                  static_cast<int>(static_cast<unsigned char>(ch)), 8, 3);
  151|  3.16k|                }
  152|  6.29M|                break;
  153|  6.30M|            }
  154|  6.30M|        }
  155|  60.8k|        result += ")";
  156|  60.8k|    }
  157|       |
  158|  84.0k|    return result;
  159|  84.0k|}
QPDF_String.cc:_ZL23is_iso_latin1_printablec:
   11|  6.29M|{
   12|  6.29M|    return (((ch >= 32) && (ch <= 126)) || (static_cast<unsigned char>(ch) >= 160));
  ------------------
  |  Branch (12:14): [True: 6.28M, False: 6.09k]
  |  Branch (12:28): [True: 6.28M, False: 10]
  |  Branch (12:44): [True: 2.93k, False: 3.16k]
  ------------------
   13|  6.29M|}

_ZN15QPDF_UnresolvedC2EP4QPDFRK10QPDFObjGen:
    8|   155k|{
    9|   155k|}
_ZN15QPDF_Unresolved6createEP4QPDFRK10QPDFObjGen:
   13|   155k|{
   14|   155k|    return do_create(new QPDF_Unresolved(qpdf, og));
   15|   155k|}

_ZN4QPDF16compute_data_keyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEiibii:
  332|  89.6k|{
  333|       |    // Algorithm 3.1 from the PDF 1.7 Reference Manual
  334|       |
  335|  89.6k|    std::string result = encryption_key;
  336|       |
  337|  89.6k|    if (encryption_V >= 5) {
  ------------------
  |  Branch (337:9): [True: 0, False: 89.6k]
  ------------------
  338|       |        // Algorithm 3.1a (PDF 1.7 extension level 3): just use encryption key straight.
  339|      0|        return result;
  340|      0|    }
  341|       |
  342|       |    // Append low three bytes of object ID and low two bytes of generation
  343|  89.6k|    result.append(1, static_cast<char>(objid & 0xff));
  344|  89.6k|    result.append(1, static_cast<char>((objid >> 8) & 0xff));
  345|  89.6k|    result.append(1, static_cast<char>((objid >> 16) & 0xff));
  346|  89.6k|    result.append(1, static_cast<char>(generation & 0xff));
  347|  89.6k|    result.append(1, static_cast<char>((generation >> 8) & 0xff));
  348|  89.6k|    if (use_aes) {
  ------------------
  |  Branch (348:9): [True: 0, False: 89.6k]
  ------------------
  349|      0|        result += "sAlT";
  350|      0|    }
  351|       |
  352|  89.6k|    MD5 md5;
  353|  89.6k|    md5.encodeDataIncrementally(result.c_str(), result.length());
  354|  89.6k|    MD5::Digest digest;
  355|  89.6k|    md5.digest(digest);
  356|  89.6k|    return {reinterpret_cast<char*>(digest), std::min(result.length(), toS(16))};
  357|  89.6k|}
_ZN4QPDF20initializeEncryptionEv:
  720|  2.04k|{
  721|  2.04k|    if (m->encp->encryption_initialized) {
  ------------------
  |  Branch (721:9): [True: 0, False: 2.04k]
  ------------------
  722|      0|        return;
  723|      0|    }
  724|  2.04k|    m->encp->encryption_initialized = true;
  725|       |
  726|       |    // After we initialize encryption parameters, we must use stored key information and never look
  727|       |    // at /Encrypt again.  Otherwise, things could go wrong if someone mutates the encryption
  728|       |    // dictionary.
  729|       |
  730|  2.04k|    if (!m->trailer.hasKey("/Encrypt")) {
  ------------------
  |  Branch (730:9): [True: 2.04k, False: 4]
  ------------------
  731|  2.04k|        return;
  732|  2.04k|    }
  733|       |
  734|       |    // Go ahead and set m->encrypted here.  That way, isEncrypted will return true even if there
  735|       |    // were errors reading the encryption dictionary.
  736|      4|    m->encp->encrypted = true;
  737|       |
  738|      4|    std::string id1;
  739|      4|    QPDFObjectHandle id_obj = m->trailer.getKey("/ID");
  740|      4|    if ((id_obj.isArray() && (id_obj.getArrayNItems() == 2) && id_obj.getArrayItem(0).isString())) {
  ------------------
  |  Branch (740:9): [True: 1, False: 3]
  |  Branch (740:10): [True: 3, False: 1]
  |  Branch (740:30): [True: 1, False: 2]
  |  Branch (740:64): [True: 1, False: 0]
  ------------------
  741|      1|        id1 = id_obj.getArrayItem(0).getStringValue();
  742|      3|    } else {
  743|       |        // Treating a missing ID as the empty string enables qpdf to decrypt some invalid encrypted
  744|       |        // files with no /ID that poppler can read but Adobe Reader can't.
  745|      3|        warn(damagedPDF("trailer", "invalid /ID in trailer dictionary"));
  746|      3|    }
  747|       |
  748|      4|    QPDFObjectHandle encryption_dict = m->trailer.getKey("/Encrypt");
  749|      4|    if (!encryption_dict.isDictionary()) {
  ------------------
  |  Branch (749:9): [True: 4, False: 0]
  ------------------
  750|      4|        throw damagedPDF("/Encrypt in trailer dictionary is not a dictionary");
  751|      4|    }
  752|       |
  753|      0|    if (!(encryption_dict.getKey("/Filter").isName() &&
  ------------------
  |  Branch (753:9): [True: 0, False: 0]
  |  Branch (753:11): [True: 0, False: 0]
  ------------------
  754|      0|          (encryption_dict.getKey("/Filter").getName() == "/Standard"))) {
  ------------------
  |  Branch (754:11): [True: 0, False: 0]
  ------------------
  755|      0|        throw QPDFExc(
  756|      0|            qpdf_e_unsupported,
  757|      0|            m->file->getName(),
  758|      0|            "encryption dictionary",
  759|      0|            m->file->getLastOffset(),
  760|      0|            "unsupported encryption filter");
  761|      0|    }
  762|      0|    if (!encryption_dict.getKey("/SubFilter").isNull()) {
  ------------------
  |  Branch (762:9): [True: 0, False: 0]
  ------------------
  763|      0|        warn(
  764|      0|            qpdf_e_unsupported,
  765|      0|            "encryption dictionary",
  766|      0|            m->file->getLastOffset(),
  767|      0|            "file uses encryption SubFilters, which qpdf does not support");
  768|      0|    }
  769|       |
  770|      0|    if (!(encryption_dict.getKey("/V").isInteger() && encryption_dict.getKey("/R").isInteger() &&
  ------------------
  |  Branch (770:9): [True: 0, False: 0]
  |  Branch (770:11): [True: 0, False: 0]
  |  Branch (770:55): [True: 0, False: 0]
  ------------------
  771|      0|          encryption_dict.getKey("/O").isString() && encryption_dict.getKey("/U").isString() &&
  ------------------
  |  Branch (771:11): [True: 0, False: 0]
  |  Branch (771:54): [True: 0, False: 0]
  ------------------
  772|      0|          encryption_dict.getKey("/P").isInteger())) {
  ------------------
  |  Branch (772:11): [True: 0, False: 0]
  ------------------
  773|      0|        throw damagedPDF(
  774|      0|            "encryption dictionary",
  775|      0|            "some encryption dictionary parameters are missing or the wrong "
  776|      0|            "type");
  777|      0|    }
  778|       |
  779|      0|    int V = encryption_dict.getKey("/V").getIntValueAsInt();
  780|      0|    int R = encryption_dict.getKey("/R").getIntValueAsInt();
  781|      0|    std::string O = encryption_dict.getKey("/O").getStringValue();
  782|      0|    std::string U = encryption_dict.getKey("/U").getStringValue();
  783|      0|    int P = static_cast<int>(encryption_dict.getKey("/P").getIntValue());
  784|       |
  785|       |    // If supporting new encryption R/V values, remember to update error message inside this if
  786|       |    // statement.
  787|      0|    if (!(((R >= 2) && (R <= 6)) && ((V == 1) || (V == 2) || (V == 4) || (V == 5)))) {
  ------------------
  |  Branch (787:12): [True: 0, False: 0]
  |  Branch (787:24): [True: 0, False: 0]
  |  Branch (787:38): [True: 0, False: 0]
  |  Branch (787:50): [True: 0, False: 0]
  |  Branch (787:62): [True: 0, False: 0]
  |  Branch (787:74): [True: 0, False: 0]
  ------------------
  788|      0|        throw QPDFExc(
  789|      0|            qpdf_e_unsupported,
  790|      0|            m->file->getName(),
  791|      0|            "encryption dictionary",
  792|      0|            m->file->getLastOffset(),
  793|      0|            "Unsupported /R or /V in encryption dictionary; R = " + std::to_string(R) +
  794|      0|                " (max 6), V = " + std::to_string(V) + " (max 5)");
  795|      0|    }
  796|       |
  797|      0|    m->encp->encryption_V = V;
  798|      0|    m->encp->encryption_R = R;
  799|       |
  800|       |    // OE, UE, and Perms are only present if V >= 5.
  801|      0|    std::string OE;
  802|      0|    std::string UE;
  803|      0|    std::string Perms;
  804|       |
  805|      0|    if (V < 5) {
  ------------------
  |  Branch (805:9): [True: 0, False: 0]
  ------------------
  806|       |        // These must be exactly the right number of bytes.
  807|      0|        pad_short_parameter(O, key_bytes);
  808|      0|        pad_short_parameter(U, key_bytes);
  809|      0|        if (!((O.length() == key_bytes) && (U.length() == key_bytes))) {
  ------------------
  |  Branch (809:15): [True: 0, False: 0]
  |  Branch (809:44): [True: 0, False: 0]
  ------------------
  810|      0|            throw damagedPDF(
  811|      0|                "encryption dictionary",
  812|      0|                "incorrect length for /O and/or /U in encryption dictionary");
  813|      0|        }
  814|      0|    } else {
  815|      0|        if (!(encryption_dict.getKey("/OE").isString() &&
  ------------------
  |  Branch (815:13): [True: 0, False: 0]
  |  Branch (815:15): [True: 0, False: 0]
  ------------------
  816|      0|              encryption_dict.getKey("/UE").isString() &&
  ------------------
  |  Branch (816:15): [True: 0, False: 0]
  ------------------
  817|      0|              encryption_dict.getKey("/Perms").isString())) {
  ------------------
  |  Branch (817:15): [True: 0, False: 0]
  ------------------
  818|      0|            throw damagedPDF(
  819|      0|                "encryption dictionary",
  820|      0|                "some V=5 encryption dictionary parameters are missing or the "
  821|      0|                "wrong type");
  822|      0|        }
  823|      0|        OE = encryption_dict.getKey("/OE").getStringValue();
  824|      0|        UE = encryption_dict.getKey("/UE").getStringValue();
  825|      0|        Perms = encryption_dict.getKey("/Perms").getStringValue();
  826|       |
  827|       |        // These may be longer than the minimum number of bytes.
  828|      0|        pad_short_parameter(O, OU_key_bytes_V5);
  829|      0|        pad_short_parameter(U, OU_key_bytes_V5);
  830|      0|        pad_short_parameter(OE, OUE_key_bytes_V5);
  831|      0|        pad_short_parameter(UE, OUE_key_bytes_V5);
  832|      0|        pad_short_parameter(Perms, Perms_key_bytes_V5);
  833|      0|    }
  834|       |
  835|      0|    int Length = 0;
  836|      0|    if (V <= 1) {
  ------------------
  |  Branch (836:9): [True: 0, False: 0]
  ------------------
  837|      0|        Length = 40;
  838|      0|    } else if (V == 4) {
  ------------------
  |  Branch (838:16): [True: 0, False: 0]
  ------------------
  839|      0|        Length = 128;
  840|      0|    } else if (V == 5) {
  ------------------
  |  Branch (840:16): [True: 0, False: 0]
  ------------------
  841|      0|        Length = 256;
  842|      0|    } else {
  843|      0|        if (encryption_dict.getKey("/Length").isInteger()) {
  ------------------
  |  Branch (843:13): [True: 0, False: 0]
  ------------------
  844|      0|            Length = encryption_dict.getKey("/Length").getIntValueAsInt();
  845|      0|            if ((Length % 8) || (Length < 40) || (Length > 128)) {
  ------------------
  |  Branch (845:17): [True: 0, False: 0]
  |  Branch (845:33): [True: 0, False: 0]
  |  Branch (845:50): [True: 0, False: 0]
  ------------------
  846|      0|                Length = 0;
  847|      0|            }
  848|      0|        }
  849|      0|    }
  850|      0|    if (Length == 0) {
  ------------------
  |  Branch (850:9): [True: 0, False: 0]
  ------------------
  851|       |        // Still no Length? Just take a guess.
  852|      0|        Length = 128;
  853|      0|    }
  854|       |
  855|      0|    m->encp->encrypt_metadata = true;
  856|      0|    if ((V >= 4) && (encryption_dict.getKey("/EncryptMetadata").isBool())) {
  ------------------
  |  Branch (856:9): [True: 0, False: 0]
  |  Branch (856:9): [True: 0, False: 0]
  |  Branch (856:21): [True: 0, False: 0]
  ------------------
  857|      0|        m->encp->encrypt_metadata = encryption_dict.getKey("/EncryptMetadata").getBoolValue();
  858|      0|    }
  859|       |
  860|      0|    if ((V == 4) || (V == 5)) {
  ------------------
  |  Branch (860:9): [True: 0, False: 0]
  |  Branch (860:21): [True: 0, False: 0]
  ------------------
  861|      0|        QPDFObjectHandle CF = encryption_dict.getKey("/CF");
  862|      0|        for (auto const& filter: CF.getKeys()) {
  ------------------
  |  Branch (862:32): [True: 0, False: 0]
  ------------------
  863|      0|            QPDFObjectHandle cdict = CF.getKey(filter);
  864|      0|            if (cdict.isDictionary()) {
  ------------------
  |  Branch (864:17): [True: 0, False: 0]
  ------------------
  865|      0|                encryption_method_e method = e_none;
  866|      0|                if (cdict.getKey("/CFM").isName()) {
  ------------------
  |  Branch (866:21): [True: 0, False: 0]
  ------------------
  867|      0|                    std::string method_name = cdict.getKey("/CFM").getName();
  868|      0|                    if (method_name == "/V2") {
  ------------------
  |  Branch (868:25): [True: 0, False: 0]
  ------------------
  869|      0|                        QTC::TC("qpdf", "QPDF_encryption CFM V2");
  870|      0|                        method = e_rc4;
  871|      0|                    } else if (method_name == "/AESV2") {
  ------------------
  |  Branch (871:32): [True: 0, False: 0]
  ------------------
  872|      0|                        QTC::TC("qpdf", "QPDF_encryption CFM AESV2");
  873|      0|                        method = e_aes;
  874|      0|                    } else if (method_name == "/AESV3") {
  ------------------
  |  Branch (874:32): [True: 0, False: 0]
  ------------------
  875|      0|                        QTC::TC("qpdf", "QPDF_encryption CFM AESV3");
  876|      0|                        method = e_aesv3;
  877|      0|                    } else {
  878|       |                        // Don't complain now -- maybe we won't need to reference this type.
  879|      0|                        method = e_unknown;
  880|      0|                    }
  881|      0|                }
  882|      0|                m->encp->crypt_filters[filter] = method;
  883|      0|            }
  884|      0|        }
  885|       |
  886|      0|        QPDFObjectHandle StmF = encryption_dict.getKey("/StmF");
  887|      0|        QPDFObjectHandle StrF = encryption_dict.getKey("/StrF");
  888|      0|        QPDFObjectHandle EFF = encryption_dict.getKey("/EFF");
  889|      0|        m->encp->cf_stream = interpretCF(m->encp, StmF);
  890|      0|        m->encp->cf_string = interpretCF(m->encp, StrF);
  891|      0|        if (EFF.isName()) {
  ------------------
  |  Branch (891:13): [True: 0, False: 0]
  ------------------
  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|      0|            m->encp->cf_file = interpretCF(m->encp, EFF);
  902|      0|        } else {
  903|      0|            m->encp->cf_file = m->encp->cf_stream;
  904|      0|        }
  905|      0|    }
  906|       |
  907|      0|    EncryptionData data(V, R, Length / 8, P, O, U, OE, UE, Perms, id1, m->encp->encrypt_metadata);
  908|      0|    if (m->provided_password_is_hex_key) {
  ------------------
  |  Branch (908:9): [True: 0, False: 0]
  ------------------
  909|       |        // ignore passwords in file
  910|      0|    } else {
  911|      0|        m->encp->owner_password_matched =
  912|      0|            check_owner_password(m->encp->user_password, m->encp->provided_password, data);
  913|      0|        if (m->encp->owner_password_matched && (V < 5)) {
  ------------------
  |  Branch (913:13): [True: 0, False: 0]
  |  Branch (913:48): [True: 0, False: 0]
  ------------------
  914|       |            // password supplied was owner password; user_password has been initialized for V < 5
  915|      0|            if (getTrimmedUserPassword() == m->encp->provided_password) {
  ------------------
  |  Branch (915:17): [True: 0, False: 0]
  ------------------
  916|      0|                m->encp->user_password_matched = true;
  917|      0|                QTC::TC("qpdf", "QPDF_encryption user matches owner V < 5");
  918|      0|            }
  919|      0|        } else {
  920|      0|            m->encp->user_password_matched = check_user_password(m->encp->provided_password, data);
  921|      0|            if (m->encp->user_password_matched) {
  ------------------
  |  Branch (921:17): [True: 0, False: 0]
  ------------------
  922|      0|                m->encp->user_password = m->encp->provided_password;
  923|      0|            }
  924|      0|        }
  925|      0|        if (m->encp->user_password_matched && m->encp->owner_password_matched) {
  ------------------
  |  Branch (925:13): [True: 0, False: 0]
  |  Branch (925:47): [True: 0, False: 0]
  ------------------
  926|      0|            QTC::TC("qpdf", "QPDF_encryption same password", (V < 5) ? 0 : 1);
  ------------------
  |  Branch (926:62): [True: 0, False: 0]
  ------------------
  927|      0|        }
  928|      0|        if (!(m->encp->owner_password_matched || m->encp->user_password_matched)) {
  ------------------
  |  Branch (928:15): [True: 0, False: 0]
  |  Branch (928:50): [True: 0, False: 0]
  ------------------
  929|      0|            throw QPDFExc(qpdf_e_password, m->file->getName(), "", 0, "invalid password");
  930|      0|        }
  931|      0|    }
  932|       |
  933|      0|    if (m->provided_password_is_hex_key) {
  ------------------
  |  Branch (933:9): [True: 0, False: 0]
  ------------------
  934|      0|        m->encp->encryption_key = QUtil::hex_decode(m->encp->provided_password);
  935|      0|    } else if (V < 5) {
  ------------------
  |  Branch (935:16): [True: 0, False: 0]
  ------------------
  936|       |        // For V < 5, the user password is encrypted with the owner password, and the user password
  937|       |        // is always used for computing the encryption key.
  938|      0|        m->encp->encryption_key = compute_encryption_key(m->encp->user_password, data);
  939|      0|    } else {
  940|       |        // For V >= 5, either password can be used independently to compute the encryption key, and
  941|       |        // neither password can be used to recover the other.
  942|      0|        bool perms_valid;
  943|      0|        m->encp->encryption_key =
  944|      0|            recover_encryption_key_with_password(m->encp->provided_password, data, perms_valid);
  945|      0|        if (!perms_valid) {
  ------------------
  |  Branch (945:13): [True: 0, False: 0]
  ------------------
  946|      0|            warn(damagedPDF(
  947|      0|                "encryption dictionary",
  948|      0|                "/Perms field in encryption dictionary doesn't match expected "
  949|      0|                "value"));
  950|      0|        }
  951|      0|    }
  952|      0|}

_ZN4QPDF21getUncompressedObjectER16QPDFObjectHandleRKN10QPDFWriter8ObjTableE:
  591|  38.4k|{
  592|  38.4k|    if (obj.contains(oh)) {
  ------------------
  |  Branch (592:9): [True: 38.4k, False: 0]
  ------------------
  593|  38.4k|        if (auto id = obj[oh].object_stream; id > 0) {
  ------------------
  |  Branch (593:46): [True: 1.15k, False: 37.2k]
  ------------------
  594|  1.15k|            return oh.isNull() ? oh : getObject(id, 0);
  ------------------
  |  Branch (594:20): [True: 7, False: 1.14k]
  ------------------
  595|  1.15k|        }
  596|  38.4k|    }
  597|  37.2k|    return oh;
  598|  38.4k|}
_ZN4QPDF18getLinearizedPartsERKN10QPDFWriter8ObjTableERNSt3__16vectorI16QPDFObjectHandleNS4_9allocatorIS6_EEEESA_SA_SA_SA_:
 1456|  1.91k|{
 1457|  1.91k|    calculateLinearizationData(obj);
 1458|  1.91k|    part4 = m->part4;
 1459|  1.91k|    part6 = m->part6;
 1460|  1.91k|    part7 = m->part7;
 1461|  1.91k|    part8 = m->part8;
 1462|  1.91k|    part9 = m->part9;
 1463|  1.91k|}
_ZN4QPDF17outputLengthNextNEiiRKN10QPDFWriter11NewObjTableERKNS0_8ObjTableE:
 1474|  24.9k|{
 1475|       |    // Figure out the length of a series of n consecutive objects in the output file starting with
 1476|       |    // whatever object in_object from the input file mapped to.
 1477|       |
 1478|  24.9k|    int first = obj[in_object].renumber;
 1479|  24.9k|    int last = first + n;
 1480|  24.9k|    if (first <= 0) {
  ------------------
  |  Branch (1480:9): [True: 0, False: 24.9k]
  ------------------
 1481|      0|        stopOnError("found object that is not renumbered while writing linearization data");
 1482|      0|    }
 1483|  24.9k|    qpdf_offset_t length = 0;
 1484|  69.5k|    for (int i = first; i < last; ++i) {
  ------------------
  |  Branch (1484:25): [True: 44.6k, False: 24.9k]
  ------------------
 1485|  44.6k|        auto l = new_obj[i].length;
 1486|  44.6k|        if (l == 0) {
  ------------------
  |  Branch (1486:13): [True: 0, False: 44.6k]
  ------------------
 1487|      0|            stopOnError("found item with unknown length while writing linearization data");
 1488|      0|        }
 1489|  44.6k|        length += l;
 1490|  44.6k|    }
 1491|  24.9k|    return toI(length);
 1492|  24.9k|}
_ZN4QPDF20calculateHPageOffsetERKN10QPDFWriter11NewObjTableERKNS0_8ObjTableE:
 1496|  1.43k|{
 1497|       |    // Page Offset Hint Table
 1498|       |
 1499|       |    // We are purposely leaving some values set to their initial zero values.
 1500|       |
 1501|  1.43k|    std::vector<QPDFObjectHandle> const& pages = getAllPages();
 1502|  1.43k|    size_t npages = pages.size();
 1503|  1.43k|    CHPageOffset& cph = m->c_page_offset_data;
 1504|  1.43k|    std::vector<CHPageOffsetEntry>& cphe = cph.entries;
 1505|       |
 1506|       |    // Calculate minimum and maximum values for number of objects per page and page length.
 1507|       |
 1508|  1.43k|    int min_nobjects = cphe.at(0).nobjects;
 1509|  1.43k|    int max_nobjects = min_nobjects;
 1510|  1.43k|    int min_length = outputLengthNextN(pages.at(0).getObjectID(), min_nobjects, new_obj, obj);
 1511|  1.43k|    int max_length = min_length;
 1512|  1.43k|    int max_shared = cphe.at(0).nshared_objects;
 1513|       |
 1514|  1.43k|    HPageOffset& ph = m->page_offset_hints;
 1515|  1.43k|    std::vector<HPageOffsetEntry>& phe = ph.entries;
 1516|       |    // npages is the size of the existing pages array.
 1517|  1.43k|    phe = std::vector<HPageOffsetEntry>(npages);
 1518|       |
 1519|  17.4k|    for (unsigned int i = 0; i < npages; ++i) {
  ------------------
  |  Branch (1519:30): [True: 15.9k, False: 1.43k]
  ------------------
 1520|       |        // Calculate values for each page, assigning full values to the delta items.  They will be
 1521|       |        // adjusted later.
 1522|       |
 1523|       |        // Repeat calculations for page 0 so we can assign to phe[i] without duplicating those
 1524|       |        // assignments.
 1525|       |
 1526|  15.9k|        int nobjects = cphe.at(i).nobjects;
 1527|  15.9k|        int length = outputLengthNextN(pages.at(i).getObjectID(), nobjects, new_obj, obj);
 1528|  15.9k|        int nshared = cphe.at(i).nshared_objects;
 1529|       |
 1530|  15.9k|        min_nobjects = std::min(min_nobjects, nobjects);
 1531|  15.9k|        max_nobjects = std::max(max_nobjects, nobjects);
 1532|  15.9k|        min_length = std::min(min_length, length);
 1533|  15.9k|        max_length = std::max(max_length, length);
 1534|  15.9k|        max_shared = std::max(max_shared, nshared);
 1535|       |
 1536|  15.9k|        phe.at(i).delta_nobjects = nobjects;
 1537|  15.9k|        phe.at(i).delta_page_length = length;
 1538|  15.9k|        phe.at(i).nshared_objects = nshared;
 1539|  15.9k|    }
 1540|       |
 1541|  1.43k|    ph.min_nobjects = min_nobjects;
 1542|  1.43k|    ph.first_page_offset = new_obj[obj[pages.at(0)].renumber].xref.getOffset();
 1543|  1.43k|    ph.nbits_delta_nobjects = nbits(max_nobjects - min_nobjects);
 1544|  1.43k|    ph.min_page_length = min_length;
 1545|  1.43k|    ph.nbits_delta_page_length = nbits(max_length - min_length);
 1546|  1.43k|    ph.nbits_nshared_objects = nbits(max_shared);
 1547|  1.43k|    ph.nbits_shared_identifier = nbits(m->c_shared_object_data.nshared_total);
 1548|  1.43k|    ph.shared_denominator = 4; // doesn't matter
 1549|       |
 1550|       |    // It isn't clear how to compute content offset and content length.  Since we are not
 1551|       |    // interleaving page objects with the content stream, we'll use the same values for content
 1552|       |    // length as page length.  We will use 0 as content offset because this is what Adobe does
 1553|       |    // (implementation note 127) and pdlin as well.
 1554|  1.43k|    ph.nbits_delta_content_length = ph.nbits_delta_page_length;
 1555|  1.43k|    ph.min_content_length = ph.min_page_length;
 1556|       |
 1557|  17.4k|    for (size_t i = 0; i < npages; ++i) {
  ------------------
  |  Branch (1557:24): [True: 15.9k, False: 1.43k]
  ------------------
 1558|       |        // Adjust delta entries
 1559|  15.9k|        if ((phe.at(i).delta_nobjects < min_nobjects) ||
  ------------------
  |  Branch (1559:13): [True: 0, False: 15.9k]
  ------------------
 1560|  15.9k|            (phe.at(i).delta_page_length < min_length)) {
  ------------------
  |  Branch (1560:13): [True: 0, False: 15.9k]
  ------------------
 1561|      0|            stopOnError("found too small delta nobjects or delta page length while writing "
 1562|      0|                        "linearization data");
 1563|      0|        }
 1564|  15.9k|        phe.at(i).delta_nobjects -= min_nobjects;
 1565|  15.9k|        phe.at(i).delta_page_length -= min_length;
 1566|  15.9k|        phe.at(i).delta_content_length = phe.at(i).delta_page_length;
 1567|       |
 1568|  32.8k|        for (size_t j = 0; j < toS(cphe.at(i).nshared_objects); ++j) {
  ------------------
  |  Branch (1568:28): [True: 16.9k, False: 15.9k]
  ------------------
 1569|  16.9k|            phe.at(i).shared_identifiers.push_back(cphe.at(i).shared_identifiers.at(j));
 1570|  16.9k|            phe.at(i).shared_numerators.push_back(0);
 1571|  16.9k|        }
 1572|  15.9k|    }
 1573|  1.43k|}
_ZN4QPDF22calculateHSharedObjectERKN10QPDFWriter11NewObjTableERKNS0_8ObjTableE:
 1578|  1.43k|{
 1579|  1.43k|    CHSharedObject& cso = m->c_shared_object_data;
 1580|  1.43k|    std::vector<CHSharedObjectEntry>& csoe = cso.entries;
 1581|  1.43k|    HSharedObject& so = m->shared_object_hints;
 1582|  1.43k|    std::vector<HSharedObjectEntry>& soe = so.entries;
 1583|  1.43k|    soe.clear();
 1584|       |
 1585|  1.43k|    int min_length = outputLengthNextN(csoe.at(0).object, 1, new_obj, obj);
 1586|  1.43k|    int max_length = min_length;
 1587|       |
 1588|  6.92k|    for (size_t i = 0; i < toS(cso.nshared_total); ++i) {
  ------------------
  |  Branch (1588:24): [True: 5.48k, False: 1.43k]
  ------------------
 1589|       |        // Assign absolute numbers to deltas; adjust later
 1590|  5.48k|        int length = outputLengthNextN(csoe.at(i).object, 1, new_obj, obj);
 1591|  5.48k|        min_length = std::min(min_length, length);
 1592|  5.48k|        max_length = std::max(max_length, length);
 1593|  5.48k|        soe.emplace_back();
 1594|  5.48k|        soe.at(i).delta_group_length = length;
 1595|  5.48k|    }
 1596|  1.43k|    if (soe.size() != toS(cso.nshared_total)) {
  ------------------
  |  Branch (1596:9): [True: 0, False: 1.43k]
  ------------------
 1597|      0|        stopOnError("soe has wrong size after initialization");
 1598|      0|    }
 1599|       |
 1600|  1.43k|    so.nshared_total = cso.nshared_total;
 1601|  1.43k|    so.nshared_first_page = cso.nshared_first_page;
 1602|  1.43k|    if (so.nshared_total > so.nshared_first_page) {
  ------------------
  |  Branch (1602:9): [True: 184, False: 1.24k]
  ------------------
 1603|    184|        so.first_shared_obj = obj[cso.first_shared_obj].renumber;
 1604|    184|        so.min_group_length = min_length;
 1605|    184|        so.first_shared_offset = new_obj[so.first_shared_obj].xref.getOffset();
 1606|    184|    }
 1607|  1.43k|    so.min_group_length = min_length;
 1608|  1.43k|    so.nbits_delta_group_length = nbits(max_length - min_length);
 1609|       |
 1610|  6.92k|    for (size_t i = 0; i < toS(cso.nshared_total); ++i) {
  ------------------
  |  Branch (1610:24): [True: 5.48k, False: 1.43k]
  ------------------
 1611|       |        // Adjust deltas
 1612|  5.48k|        if (soe.at(i).delta_group_length < min_length) {
  ------------------
  |  Branch (1612:13): [True: 0, False: 5.48k]
  ------------------
 1613|      0|            stopOnError("found too small group length while writing linearization data");
 1614|      0|        }
 1615|  5.48k|        soe.at(i).delta_group_length -= min_length;
 1616|  5.48k|    }
 1617|  1.43k|}
_ZN4QPDF17calculateHOutlineERKN10QPDFWriter11NewObjTableERKNS0_8ObjTableE:
 1621|  1.43k|{
 1622|  1.43k|    HGeneric& cho = m->c_outline_data;
 1623|       |
 1624|  1.43k|    if (cho.nobjects == 0) {
  ------------------
  |  Branch (1624:9): [True: 830, False: 601]
  ------------------
 1625|    830|        return;
 1626|    830|    }
 1627|       |
 1628|    601|    HGeneric& ho = m->outline_hints;
 1629|       |
 1630|    601|    ho.first_object = obj[cho.first_object].renumber;
 1631|    601|    ho.first_object_offset = new_obj[ho.first_object].xref.getOffset();
 1632|    601|    ho.nobjects = cho.nobjects;
 1633|    601|    ho.group_length = outputLengthNextN(cho.first_object, ho.nobjects, new_obj, obj);
 1634|    601|}
_ZN4QPDF16writeHPageOffsetER9BitWriter:
 1672|  1.43k|{
 1673|  1.43k|    HPageOffset& t = m->page_offset_hints;
 1674|       |
 1675|  1.43k|    w.writeBitsInt(t.min_nobjects, 32);               // 1
 1676|  1.43k|    w.writeBits(toULL(t.first_page_offset), 32);      // 2
 1677|  1.43k|    w.writeBitsInt(t.nbits_delta_nobjects, 16);       // 3
 1678|  1.43k|    w.writeBitsInt(t.min_page_length, 32);            // 4
 1679|  1.43k|    w.writeBitsInt(t.nbits_delta_page_length, 16);    // 5
 1680|  1.43k|    w.writeBits(toULL(t.min_content_offset), 32);     // 6
 1681|  1.43k|    w.writeBitsInt(t.nbits_delta_content_offset, 16); // 7
 1682|  1.43k|    w.writeBitsInt(t.min_content_length, 32);         // 8
 1683|  1.43k|    w.writeBitsInt(t.nbits_delta_content_length, 16); // 9
 1684|  1.43k|    w.writeBitsInt(t.nbits_nshared_objects, 16);      // 10
 1685|  1.43k|    w.writeBitsInt(t.nbits_shared_identifier, 16);    // 11
 1686|  1.43k|    w.writeBitsInt(t.nbits_shared_numerator, 16);     // 12
 1687|  1.43k|    w.writeBitsInt(t.shared_denominator, 16);         // 13
 1688|       |
 1689|  1.43k|    int nitems = toI(getAllPages().size());
 1690|  1.43k|    std::vector<HPageOffsetEntry>& entries = t.entries;
 1691|       |
 1692|  1.43k|    write_vector_int(w, nitems, entries, t.nbits_delta_nobjects, &HPageOffsetEntry::delta_nobjects);
 1693|  1.43k|    write_vector_int(
 1694|  1.43k|        w, nitems, entries, t.nbits_delta_page_length, &HPageOffsetEntry::delta_page_length);
 1695|  1.43k|    write_vector_int(
 1696|  1.43k|        w, nitems, entries, t.nbits_nshared_objects, &HPageOffsetEntry::nshared_objects);
 1697|  1.43k|    write_vector_vector(
 1698|  1.43k|        w,
 1699|  1.43k|        nitems,
 1700|  1.43k|        entries,
 1701|  1.43k|        &HPageOffsetEntry::nshared_objects,
 1702|  1.43k|        t.nbits_shared_identifier,
 1703|  1.43k|        &HPageOffsetEntry::shared_identifiers);
 1704|  1.43k|    write_vector_vector(
 1705|  1.43k|        w,
 1706|  1.43k|        nitems,
 1707|  1.43k|        entries,
 1708|  1.43k|        &HPageOffsetEntry::nshared_objects,
 1709|  1.43k|        t.nbits_shared_numerator,
 1710|  1.43k|        &HPageOffsetEntry::shared_numerators);
 1711|  1.43k|    write_vector_int(
 1712|  1.43k|        w, nitems, entries, t.nbits_delta_content_offset, &HPageOffsetEntry::delta_content_offset);
 1713|  1.43k|    write_vector_int(
 1714|  1.43k|        w, nitems, entries, t.nbits_delta_content_length, &HPageOffsetEntry::delta_content_length);
 1715|  1.43k|}
_ZN4QPDF18writeHSharedObjectER9BitWriter:
 1719|  1.43k|{
 1720|  1.43k|    HSharedObject& t = m->shared_object_hints;
 1721|       |
 1722|  1.43k|    w.writeBitsInt(t.first_shared_obj, 32);         // 1
 1723|  1.43k|    w.writeBits(toULL(t.first_shared_offset), 32);  // 2
 1724|  1.43k|    w.writeBitsInt(t.nshared_first_page, 32);       // 3
 1725|  1.43k|    w.writeBitsInt(t.nshared_total, 32);            // 4
 1726|  1.43k|    w.writeBitsInt(t.nbits_nobjects, 16);           // 5
 1727|  1.43k|    w.writeBitsInt(t.min_group_length, 32);         // 6
 1728|  1.43k|    w.writeBitsInt(t.nbits_delta_group_length, 16); // 7
 1729|       |
 1730|  1.43k|    QTC::TC(
 1731|  1.43k|        "qpdf",
 1732|  1.43k|        "QPDF lin write nshared_total > nshared_first_page",
 1733|  1.43k|        (t.nshared_total > t.nshared_first_page) ? 1 : 0);
  ------------------
  |  Branch (1733:9): [True: 184, False: 1.24k]
  ------------------
 1734|       |
 1735|  1.43k|    int nitems = t.nshared_total;
 1736|  1.43k|    std::vector<HSharedObjectEntry>& entries = t.entries;
 1737|       |
 1738|  1.43k|    write_vector_int(
 1739|  1.43k|        w, nitems, entries, t.nbits_delta_group_length, &HSharedObjectEntry::delta_group_length);
 1740|  1.43k|    write_vector_int(w, nitems, entries, 1, &HSharedObjectEntry::signature_present);
 1741|  6.92k|    for (size_t i = 0; i < toS(nitems); ++i) {
  ------------------
  |  Branch (1741:24): [True: 5.48k, False: 1.43k]
  ------------------
 1742|       |        // If signature were present, we'd have to write a 128-bit hash.
 1743|  5.48k|        if (entries.at(i).signature_present != 0) {
  ------------------
  |  Branch (1743:13): [True: 0, False: 5.48k]
  ------------------
 1744|      0|            stopOnError("found unexpected signature present"
 1745|      0|                        " while writing linearization data");
 1746|      0|        }
 1747|  5.48k|    }
 1748|  1.43k|    write_vector_int(w, nitems, entries, t.nbits_nobjects, &HSharedObjectEntry::nobjects_minus_one);
 1749|  1.43k|}
_ZN4QPDF13writeHGenericER9BitWriterRNS_8HGenericE:
 1753|    601|{
 1754|    601|    w.writeBitsInt(t.first_object, 32);            // 1
 1755|    601|    w.writeBits(toULL(t.first_object_offset), 32); // 2
 1756|    601|    w.writeBitsInt(t.nobjects, 32);                // 3
 1757|    601|    w.writeBitsInt(t.group_length, 32);            // 4
 1758|    601|}
_ZN4QPDF18generateHintStreamERKN10QPDFWriter11NewObjTableERKNS0_8ObjTableERNSt3__110shared_ptrI6BufferEERiSC_b:
 1768|  1.43k|{
 1769|       |    // Populate actual hint table values
 1770|  1.43k|    calculateHPageOffset(new_obj, obj);
 1771|  1.43k|    calculateHSharedObject(new_obj, obj);
 1772|  1.43k|    calculateHOutline(new_obj, obj);
 1773|       |
 1774|       |    // Write the hint stream itself into a compressed memory buffer. Write through a counter so we
 1775|       |    // can get offsets.
 1776|  1.43k|    Pl_Buffer hint_stream("hint stream");
 1777|  1.43k|    Pipeline* next = &hint_stream;
 1778|  1.43k|    std::shared_ptr<Pipeline> flate;
 1779|  1.43k|    if (compressed) {
  ------------------
  |  Branch (1779:9): [True: 1.43k, False: 0]
  ------------------
 1780|  1.43k|        flate =
 1781|  1.43k|            std::make_shared<Pl_Flate>("compress hint stream", &hint_stream, Pl_Flate::a_deflate);
 1782|  1.43k|        next = flate.get();
 1783|  1.43k|    }
 1784|  1.43k|    Pl_Count c("count", next);
 1785|  1.43k|    BitWriter w(&c);
 1786|       |
 1787|  1.43k|    writeHPageOffset(w);
 1788|  1.43k|    S = toI(c.getCount());
 1789|  1.43k|    writeHSharedObject(w);
 1790|  1.43k|    O = 0;
 1791|  1.43k|    if (m->outline_hints.nobjects > 0) {
  ------------------
  |  Branch (1791:9): [True: 601, False: 830]
  ------------------
 1792|    601|        O = toI(c.getCount());
 1793|    601|        writeHGeneric(w, m->outline_hints);
 1794|    601|    }
 1795|  1.43k|    c.finish();
 1796|       |
 1797|  1.43k|    hint_buffer = hint_stream.getBufferSharedPointer();
 1798|  1.43k|}
QPDF_linearization.cc:_ZL5nbitsi:
 1467|  36.0k|{
 1468|  36.0k|    return (val == 0 ? 0 : (1 + nbits(val >> 1)));
  ------------------
  |  Branch (1468:13): [True: 7.15k, False: 28.8k]
  ------------------
 1469|  36.0k|}
_ZN4QPDF26calculateLinearizationDataIN10QPDFWriter8ObjTableEEEvRKT_:
  977|  1.91k|{
  978|       |    // This function calculates the ordering of objects, divides them into the appropriate parts,
  979|       |    // and computes some values for the linearization parameter dictionary and hint tables.  The
  980|       |    // file must be optimized (via calling optimize()) prior to calling this function.  Note that
  981|       |    // actual offsets and lengths are not computed here, but anything related to object ordering is.
  982|       |
  983|  1.91k|    if (m->object_to_obj_users.empty()) {
  ------------------
  |  Branch (983:9): [True: 0, False: 1.91k]
  ------------------
  984|       |        // Note that we can't call optimize here because we don't know whether it should be called
  985|       |        // with or without allow changes.
  986|      0|        throw std::logic_error(
  987|      0|            "INTERNAL ERROR: QPDF::calculateLinearizationData called before optimize()");
  988|      0|    }
  989|       |
  990|       |    // Separate objects into the categories sufficient for us to determine which part of the
  991|       |    // linearized file should contain the object.  This categorization is useful for other purposes
  992|       |    // as well.  Part numbers refer to version 1.4 of the PDF spec.
  993|       |
  994|       |    // Parts 1, 3, 5, 10, and 11 don't contain any objects from the original file (except the
  995|       |    // trailer dictionary in part 11).
  996|       |
  997|       |    // Part 4 is the document catalog (root) and the following root keys: /ViewerPreferences,
  998|       |    // /PageMode, /Threads, /OpenAction, /AcroForm, /Encrypt.  Note that Thread information
  999|       |    // dictionaries are supposed to appear in part 9, but we are disregarding that recommendation
 1000|       |    // for now.
 1001|       |
 1002|       |    // Part 6 is the first page section.  It includes all remaining objects referenced by the first
 1003|       |    // page including shared objects but not including thumbnails.  Additionally, if /PageMode is
 1004|       |    // /Outlines, then information from /Outlines also appears here.
 1005|       |
 1006|       |    // Part 7 contains remaining objects private to pages other than the first page.
 1007|       |
 1008|       |    // Part 8 contains all remaining shared objects except those that are shared only within
 1009|       |    // thumbnails.
 1010|       |
 1011|       |    // Part 9 contains all remaining objects.
 1012|       |
 1013|       |    // We sort objects into the following categories:
 1014|       |
 1015|       |    //   * open_document: part 4
 1016|       |
 1017|       |    //   * first_page_private: part 6
 1018|       |
 1019|       |    //   * first_page_shared: part 6
 1020|       |
 1021|       |    //   * other_page_private: part 7
 1022|       |
 1023|       |    //   * other_page_shared: part 8
 1024|       |
 1025|       |    //   * thumbnail_private: part 9
 1026|       |
 1027|       |    //   * thumbnail_shared: part 9
 1028|       |
 1029|       |    //   * other: part 9
 1030|       |
 1031|       |    //   * outlines: part 6 or 9
 1032|       |
 1033|  1.91k|    m->part4.clear();
 1034|  1.91k|    m->part6.clear();
 1035|  1.91k|    m->part7.clear();
 1036|  1.91k|    m->part8.clear();
 1037|  1.91k|    m->part9.clear();
 1038|  1.91k|    m->c_linp = LinParameters();
 1039|  1.91k|    m->c_page_offset_data = CHPageOffset();
 1040|  1.91k|    m->c_shared_object_data = CHSharedObject();
 1041|  1.91k|    m->c_outline_data = HGeneric();
 1042|       |
 1043|  1.91k|    QPDFObjectHandle root = getRoot();
 1044|  1.91k|    bool outlines_in_first_page = false;
 1045|  1.91k|    QPDFObjectHandle pagemode = root.getKey("/PageMode");
 1046|  1.91k|    QTC::TC("qpdf", "QPDF categorize pagemode present", pagemode.isName() ? 1 : 0);
  ------------------
  |  Branch (1046:57): [True: 789, False: 1.12k]
  ------------------
 1047|  1.91k|    if (pagemode.isName()) {
  ------------------
  |  Branch (1047:9): [True: 789, False: 1.12k]
  ------------------
 1048|    789|        if (pagemode.getName() == "/UseOutlines") {
  ------------------
  |  Branch (1048:13): [True: 778, False: 11]
  ------------------
 1049|    778|            if (root.hasKey("/Outlines")) {
  ------------------
  |  Branch (1049:17): [True: 696, False: 82]
  ------------------
 1050|    696|                outlines_in_first_page = true;
 1051|    696|            } else {
 1052|     82|                QTC::TC("qpdf", "QPDF UseOutlines but no Outlines");
 1053|     82|            }
 1054|    778|        }
 1055|    789|        QTC::TC("qpdf", "QPDF categorize pagemode outlines", outlines_in_first_page ? 1 : 0);
  ------------------
  |  Branch (1055:62): [True: 696, False: 93]
  ------------------
 1056|    789|    }
 1057|       |
 1058|  1.91k|    std::set<std::string> open_document_keys;
 1059|  1.91k|    open_document_keys.insert("/ViewerPreferences");
 1060|  1.91k|    open_document_keys.insert("/PageMode");
 1061|  1.91k|    open_document_keys.insert("/Threads");
 1062|  1.91k|    open_document_keys.insert("/OpenAction");
 1063|  1.91k|    open_document_keys.insert("/AcroForm");
 1064|       |
 1065|  1.91k|    std::set<QPDFObjGen> lc_open_document;
 1066|  1.91k|    std::set<QPDFObjGen> lc_first_page_private;
 1067|  1.91k|    std::set<QPDFObjGen> lc_first_page_shared;
 1068|  1.91k|    std::set<QPDFObjGen> lc_other_page_private;
 1069|  1.91k|    std::set<QPDFObjGen> lc_other_page_shared;
 1070|  1.91k|    std::set<QPDFObjGen> lc_thumbnail_private;
 1071|  1.91k|    std::set<QPDFObjGen> lc_thumbnail_shared;
 1072|  1.91k|    std::set<QPDFObjGen> lc_other;
 1073|  1.91k|    std::set<QPDFObjGen> lc_outlines;
 1074|  1.91k|    std::set<QPDFObjGen> lc_root;
 1075|       |
 1076|  52.2k|    for (auto& oiter: m->object_to_obj_users) {
  ------------------
  |  Branch (1076:21): [True: 52.2k, False: 1.91k]
  ------------------
 1077|  52.2k|        QPDFObjGen const& og = oiter.first;
 1078|  52.2k|        std::set<ObjUser>& ous = oiter.second;
 1079|       |
 1080|  52.2k|        bool in_open_document = false;
 1081|  52.2k|        bool in_first_page = false;
 1082|  52.2k|        int other_pages = 0;
 1083|  52.2k|        int thumbs = 0;
 1084|  52.2k|        int others = 0;
 1085|  52.2k|        bool in_outlines = false;
 1086|  52.2k|        bool is_root = false;
 1087|       |
 1088|  95.8k|        for (auto const& ou: ous) {
  ------------------
  |  Branch (1088:28): [True: 95.8k, False: 52.2k]
  ------------------
 1089|  95.8k|            switch (ou.ou_type) {
  ------------------
  |  Branch (1089:21): [True: 0, False: 95.8k]
  ------------------
 1090|  1.41k|            case ObjUser::ou_trailer_key:
  ------------------
  |  Branch (1090:13): [True: 1.41k, False: 94.4k]
  ------------------
 1091|  1.41k|                if (ou.key == "/Encrypt") {
  ------------------
  |  Branch (1091:21): [True: 0, False: 1.41k]
  ------------------
 1092|      0|                    in_open_document = true;
 1093|  1.41k|                } else {
 1094|  1.41k|                    ++others;
 1095|  1.41k|                }
 1096|  1.41k|                break;
 1097|       |
 1098|  27.5k|            case ObjUser::ou_thumb:
  ------------------
  |  Branch (1098:13): [True: 27.5k, False: 68.3k]
  ------------------
 1099|  27.5k|                ++thumbs;
 1100|  27.5k|                break;
 1101|       |
 1102|  6.47k|            case ObjUser::ou_root_key:
  ------------------
  |  Branch (1102:13): [True: 6.47k, False: 89.4k]
  ------------------
 1103|  6.47k|                if (open_document_keys.count(ou.key) > 0) {
  ------------------
  |  Branch (1103:21): [True: 752, False: 5.72k]
  ------------------
 1104|    752|                    in_open_document = true;
 1105|  5.72k|                } else if (ou.key == "/Outlines") {
  ------------------
  |  Branch (1105:28): [True: 1.17k, False: 4.55k]
  ------------------
 1106|  1.17k|                    in_outlines = true;
 1107|  4.55k|                } else {
 1108|  4.55k|                    ++others;
 1109|  4.55k|                }
 1110|  6.47k|                break;
 1111|       |
 1112|  58.5k|            case ObjUser::ou_page:
  ------------------
  |  Branch (1112:13): [True: 58.5k, False: 37.3k]
  ------------------
 1113|  58.5k|                if (ou.pageno == 0) {
  ------------------
  |  Branch (1113:21): [True: 6.25k, False: 52.2k]
  ------------------
 1114|  6.25k|                    in_first_page = true;
 1115|  52.2k|                } else {
 1116|  52.2k|                    ++other_pages;
 1117|  52.2k|                }
 1118|  58.5k|                break;
 1119|       |
 1120|  1.91k|            case ObjUser::ou_root:
  ------------------
  |  Branch (1120:13): [True: 1.91k, False: 93.9k]
  ------------------
 1121|  1.91k|                is_root = true;
 1122|  1.91k|                break;
 1123|       |
 1124|      0|            case ObjUser::ou_bad:
  ------------------
  |  Branch (1124:13): [True: 0, False: 95.8k]
  ------------------
 1125|      0|                stopOnError("INTERNAL ERROR: QPDF::calculateLinearizationData: "
 1126|      0|                            "invalid user type");
 1127|      0|                break;
 1128|  95.8k|            }
 1129|  95.8k|        }
 1130|       |
 1131|  52.2k|        if (is_root) {
  ------------------
  |  Branch (1131:13): [True: 1.91k, False: 50.3k]
  ------------------
 1132|  1.91k|            lc_root.insert(og);
 1133|  50.3k|        } else if (in_outlines) {
  ------------------
  |  Branch (1133:20): [True: 1.16k, False: 49.1k]
  ------------------
 1134|  1.16k|            lc_outlines.insert(og);
 1135|  49.1k|        } else if (in_open_document) {
  ------------------
  |  Branch (1135:20): [True: 732, False: 48.4k]
  ------------------
 1136|    732|            lc_open_document.insert(og);
 1137|  48.4k|        } else if ((in_first_page) && (others == 0) && (other_pages == 0) && (thumbs == 0)) {
  ------------------
  |  Branch (1137:20): [True: 4.94k, False: 43.4k]
  |  Branch (1137:39): [True: 4.10k, False: 836]
  |  Branch (1137:56): [True: 3.87k, False: 237]
  |  Branch (1137:78): [True: 3.86k, False: 10]
  ------------------
 1138|  3.86k|            lc_first_page_private.insert(og);
 1139|  44.5k|        } else if (in_first_page) {
  ------------------
  |  Branch (1139:20): [True: 1.08k, False: 43.4k]
  ------------------
 1140|  1.08k|            lc_first_page_shared.insert(og);
 1141|  43.4k|        } else if ((other_pages == 1) && (others == 0) && (thumbs == 0)) {
  ------------------
  |  Branch (1141:20): [True: 32.3k, False: 11.1k]
  |  Branch (1141:42): [True: 31.8k, False: 517]
  |  Branch (1141:59): [True: 31.5k, False: 218]
  ------------------
 1142|  31.5k|            lc_other_page_private.insert(og);
 1143|  31.5k|        } else if (other_pages > 1) {
  ------------------
  |  Branch (1143:20): [True: 829, False: 11.0k]
  ------------------
 1144|    829|            lc_other_page_shared.insert(og);
 1145|  11.0k|        } else if ((thumbs == 1) && (others == 0)) {
  ------------------
  |  Branch (1145:20): [True: 8.52k, False: 2.54k]
  |  Branch (1145:37): [True: 8.48k, False: 39]
  ------------------
 1146|  8.48k|            lc_thumbnail_private.insert(og);
 1147|  8.48k|        } else if (thumbs > 1) {
  ------------------
  |  Branch (1147:20): [True: 600, False: 1.98k]
  ------------------
 1148|    600|            lc_thumbnail_shared.insert(og);
 1149|  1.98k|        } else {
 1150|  1.98k|            lc_other.insert(og);
 1151|  1.98k|        }
 1152|  52.2k|    }
 1153|       |
 1154|       |    // Generate ordering for objects in the output file.  Sometimes we just dump right from a set
 1155|       |    // into a vector.  Rather than optimizing this by going straight into the vector, we'll leave
 1156|       |    // these phases separate for now.  That way, this section can be concerned only with ordering,
 1157|       |    // and the above section can be considered only with categorization.  Note that sets of
 1158|       |    // QPDFObjGens are sorted by QPDFObjGen.  In a linearized file, objects appear in sequence with
 1159|       |    // the possible exception of hints tables which we won't see here anyway.  That means that
 1160|       |    // running calculateLinearizationData() on a linearized file should give results identical to
 1161|       |    // the original file ordering.
 1162|       |
 1163|       |    // We seem to traverse the page tree a lot in this code, but we can address this for a future
 1164|       |    // code optimization if necessary. Premature optimization is the root of all evil.
 1165|  1.91k|    std::vector<QPDFObjectHandle> pages;
 1166|  1.91k|    { // local scope
 1167|       |        // Map all page objects to the containing object stream.  This should be a no-op in a
 1168|       |        // properly linearized file.
 1169|  19.4k|        for (auto oh: getAllPages()) {
  ------------------
  |  Branch (1169:21): [True: 19.4k, False: 1.91k]
  ------------------
 1170|  19.4k|            pages.push_back(getUncompressedObject(oh, object_stream_data));
 1171|  19.4k|        }
 1172|  1.91k|    }
 1173|  1.91k|    int npages = toI(pages.size());
 1174|       |
 1175|       |    // We will be initializing some values of the computed hint tables.  Specifically, we can
 1176|       |    // initialize any items that deal with object numbers or counts but not any items that deal with
 1177|       |    // lengths or offsets.  The code that writes linearized files will have to fill in these values
 1178|       |    // during the first pass.  The validation code can compute them relatively easily given the rest
 1179|       |    // of the information.
 1180|       |
 1181|       |    // npages is the size of the existing pages vector, which has been created by traversing the
 1182|       |    // pages tree, and as such is a reasonable size.
 1183|  1.91k|    m->c_linp.npages = npages;
 1184|  1.91k|    m->c_page_offset_data.entries = std::vector<CHPageOffsetEntry>(toS(npages));
 1185|       |
 1186|       |    // Part 4: open document objects.  We don't care about the order.
 1187|       |
 1188|  1.91k|    if (lc_root.size() != 1) {
  ------------------
  |  Branch (1188:9): [True: 0, False: 1.91k]
  ------------------
 1189|      0|        stopOnError("found other than one root while"
 1190|      0|                    " calculating linearization data");
 1191|      0|    }
 1192|  1.91k|    m->part4.push_back(getObject(*(lc_root.begin())));
 1193|  1.91k|    for (auto const& og: lc_open_document) {
  ------------------
  |  Branch (1193:24): [True: 732, False: 1.91k]
  ------------------
 1194|    732|        m->part4.push_back(getObject(og));
 1195|    732|    }
 1196|       |
 1197|       |    // Part 6: first page objects.  Note: implementation note 124 states that Acrobat always treats
 1198|       |    // page 0 as the first page for linearization regardless of /OpenAction.  pdlin doesn't provide
 1199|       |    // any option to set this and also disregards /OpenAction.  We will do the same.
 1200|       |
 1201|       |    // First, place the actual first page object itself.
 1202|  1.91k|    if (pages.empty()) {
  ------------------
  |  Branch (1202:9): [True: 4, False: 1.91k]
  ------------------
 1203|      4|        stopOnError("no pages found while calculating linearization data");
 1204|      4|    }
 1205|  1.91k|    QPDFObjGen first_page_og(pages.at(0).getObjGen());
 1206|  1.91k|    if (!lc_first_page_private.count(first_page_og)) {
  ------------------
  |  Branch (1206:9): [True: 15, False: 1.90k]
  ------------------
 1207|     15|        stopOnError("INTERNAL ERROR: QPDF::calculateLinearizationData: first page "
 1208|     15|                    "object not in lc_first_page_private");
 1209|     15|    }
 1210|  1.91k|    lc_first_page_private.erase(first_page_og);
 1211|  1.91k|    m->c_linp.first_page_object = pages.at(0).getObjectID();
 1212|  1.91k|    m->part6.push_back(pages.at(0));
 1213|       |
 1214|       |    // The PDF spec "recommends" an order for the rest of the objects, but we are going to disregard
 1215|       |    // it except to the extent that it groups private and shared objects contiguously for the sake
 1216|       |    // of hint tables.
 1217|       |
 1218|  1.96k|    for (auto const& og: lc_first_page_private) {
  ------------------
  |  Branch (1218:24): [True: 1.96k, False: 1.91k]
  ------------------
 1219|  1.96k|        m->part6.push_back(getObject(og));
 1220|  1.96k|    }
 1221|       |
 1222|  1.91k|    for (auto const& og: lc_first_page_shared) {
  ------------------
  |  Branch (1222:24): [True: 1.06k, False: 1.91k]
  ------------------
 1223|  1.06k|        m->part6.push_back(getObject(og));
 1224|  1.06k|    }
 1225|       |
 1226|       |    // Place the outline dictionary if it goes in the first page section.
 1227|  1.91k|    if (outlines_in_first_page) {
  ------------------
  |  Branch (1227:9): [True: 695, False: 1.22k]
  ------------------
 1228|    695|        pushOutlinesToPart(m->part6, lc_outlines, object_stream_data);
 1229|    695|    }
 1230|       |
 1231|       |    // Fill in page offset hint table information for the first page. The PDF spec says that
 1232|       |    // nshared_objects should be zero for the first page.  pdlin does not appear to obey this, but
 1233|       |    // it fills in garbage values for all the shared object identifiers on the first page.
 1234|       |
 1235|  1.91k|    m->c_page_offset_data.entries.at(0).nobjects = toI(m->part6.size());
 1236|       |
 1237|       |    // Part 7: other pages' private objects
 1238|       |
 1239|       |    // For each page in order:
 1240|  18.6k|    for (size_t i = 1; i < toS(npages); ++i) {
  ------------------
  |  Branch (1240:24): [True: 16.7k, False: 1.91k]
  ------------------
 1241|       |        // Place this page's page object
 1242|       |
 1243|  16.7k|        QPDFObjGen page_og(pages.at(i).getObjGen());
 1244|  16.7k|        if (!lc_other_page_private.count(page_og)) {
  ------------------
  |  Branch (1244:13): [True: 62, False: 16.6k]
  ------------------
 1245|     62|            stopOnError(
 1246|     62|                "INTERNAL ERROR: "
 1247|     62|                "QPDF::calculateLinearizationData: page object for page " +
 1248|     62|                std::to_string(i) + " not in lc_other_page_private");
 1249|     62|        }
 1250|  16.7k|        lc_other_page_private.erase(page_og);
 1251|  16.7k|        m->part7.push_back(pages.at(i));
 1252|       |
 1253|       |        // Place all non-shared objects referenced by this page, updating the page object count for
 1254|       |        // the hint table.
 1255|       |
 1256|  16.7k|        m->c_page_offset_data.entries.at(i).nobjects = 1;
 1257|       |
 1258|  16.7k|        ObjUser ou(ObjUser::ou_page, toI(i));
 1259|  16.7k|        if (m->obj_user_to_objects.count(ou) == 0) {
  ------------------
  |  Branch (1259:13): [True: 0, False: 16.7k]
  ------------------
 1260|      0|            stopOnError("found unreferenced page while"
 1261|      0|                        " calculating linearization data");
 1262|      0|        }
 1263|  49.8k|        for (auto const& og: m->obj_user_to_objects[ou]) {
  ------------------
  |  Branch (1263:28): [True: 49.8k, False: 16.7k]
  ------------------
 1264|  49.8k|            if (lc_other_page_private.count(og)) {
  ------------------
  |  Branch (1264:17): [True: 13.9k, False: 35.9k]
  ------------------
 1265|  13.9k|                lc_other_page_private.erase(og);
 1266|  13.9k|                m->part7.push_back(getObject(og));
 1267|  13.9k|                ++m->c_page_offset_data.entries.at(i).nobjects;
 1268|  13.9k|            }
 1269|  49.8k|        }
 1270|  16.7k|    }
 1271|       |    // That should have covered all part7 objects.
 1272|  1.91k|    if (!lc_other_page_private.empty()) {
  ------------------
  |  Branch (1272:9): [True: 0, False: 1.91k]
  ------------------
 1273|      0|        stopOnError("INTERNAL ERROR:"
 1274|      0|                    " QPDF::calculateLinearizationData: lc_other_page_private is "
 1275|      0|                    "not empty after generation of part7");
 1276|      0|    }
 1277|       |
 1278|       |    // Part 8: other pages' shared objects
 1279|       |
 1280|       |    // Order is unimportant.
 1281|  1.91k|    for (auto const& og: lc_other_page_shared) {
  ------------------
  |  Branch (1281:24): [True: 725, False: 1.91k]
  ------------------
 1282|    725|        m->part8.push_back(getObject(og));
 1283|    725|    }
 1284|       |
 1285|       |    // Part 9: other objects
 1286|       |
 1287|       |    // The PDF specification makes recommendations on ordering here. We follow them only to a
 1288|       |    // limited extent.  Specifically, we put the pages tree first, then private thumbnail objects in
 1289|       |    // page order, then shared thumbnail objects, and then outlines (unless in part 6).  After that,
 1290|       |    // we throw all remaining objects in arbitrary order.
 1291|       |
 1292|       |    // Place the pages tree.
 1293|  1.91k|    std::set<QPDFObjGen> pages_ogs =
 1294|  1.91k|        m->obj_user_to_objects[ObjUser(ObjUser::ou_root_key, "/Pages")];
 1295|  1.91k|    if (pages_ogs.empty()) {
  ------------------
  |  Branch (1295:9): [True: 19, False: 1.89k]
  ------------------
 1296|     19|        stopOnError("found empty pages tree while"
 1297|     19|                    " calculating linearization data");
 1298|     19|    }
 1299|  2.18k|    for (auto const& og: pages_ogs) {
  ------------------
  |  Branch (1299:24): [True: 2.18k, False: 1.91k]
  ------------------
 1300|  2.18k|        if (lc_other.count(og)) {
  ------------------
  |  Branch (1300:13): [True: 413, False: 1.77k]
  ------------------
 1301|    413|            lc_other.erase(og);
 1302|    413|            m->part9.push_back(getObject(og));
 1303|    413|        }
 1304|  2.18k|    }
 1305|       |
 1306|       |    // Place private thumbnail images in page order.  Slightly more information would be required if
 1307|       |    // we were going to bother with thumbnail hint tables.
 1308|  20.1k|    for (size_t i = 0; i < toS(npages); ++i) {
  ------------------
  |  Branch (1308:24): [True: 18.2k, False: 1.91k]
  ------------------
 1309|  18.2k|        QPDFObjectHandle thumb = pages.at(i).getKey("/Thumb");
 1310|  18.2k|        thumb = getUncompressedObject(thumb, object_stream_data);
 1311|  18.2k|        if (!thumb.isNull()) {
  ------------------
  |  Branch (1311:13): [True: 8.41k, False: 9.83k]
  ------------------
 1312|       |            // Output the thumbnail itself
 1313|  8.41k|            QPDFObjGen thumb_og(thumb.getObjGen());
 1314|  8.41k|            if (lc_thumbnail_private.count(thumb_og)) {
  ------------------
  |  Branch (1314:17): [True: 8.09k, False: 326]
  ------------------
 1315|  8.09k|                lc_thumbnail_private.erase(thumb_og);
 1316|  8.09k|                m->part9.push_back(thumb);
 1317|  8.09k|            } else {
 1318|       |                // No internal error this time...there's nothing to stop this object from having
 1319|       |                // been referred to somewhere else outside of a page's /Thumb, and if it had been,
 1320|       |                // there's nothing to prevent it from having been in some set other than
 1321|       |                // lc_thumbnail_private.
 1322|    326|            }
 1323|  8.41k|            std::set<QPDFObjGen>& ogs = m->obj_user_to_objects[ObjUser(ObjUser::ou_thumb, toI(i))];
 1324|  24.4k|            for (auto const& og: ogs) {
  ------------------
  |  Branch (1324:32): [True: 24.4k, False: 8.41k]
  ------------------
 1325|  24.4k|                if (lc_thumbnail_private.count(og)) {
  ------------------
  |  Branch (1325:21): [True: 47, False: 24.4k]
  ------------------
 1326|     47|                    lc_thumbnail_private.erase(og);
 1327|     47|                    m->part9.push_back(getObject(og));
 1328|     47|                }
 1329|  24.4k|            }
 1330|  8.41k|        }
 1331|  18.2k|    }
 1332|  1.91k|    if (!lc_thumbnail_private.empty()) {
  ------------------
  |  Branch (1332:9): [True: 8, False: 1.90k]
  ------------------
 1333|      8|        stopOnError("INTERNAL ERROR: QPDF::calculateLinearizationData: lc_thumbnail_private not "
 1334|      8|                    "empty after placing thumbnails");
 1335|      8|    }
 1336|       |
 1337|       |    // Place shared thumbnail objects
 1338|  1.91k|    for (auto const& og: lc_thumbnail_shared) {
  ------------------
  |  Branch (1338:24): [True: 453, False: 1.91k]
  ------------------
 1339|    453|        m->part9.push_back(getObject(og));
 1340|    453|    }
 1341|       |
 1342|       |    // Place outlines unless in first page
 1343|  1.91k|    if (!outlines_in_first_page) {
  ------------------
  |  Branch (1343:9): [True: 1.16k, False: 752]
  ------------------
 1344|  1.16k|        pushOutlinesToPart(m->part9, lc_outlines, object_stream_data);
 1345|  1.16k|    }
 1346|       |
 1347|       |    // Place all remaining objects
 1348|  1.91k|    for (auto const& og: lc_other) {
  ------------------
  |  Branch (1348:24): [True: 1.08k, False: 1.91k]
  ------------------
 1349|  1.08k|        m->part9.push_back(getObject(og));
 1350|  1.08k|    }
 1351|       |
 1352|       |    // Make sure we got everything exactly once.
 1353|       |
 1354|  1.91k|    size_t num_placed =
 1355|  1.91k|        m->part4.size() + m->part6.size() + m->part7.size() + m->part8.size() + m->part9.size();
 1356|  1.91k|    size_t num_wanted = m->object_to_obj_users.size();
 1357|  1.91k|    if (num_placed != num_wanted) {
  ------------------
  |  Branch (1357:9): [True: 7, False: 1.90k]
  ------------------
 1358|      7|        stopOnError(
 1359|      7|            "INTERNAL ERROR: QPDF::calculateLinearizationData: wrong "
 1360|      7|            "number of objects placed (num_placed = " +
 1361|      7|            std::to_string(num_placed) + "; number of objects: " + std::to_string(num_wanted));
 1362|      7|    }
 1363|       |
 1364|       |    // Calculate shared object hint table information including references to shared objects from
 1365|       |    // page offset hint data.
 1366|       |
 1367|       |    // The shared object hint table consists of all part 6 (whether shared or not) in order followed
 1368|       |    // by all part 8 objects in order.  Add the objects to shared object data keeping a map of
 1369|       |    // object number to index.  Then populate the shared object information for the pages.
 1370|       |
 1371|       |    // Note that two objects never have the same object number, so we can map from object number
 1372|       |    // only without regards to generation.
 1373|  1.91k|    std::map<int, int> obj_to_index;
 1374|       |
 1375|  1.91k|    m->c_shared_object_data.nshared_first_page = toI(m->part6.size());
 1376|  1.91k|    m->c_shared_object_data.nshared_total =
 1377|  1.91k|        m->c_shared_object_data.nshared_first_page + toI(m->part8.size());
 1378|       |
 1379|  1.91k|    std::vector<CHSharedObjectEntry>& shared = m->c_shared_object_data.entries;
 1380|  5.75k|    for (auto& oh: m->part6) {
  ------------------
  |  Branch (1380:18): [True: 5.75k, False: 1.91k]
  ------------------
 1381|  5.75k|        int obj = oh.getObjectID();
 1382|  5.75k|        obj_to_index[obj] = toI(shared.size());
 1383|  5.75k|        shared.emplace_back(obj);
 1384|  5.75k|    }
 1385|  1.91k|    QTC::TC("qpdf", "QPDF lin part 8 empty", m->part8.empty() ? 1 : 0);
  ------------------
  |  Branch (1385:46): [True: 1.59k, False: 319]
  ------------------
 1386|  1.91k|    if (!m->part8.empty()) {
  ------------------
  |  Branch (1386:9): [True: 204, False: 1.71k]
  ------------------
 1387|    204|        m->c_shared_object_data.first_shared_obj = m->part8.at(0).getObjectID();
 1388|    693|        for (auto& oh: m->part8) {
  ------------------
  |  Branch (1388:22): [True: 693, False: 204]
  ------------------
 1389|    693|            int obj = oh.getObjectID();
 1390|    693|            obj_to_index[obj] = toI(shared.size());
 1391|    693|            shared.emplace_back(obj);
 1392|    693|        }
 1393|    204|    }
 1394|  1.91k|    if (static_cast<size_t>(m->c_shared_object_data.nshared_total) !=
  ------------------
  |  Branch (1394:9): [True: 0, False: 1.91k]
  ------------------
 1395|  1.91k|        m->c_shared_object_data.entries.size()) {
 1396|      0|        stopOnError("shared object hint table has wrong number of entries");
 1397|      0|    }
 1398|       |
 1399|       |    // Now compute the list of shared objects for each page after the first page.
 1400|       |
 1401|  18.1k|    for (size_t i = 1; i < toS(npages); ++i) {
  ------------------
  |  Branch (1401:24): [True: 16.2k, False: 1.91k]
  ------------------
 1402|  16.2k|        CHPageOffsetEntry& pe = m->c_page_offset_data.entries.at(i);
 1403|  16.2k|        ObjUser ou(ObjUser::ou_page, toI(i));
 1404|  16.2k|        if (m->obj_user_to_objects.count(ou) == 0) {
  ------------------
  |  Branch (1404:13): [True: 0, False: 16.2k]
  ------------------
 1405|      0|            stopOnError("found unreferenced page while"
 1406|      0|                        " calculating linearization data");
 1407|      0|        }
 1408|  48.5k|        for (auto const& og: m->obj_user_to_objects[ou]) {
  ------------------
  |  Branch (1408:28): [True: 48.5k, False: 16.2k]
  ------------------
 1409|  48.5k|            if ((m->object_to_obj_users[og].size() > 1) && (obj_to_index.count(og.getObj()) > 0)) {
  ------------------
  |  Branch (1409:17): [True: 18.5k, False: 29.9k]
  |  Branch (1409:17): [True: 18.1k, False: 30.3k]
  |  Branch (1409:60): [True: 18.1k, False: 471]
  ------------------
 1410|  18.1k|                int idx = obj_to_index[og.getObj()];
 1411|  18.1k|                ++pe.nshared_objects;
 1412|  18.1k|                pe.shared_identifiers.push_back(idx);
 1413|  18.1k|            }
 1414|  48.5k|        }
 1415|  16.2k|    }
 1416|  1.91k|}
_ZN4QPDF18pushOutlinesToPartIN10QPDFWriter8ObjTableEEEvRNSt3__16vectorI16QPDFObjectHandleNS3_9allocatorIS5_EEEERNS3_3setI10QPDFObjGenNS3_4lessISB_EENS6_ISB_EEEERKT_:
 1424|  1.85k|{
 1425|  1.85k|    QPDFObjectHandle root = getRoot();
 1426|  1.85k|    QPDFObjectHandle outlines = root.getKey("/Outlines");
 1427|  1.85k|    if (outlines.isNull()) {
  ------------------
  |  Branch (1427:9): [True: 1.13k, False: 727]
  ------------------
 1428|  1.13k|        return;
 1429|  1.13k|    }
 1430|    727|    outlines = getUncompressedObject(outlines, object_stream_data);
 1431|    727|    QPDFObjGen outlines_og(outlines.getObjGen());
 1432|    727|    QTC::TC(
 1433|    727|        "qpdf",
 1434|    727|        "QPDF lin outlines in part",
 1435|    727|        ((&part == (&m->part6))       ? 0
  ------------------
  |  Branch (1435:10): [True: 695, False: 32]
  ------------------
 1436|    727|             : (&part == (&m->part9)) ? 1
  ------------------
  |  Branch (1436:16): [True: 32, False: 0]
  ------------------
 1437|     32|                                      : 9999)); // can't happen
 1438|    727|    m->c_outline_data.first_object = outlines_og.getObj();
 1439|    727|    m->c_outline_data.nobjects = 1;
 1440|    727|    lc_outlines.erase(outlines_og);
 1441|    727|    part.push_back(outlines);
 1442|    727|    for (auto const& og: lc_outlines) {
  ------------------
  |  Branch (1442:24): [True: 428, False: 727]
  ------------------
 1443|    428|        part.push_back(getObject(og));
 1444|    428|        ++m->c_outline_data.nobjects;
 1445|    428|    }
 1446|    727|}
QPDF_linearization.cc:_ZL16write_vector_intIN4QPDF16HPageOffsetEntryEiEvR9BitWriteriRNSt3__16vectorIT_NS4_9allocatorIS6_EEEEiMS6_T0_:
 1639|  2.86k|{
 1640|       |    // nitems times, write bits bits from the given field of the ith vector to the given bit writer.
 1641|       |
 1642|  34.8k|    for (size_t i = 0; i < QIntC::to_size(nitems); ++i) {
  ------------------
  |  Branch (1642:24): [True: 31.9k, False: 2.86k]
  ------------------
 1643|  31.9k|        w.writeBits(QIntC::to_ulonglong(vec.at(i).*field), QIntC::to_size(bits));
 1644|  31.9k|    }
 1645|       |    // The PDF spec says that each hint table starts at a byte boundary.  Each "row" actually must
 1646|       |    // start on a byte boundary.
 1647|  2.86k|    w.flush();
 1648|  2.86k|}
QPDF_linearization.cc:_ZL16write_vector_intIN4QPDF16HPageOffsetEntryExEvR9BitWriteriRNSt3__16vectorIT_NS4_9allocatorIS6_EEEEiMS6_T0_:
 1639|  4.29k|{
 1640|       |    // nitems times, write bits bits from the given field of the ith vector to the given bit writer.
 1641|       |
 1642|  52.2k|    for (size_t i = 0; i < QIntC::to_size(nitems); ++i) {
  ------------------
  |  Branch (1642:24): [True: 47.9k, False: 4.29k]
  ------------------
 1643|  47.9k|        w.writeBits(QIntC::to_ulonglong(vec.at(i).*field), QIntC::to_size(bits));
 1644|  47.9k|    }
 1645|       |    // The PDF spec says that each hint table starts at a byte boundary.  Each "row" actually must
 1646|       |    // start on a byte boundary.
 1647|  4.29k|    w.flush();
 1648|  4.29k|}
QPDF_linearization.cc:_ZL19write_vector_vectorIN4QPDF16HPageOffsetEntryEEvR9BitWriteriRNSt3__16vectorIT_NS4_9allocatorIS6_EEEEMS6_iiMS6_NS5_IiNS7_IiEEEE:
 1659|  2.86k|{
 1660|       |    // nitems1 times, write nitems2 (from the ith element of vec1) items from the vec2 vector field
 1661|       |    // of the ith item of vec1.
 1662|  34.8k|    for (size_t i1 = 0; i1 < QIntC::to_size(nitems1); ++i1) {
  ------------------
  |  Branch (1662:25): [True: 31.9k, False: 2.86k]
  ------------------
 1663|  65.7k|        for (size_t i2 = 0; i2 < QIntC::to_size(vec1.at(i1).*nitems2); ++i2) {
  ------------------
  |  Branch (1663:29): [True: 33.8k, False: 31.9k]
  ------------------
 1664|  33.8k|            w.writeBits(QIntC::to_ulonglong((vec1.at(i1).*vec2).at(i2)), QIntC::to_size(bits));
 1665|  33.8k|        }
 1666|  31.9k|    }
 1667|  2.86k|    w.flush();
 1668|  2.86k|}
QPDF_linearization.cc:_ZL16write_vector_intIN4QPDF18HSharedObjectEntryEiEvR9BitWriteriRNSt3__16vectorIT_NS4_9allocatorIS6_EEEEiMS6_T0_:
 1639|  4.29k|{
 1640|       |    // nitems times, write bits bits from the given field of the ith vector to the given bit writer.
 1641|       |
 1642|  20.7k|    for (size_t i = 0; i < QIntC::to_size(nitems); ++i) {
  ------------------
  |  Branch (1642:24): [True: 16.4k, False: 4.29k]
  ------------------
 1643|  16.4k|        w.writeBits(QIntC::to_ulonglong(vec.at(i).*field), QIntC::to_size(bits));
 1644|  16.4k|    }
 1645|       |    // The PDF spec says that each hint table starts at a byte boundary.  Each "row" actually must
 1646|       |    // start on a byte boundary.
 1647|  4.29k|    w.flush();
 1648|  4.29k|}

_ZN4QPDF7ObjUserC2ENS0_6user_eE:
   22|  1.91k|{
   23|  1.91k|    qpdf_assert_debug(type == ou_root);
  ------------------
  |  |   16|  1.91k|# define qpdf_assert_debug assert
  ------------------
   24|  1.91k|}
_ZN4QPDF7ObjUserC2ENS0_6user_eEi:
   29|  70.5k|{
   30|  70.5k|    qpdf_assert_debug((type == ou_page) || (type == ou_thumb));
  ------------------
  |  |   16|  70.5k|# define qpdf_assert_debug assert
  ------------------
   31|  70.5k|}
_ZN4QPDF7ObjUserC2ENS0_6user_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
   37|  19.6k|{
   38|  19.6k|    qpdf_assert_debug((type == ou_trailer_key) || (type == ou_root_key));
  ------------------
  |  |   16|  19.6k|# define qpdf_assert_debug assert
  ------------------
   39|  19.6k|}
_ZNK4QPDF7ObjUserltERKS0_:
   43|  5.56M|{
   44|  5.56M|    if (this->ou_type < rhs.ou_type) {
  ------------------
  |  Branch (44:9): [True: 563k, False: 4.99M]
  ------------------
   45|   563k|        return true;
   46|  4.99M|    } else if (this->ou_type == rhs.ou_type) {
  ------------------
  |  Branch (46:16): [True: 4.46M, False: 537k]
  ------------------
   47|  4.46M|        if (this->pageno < rhs.pageno) {
  ------------------
  |  Branch (47:13): [True: 1.67M, False: 2.78M]
  ------------------
   48|  1.67M|            return true;
   49|  2.78M|        } else if (this->pageno == rhs.pageno) {
  ------------------
  |  Branch (49:20): [True: 980k, False: 1.80M]
  ------------------
   50|   980k|            return (this->key < rhs.key);
   51|   980k|        }
   52|  4.46M|    }
   53|       |
   54|  2.34M|    return false;
   55|  5.56M|}
_ZN4QPDF21UpdateObjectMapsFrameC2ERKNS_7ObjUserE16QPDFObjectHandleb:
   62|  1.37M|{
   63|  1.37M|}
_ZN4QPDF8optimizeERKN10QPDFWriter8ObjTableENSt3__18functionIFiR16QPDFObjectHandleEEE:
   77|  1.94k|{
   78|  1.94k|    optimize_internal(obj, true, skip_stream_parameters);
   79|  1.94k|}
_ZN4QPDF29pushInheritedAttributesToPageEbb:
  155|  3.11k|{
  156|       |    // Traverse pages tree pushing all inherited resources down to the page level.
  157|       |
  158|       |    // The record of whether we've done this is cleared by updateAllPagesCache().  If we're warning
  159|       |    // for skipped keys, re-traverse unconditionally.
  160|  3.11k|    if (m->pushed_inherited_attributes_to_pages && (!warn_skipped_keys)) {
  ------------------
  |  Branch (160:9): [True: 1.07k, False: 2.04k]
  |  Branch (160:52): [True: 1.07k, False: 0]
  ------------------
  161|  1.07k|        return;
  162|  1.07k|    }
  163|       |
  164|       |    // Calling getAllPages() resolves any duplicated page objects, repairs broken nodes, and detects
  165|       |    // loops, so we don't have to do those activities here.
  166|  2.04k|    getAllPages();
  167|       |
  168|       |    // key_ancestors is a mapping of page attribute keys to a stack of Pages nodes that contain
  169|       |    // values for them.
  170|  2.04k|    std::map<std::string, std::vector<QPDFObjectHandle>> key_ancestors;
  171|  2.04k|    pushInheritedAttributesToPageInternal(
  172|  2.04k|        m->trailer.getKey("/Root").getKey("/Pages"),
  173|  2.04k|        key_ancestors,
  174|  2.04k|        allow_changes,
  175|  2.04k|        warn_skipped_keys);
  176|  2.04k|    if (!key_ancestors.empty()) {
  ------------------
  |  Branch (176:9): [True: 0, False: 2.04k]
  ------------------
  177|      0|        throw std::logic_error("key_ancestors not empty after"
  178|      0|                               " pushing inherited attributes to pages");
  179|      0|    }
  180|  2.04k|    m->pushed_inherited_attributes_to_pages = true;
  181|  2.04k|    m->ever_pushed_inherited_attributes_to_pages = true;
  182|  2.04k|}
_ZN4QPDF37pushInheritedAttributesToPageInternalE16QPDFObjectHandleRNSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_6vectorIS0_NS6_IS0_EEEENS1_4lessIS8_EENS6_INS1_4pairIKS8_SB_EEEEEEbb:
  190|  2.29k|{
  191|       |    // Make a list of inheritable keys. Only the keys /MediaBox, /CropBox, /Resources, and /Rotate
  192|       |    // are inheritable attributes. Push this object onto the stack of pages nodes that have values
  193|       |    // for this attribute.
  194|       |
  195|  2.29k|    std::set<std::string> inheritable_keys;
  196|  10.1k|    for (auto const& key: cur_pages.getKeys()) {
  ------------------
  |  Branch (196:25): [True: 10.1k, False: 2.29k]
  ------------------
  197|  10.1k|        if ((key == "/MediaBox") || (key == "/CropBox") || (key == "/Resources") ||
  ------------------
  |  Branch (197:13): [True: 375, False: 9.80k]
  |  Branch (197:37): [True: 7, False: 9.79k]
  |  Branch (197:60): [True: 322, False: 9.47k]
  ------------------
  198|  10.1k|            (key == "/Rotate")) {
  ------------------
  |  Branch (198:13): [True: 9, False: 9.46k]
  ------------------
  199|    713|            if (!allow_changes) {
  ------------------
  |  Branch (199:17): [True: 0, False: 713]
  ------------------
  200|      0|                throw QPDFExc(
  201|      0|                    qpdf_e_internal,
  202|      0|                    m->file->getName(),
  203|      0|                    m->last_object_description,
  204|      0|                    m->file->getLastOffset(),
  205|      0|                    "optimize detected an inheritable attribute when called in no-change mode");
  206|      0|            }
  207|       |
  208|       |            // This is an inheritable resource
  209|    713|            inheritable_keys.insert(key);
  210|    713|            QPDFObjectHandle oh = cur_pages.getKey(key);
  211|    713|            QTC::TC("qpdf", "QPDF opt direct pages resource", oh.isIndirect() ? 0 : 1);
  ------------------
  |  Branch (211:63): [True: 266, False: 447]
  ------------------
  212|    713|            if (!oh.isIndirect()) {
  ------------------
  |  Branch (212:17): [True: 447, False: 266]
  ------------------
  213|    447|                if (!oh.isScalar()) {
  ------------------
  |  Branch (213:21): [True: 402, False: 45]
  ------------------
  214|       |                    // Replace shared direct object non-scalar resources with indirect objects to
  215|       |                    // avoid copying large structures around.
  216|    402|                    cur_pages.replaceKey(key, makeIndirectObject(oh));
  217|    402|                    oh = cur_pages.getKey(key);
  218|    402|                } else {
  219|       |                    // It's okay to copy scalars.
  220|     45|                    QTC::TC("qpdf", "QPDF opt inherited scalar");
  221|     45|                }
  222|    447|            }
  223|    713|            key_ancestors[key].push_back(oh);
  224|    713|            if (key_ancestors[key].size() > 1) {
  ------------------
  |  Branch (224:17): [True: 5, False: 708]
  ------------------
  225|      5|                QTC::TC("qpdf", "QPDF opt key ancestors depth > 1");
  226|      5|            }
  227|       |            // Remove this resource from this node.  It will be reattached at the page level.
  228|    713|            cur_pages.removeKey(key);
  229|  9.46k|        } else if (!((key == "/Type") || (key == "/Parent") || (key == "/Kids") ||
  ------------------
  |  Branch (229:22): [True: 2.28k, False: 7.18k]
  |  Branch (229:42): [True: 65, False: 7.11k]
  |  Branch (229:64): [True: 2.28k, False: 4.83k]
  ------------------
  230|  9.46k|                     (key == "/Count"))) {
  ------------------
  |  Branch (230:22): [True: 2.17k, False: 2.66k]
  ------------------
  231|       |            // Warn when flattening, but not if the key is at the top level (i.e. "/Parent" not
  232|       |            // set), as we don't change these; but flattening removes intermediate /Pages nodes.
  233|  2.66k|            if ((warn_skipped_keys) && (cur_pages.hasKey("/Parent"))) {
  ------------------
  |  Branch (233:17): [True: 1.44k, False: 1.21k]
  |  Branch (233:17): [True: 316, False: 2.34k]
  |  Branch (233:40): [True: 316, False: 1.13k]
  ------------------
  234|    316|                QTC::TC("qpdf", "QPDF unknown key not inherited");
  235|    316|                setLastObjectDescription("Pages object", cur_pages.getObjGen());
  236|    316|                warn(
  237|    316|                    qpdf_e_pages,
  238|    316|                    m->last_object_description,
  239|    316|                    0,
  240|    316|                    ("Unknown key " + key +
  241|    316|                     " in /Pages object is being discarded as a result of flattening the /Pages "
  242|    316|                     "tree"));
  243|    316|            }
  244|  2.66k|        }
  245|  10.1k|    }
  246|       |
  247|       |    // Process descendant nodes. This method does not perform loop detection because all code paths
  248|       |    // that lead here follow a call to getAllPages, which already throws an exception in the event
  249|       |    // of a loop in the pages tree.
  250|  34.2k|    for (auto& kid: cur_pages.getKey("/Kids").aitems()) {
  ------------------
  |  Branch (250:19): [True: 34.2k, False: 2.29k]
  ------------------
  251|  34.2k|        if (kid.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (251:13): [True: 249, False: 34.0k]
  ------------------
  252|    249|            pushInheritedAttributesToPageInternal(
  253|    249|                kid, key_ancestors, allow_changes, warn_skipped_keys);
  254|  34.0k|        } else {
  255|       |            // Add all available inheritable attributes not present in this object to this object.
  256|  34.0k|            for (auto const& iter: key_ancestors) {
  ------------------
  |  Branch (256:34): [True: 1.29k, False: 34.0k]
  ------------------
  257|  1.29k|                std::string const& key = iter.first;
  258|  1.29k|                if (!kid.hasKey(key)) {
  ------------------
  |  Branch (258:21): [True: 479, False: 812]
  ------------------
  259|    479|                    QTC::TC("qpdf", "QPDF opt resource inherited");
  260|    479|                    kid.replaceKey(key, iter.second.back());
  261|    812|                } else {
  262|    812|                    QTC::TC("qpdf", "QPDF opt page resource hides ancestor");
  263|    812|                }
  264|  1.29k|            }
  265|  34.0k|        }
  266|  34.2k|    }
  267|       |
  268|       |    // For each inheritable key, pop the stack.  If the stack becomes empty, remove it from the map.
  269|       |    // That way, the invariant that the list of keys in key_ancestors is exactly those keys for
  270|       |    // which inheritable attributes are available.
  271|       |
  272|  2.29k|    if (!inheritable_keys.empty()) {
  ------------------
  |  Branch (272:9): [True: 359, False: 1.93k]
  ------------------
  273|    359|        QTC::TC("qpdf", "QPDF opt inheritable keys");
  274|    649|        for (auto const& key: inheritable_keys) {
  ------------------
  |  Branch (274:29): [True: 649, False: 359]
  ------------------
  275|    649|            key_ancestors[key].pop_back();
  276|    649|            if (key_ancestors[key].empty()) {
  ------------------
  |  Branch (276:17): [True: 645, False: 4]
  ------------------
  277|    645|                QTC::TC("qpdf", "QPDF opt erase empty key ancestor");
  278|    645|                key_ancestors.erase(key);
  279|    645|            }
  280|    649|        }
  281|  1.93k|    } else {
  282|  1.93k|        QTC::TC("qpdf", "QPDF opt no inheritable keys");
  283|  1.93k|    }
  284|  2.29k|}
_ZN4QPDF16updateObjectMapsERKNS_7ObjUserE16QPDFObjectHandleNSt3__18functionIFiRS3_EEE:
  291|  37.4k|{
  292|  37.4k|    QPDFObjGen::set visited;
  293|  37.4k|    std::vector<UpdateObjectMapsFrame> pending;
  294|  37.4k|    pending.emplace_back(first_ou, first_oh, true);
  295|       |    // Traverse the object tree from this point taking care to avoid crossing page boundaries.
  296|  37.4k|    std::unique_ptr<ObjUser> thumb_ou;
  297|  1.41M|    while (!pending.empty()) {
  ------------------
  |  Branch (297:12): [True: 1.37M, False: 37.4k]
  ------------------
  298|  1.37M|        auto cur = pending.back();
  299|  1.37M|        pending.pop_back();
  300|       |
  301|  1.37M|        bool is_page_node = false;
  302|       |
  303|  1.37M|        if (cur.oh.isDictionaryOfType("/Page")) {
  ------------------
  |  Branch (303:13): [True: 79.1k, False: 1.29M]
  ------------------
  304|  79.1k|            is_page_node = true;
  305|  79.1k|            if (!cur.top) {
  ------------------
  |  Branch (305:17): [True: 59.2k, False: 19.9k]
  ------------------
  306|  59.2k|                continue;
  307|  59.2k|            }
  308|  79.1k|        }
  309|       |
  310|  1.31M|        if (cur.oh.isIndirect()) {
  ------------------
  |  Branch (310:13): [True: 225k, False: 1.08M]
  ------------------
  311|   225k|            QPDFObjGen og(cur.oh.getObjGen());
  312|   225k|            if (!visited.add(og)) {
  ------------------
  |  Branch (312:17): [True: 59.7k, False: 165k]
  ------------------
  313|  59.7k|                QTC::TC("qpdf", "QPDF opt loop detected");
  314|  59.7k|                continue;
  315|  59.7k|            }
  316|   165k|            m->obj_user_to_objects[cur.ou].insert(og);
  317|   165k|            m->object_to_obj_users[og].insert(cur.ou);
  318|   165k|        }
  319|       |
  320|  1.25M|        if (cur.oh.isArray()) {
  ------------------
  |  Branch (320:13): [True: 95.2k, False: 1.15M]
  ------------------
  321|  95.2k|            int n = cur.oh.getArrayNItems();
  322|   802k|            for (int i = 0; i < n; ++i) {
  ------------------
  |  Branch (322:29): [True: 707k, False: 95.2k]
  ------------------
  323|   707k|                pending.emplace_back(cur.ou, cur.oh.getArrayItem(i), false);
  324|   707k|            }
  325|  1.15M|        } else if (cur.oh.isDictionary() || cur.oh.isStream()) {
  ------------------
  |  Branch (325:20): [True: 148k, False: 1.01M]
  |  Branch (325:45): [True: 45.3k, False: 965k]
  ------------------
  326|   193k|            QPDFObjectHandle dict = cur.oh;
  327|   193k|            bool is_stream = cur.oh.isStream();
  328|   193k|            int ssp = 0;
  329|   193k|            if (is_stream) {
  ------------------
  |  Branch (329:17): [True: 45.3k, False: 148k]
  ------------------
  330|  45.3k|                dict = cur.oh.getDict();
  331|  45.3k|                if (skip_stream_parameters) {
  ------------------
  |  Branch (331:21): [True: 45.3k, False: 0]
  ------------------
  332|  45.3k|                    ssp = skip_stream_parameters(cur.oh);
  333|  45.3k|                }
  334|  45.3k|            }
  335|       |
  336|   709k|            for (auto const& key: dict.getKeys()) {
  ------------------
  |  Branch (336:33): [True: 709k, False: 193k]
  ------------------
  337|   709k|                if (is_page_node && (key == "/Thumb")) {
  ------------------
  |  Branch (337:21): [True: 140k, False: 568k]
  |  Branch (337:37): [True: 9.56k, False: 130k]
  ------------------
  338|       |                    // Traverse page thumbnail dictionaries as a special case. There can only ever
  339|       |                    // be one /Thumb key on a page, and we see at most one page node per call.
  340|  9.56k|                    thumb_ou = std::make_unique<ObjUser>(ObjUser::ou_thumb, cur.ou.pageno);
  341|  9.56k|                    pending.emplace_back(*thumb_ou, dict.getKey(key), false);
  342|   699k|                } else if (is_page_node && (key == "/Parent")) {
  ------------------
  |  Branch (342:28): [True: 130k, False: 568k]
  |  Branch (342:44): [True: 19.6k, False: 111k]
  ------------------
  343|       |                    // Don't traverse back up the page tree
  344|   680k|                } else if (
  345|   680k|                    ((ssp >= 1) && (key == "/Length")) ||
  ------------------
  |  Branch (345:22): [True: 170k, False: 510k]
  |  Branch (345:36): [True: 43.0k, False: 127k]
  ------------------
  346|   680k|                    ((ssp >= 2) && ((key == "/Filter") || (key == "/DecodeParms")))) {
  ------------------
  |  Branch (346:22): [True: 78.4k, False: 558k]
  |  Branch (346:37): [True: 16.5k, False: 61.8k]
  |  Branch (346:59): [True: 17, False: 61.8k]
  ------------------
  347|       |                    // Don't traverse into stream parameters that we are not going to write.
  348|   620k|                } else {
  349|   620k|                    pending.emplace_back(cur.ou, dict.getKey(key), false);
  350|   620k|                }
  351|   709k|            }
  352|   193k|        }
  353|  1.25M|    }
  354|  37.4k|}
_ZN4QPDF23filterCompressedObjectsERKN10QPDFWriter8ObjTableE:
  402|  1.91k|{
  403|  1.91k|    if (obj.getStreamsEmpty()) {
  ------------------
  |  Branch (403:9): [True: 13, False: 1.90k]
  ------------------
  404|     13|        return;
  405|     13|    }
  406|       |
  407|       |    // Transform object_to_obj_users and obj_user_to_objects so that they refer only to uncompressed
  408|       |    // objects.  If something is a user of a compressed object, then it is really a user of the
  409|       |    // object stream that contains it.
  410|       |
  411|  1.90k|    std::map<ObjUser, std::set<QPDFObjGen>> t_obj_user_to_objects;
  412|  1.90k|    std::map<QPDFObjGen, std::set<ObjUser>> t_object_to_obj_users;
  413|       |
  414|  35.6k|    for (auto const& i1: m->obj_user_to_objects) {
  ------------------
  |  Branch (414:24): [True: 35.6k, False: 1.90k]
  ------------------
  415|  35.6k|        ObjUser const& ou = i1.first;
  416|       |        // Loop over objects.
  417|   165k|        for (auto const& og: i1.second) {
  ------------------
  |  Branch (417:28): [True: 165k, False: 35.6k]
  ------------------
  418|   165k|            if (obj.contains(og)) {
  ------------------
  |  Branch (418:17): [True: 165k, False: 1]
  ------------------
  419|   165k|                if (auto const& i2 = obj[og].object_stream; i2 <= 0) {
  ------------------
  |  Branch (419:61): [True: 66.5k, False: 98.9k]
  ------------------
  420|  66.5k|                    t_obj_user_to_objects[ou].insert(og);
  421|  98.9k|                } else {
  422|  98.9k|                    t_obj_user_to_objects[ou].insert(QPDFObjGen(i2, 0));
  423|  98.9k|                }
  424|   165k|            }
  425|   165k|        }
  426|  35.6k|    }
  427|       |
  428|  81.9k|    for (auto const& i1: m->object_to_obj_users) {
  ------------------
  |  Branch (428:24): [True: 81.9k, False: 1.90k]
  ------------------
  429|  81.9k|        QPDFObjGen const& og = i1.first;
  430|  81.9k|        if (obj.contains(og)) {
  ------------------
  |  Branch (430:13): [True: 81.9k, False: 1]
  ------------------
  431|       |            // Loop over obj_users.
  432|   165k|            for (auto const& ou: i1.second) {
  ------------------
  |  Branch (432:32): [True: 165k, False: 81.9k]
  ------------------
  433|   165k|                if (auto i2 = obj[og].object_stream; i2 <= 0) {
  ------------------
  |  Branch (433:54): [True: 66.5k, False: 98.9k]
  ------------------
  434|  66.5k|                    t_object_to_obj_users[og].insert(ou);
  435|  98.9k|                } else {
  436|  98.9k|                    t_object_to_obj_users[QPDFObjGen(i2, 0)].insert(ou);
  437|  98.9k|                }
  438|   165k|            }
  439|  81.9k|        }
  440|  81.9k|    }
  441|       |
  442|  1.90k|    m->obj_user_to_objects = t_obj_user_to_objects;
  443|  1.90k|    m->object_to_obj_users = t_object_to_obj_users;
  444|  1.90k|}
_ZN4QPDF17optimize_internalIN10QPDFWriter8ObjTableEEEvRKT_bNSt3__18functionIFiR16QPDFObjectHandleEEE:
   87|  1.94k|{
   88|  1.94k|    if (!m->obj_user_to_objects.empty()) {
  ------------------
  |  Branch (88:9): [True: 0, False: 1.94k]
  ------------------
   89|       |        // already optimized
   90|      0|        return;
   91|      0|    }
   92|       |
   93|       |    // The PDF specification indicates that /Outlines is supposed to be an indirect reference. Force
   94|       |    // it to be so if it exists and is direct.  (This has been seen in the wild.)
   95|  1.94k|    QPDFObjectHandle root = getRoot();
   96|  1.94k|    if (root.getKey("/Outlines").isDictionary()) {
  ------------------
  |  Branch (96:9): [True: 748, False: 1.19k]
  ------------------
   97|    748|        QPDFObjectHandle outlines = root.getKey("/Outlines");
   98|    748|        if (!outlines.isIndirect()) {
  ------------------
  |  Branch (98:13): [True: 0, False: 748]
  ------------------
   99|      0|            QTC::TC("qpdf", "QPDF_optimization indirect outlines");
  100|      0|            root.replaceKey("/Outlines", makeIndirectObject(outlines));
  101|      0|        }
  102|    748|    }
  103|       |
  104|       |    // Traverse pages tree pushing all inherited resources down to the page level.  This also
  105|       |    // initializes m->all_pages.
  106|  1.94k|    pushInheritedAttributesToPage(allow_changes, false);
  107|       |
  108|       |    // Traverse pages
  109|  1.94k|    int n = toI(m->all_pages.size());
  110|  21.5k|    for (int pageno = 0; pageno < n; ++pageno) {
  ------------------
  |  Branch (110:26): [True: 19.6k, False: 1.94k]
  ------------------
  111|  19.6k|        updateObjectMaps(
  112|  19.6k|            ObjUser(ObjUser::ou_page, pageno),
  113|  19.6k|            m->all_pages.at(toS(pageno)),
  114|  19.6k|            skip_stream_parameters);
  115|  19.6k|    }
  116|       |
  117|       |    // Traverse document-level items
  118|  10.6k|    for (auto const& key: m->trailer.getKeys()) {
  ------------------
  |  Branch (118:25): [True: 10.6k, False: 1.94k]
  ------------------
  119|  10.6k|        if (key == "/Root") {
  ------------------
  |  Branch (119:13): [True: 1.91k, False: 8.69k]
  ------------------
  120|       |            // handled separately
  121|  8.69k|        } else {
  122|  8.69k|            updateObjectMaps(
  123|  8.69k|                ObjUser(ObjUser::ou_trailer_key, key),
  124|  8.69k|                m->trailer.getKey(key),
  125|  8.69k|                skip_stream_parameters);
  126|  8.69k|        }
  127|  10.6k|    }
  128|       |
  129|  9.08k|    for (auto const& key: root.getKeys()) {
  ------------------
  |  Branch (129:25): [True: 9.08k, False: 1.94k]
  ------------------
  130|       |        // Technically, /I keys from /Thread dictionaries are supposed to be handled separately, but
  131|       |        // we are going to disregard that specification for now.  There is loads of evidence that
  132|       |        // pdlin and Acrobat both disregard things like this from time to time, so this is almost
  133|       |        // certain not to cause any problems.
  134|  9.08k|        updateObjectMaps(
  135|  9.08k|            ObjUser(ObjUser::ou_root_key, key), root.getKey(key), skip_stream_parameters);
  136|  9.08k|    }
  137|       |
  138|  1.94k|    ObjUser root_ou = ObjUser(ObjUser::ou_root);
  139|  1.94k|    auto root_og = QPDFObjGen(root.getObjGen());
  140|  1.94k|    m->obj_user_to_objects[root_ou].insert(root_og);
  141|  1.94k|    m->object_to_obj_users[root_og].insert(root_ou);
  142|       |
  143|  1.94k|    filterCompressedObjects(object_stream_data);
  144|  1.94k|}

_ZN4QPDF11getAllPagesEv:
   41|  14.5k|{
   42|       |    // Note that pushInheritedAttributesToPage may also be used to initialize m->all_pages.
   43|  14.5k|    if (m->all_pages.empty() && !m->invalid_page_found) {
  ------------------
  |  Branch (43:9): [True: 2.43k, False: 12.0k]
  |  Branch (43:33): [True: 2.37k, False: 60]
  ------------------
   44|  2.37k|        m->ever_called_get_all_pages = true;
   45|  2.37k|        QPDFObjGen::set visited;
   46|  2.37k|        QPDFObjGen::set seen;
   47|  2.37k|        QPDFObjectHandle pages = getRoot().getKey("/Pages");
   48|  2.37k|        bool warned = false;
   49|  2.37k|        bool changed_pages = false;
   50|  2.43k|        while (pages.isDictionary() && pages.hasKey("/Parent")) {
  ------------------
  |  Branch (50:16): [True: 2.21k, False: 219]
  |  Branch (50:16): [True: 84, False: 2.34k]
  |  Branch (50:40): [True: 84, False: 2.12k]
  ------------------
   51|     84|            if (!seen.add(pages)) {
  ------------------
  |  Branch (51:17): [True: 31, False: 53]
  ------------------
   52|       |                // loop -- will be detected again and reported later
   53|     31|                break;
   54|     31|            }
   55|       |            // Files have been found in the wild where /Pages in the catalog points to the first
   56|       |            // page. Try to work around this and similar cases with this heuristic.
   57|     53|            if (!warned) {
  ------------------
  |  Branch (57:17): [True: 49, False: 4]
  ------------------
   58|     49|                getRoot().warnIfPossible("document page tree root (root -> /Pages) doesn't point"
   59|     49|                                         " to the root of the page tree; attempting to correct");
   60|     49|                warned = true;
   61|     49|            }
   62|     53|            changed_pages = true;
   63|     53|            pages = pages.getKey("/Parent");
   64|     53|        }
   65|  2.37k|        if (changed_pages) {
  ------------------
  |  Branch (65:13): [True: 49, False: 2.33k]
  ------------------
   66|     49|            getRoot().replaceKey("/Pages", pages);
   67|     49|        }
   68|  2.37k|        seen.clear();
   69|  2.37k|        if (!pages.hasKey("/Kids")) {
  ------------------
  |  Branch (69:13): [True: 61, False: 2.31k]
  ------------------
   70|       |            // Ensure we actually found a /Pages object.
   71|     61|            throw QPDFExc(
   72|     61|                qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array");
   73|     61|        }
   74|  2.31k|        getAllPagesInternal(pages, visited, seen, false);
   75|  2.31k|        if (m->invalid_page_found) {
  ------------------
  |  Branch (75:13): [True: 1.16k, False: 1.15k]
  ------------------
   76|  1.16k|            flattenPagesTree();
   77|  1.16k|            m->invalid_page_found = false;
   78|  1.16k|        }
   79|  2.31k|    }
   80|  14.4k|    return m->all_pages;
   81|  14.5k|}
_ZN4QPDF19getAllPagesInternalE16QPDFObjectHandleRN10QPDFObjGen3setES3_b:
   86|  2.44k|{
   87|  2.44k|    if (!visited.add(cur_node)) {
  ------------------
  |  Branch (87:9): [True: 9, False: 2.43k]
  ------------------
   88|      9|        throw QPDFExc(
   89|      9|            qpdf_e_pages,
   90|      9|            m->file->getName(),
   91|      9|            m->last_object_description,
   92|      9|            0,
   93|      9|            "Loop detected in /Pages structure (getAllPages)");
   94|      9|    }
   95|  2.43k|    if (!cur_node.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (95:9): [True: 275, False: 2.15k]
  ------------------
   96|    275|        cur_node.warnIfPossible("/Type key should be /Pages but is not; overriding");
   97|    275|        cur_node.replaceKey("/Type", "/Pages"_qpdf);
   98|    275|    }
   99|  2.43k|    if (!media_box) {
  ------------------
  |  Branch (99:9): [True: 2.41k, False: 14]
  ------------------
  100|  2.41k|        media_box = cur_node.getKey("/MediaBox").isRectangle();
  101|  2.41k|        QTC::TC("qpdf", "QPDF inherit mediabox", media_box ? 0 : 1);
  ------------------
  |  Branch (101:50): [True: 346, False: 2.07k]
  ------------------
  102|  2.41k|    }
  103|  2.43k|    auto kids = cur_node.getKey("/Kids");
  104|  2.43k|    int n = kids.getArrayNItems();
  105|  39.4k|    for (int i = 0; i < n; ++i) {
  ------------------
  |  Branch (105:21): [True: 37.0k, False: 2.43k]
  ------------------
  106|  37.0k|        auto kid = kids.getArrayItem(i);
  107|  37.0k|        if (!kid.isDictionary()) {
  ------------------
  |  Branch (107:13): [True: 15.8k, False: 21.1k]
  ------------------
  108|  15.8k|            kid.warnIfPossible("Pages tree includes non-dictionary object; ignoring");
  109|  15.8k|            m->invalid_page_found = true;
  110|  15.8k|            continue;
  111|  15.8k|        }
  112|  21.1k|        if (kid.hasKey("/Kids")) {
  ------------------
  |  Branch (112:13): [True: 296, False: 20.8k]
  ------------------
  113|    296|            getAllPagesInternal(kid, visited, seen, media_box);
  114|  20.8k|        } else {
  115|  20.8k|            if (!media_box && !kid.getKey("/MediaBox").isRectangle()) {
  ------------------
  |  Branch (115:17): [True: 20.3k, False: 549]
  |  Branch (115:17): [True: 2.24k, False: 18.6k]
  |  Branch (115:31): [True: 2.24k, False: 18.0k]
  ------------------
  116|  2.24k|                QTC::TC("qpdf", "QPDF missing mediabox");
  117|  2.24k|                kid.warnIfPossible(
  118|  2.24k|                    "kid " + std::to_string(i) +
  119|  2.24k|                    " (from 0) MediaBox is undefined; setting to letter / ANSI A");
  120|  2.24k|                kid.replaceKey(
  121|  2.24k|                    "/MediaBox",
  122|  2.24k|                    QPDFObjectHandle::newArray(QPDFObjectHandle::Rectangle(0, 0, 612, 792)));
  123|  2.24k|            }
  124|  20.8k|            if (!kid.isIndirect()) {
  ------------------
  |  Branch (124:17): [True: 79, False: 20.7k]
  ------------------
  125|     79|                QTC::TC("qpdf", "QPDF handle direct page object");
  126|     79|                cur_node.warnIfPossible(
  127|     79|                    "kid " + std::to_string(i) + " (from 0) is direct; converting to indirect");
  128|     79|                kid = makeIndirectObject(kid);
  129|     79|                kids.setArrayItem(i, kid);
  130|  20.7k|            } else if (!seen.add(kid)) {
  ------------------
  |  Branch (130:24): [True: 510, False: 20.2k]
  ------------------
  131|       |                // Make a copy of the page. This does the same as shallowCopyPage in
  132|       |                // QPDFPageObjectHelper.
  133|    510|                QTC::TC("qpdf", "QPDF resolve duplicated page object");
  134|    510|                cur_node.warnIfPossible(
  135|    510|                    "kid " + std::to_string(i) +
  136|    510|                    " (from 0) appears more than once in the pages tree;"
  137|    510|                    " creating a new page object as a copy");
  138|    510|                kid = makeIndirectObject(QPDFObjectHandle(kid).shallowCopy());
  139|    510|                seen.add(kid);
  140|    510|                kids.setArrayItem(i, kid);
  141|    510|            }
  142|  20.8k|            if (!kid.isDictionaryOfType("/Page")) {
  ------------------
  |  Branch (142:17): [True: 2.16k, False: 18.7k]
  ------------------
  143|  2.16k|                kid.warnIfPossible("/Type key should be /Page but is not; overriding");
  144|  2.16k|                kid.replaceKey("/Type", "/Page"_qpdf);
  145|  2.16k|            }
  146|  20.8k|            m->all_pages.push_back(kid);
  147|  20.8k|        }
  148|  21.1k|    }
  149|  2.43k|}
_ZN4QPDF16flattenPagesTreeEv:
  166|  1.16k|{
  167|       |    // If not already done, flatten the /Pages structure and initialize pageobj_to_pages_pos.
  168|       |
  169|  1.16k|    if (!m->pageobj_to_pages_pos.empty()) {
  ------------------
  |  Branch (169:9): [True: 0, False: 1.16k]
  ------------------
  170|      0|        return;
  171|      0|    }
  172|       |
  173|       |    // Push inherited objects down to the /Page level.  As a side effect m->all_pages will also be
  174|       |    // generated.
  175|  1.16k|    pushInheritedAttributesToPage(true, true);
  176|       |
  177|  1.16k|    QPDFObjectHandle pages = getRoot().getKey("/Pages");
  178|       |
  179|  1.16k|    size_t const len = m->all_pages.size();
  180|  17.0k|    for (size_t pos = 0; pos < len; ++pos) {
  ------------------
  |  Branch (180:26): [True: 15.8k, False: 1.16k]
  ------------------
  181|       |        // Populate pageobj_to_pages_pos and fix parent pointer. There should be no duplicates at
  182|       |        // this point because pushInheritedAttributesToPage calls getAllPages which resolves
  183|       |        // duplicates.
  184|  15.8k|        insertPageobjToPage(m->all_pages.at(pos), toI(pos), true);
  185|  15.8k|        m->all_pages.at(pos).replaceKey("/Parent", pages);
  186|  15.8k|    }
  187|       |
  188|  1.16k|    pages.replaceKey("/Kids", QPDFObjectHandle::newArray(m->all_pages));
  189|       |    // /Count has not changed
  190|  1.16k|    if (pages.getKey("/Count").getUIntValue() != len) {
  ------------------
  |  Branch (190:9): [True: 1.10k, False: 60]
  ------------------
  191|  1.10k|        if (m->invalid_page_found && pages.getKey("/Count").getUIntValue() > len) {
  ------------------
  |  Branch (191:13): [True: 1.10k, False: 0]
  |  Branch (191:13): [True: 1.09k, False: 12]
  |  Branch (191:38): [True: 1.09k, False: 12]
  ------------------
  192|  1.09k|            pages.replaceKey("/Count", QPDFObjectHandle::newInteger(toI(len)));
  193|  1.09k|        } else {
  194|     12|            throw std::runtime_error("/Count is wrong after flattening pages tree");
  195|     12|        }
  196|  1.10k|    }
  197|  1.16k|}
_ZN4QPDF19insertPageobjToPageERK16QPDFObjectHandleib:
  201|  15.8k|{
  202|  15.8k|    QPDFObjGen og(obj.getObjGen());
  203|  15.8k|    if (check_duplicate) {
  ------------------
  |  Branch (203:9): [True: 15.8k, False: 0]
  ------------------
  204|  15.8k|        if (!m->pageobj_to_pages_pos.insert(std::make_pair(og, pos)).second) {
  ------------------
  |  Branch (204:13): [True: 0, False: 15.8k]
  ------------------
  205|       |            // The library never calls insertPageobjToPage in a way that causes this to happen.
  206|      0|            setLastObjectDescription("page " + std::to_string(pos) + " (numbered from zero)", og);
  207|      0|            throw QPDFExc(
  208|      0|                qpdf_e_pages,
  209|      0|                m->file->getName(),
  210|      0|                m->last_object_description,
  211|      0|                0,
  212|      0|                "duplicate page reference found; this would cause loss of data");
  213|      0|        }
  214|  15.8k|    } else {
  215|      0|        m->pageobj_to_pages_pos[og] = pos;
  216|      0|    }
  217|  15.8k|}

_ZN5QUtil18int_to_string_baseExii:
  338|  3.16k|{
  339|  3.16k|    return int_to_string_base_internal(num, base, length);
  340|  3.16k|}
_ZN5QUtil16double_to_stringEdib:
  350|  8.99k|{
  351|       |    // Backward compatibility -- this code used to use sprintf and treated decimal_places <= 0 to
  352|       |    // mean to use the default, which was six decimal places. Starting in 10.2, we trim trailing
  353|       |    // zeroes by default.
  354|  8.99k|    if (decimal_places <= 0) {
  ------------------
  |  Branch (354:9): [True: 8.99k, False: 0]
  ------------------
  355|  8.99k|        decimal_places = 6;
  356|  8.99k|    }
  357|  8.99k|    std::ostringstream buf;
  358|  8.99k|    buf.imbue(std::locale::classic());
  359|  8.99k|    buf << std::setprecision(decimal_places) << std::fixed << num;
  360|  8.99k|    std::string result = buf.str();
  361|  8.99k|    if (trim_trailing_zeroes) {
  ------------------
  |  Branch (361:9): [True: 8.99k, False: 0]
  ------------------
  362|  62.9k|        while ((result.length() > 1) && (result.back() == '0')) {
  ------------------
  |  Branch (362:16): [True: 62.9k, False: 0]
  |  Branch (362:41): [True: 53.9k, False: 8.99k]
  ------------------
  363|  53.9k|            result.pop_back();
  364|  53.9k|        }
  365|  8.99k|        if ((result.length() > 1) && (result.back() == '.')) {
  ------------------
  |  Branch (365:13): [True: 8.99k, False: 0]
  |  Branch (365:38): [True: 8.99k, False: 0]
  ------------------
  366|  8.99k|            result.pop_back();
  367|  8.99k|        }
  368|  8.99k|    }
  369|  8.99k|    return result;
  370|  8.99k|}
_ZN5QUtil12string_to_llEPKc:
  374|  2.14M|{
  375|  2.14M|    errno = 0;
  376|       |#ifdef _MSC_VER
  377|       |    long long result = _strtoi64(str, 0, 10);
  378|       |#else
  379|  2.14M|    long long result = strtoll(str, nullptr, 10);
  380|  2.14M|#endif
  381|  2.14M|    if (errno == ERANGE) {
  ------------------
  |  Branch (381:9): [True: 84, False: 2.14M]
  ------------------
  382|     84|        throw std::range_error(
  383|     84|            std::string("overflow/underflow converting ") + str + " to 64-bit integer");
  384|     84|    }
  385|  2.14M|    return result;
  386|  2.14M|}
_ZN5QUtil13string_to_intEPKc:
  390|   862k|{
  391|       |    // QIntC::to_int does range checking
  392|   862k|    return QIntC::to_int(string_to_ll(str));
  393|   862k|}
_ZN5QUtil21unsigned_char_pointerEPKc:
  448|  2.32M|{
  449|  2.32M|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str));
  450|  2.32M|}
_ZN5QUtil10hex_encodeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  722|  1.43k|{
  723|  1.43k|    static auto constexpr hexchars = "0123456789abcdef";
  724|  1.43k|    std::string result;
  725|  1.43k|    result.reserve(2 * input.length());
  726|  22.8k|    for (const char c: input) {
  ------------------
  |  Branch (726:22): [True: 22.8k, False: 1.43k]
  ------------------
  727|  22.8k|        result += hexchars[static_cast<unsigned char>(c) >> 4];
  728|  22.8k|        result += hexchars[c & 0x0f];
  729|  22.8k|    }
  730|  1.43k|    return result;
  731|  1.43k|}
_ZN5QUtil7get_envERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPS6_:
  807|      1|{
  808|       |    // This was basically ripped out of wxWindows.
  809|       |#ifdef _WIN32
  810|       |# ifdef NO_GET_ENVIRONMENT
  811|       |    return false;
  812|       |# else
  813|       |    // first get the size of the buffer
  814|       |    DWORD len = ::GetEnvironmentVariable(var.c_str(), NULL, 0);
  815|       |    if (len == 0) {
  816|       |        // this means that there is no such variable
  817|       |        return false;
  818|       |    }
  819|       |
  820|       |    if (value) {
  821|       |        auto t = QUtil::make_shared_array<char>(len + 1);
  822|       |        ::GetEnvironmentVariable(var.c_str(), t.get(), len);
  823|       |        *value = t.get();
  824|       |    }
  825|       |
  826|       |    return true;
  827|       |# endif
  828|       |#else
  829|      1|    char* p = getenv(var.c_str());
  830|      1|    if (p == nullptr) {
  ------------------
  |  Branch (830:9): [True: 1, False: 0]
  ------------------
  831|      1|        return false;
  832|      1|    }
  833|      0|    if (value) {
  ------------------
  |  Branch (833:9): [True: 0, False: 0]
  ------------------
  834|      0|        *value = p;
  835|      0|    }
  836|       |
  837|      0|    return true;
  838|      1|#endif
  839|      1|}
QUtil.cc:_ZL27int_to_string_base_internalIxENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEET_ii:
  295|  3.16k|{
  296|       |    // Backward compatibility -- int_to_string, which calls this function, used to use sprintf with
  297|       |    // %0*d, so we interpret length such that a negative value appends spaces and a positive value
  298|       |    // prepends zeroes.
  299|  3.16k|    if (!((base == 8) || (base == 10) || (base == 16))) {
  ------------------
  |  Branch (299:11): [True: 3.16k, False: 0]
  |  Branch (299:26): [True: 0, False: 0]
  |  Branch (299:42): [True: 0, False: 0]
  ------------------
  300|      0|        throw std::logic_error("int_to_string_base called with unsupported base");
  301|      0|    }
  302|  3.16k|    std::string cvt;
  303|  3.16k|    if (base == 10) {
  ------------------
  |  Branch (303:9): [True: 0, False: 3.16k]
  ------------------
  304|       |        // Use the more efficient std::to_string when possible
  305|      0|        cvt = std::to_string(num);
  306|  3.16k|    } else {
  307|  3.16k|        std::ostringstream buf;
  308|  3.16k|        buf.imbue(std::locale::classic());
  309|  3.16k|        buf << std::setbase(base) << std::nouppercase << num;
  310|  3.16k|        cvt = buf.str();
  311|  3.16k|    }
  312|  3.16k|    std::string result;
  313|  3.16k|    int str_length = QIntC::to_int(cvt.length());
  314|  3.16k|    if ((length > 0) && (str_length < length)) {
  ------------------
  |  Branch (314:9): [True: 3.16k, False: 0]
  |  Branch (314:25): [True: 67, False: 3.09k]
  ------------------
  315|     67|        result.append(QIntC::to_size(length - str_length), '0');
  316|     67|    }
  317|  3.16k|    result += cvt;
  318|  3.16k|    if ((length < 0) && (str_length < -length)) {
  ------------------
  |  Branch (318:9): [True: 0, False: 3.16k]
  |  Branch (318:25): [True: 0, False: 0]
  ------------------
  319|      0|        result.append(QIntC::to_size(-length - str_length), ' ');
  320|      0|    }
  321|  3.16k|    return result;
  322|  3.16k|}

_ZN17SF_FlateLzwDecodeC2Eb:
   18|  25.7k|{
   19|  25.7k|}
_ZN17SF_FlateLzwDecode14setDecodeParmsE16QPDFObjectHandle:
   23|  25.6k|{
   24|  25.6k|    if (decode_parms.isNull()) {
  ------------------
  |  Branch (24:9): [True: 25.3k, False: 306]
  ------------------
   25|  25.3k|        return true;
   26|  25.3k|    }
   27|       |
   28|    306|    bool filterable = true;
   29|    306|    std::set<std::string> keys = decode_parms.getKeys();
   30|    650|    for (auto const& key: keys) {
  ------------------
  |  Branch (30:25): [True: 650, False: 306]
  ------------------
   31|    650|        QPDFObjectHandle value = decode_parms.getKey(key);
   32|    650|        if (key == "/Predictor") {
  ------------------
  |  Branch (32:13): [True: 289, False: 361]
  ------------------
   33|    289|            if (value.isInteger()) {
  ------------------
  |  Branch (33:17): [True: 288, False: 1]
  ------------------
   34|    288|                this->predictor = value.getIntValueAsInt();
   35|    288|                if (!((this->predictor == 1) || (this->predictor == 2) ||
  ------------------
  |  Branch (35:23): [True: 0, False: 288]
  |  Branch (35:49): [True: 19, False: 269]
  ------------------
   36|    288|                      ((this->predictor >= 10) && (this->predictor <= 15)))) {
  ------------------
  |  Branch (36:24): [True: 269, False: 0]
  |  Branch (36:51): [True: 268, False: 1]
  ------------------
   37|      1|                    filterable = false;
   38|      1|                }
   39|    288|            } else {
   40|      1|                filterable = false;
   41|      1|            }
   42|    361|        } else if ((key == "/Columns") || (key == "/Colors") || (key == "/BitsPerComponent")) {
  ------------------
  |  Branch (42:20): [True: 287, False: 74]
  |  Branch (42:43): [True: 0, False: 74]
  |  Branch (42:65): [True: 2, False: 72]
  ------------------
   43|    289|            if (value.isInteger()) {
  ------------------
  |  Branch (43:17): [True: 285, False: 4]
  ------------------
   44|    285|                int val = value.getIntValueAsInt();
   45|    285|                if (key == "/Columns") {
  ------------------
  |  Branch (45:21): [True: 283, False: 2]
  ------------------
   46|    283|                    this->columns = val;
   47|    283|                } else if (key == "/Colors") {
  ------------------
  |  Branch (47:28): [True: 0, False: 2]
  ------------------
   48|      0|                    this->colors = val;
   49|      2|                } else if (key == "/BitsPerComponent") {
  ------------------
  |  Branch (49:28): [True: 2, False: 0]
  ------------------
   50|      2|                    this->bits_per_component = val;
   51|      2|                }
   52|    285|            } else {
   53|      4|                filterable = false;
   54|      4|            }
   55|    289|        } else if (lzw && (key == "/EarlyChange")) {
  ------------------
  |  Branch (55:20): [True: 0, False: 72]
  |  Branch (55:27): [True: 0, False: 0]
  ------------------
   56|      0|            if (value.isInteger()) {
  ------------------
  |  Branch (56:17): [True: 0, False: 0]
  ------------------
   57|      0|                int earlychange = value.getIntValueAsInt();
   58|      0|                this->early_code_change = (earlychange == 1);
   59|      0|                if (!((earlychange == 0) || (earlychange == 1))) {
  ------------------
  |  Branch (59:23): [True: 0, False: 0]
  |  Branch (59:45): [True: 0, False: 0]
  ------------------
   60|      0|                    filterable = false;
   61|      0|                }
   62|      0|            } else {
   63|      0|                filterable = false;
   64|      0|            }
   65|      0|        }
   66|    650|    }
   67|       |
   68|    306|    if ((this->predictor > 1) && (this->columns == 0)) {
  ------------------
  |  Branch (68:9): [True: 288, False: 18]
  |  Branch (68:34): [True: 2, False: 286]
  ------------------
   69|      2|        filterable = false;
   70|      2|    }
   71|       |
   72|    306|    return filterable;
   73|  25.6k|}
_ZN17SF_FlateLzwDecode17getDecodePipelineEP8Pipeline:
   77|  25.6k|{
   78|  25.6k|    std::shared_ptr<Pipeline> pipeline;
   79|  25.6k|    if ((this->predictor >= 10) && (this->predictor <= 15)) {
  ------------------
  |  Branch (79:9): [True: 265, False: 25.4k]
  |  Branch (79:36): [True: 265, False: 0]
  ------------------
   80|    265|        QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter");
   81|    265|        pipeline = std::make_shared<Pl_PNGFilter>(
   82|    265|            "png decode",
   83|    265|            next,
   84|    265|            Pl_PNGFilter::a_decode,
   85|    265|            QIntC::to_uint(this->columns),
   86|    265|            QIntC::to_uint(this->colors),
   87|    265|            QIntC::to_uint(this->bits_per_component));
   88|    265|        this->pipelines.push_back(pipeline);
   89|    265|        next = pipeline.get();
   90|  25.4k|    } else if (this->predictor == 2) {
  ------------------
  |  Branch (90:16): [True: 17, False: 25.3k]
  ------------------
   91|     17|        QTC::TC("qpdf", "SF_FlateLzwDecode TIFF predictor");
   92|     17|        pipeline = std::make_shared<Pl_TIFFPredictor>(
   93|     17|            "tiff decode",
   94|     17|            next,
   95|     17|            Pl_TIFFPredictor::a_decode,
   96|     17|            QIntC::to_uint(this->columns),
   97|     17|            QIntC::to_uint(this->colors),
   98|     17|            QIntC::to_uint(this->bits_per_component));
   99|     17|        this->pipelines.push_back(pipeline);
  100|     17|        next = pipeline.get();
  101|     17|    }
  102|       |
  103|  25.6k|    if (lzw) {
  ------------------
  |  Branch (103:9): [True: 953, False: 24.7k]
  ------------------
  104|    953|        pipeline = std::make_shared<Pl_LZWDecoder>("lzw decode", next, early_code_change);
  105|  24.7k|    } else {
  106|  24.7k|        pipeline = std::make_shared<Pl_Flate>("stream inflate", next, Pl_Flate::a_inflate);
  107|  24.7k|    }
  108|  25.6k|    this->pipelines.push_back(pipeline);
  109|  25.6k|    return pipeline.get();
  110|  25.6k|}
_ZN17SF_FlateLzwDecode13flate_factoryEv:
  114|  24.7k|{
  115|  24.7k|    return std::make_shared<SF_FlateLzwDecode>(false);
  116|  24.7k|}
_ZN17SF_FlateLzwDecode11lzw_factoryEv:
  120|    954|{
  121|    954|    return std::make_shared<SF_FlateLzwDecode>(true);
  122|    954|}

_ZN8ObjTableIN10QPDFWriter6ObjectEEC2Ev:
   32|  2.00k|    ObjTable() = default;
_ZN8ObjTableIN10QPDFWriter9NewObjectEEC2Ev:
   32|  2.00k|    ObjTable() = default;
_ZN8ObjTableIN10QPDFWriter9NewObjectEEixEi:
   81|   499k|    {
   82|   499k|        return element(static_cast<size_t>(id));
   83|   499k|    }
_ZN8ObjTableIN10QPDFWriter9NewObjectEE7elementEm:
  149|   499k|    {
  150|   499k|        if (idx < std::vector<T>::size()) {
  ------------------
  |  Branch (150:13): [True: 499k, False: 0]
  ------------------
  151|   499k|            return std::vector<T>::operator[](idx);
  152|   499k|        }
  153|      0|        return large_element(idx);
  154|   499k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEEixE10QPDFObjGen:
   87|   475k|    {
   88|   475k|        return element(static_cast<size_t>(og.getObj()));
   89|   475k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEE7elementEm:
  149|   997k|    {
  150|   997k|        if (idx < std::vector<T>::size()) {
  ------------------
  |  Branch (150:13): [True: 993k, False: 3.59k]
  ------------------
  151|   993k|            return std::vector<T>::operator[](idx);
  152|   993k|        }
  153|  3.59k|        return large_element(idx);
  154|   997k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEE13large_elementEm:
  159|  3.59k|    {
  160|  3.59k|        static const size_t max_size = std::vector<T>::max_size();
  161|  3.59k|        if (idx < min_sparse) {
  ------------------
  |  Branch (161:13): [True: 102, False: 3.48k]
  ------------------
  162|    102|            min_sparse = idx;
  163|    102|        }
  164|  3.59k|        if (idx < max_size) {
  ------------------
  |  Branch (164:13): [True: 3.58k, False: 1]
  ------------------
  165|  3.58k|            return sparse_elements[idx];
  166|  3.58k|        }
  167|      1|        throw std::runtime_error("Impossibly large object id encountered accessing ObjTable");
  168|      0|        return element(0); // doesn't return
  169|  3.59k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEEixE16QPDFObjectHandle:
   93|   522k|    {
   94|   522k|        return element(static_cast<size_t>(oh.getObjectID()));
   95|   522k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEE6resizeEm:
  117|  1.96k|    {
  118|  1.96k|        std::vector<T>::resize(a_size);
  119|  1.96k|        if (a_size > min_sparse) {
  ------------------
  |  Branch (119:13): [True: 0, False: 1.96k]
  ------------------
  120|      0|            auto it = sparse_elements.begin();
  121|      0|            auto end = sparse_elements.end();
  122|      0|            while (it != end && it->first < a_size) {
  ------------------
  |  Branch (122:20): [True: 0, False: 0]
  |  Branch (122:33): [True: 0, False: 0]
  ------------------
  123|      0|                std::vector<T>::operator[](it->first) = std::move(it->second);
  124|      0|                it = sparse_elements.erase(it);
  125|      0|            }
  126|      0|            min_sparse = (it == end) ? std::numeric_limits<size_t>::max() : it->first;
  ------------------
  |  Branch (126:26): [True: 0, False: 0]
  ------------------
  127|      0|        }
  128|  1.96k|    }
_ZN8ObjTableIN10QPDFWriter9NewObjectEE6resizeEm:
  117|  1.96k|    {
  118|  1.96k|        std::vector<T>::resize(a_size);
  119|  1.96k|        if (a_size > min_sparse) {
  ------------------
  |  Branch (119:13): [True: 0, False: 1.96k]
  ------------------
  120|      0|            auto it = sparse_elements.begin();
  121|      0|            auto end = sparse_elements.end();
  122|      0|            while (it != end && it->first < a_size) {
  ------------------
  |  Branch (122:20): [True: 0, False: 0]
  |  Branch (122:33): [True: 0, False: 0]
  ------------------
  123|      0|                std::vector<T>::operator[](it->first) = std::move(it->second);
  124|      0|                it = sparse_elements.erase(it);
  125|      0|            }
  126|      0|            min_sparse = (it == end) ? std::numeric_limits<size_t>::max() : it->first;
  ------------------
  |  Branch (126:26): [True: 0, False: 0]
  ------------------
  127|      0|        }
  128|  1.96k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEE7forEachENSt3__18functionIFviRKS1_EEE:
  132|  1.94k|    {
  133|  1.94k|        int i = 0;
  134|   583k|        for (auto const& item: *this) {
  ------------------
  |  Branch (134:30): [True: 583k, False: 1.94k]
  ------------------
  135|   583k|            fn(i++, item);
  136|   583k|        }
  137|  1.94k|        for (auto const& [id, item]: sparse_elements) {
  ------------------
  |  Branch (137:36): [True: 581, False: 1.94k]
  ------------------
  138|    581|            fn(QIntC::to_int(id), item);
  139|    581|        }
  140|  1.94k|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEE8containsE16QPDFObjectHandle:
   74|  38.4k|    {
   75|  38.4k|        return contains(static_cast<size_t>(oh.getObjectID()));
   76|  38.4k|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEE8containsEm:
   62|   285k|    {
   63|   285k|        return idx < std::vector<T>::size() || sparse_elements.count(idx);
  ------------------
  |  Branch (63:16): [True: 284k, False: 1.50k]
  |  Branch (63:48): [True: 1.50k, False: 2]
  ------------------
   64|   285k|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEEixE16QPDFObjectHandle:
   56|  39.8k|    {
   57|  39.8k|        return element(static_cast<size_t>(oh.getObjectID()));
   58|  39.8k|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEE7elementEm:
  173|   396k|    {
  174|   396k|        static const size_t max_size = std::vector<T>::max_size();
  175|   396k|        if (idx < std::vector<T>::size()) {
  ------------------
  |  Branch (175:13): [True: 394k, False: 1.88k]
  ------------------
  176|   394k|            return std::vector<T>::operator[](idx);
  177|   394k|        }
  178|  1.88k|        if (idx < max_size) {
  ------------------
  |  Branch (178:13): [True: 1.88k, False: 0]
  ------------------
  179|  1.88k|            return sparse_elements.at(idx);
  180|  1.88k|        }
  181|      0|        throw std::runtime_error("Impossibly large object id encountered accessing ObjTable");
  182|      0|        return element(0); // doesn't return
  183|  1.88k|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEEixEi:
   44|  25.7k|    {
   45|  25.7k|        return element(static_cast<size_t>(idx));
   46|  25.7k|    }
_ZNK8ObjTableIN10QPDFWriter9NewObjectEEixEi:
   44|  46.8k|    {
   45|  46.8k|        return element(static_cast<size_t>(idx));
   46|  46.8k|    }
_ZNK8ObjTableIN10QPDFWriter9NewObjectEE7elementEm:
  173|  46.8k|    {
  174|  46.8k|        static const size_t max_size = std::vector<T>::max_size();
  175|  46.8k|        if (idx < std::vector<T>::size()) {
  ------------------
  |  Branch (175:13): [True: 46.8k, False: 0]
  ------------------
  176|  46.8k|            return std::vector<T>::operator[](idx);
  177|  46.8k|        }
  178|      0|        if (idx < max_size) {
  ------------------
  |  Branch (178:13): [True: 0, False: 0]
  ------------------
  179|      0|            return sparse_elements.at(idx);
  180|      0|        }
  181|      0|        throw std::runtime_error("Impossibly large object id encountered accessing ObjTable");
  182|      0|        return element(0); // doesn't return
  183|      0|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEE8containsE10QPDFObjGen:
   68|   247k|    {
   69|   247k|        return contains(static_cast<size_t>(og.getObj()));
   70|   247k|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEEixE10QPDFObjGen:
   50|   330k|    {
   51|   330k|        return element(static_cast<size_t>(og.getObj()));
   52|   330k|    }

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

_ZN13Pl_LZWDecoderD2Ev:
   13|    953|    ~Pl_LZWDecoder() override = default;

_ZN6Pl_MD5D2Ev:
   17|  1.80k|    ~Pl_MD5() override = default;

_ZN12Pl_PNGFilterD2Ev:
   25|  6.34k|    ~Pl_PNGFilter() override = default;

_ZN16Pl_TIFFPredictorD2Ev:
   23|     17|    ~Pl_TIFFPredictor() override = default;

_ZN17QPDFCrypto_nativeC2Ev:
   14|  94.6k|    QPDFCrypto_native() = default;
_ZN17QPDFCrypto_nativeD2Ev:
   16|  94.6k|    virtual ~QPDFCrypto_native() = default;

_ZN10QPDFObject10disconnectEv:
  148|  1.83M|    {
  149|       |        // Disconnect an object from its owning QPDF. This is called by QPDF's destructor.
  150|  1.83M|        value->disconnect();
  151|  1.83M|        value->qpdf = nullptr;
  152|  1.83M|        value->og = QPDFObjGen();
  153|  1.83M|    }
_ZNK10QPDFObject11getTypeCodeEv:
   58|   567k|    {
   59|   567k|        return value->type_code;
   60|   567k|    }
_ZN10QPDFObject21setDefaultDescriptionEP4QPDFRK10QPDFObjGen:
  136|   205k|    {
  137|       |        // Intended for use by the QPDF class
  138|   205k|        value->setDefaultDescription(qpdf, og);
  139|   205k|    }
_ZN10QPDFObject9setObjGenEP4QPDFRK10QPDFObjGen:
  142|   175k|    {
  143|   175k|        value->qpdf = qpdf;
  144|   175k|        value->og = og;
  145|   175k|    }
_ZN10QPDFObject6assignENSt3__110shared_ptrIS_EE:
  120|   144k|    {
  121|   144k|        value = o->value;
  122|   144k|    }
_ZNK10QPDFObject12isUnresolvedEv:
  159|   551k|    {
  160|   551k|        return value->type_code == ::ot_unresolved;
  161|   551k|    }
_ZNK10QPDFObject2asI11QPDF_StreamEEPT_v:
  171|   534k|    {
  172|   534k|        if (auto result = dynamic_cast<T*>(value.get())) {
  ------------------
  |  Branch (172:18): [True: 534k, False: 0]
  ------------------
  173|   534k|            return result;
  174|   534k|        } else {
  175|      0|            return isUnresolved()
  ------------------
  |  Branch (175:20): [True: 0, False: 0]
  ------------------
  176|      0|                ? dynamic_cast<T*>(QPDF::Resolver::resolved(value->qpdf, value->og)->value.get())
  177|      0|                : nullptr;
  178|      0|        }
  179|   534k|    }
_ZN10QPDFObject4copyEb:
   28|   309k|    {
   29|   309k|        return value->copy(shallow);
   30|   309k|    }
_ZN10QPDFObject7unparseEv:
   33|  1.64M|    {
   34|  1.64M|        return value->unparse();
   35|  1.64M|    }
_ZNK10QPDFObject14getStringValueEv:
   43|   396k|    {
   44|   396k|        return value->getStringValue();
   45|   396k|    }
_ZNK10QPDFObject19getResolvedTypeCodeEv:
   49|  14.2M|    {
   50|  14.2M|        auto tc = value->type_code;
   51|  14.2M|        return tc == ::ot_unresolved
  ------------------
  |  Branch (51:16): [True: 92.4k, False: 14.1M]
  ------------------
   52|  14.2M|            ? QPDF::Resolver::resolved(value->qpdf, value->og)->value->type_code
   53|  14.2M|            : tc;
   54|  14.2M|    }
_ZNK10QPDFObject7getQPDFEv:
   64|  96.2k|    {
   65|  96.2k|        return value->qpdf;
   66|  96.2k|    }
_ZNK10QPDFObject9getObjGenEv:
   69|  10.8M|    {
   70|  10.8M|        return value->og;
   71|  10.8M|    }
_ZN10QPDFObject14setDescriptionEP4QPDFRNSt3__110shared_ptrINS2_7variantIJNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEN9QPDFValue10JSON_DescrENSB_10ChildDescrEEEEEEx:
   75|  1.95M|    {
   76|  1.95M|        return value->setDescription(qpdf, description, offset);
   77|  1.95M|    }
_ZN10QPDFObject19setChildDescriptionENSt3__110shared_ptrIS_EERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS5_NS0_9allocatorIcEEEE:
   83|     23|    {
   84|     23|        auto qpdf = parent ? parent->value->qpdf : nullptr;
  ------------------
  |  Branch (84:21): [True: 23, False: 0]
  ------------------
   85|     23|        value->setChildDescription(qpdf, parent->value, static_descr, var_descr);
   86|     23|    }
_ZN10QPDFObject19setChildDescriptionENSt3__110shared_ptrI9QPDFValueEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
   92|   360k|    {
   93|   360k|        auto qpdf = parent ? parent->qpdf : nullptr;
  ------------------
  |  Branch (93:21): [True: 360k, False: 0]
  ------------------
   94|   360k|        value->setChildDescription(qpdf, parent, static_descr, var_descr);
   95|   360k|    }
_ZN10QPDFObject14getDescriptionERP4QPDFRNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   98|  22.4k|    {
   99|  22.4k|        qpdf = value->qpdf;
  100|  22.4k|        description = value->getDescription();
  101|  22.4k|        return qpdf != nullptr;
  102|  22.4k|    }
_ZN10QPDFObject14hasDescriptionEv:
  105|  47.4k|    {
  106|  47.4k|        return value->hasDescription();
  107|  47.4k|    }
_ZNK10QPDFObject2asI10QPDF_ArrayEEPT_v:
  171|  1.81M|    {
  172|  1.81M|        if (auto result = dynamic_cast<T*>(value.get())) {
  ------------------
  |  Branch (172:18): [True: 1.81M, False: 4.06k]
  ------------------
  173|  1.81M|            return result;
  174|  1.81M|        } else {
  175|  4.06k|            return isUnresolved()
  ------------------
  |  Branch (175:20): [True: 1, False: 4.06k]
  ------------------
  176|  4.06k|                ? dynamic_cast<T*>(QPDF::Resolver::resolved(value->qpdf, value->og)->value.get())
  177|  4.06k|                : nullptr;
  178|  4.06k|        }
  179|  1.81M|    }
_ZNK10QPDFObject2asI15QPDF_DictionaryEEPT_v:
  171|  2.91M|    {
  172|  2.91M|        if (auto result = dynamic_cast<T*>(value.get())) {
  ------------------
  |  Branch (172:18): [True: 2.91M, False: 770]
  ------------------
  173|  2.91M|            return result;
  174|  2.91M|        } else {
  175|    770|            return isUnresolved()
  ------------------
  |  Branch (175:20): [True: 0, False: 770]
  ------------------
  176|    770|                ? dynamic_cast<T*>(QPDF::Resolver::resolved(value->qpdf, value->og)->value.get())
  177|    770|                : nullptr;
  178|    770|        }
  179|  2.91M|    }
_ZNK10QPDFObject2asI12QPDF_IntegerEEPT_v:
  171|  53.7k|    {
  172|  53.7k|        if (auto result = dynamic_cast<T*>(value.get())) {
  ------------------
  |  Branch (172:18): [True: 53.6k, False: 32]
  ------------------
  173|  53.6k|            return result;
  174|  53.6k|        } else {
  175|     32|            return isUnresolved()
  ------------------
  |  Branch (175:20): [True: 0, False: 32]
  ------------------
  176|     32|                ? dynamic_cast<T*>(QPDF::Resolver::resolved(value->qpdf, value->og)->value.get())
  177|     32|                : nullptr;
  178|     32|        }
  179|  53.7k|    }
_ZN10QPDFObjectC2Ev:
   24|  2.90M|    QPDFObject() = default;

_ZN10QPDFParserC2ENSt3__110shared_ptrI11InputSourceEERKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEER13QPDFTokenizerPN16QPDFObjectHandle15StringDecrypterEP4QPDFb:
   29|   172k|    {
   30|   172k|    }
_ZN10QPDFParserD2Ev:
   31|   172k|    virtual ~QPDFParser() = default;
_ZN10QPDFParser10StackFrameC2ERKNSt3__110shared_ptrI11InputSourceEENS_14parser_state_eE:
   45|   366k|        {
   46|   366k|        }

_ZN9QPDFValue21setDefaultDescriptionEP4QPDFRK10QPDFObjGen:
   69|   205k|    {
   70|   205k|        qpdf = a_qpdf;
   71|   205k|        og = a_og;
   72|   205k|    }
_ZN9QPDFValue10ChildDescrC2ENSt3__110shared_ptrIS_EERKNS1_17basic_string_viewIcNS1_11char_traitsIcEEEENS1_12basic_stringIcS6_NS1_9allocatorIcEEEE:
   50|   360k|        {
   51|   360k|        }
_ZN9QPDFValue14setDescriptionEP4QPDFRNSt3__110shared_ptrINS2_7variantIJNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS_10JSON_DescrENS_10ChildDescrEEEEEEx:
   62|  1.99M|    {
   63|  1.99M|        qpdf = qpdf_p;
   64|  1.99M|        object_description = description;
   65|  1.99M|        setParsedOffset(offset);
   66|  1.99M|    }
_ZN9QPDFValue19setChildDescriptionEP4QPDFNSt3__110shared_ptrIS_EERKNS2_17basic_string_viewIcNS2_11char_traitsIcEEEENS2_12basic_stringIcS7_NS2_9allocatorIcEEEE:
   79|   360k|    {
   80|   360k|        object_description =
   81|   360k|            std::make_shared<Description>(ChildDescr(parent, static_descr, var_descr));
   82|   360k|        qpdf = a_qpdf;
   83|   360k|    }
_ZN9QPDFValue14hasDescriptionEv:
   87|  47.4k|    {
   88|  47.4k|        return object_description || og.isIndirect();
  ------------------
  |  Branch (88:16): [True: 47.4k, False: 0]
  |  Branch (88:38): [True: 0, False: 0]
  ------------------
   89|  47.4k|    }
_ZN9QPDFValue15setParsedOffsetEx:
   92|  1.99M|    {
   93|  1.99M|        if (parsed_offset < 0) {
  ------------------
  |  Branch (93:13): [True: 1.99M, False: 0]
  ------------------
   94|  1.99M|            parsed_offset = offset;
   95|  1.99M|        }
   96|  1.99M|    }
_ZN9QPDFValue10disconnectEv:
  114|  1.51M|    {
  115|  1.51M|    }
_ZN9QPDFValueC2E18qpdf_object_type_e:
  127|  2.32M|    {
  128|  2.32M|    }
_ZN9QPDFValueC2E18qpdf_object_type_eP4QPDF10QPDFObjGen:
  133|   587k|    {
  134|   587k|    }
_ZN9QPDFValueD2Ev:
   23|  2.91M|    virtual ~QPDFValue() = default;

_ZNK10QPDFWriter8ObjTable15getStreamsEmptyEv:
   31|  1.91k|    {
   32|  1.91k|        return streams_empty;
   33|  1.91k|    }

_ZNK10QPDF_Array4sizeEv:
   30|  1.75M|    {
   31|  1.75M|        return sp ? sp->size : int(elements.size());
  ------------------
  |  Branch (31:16): [True: 454k, False: 1.30M]
  ------------------
   32|  1.75M|    }
_ZN10QPDF_ArrayD2Ev:
   19|   110k|    ~QPDF_Array() override = default;

_ZN15QPDF_DictionaryD2Ev:
   14|   513k|    ~QPDF_Dictionary() override = default;

_ZNK9QPDF_Name14getStringValueEv:
   24|   391k|    {
   25|   391k|        return name;
   26|   391k|    }
_ZN9QPDF_NameD2Ev:
    9|   971k|    ~QPDF_Name() override = default;

_ZN9QPDF_RealD2Ev:
    9|  41.2k|    ~QPDF_Real() override = default;

_ZN11QPDF_StreamD2Ev:
   19|  47.4k|    ~QPDF_Stream() override = default;

_ZNK11QPDF_String14getStringValueEv:
   23|  5.32k|    {
   24|  5.32k|        return val;
   25|  5.32k|    }
_ZN11QPDF_StringD2Ev:
   13|   129k|    ~QPDF_String() override = default;

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

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

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

_ZN17SF_FlateLzwDecodeD2Ev:
   12|  25.7k|    ~SF_FlateLzwDecode() override = default;

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

BitWriter.cc:_ZL10write_bitsRhRmymP8Pipeline:
   88|   167k|{
   89|   167k|    if (bits > 32) {
  ------------------
  |  Branch (89:9): [True: 0, False: 167k]
  ------------------
   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|   399k|    while (bits > 0) {
  ------------------
  |  Branch (99:12): [True: 232k, False: 167k]
  ------------------
  100|   232k|        size_t bits_to_write = std::min(bits, bit_offset + 1);
  101|   232k|        unsigned char newval = static_cast<unsigned char>(
  102|   232k|            (val >> (bits - bits_to_write)) & ((1U << bits_to_write) - 1));
  103|   232k|        size_t bits_left_in_ch = bit_offset + 1 - bits_to_write;
  104|   232k|        newval = static_cast<unsigned char>(newval << bits_left_in_ch);
  105|   232k|        ch |= newval;
  106|   232k|        if (bits_left_in_ch == 0) {
  ------------------
  |  Branch (106:13): [True: 160k, False: 71.9k]
  ------------------
  107|       |# ifdef BITS_TESTING
  108|       |            QTC::TC("libtests", "bits write pipeline");
  109|       |# endif
  110|   160k|            pipeline->write(&ch, 1);
  111|   160k|            bit_offset = 7;
  112|   160k|            ch = 0;
  113|   160k|        } else {
  114|       |# ifdef BITS_TESTING
  115|       |            QTC::TC("libtests", "bits write leftover");
  116|       |# endif
  117|  71.9k|            bit_offset -= bits_to_write;
  118|  71.9k|        }
  119|   232k|        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|   232k|    }
  124|   167k|}

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

deflateInit_:
  372|  40.2k|                         int stream_size) {
  373|  40.2k|    return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
  ------------------
  |  |  209|  40.2k|#define Z_DEFLATED   8
  ------------------
                  return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
  ------------------
  |  |  278|  40.2k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
                  return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
  ------------------
  |  |   75|  40.2k|#  define DEF_MEM_LEVEL 8
  ------------------
  374|  40.2k|                         Z_DEFAULT_STRATEGY, version, stream_size);
  ------------------
  |  |  200|  40.2k|#define Z_DEFAULT_STRATEGY    0
  ------------------
  375|       |    /* To do: ignore strm->next_in if we use it as window */
  376|  40.2k|}
deflateInit2_:
  381|  40.2k|                          const char *version, int stream_size) {
  382|  40.2k|    deflate_state *s;
  383|  40.2k|    int wrap = 1;
  384|  40.2k|    static const char my_version[] = ZLIB_VERSION;
  ------------------
  |  |   40|  40.2k|#define ZLIB_VERSION "1.3.1.1-motley"
  ------------------
  385|       |
  386|  40.2k|    if (version == Z_NULL || version[0] != my_version[0] ||
  ------------------
  |  |  212|  80.4k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (386:9): [True: 0, False: 40.2k]
  |  Branch (386:30): [True: 0, False: 40.2k]
  ------------------
  387|  40.2k|        stream_size != sizeof(z_stream)) {
  ------------------
  |  Branch (387:9): [True: 0, False: 40.2k]
  ------------------
  388|      0|        return Z_VERSION_ERROR;
  ------------------
  |  |  185|      0|#define Z_VERSION_ERROR (-6)
  ------------------
  389|      0|    }
  390|  40.2k|    if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  212|  40.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (390:9): [True: 0, False: 40.2k]
  ------------------
  391|       |
  392|  40.2k|    strm->msg = Z_NULL;
  ------------------
  |  |  212|  40.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  393|  40.2k|    if (strm->zalloc == (alloc_func)0) {
  ------------------
  |  Branch (393:9): [True: 40.2k, False: 0]
  ------------------
  394|       |#ifdef Z_SOLO
  395|       |        return Z_STREAM_ERROR;
  396|       |#else
  397|  40.2k|        strm->zalloc = zcalloc;
  398|  40.2k|        strm->opaque = (voidpf)0;
  399|  40.2k|#endif
  400|  40.2k|    }
  401|  40.2k|    if (strm->zfree == (free_func)0)
  ------------------
  |  Branch (401:9): [True: 40.2k, False: 0]
  ------------------
  402|       |#ifdef Z_SOLO
  403|       |        return Z_STREAM_ERROR;
  404|       |#else
  405|  40.2k|        strm->zfree = zcfree;
  406|  40.2k|#endif
  407|       |
  408|       |#ifdef FASTEST
  409|       |    if (level != 0) level = 1;
  410|       |#else
  411|  40.2k|    if (level == Z_DEFAULT_COMPRESSION) level = 6;
  ------------------
  |  |  193|  40.2k|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
  |  Branch (411:9): [True: 40.2k, False: 0]
  ------------------
  412|  40.2k|#endif
  413|       |
  414|  40.2k|    if (windowBits < 0) { /* suppress zlib wrapper */
  ------------------
  |  Branch (414:9): [True: 0, False: 40.2k]
  ------------------
  415|      0|        wrap = 0;
  416|      0|        if (windowBits < -15)
  ------------------
  |  Branch (416:13): [True: 0, False: 0]
  ------------------
  417|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  418|      0|        windowBits = -windowBits;
  419|      0|    }
  420|  40.2k|#ifdef GZIP
  421|  40.2k|    else if (windowBits > 15) {
  ------------------
  |  Branch (421:14): [True: 0, False: 40.2k]
  ------------------
  422|      0|        wrap = 2;       /* write gzip wrapper instead */
  423|      0|        windowBits -= 16;
  424|      0|    }
  425|  40.2k|#endif
  426|  40.2k|    if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
  ------------------
  |  |  268|  80.4k|#    define MAX_MEM_LEVEL 9
  ------------------
                  if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
  ------------------
  |  |  209|  80.4k|#define Z_DEFLATED   8
  ------------------
  |  Branch (426:9): [True: 0, False: 40.2k]
  |  Branch (426:25): [True: 0, False: 40.2k]
  |  Branch (426:53): [True: 0, False: 40.2k]
  ------------------
  427|  40.2k|        windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
  ------------------
  |  Branch (427:9): [True: 0, False: 40.2k]
  |  Branch (427:27): [True: 0, False: 40.2k]
  |  Branch (427:46): [True: 0, False: 40.2k]
  |  Branch (427:59): [True: 0, False: 40.2k]
  ------------------
  428|  40.2k|        strategy < 0 || strategy > Z_FIXED || (windowBits == 8 && wrap != 1)) {
  ------------------
  |  |  199|  80.4k|#define Z_FIXED               4
  ------------------
  |  Branch (428:9): [True: 0, False: 40.2k]
  |  Branch (428:25): [True: 0, False: 40.2k]
  |  Branch (428:48): [True: 0, False: 40.2k]
  |  Branch (428:67): [True: 0, False: 0]
  ------------------
  429|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  430|      0|    }
  431|  40.2k|    if (windowBits == 8) windowBits = 9;  /* until 256-byte window bug fixed */
  ------------------
  |  Branch (431:9): [True: 0, False: 40.2k]
  ------------------
  432|  40.2k|    s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
  ------------------
  |  |  247|  40.2k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  433|  40.2k|    if (s == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  212|  40.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (s == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  183|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  |  Branch (433:9): [True: 0, False: 40.2k]
  ------------------
  434|  40.2k|    strm->state = (struct internal_state FAR *)s;
  435|  40.2k|    s->strm = strm;
  436|  40.2k|    s->status = INIT_STATE;     /* to pass state test in deflateReset() */
  ------------------
  |  |   58|  40.2k|#define INIT_STATE    42    /* zlib header -> BUSY_STATE */
  ------------------
  437|       |
  438|  40.2k|    s->wrap = wrap;
  439|  40.2k|    s->gzhead = Z_NULL;
  ------------------
  |  |  212|  40.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  440|  40.2k|    s->w_bits = (uInt)windowBits;
  441|  40.2k|    s->w_size = 1 << s->w_bits;
  442|  40.2k|    s->w_mask = s->w_size - 1;
  443|       |
  444|  40.2k|    s->hash_bits = (uInt)memLevel + 7;
  445|  40.2k|    s->hash_size = 1 << s->hash_bits;
  446|  40.2k|    s->hash_mask = s->hash_size - 1;
  447|  40.2k|    s->hash_shift =  ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH);
  ------------------
  |  |   86|  40.2k|#define MIN_MATCH  3
  ------------------
                  s->hash_shift =  ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH);
  ------------------
  |  |   86|  40.2k|#define MIN_MATCH  3
  ------------------
  448|       |
  449|  40.2k|    s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
  ------------------
  |  |  247|  40.2k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  450|  40.2k|    s->prev   = (Posf *)  ZALLOC(strm, s->w_size, sizeof(Pos));
  ------------------
  |  |  247|  40.2k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  451|  40.2k|    s->head   = (Posf *)  ZALLOC(strm, s->hash_size, sizeof(Pos));
  ------------------
  |  |  247|  40.2k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  452|       |
  453|  40.2k|    s->high_water = 0;      /* nothing written to s->window yet */
  454|       |
  455|  40.2k|    s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
  456|       |
  457|       |    /* We overlay pending_buf and sym_buf. This works since the average size
  458|       |     * for length/distance pairs over any compressed block is assured to be 31
  459|       |     * bits or less.
  460|       |     *
  461|       |     * Analysis: The longest fixed codes are a length code of 8 bits plus 5
  462|       |     * extra bits, for lengths 131 to 257. The longest fixed distance codes are
  463|       |     * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest
  464|       |     * possible fixed-codes length/distance pair is then 31 bits total.
  465|       |     *
  466|       |     * sym_buf starts one-fourth of the way into pending_buf. So there are
  467|       |     * three bytes in sym_buf for every four bytes in pending_buf. Each symbol
  468|       |     * in sym_buf is three bytes -- two for the distance and one for the
  469|       |     * literal/length. As each symbol is consumed, the pointer to the next
  470|       |     * sym_buf value to read moves forward three bytes. From that symbol, up to
  471|       |     * 31 bits are written to pending_buf. The closest the written pending_buf
  472|       |     * bits gets to the next sym_buf symbol to read is just before the last
  473|       |     * code is written. At that time, 31*(n - 2) bits have been written, just
  474|       |     * after 24*(n - 2) bits have been consumed from sym_buf. sym_buf starts at
  475|       |     * 8*n bits into pending_buf. (Note that the symbol buffer fills when n - 1
  476|       |     * symbols are written.) The closest the writing gets to what is unread is
  477|       |     * then n + 14 bits. Here n is lit_bufsize, which is 16384 by default, and
  478|       |     * can range from 128 to 32768.
  479|       |     *
  480|       |     * Therefore, at a minimum, there are 142 bits of space between what is
  481|       |     * written and what is read in the overlain buffers, so the symbols cannot
  482|       |     * be overwritten by the compressed data. That space is actually 139 bits,
  483|       |     * due to the three-bit fixed-code block header.
  484|       |     *
  485|       |     * That covers the case where either Z_FIXED is specified, forcing fixed
  486|       |     * codes, or when the use of fixed codes is chosen, because that choice
  487|       |     * results in a smaller compressed block than dynamic codes. That latter
  488|       |     * condition then assures that the above analysis also covers all dynamic
  489|       |     * blocks. A dynamic-code block will only be chosen to be emitted if it has
  490|       |     * fewer bits than a fixed-code block would for the same set of symbols.
  491|       |     * Therefore its average symbol length is assured to be less than 31. So
  492|       |     * the compressed data for a dynamic block also cannot overwrite the
  493|       |     * symbols from which it is being constructed.
  494|       |     */
  495|       |
  496|  40.2k|    s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS);
  ------------------
  |  |  247|  40.2k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  497|  40.2k|    s->pending_buf_size = (ulg)s->lit_bufsize * 4;
  498|       |
  499|  40.2k|    if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
  ------------------
  |  |  212|  80.4k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
  ------------------
  |  |  212|  80.4k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
  ------------------
  |  |  212|  80.4k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (499:9): [True: 0, False: 40.2k]
  |  Branch (499:32): [True: 0, False: 40.2k]
  |  Branch (499:53): [True: 0, False: 40.2k]
  ------------------
  500|  40.2k|        s->pending_buf == Z_NULL) {
  ------------------
  |  |  212|  40.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (500:9): [True: 0, False: 40.2k]
  ------------------
  501|      0|        s->status = FINISH_STATE;
  ------------------
  |  |   67|      0|#define FINISH_STATE 666    /* stream complete */
  ------------------
  502|      0|        strm->msg = ERR_MSG(Z_MEM_ERROR);
  ------------------
  |  |   61|      0|#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
  |  |  ------------------
  |  |  |  Branch (61:31): [Folded - Ignored]
  |  |  |  Branch (61:45): [Folded - Ignored]
  |  |  ------------------
  ------------------
  503|      0|        deflateEnd (strm);
  504|      0|        return Z_MEM_ERROR;
  ------------------
  |  |  183|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  505|      0|    }
  506|       |#ifdef LIT_MEM
  507|       |    s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1));
  508|       |    s->l_buf = s->pending_buf + (s->lit_bufsize << 2);
  509|       |    s->sym_end = s->lit_bufsize - 1;
  510|       |#else
  511|  40.2k|    s->sym_buf = s->pending_buf + s->lit_bufsize;
  512|  40.2k|    s->sym_end = (s->lit_bufsize - 1) * 3;
  513|  40.2k|#endif
  514|       |    /* We avoid equality with lit_bufsize*3 because of wraparound at 64K
  515|       |     * on 16 bit machines and because stored blocks are restricted to
  516|       |     * 64K-1 bytes.
  517|       |     */
  518|       |
  519|  40.2k|    s->level = level;
  520|  40.2k|    s->strategy = strategy;
  521|  40.2k|    s->method = (Byte)method;
  522|       |
  523|  40.2k|    return deflateReset(strm);
  524|  40.2k|}
deflateResetKeep:
  635|  40.2k|int ZEXPORT deflateResetKeep(z_streamp strm) {
  636|  40.2k|    deflate_state *s;
  637|       |
  638|  40.2k|    if (deflateStateCheck(strm)) {
  ------------------
  |  Branch (638:9): [True: 0, False: 40.2k]
  ------------------
  639|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  640|      0|    }
  641|       |
  642|  40.2k|    strm->total_in = strm->total_out = 0;
  643|  40.2k|    strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
  ------------------
  |  |  212|  40.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  644|  40.2k|    strm->data_type = Z_UNKNOWN;
  ------------------
  |  |  206|  40.2k|#define Z_UNKNOWN  2
  ------------------
  645|       |
  646|  40.2k|    s = (deflate_state *)strm->state;
  647|  40.2k|    s->pending = 0;
  648|  40.2k|    s->pending_out = s->pending_buf;
  649|       |
  650|  40.2k|    if (s->wrap < 0) {
  ------------------
  |  Branch (650:9): [True: 0, False: 40.2k]
  ------------------
  651|      0|        s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
  652|      0|    }
  653|  40.2k|    s->status =
  654|  40.2k|#ifdef GZIP
  655|  40.2k|        s->wrap == 2 ? GZIP_STATE :
  ------------------
  |  |   60|      0|#  define GZIP_STATE  57    /* gzip header -> BUSY_STATE | EXTRA_STATE */
  ------------------
  |  Branch (655:9): [True: 0, False: 40.2k]
  ------------------
  656|  40.2k|#endif
  657|  40.2k|        INIT_STATE;
  ------------------
  |  |   58|  80.4k|#define INIT_STATE    42    /* zlib header -> BUSY_STATE */
  ------------------
  658|  40.2k|    strm->adler =
  659|  40.2k|#ifdef GZIP
  660|  40.2k|        s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (660:9): [True: 0, False: 40.2k]
  ------------------
  661|  40.2k|#endif
  662|  40.2k|        adler32(0L, Z_NULL, 0);
  ------------------
  |  |  212|  40.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  663|  40.2k|    s->last_flush = -2;
  664|       |
  665|  40.2k|    _tr_init(s);
  666|       |
  667|  40.2k|    return Z_OK;
  ------------------
  |  |  177|  40.2k|#define Z_OK            0
  ------------------
  668|  40.2k|}
deflateReset:
  695|  40.2k|int ZEXPORT deflateReset(z_streamp strm) {
  696|  40.2k|    int ret;
  697|       |
  698|  40.2k|    ret = deflateResetKeep(strm);
  699|  40.2k|    if (ret == Z_OK)
  ------------------
  |  |  177|  40.2k|#define Z_OK            0
  ------------------
  |  Branch (699:9): [True: 40.2k, False: 0]
  ------------------
  700|  40.2k|        lm_init(strm->state);
  701|  40.2k|    return ret;
  702|  40.2k|}
deflate:
  954|  3.80M|int ZEXPORT deflate(z_streamp strm, int flush) {
  955|  3.80M|    int old_flush; /* value of flush param for previous deflate call */
  956|  3.80M|    deflate_state *s;
  957|       |
  958|  3.80M|    if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0) {
  ------------------
  |  |  173|  7.60M|#define Z_BLOCK         5
  ------------------
  |  Branch (958:9): [True: 0, False: 3.80M]
  |  Branch (958:36): [True: 0, False: 3.80M]
  |  Branch (958:55): [True: 0, False: 3.80M]
  ------------------
  959|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  960|      0|    }
  961|  3.80M|    s = strm->state;
  962|       |
  963|  3.80M|    if (strm->next_out == Z_NULL ||
  ------------------
  |  |  212|  7.60M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (963:9): [True: 0, False: 3.80M]
  ------------------
  964|  3.80M|        (strm->avail_in != 0 && strm->next_in == Z_NULL) ||
  ------------------
  |  |  212|  3.76M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (964:10): [True: 3.76M, False: 40.1k]
  |  Branch (964:33): [True: 0, False: 3.76M]
  ------------------
  965|  3.80M|        (s->status == FINISH_STATE && flush != Z_FINISH)) {
  ------------------
  |  |   67|  7.60M|#define FINISH_STATE 666    /* stream complete */
  ------------------
                      (s->status == FINISH_STATE && flush != Z_FINISH)) {
  ------------------
  |  |  172|      0|#define Z_FINISH        4
  ------------------
  |  Branch (965:10): [True: 0, False: 3.80M]
  |  Branch (965:39): [True: 0, False: 0]
  ------------------
  966|      0|        ERR_RETURN(strm, Z_STREAM_ERROR);
  ------------------
  |  |   64|      0|  return (strm->msg = ERR_MSG(err), (err))
  |  |  ------------------
  |  |  |  |   61|      0|#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:31): [Folded - Ignored]
  |  |  |  |  |  Branch (61:45): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  967|      0|    }
  968|  3.80M|    if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
  ------------------
  |  |   64|      0|  return (strm->msg = ERR_MSG(err), (err))
  |  |  ------------------
  |  |  |  |   61|      0|#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:31): [Folded - Ignored]
  |  |  |  |  |  Branch (61:45): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (968:9): [True: 0, False: 3.80M]
  ------------------
  969|       |
  970|  3.80M|    old_flush = s->last_flush;
  971|  3.80M|    s->last_flush = flush;
  972|       |
  973|       |    /* Flush as much pending output as possible */
  974|  3.80M|    if (s->pending != 0) {
  ------------------
  |  Branch (974:9): [True: 223, False: 3.80M]
  ------------------
  975|    223|        flush_pending(strm);
  976|    223|        if (strm->avail_out == 0) {
  ------------------
  |  Branch (976:13): [True: 0, False: 223]
  ------------------
  977|       |            /* Since avail_out is 0, deflate will be called again with
  978|       |             * more output space, but possibly with both pending and
  979|       |             * avail_in equal to zero. There won't be anything to do,
  980|       |             * but this is not an error situation so make sure we
  981|       |             * return OK instead of BUF_ERROR at next call of deflate:
  982|       |             */
  983|      0|            s->last_flush = -1;
  984|      0|            return Z_OK;
  ------------------
  |  |  177|      0|#define Z_OK            0
  ------------------
  985|      0|        }
  986|       |
  987|       |    /* Make sure there is something to do and avoid duplicate consecutive
  988|       |     * flushes. For repeated and useless calls with Z_FINISH, we keep
  989|       |     * returning Z_STREAM_END instead of Z_BUF_ERROR.
  990|       |     */
  991|  3.80M|    } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
  ------------------
  |  |  133|  40.0k|#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
  |  |  ------------------
  |  |  |  Branch (133:31): [True: 0, False: 40.0k]
  |  |  ------------------
  ------------------
                  } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
  ------------------
  |  |  133|  3.84M|#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
  |  |  ------------------
  |  |  |  Branch (133:31): [True: 0, False: 40.0k]
  |  |  ------------------
  ------------------
  |  Branch (991:16): [True: 40.0k, False: 3.76M]
  |  Branch (991:39): [True: 0, False: 40.0k]
  ------------------
  992|  3.80M|               flush != Z_FINISH) {
  ------------------
  |  |  172|      0|#define Z_FINISH        4
  ------------------
  |  Branch (992:16): [True: 0, False: 0]
  ------------------
  993|      0|        ERR_RETURN(strm, Z_BUF_ERROR);
  ------------------
  |  |   64|      0|  return (strm->msg = ERR_MSG(err), (err))
  |  |  ------------------
  |  |  |  |   61|      0|#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:31): [Folded - Ignored]
  |  |  |  |  |  Branch (61:45): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  994|      0|    }
  995|       |
  996|       |    /* User must not provide more input after the first FINISH: */
  997|  3.80M|    if (s->status == FINISH_STATE && strm->avail_in != 0) {
  ------------------
  |  |   67|  7.60M|#define FINISH_STATE 666    /* stream complete */
  ------------------
  |  Branch (997:9): [True: 0, False: 3.80M]
  |  Branch (997:38): [True: 0, False: 0]
  ------------------
  998|      0|        ERR_RETURN(strm, Z_BUF_ERROR);
  ------------------
  |  |   64|      0|  return (strm->msg = ERR_MSG(err), (err))
  |  |  ------------------
  |  |  |  |   61|      0|#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:31): [Folded - Ignored]
  |  |  |  |  |  Branch (61:45): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  999|      0|    }
 1000|       |
 1001|       |    /* Write the header */
 1002|  3.80M|    if (s->status == INIT_STATE && s->wrap == 0)
  ------------------
  |  |   58|  7.60M|#define INIT_STATE    42    /* zlib header -> BUSY_STATE */
  ------------------
  |  Branch (1002:9): [True: 40.2k, False: 3.76M]
  |  Branch (1002:36): [True: 0, False: 40.2k]
  ------------------
 1003|      0|        s->status = BUSY_STATE;
  ------------------
  |  |   66|      0|#define BUSY_STATE   113    /* deflate -> FINISH_STATE */
  ------------------
 1004|  3.80M|    if (s->status == INIT_STATE) {
  ------------------
  |  |   58|  3.80M|#define INIT_STATE    42    /* zlib header -> BUSY_STATE */
  ------------------
  |  Branch (1004:9): [True: 40.2k, False: 3.76M]
  ------------------
 1005|       |        /* zlib header */
 1006|  40.2k|        uInt header = (Z_DEFLATED + ((s->w_bits - 8) << 4)) << 8;
  ------------------
  |  |  209|  40.2k|#define Z_DEFLATED   8
  ------------------
 1007|  40.2k|        uInt level_flags;
 1008|       |
 1009|  40.2k|        if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
  ------------------
  |  |  197|  80.4k|#define Z_HUFFMAN_ONLY        2
  ------------------
  |  Branch (1009:13): [True: 0, False: 40.2k]
  |  Branch (1009:46): [True: 0, False: 40.2k]
  ------------------
 1010|      0|            level_flags = 0;
 1011|  40.2k|        else if (s->level < 6)
  ------------------
  |  Branch (1011:18): [True: 0, False: 40.2k]
  ------------------
 1012|      0|            level_flags = 1;
 1013|  40.2k|        else if (s->level == 6)
  ------------------
  |  Branch (1013:18): [True: 40.2k, False: 0]
  ------------------
 1014|  40.2k|            level_flags = 2;
 1015|      0|        else
 1016|      0|            level_flags = 3;
 1017|  40.2k|        header |= (level_flags << 6);
 1018|  40.2k|        if (s->strstart != 0) header |= PRESET_DICT;
  ------------------
  |  |   90|      0|#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
  ------------------
  |  Branch (1018:13): [True: 0, False: 40.2k]
  ------------------
 1019|  40.2k|        header += 31 - (header % 31);
 1020|       |
 1021|  40.2k|        putShortMSB(s, header);
 1022|       |
 1023|       |        /* Save the adler32 of the preset dictionary: */
 1024|  40.2k|        if (s->strstart != 0) {
  ------------------
  |  Branch (1024:13): [True: 0, False: 40.2k]
  ------------------
 1025|      0|            putShortMSB(s, (uInt)(strm->adler >> 16));
 1026|      0|            putShortMSB(s, (uInt)(strm->adler & 0xffff));
 1027|      0|        }
 1028|  40.2k|        strm->adler = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  212|  40.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1029|  40.2k|        s->status = BUSY_STATE;
  ------------------
  |  |   66|  40.2k|#define BUSY_STATE   113    /* deflate -> FINISH_STATE */
  ------------------
 1030|       |
 1031|       |        /* Compression must start with an empty pending buffer */
 1032|  40.2k|        flush_pending(strm);
 1033|  40.2k|        if (s->pending != 0) {
  ------------------
  |  Branch (1033:13): [True: 0, False: 40.2k]
  ------------------
 1034|      0|            s->last_flush = -1;
 1035|      0|            return Z_OK;
  ------------------
  |  |  177|      0|#define Z_OK            0
  ------------------
 1036|      0|        }
 1037|  40.2k|    }
 1038|  3.80M|#ifdef GZIP
 1039|  3.80M|    if (s->status == GZIP_STATE) {
  ------------------
  |  |   60|  3.80M|#  define GZIP_STATE  57    /* gzip header -> BUSY_STATE | EXTRA_STATE */
  ------------------
  |  Branch (1039:9): [True: 0, False: 3.80M]
  ------------------
 1040|       |        /* gzip header */
 1041|      0|        strm->adler = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1042|      0|        put_byte(s, 31);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1043|      0|        put_byte(s, 139);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1044|      0|        put_byte(s, 8);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1045|      0|        if (s->gzhead == Z_NULL) {
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (1045:13): [True: 0, False: 0]
  ------------------
 1046|      0|            put_byte(s, 0);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1047|      0|            put_byte(s, 0);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1048|      0|            put_byte(s, 0);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1049|      0|            put_byte(s, 0);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1050|      0|            put_byte(s, 0);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1051|      0|            put_byte(s, s->level == 9 ? 2 :
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  |  Branch (290:64): [True: 0, False: 0]
  |  |  |  Branch (290:64): [True: 0, False: 0]
  |  |  |  Branch (290:64): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1052|      0|                     (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
 1053|      0|                      4 : 0));
 1054|      0|            put_byte(s, OS_CODE);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1055|      0|            s->status = BUSY_STATE;
  ------------------
  |  |   66|      0|#define BUSY_STATE   113    /* deflate -> FINISH_STATE */
  ------------------
 1056|       |
 1057|       |            /* Compression must start with an empty pending buffer */
 1058|      0|            flush_pending(strm);
 1059|      0|            if (s->pending != 0) {
  ------------------
  |  Branch (1059:17): [True: 0, False: 0]
  ------------------
 1060|      0|                s->last_flush = -1;
 1061|      0|                return Z_OK;
  ------------------
  |  |  177|      0|#define Z_OK            0
  ------------------
 1062|      0|            }
 1063|      0|        }
 1064|      0|        else {
 1065|      0|            put_byte(s, (s->gzhead->text ? 1 : 0) +
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  |  Branch (290:64): [True: 0, False: 0]
  |  |  |  Branch (290:64): [True: 0, False: 0]
  |  |  |  Branch (290:64): [True: 0, False: 0]
  |  |  |  Branch (290:64): [True: 0, False: 0]
  |  |  |  Branch (290:64): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1066|      0|                     (s->gzhead->hcrc ? 2 : 0) +
 1067|      0|                     (s->gzhead->extra == Z_NULL ? 0 : 4) +
 1068|      0|                     (s->gzhead->name == Z_NULL ? 0 : 8) +
 1069|      0|                     (s->gzhead->comment == Z_NULL ? 0 : 16)
 1070|      0|                     );
 1071|      0|            put_byte(s, (Byte)(s->gzhead->time & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1072|      0|            put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1073|      0|            put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1074|      0|            put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1075|      0|            put_byte(s, s->level == 9 ? 2 :
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  |  Branch (290:64): [True: 0, False: 0]
  |  |  |  Branch (290:64): [True: 0, False: 0]
  |  |  |  Branch (290:64): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1076|      0|                     (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
 1077|      0|                      4 : 0));
 1078|      0|            put_byte(s, s->gzhead->os & 0xff);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1079|      0|            if (s->gzhead->extra != Z_NULL) {
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (1079:17): [True: 0, False: 0]
  ------------------
 1080|      0|                put_byte(s, s->gzhead->extra_len & 0xff);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1081|      0|                put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1082|      0|            }
 1083|      0|            if (s->gzhead->hcrc)
  ------------------
  |  Branch (1083:17): [True: 0, False: 0]
  ------------------
 1084|      0|                strm->adler = crc32(strm->adler, s->pending_buf,
 1085|      0|                                    s->pending);
 1086|      0|            s->gzindex = 0;
 1087|      0|            s->status = EXTRA_STATE;
  ------------------
  |  |   62|      0|#define EXTRA_STATE   69    /* gzip extra block -> NAME_STATE */
  ------------------
 1088|      0|        }
 1089|      0|    }
 1090|  3.80M|    if (s->status == EXTRA_STATE) {
  ------------------
  |  |   62|  3.80M|#define EXTRA_STATE   69    /* gzip extra block -> NAME_STATE */
  ------------------
  |  Branch (1090:9): [True: 0, False: 3.80M]
  ------------------
 1091|      0|        if (s->gzhead->extra != Z_NULL) {
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (1091:13): [True: 0, False: 0]
  ------------------
 1092|      0|            ulg beg = s->pending;   /* start of bytes to update crc */
 1093|      0|            uInt left = (s->gzhead->extra_len & 0xffff) - s->gzindex;
 1094|      0|            while (s->pending + left > s->pending_buf_size) {
  ------------------
  |  Branch (1094:20): [True: 0, False: 0]
  ------------------
 1095|      0|                uInt copy = s->pending_buf_size - s->pending;
 1096|      0|                zmemcpy(s->pending_buf + s->pending,
  ------------------
  |  |  210|      0|#    define zmemcpy memcpy
  ------------------
 1097|      0|                        s->gzhead->extra + s->gzindex, copy);
 1098|      0|                s->pending = s->pending_buf_size;
 1099|      0|                HCRC_UPDATE(beg);
  ------------------
  |  |  947|      0|    do { \
  |  |  948|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (948:13): [True: 0, False: 0]
  |  |  |  Branch (948:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  949|      0|            strm->adler = crc32(strm->adler, s->pending_buf + (beg), \
  |  |  950|      0|                                s->pending - (beg)); \
  |  |  951|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (951:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1100|      0|                s->gzindex += copy;
 1101|      0|                flush_pending(strm);
 1102|      0|                if (s->pending != 0) {
  ------------------
  |  Branch (1102:21): [True: 0, False: 0]
  ------------------
 1103|      0|                    s->last_flush = -1;
 1104|      0|                    return Z_OK;
  ------------------
  |  |  177|      0|#define Z_OK            0
  ------------------
 1105|      0|                }
 1106|      0|                beg = 0;
 1107|      0|                left -= copy;
 1108|      0|            }
 1109|      0|            zmemcpy(s->pending_buf + s->pending,
  ------------------
  |  |  210|      0|#    define zmemcpy memcpy
  ------------------
 1110|      0|                    s->gzhead->extra + s->gzindex, left);
 1111|      0|            s->pending += left;
 1112|      0|            HCRC_UPDATE(beg);
  ------------------
  |  |  947|      0|    do { \
  |  |  948|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (948:13): [True: 0, False: 0]
  |  |  |  Branch (948:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  949|      0|            strm->adler = crc32(strm->adler, s->pending_buf + (beg), \
  |  |  950|      0|                                s->pending - (beg)); \
  |  |  951|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (951:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1113|      0|            s->gzindex = 0;
 1114|      0|        }
 1115|      0|        s->status = NAME_STATE;
  ------------------
  |  |   63|      0|#define NAME_STATE    73    /* gzip file name -> COMMENT_STATE */
  ------------------
 1116|      0|    }
 1117|  3.80M|    if (s->status == NAME_STATE) {
  ------------------
  |  |   63|  3.80M|#define NAME_STATE    73    /* gzip file name -> COMMENT_STATE */
  ------------------
  |  Branch (1117:9): [True: 0, False: 3.80M]
  ------------------
 1118|      0|        if (s->gzhead->name != Z_NULL) {
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (1118:13): [True: 0, False: 0]
  ------------------
 1119|      0|            ulg beg = s->pending;   /* start of bytes to update crc */
 1120|      0|            int val;
 1121|      0|            do {
 1122|      0|                if (s->pending == s->pending_buf_size) {
  ------------------
  |  Branch (1122:21): [True: 0, False: 0]
  ------------------
 1123|      0|                    HCRC_UPDATE(beg);
  ------------------
  |  |  947|      0|    do { \
  |  |  948|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (948:13): [True: 0, False: 0]
  |  |  |  Branch (948:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  949|      0|            strm->adler = crc32(strm->adler, s->pending_buf + (beg), \
  |  |  950|      0|                                s->pending - (beg)); \
  |  |  951|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (951:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1124|      0|                    flush_pending(strm);
 1125|      0|                    if (s->pending != 0) {
  ------------------
  |  Branch (1125:25): [True: 0, False: 0]
  ------------------
 1126|      0|                        s->last_flush = -1;
 1127|      0|                        return Z_OK;
  ------------------
  |  |  177|      0|#define Z_OK            0
  ------------------
 1128|      0|                    }
 1129|      0|                    beg = 0;
 1130|      0|                }
 1131|      0|                val = s->gzhead->name[s->gzindex++];
 1132|      0|                put_byte(s, val);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1133|      0|            } while (val != 0);
  ------------------
  |  Branch (1133:22): [True: 0, False: 0]
  ------------------
 1134|      0|            HCRC_UPDATE(beg);
  ------------------
  |  |  947|      0|    do { \
  |  |  948|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (948:13): [True: 0, False: 0]
  |  |  |  Branch (948:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  949|      0|            strm->adler = crc32(strm->adler, s->pending_buf + (beg), \
  |  |  950|      0|                                s->pending - (beg)); \
  |  |  951|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (951:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1135|      0|            s->gzindex = 0;
 1136|      0|        }
 1137|      0|        s->status = COMMENT_STATE;
  ------------------
  |  |   64|      0|#define COMMENT_STATE 91    /* gzip comment -> HCRC_STATE */
  ------------------
 1138|      0|    }
 1139|  3.80M|    if (s->status == COMMENT_STATE) {
  ------------------
  |  |   64|  3.80M|#define COMMENT_STATE 91    /* gzip comment -> HCRC_STATE */
  ------------------
  |  Branch (1139:9): [True: 0, False: 3.80M]
  ------------------
 1140|      0|        if (s->gzhead->comment != Z_NULL) {
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (1140:13): [True: 0, False: 0]
  ------------------
 1141|      0|            ulg beg = s->pending;   /* start of bytes to update crc */
 1142|      0|            int val;
 1143|      0|            do {
 1144|      0|                if (s->pending == s->pending_buf_size) {
  ------------------
  |  Branch (1144:21): [True: 0, False: 0]
  ------------------
 1145|      0|                    HCRC_UPDATE(beg);
  ------------------
  |  |  947|      0|    do { \
  |  |  948|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (948:13): [True: 0, False: 0]
  |  |  |  Branch (948:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  949|      0|            strm->adler = crc32(strm->adler, s->pending_buf + (beg), \
  |  |  950|      0|                                s->pending - (beg)); \
  |  |  951|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (951:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1146|      0|                    flush_pending(strm);
 1147|      0|                    if (s->pending != 0) {
  ------------------
  |  Branch (1147:25): [True: 0, False: 0]
  ------------------
 1148|      0|                        s->last_flush = -1;
 1149|      0|                        return Z_OK;
  ------------------
  |  |  177|      0|#define Z_OK            0
  ------------------
 1150|      0|                    }
 1151|      0|                    beg = 0;
 1152|      0|                }
 1153|      0|                val = s->gzhead->comment[s->gzindex++];
 1154|      0|                put_byte(s, val);
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1155|      0|            } while (val != 0);
  ------------------
  |  Branch (1155:22): [True: 0, False: 0]
  ------------------
 1156|      0|            HCRC_UPDATE(beg);
  ------------------
  |  |  947|      0|    do { \
  |  |  948|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (948:13): [True: 0, False: 0]
  |  |  |  Branch (948:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  949|      0|            strm->adler = crc32(strm->adler, s->pending_buf + (beg), \
  |  |  950|      0|                                s->pending - (beg)); \
  |  |  951|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (951:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1157|      0|        }
 1158|      0|        s->status = HCRC_STATE;
  ------------------
  |  |   65|      0|#define HCRC_STATE   103    /* gzip header CRC -> BUSY_STATE */
  ------------------
 1159|      0|    }
 1160|  3.80M|    if (s->status == HCRC_STATE) {
  ------------------
  |  |   65|  3.80M|#define HCRC_STATE   103    /* gzip header CRC -> BUSY_STATE */
  ------------------
  |  Branch (1160:9): [True: 0, False: 3.80M]
  ------------------
 1161|      0|        if (s->gzhead->hcrc) {
  ------------------
  |  Branch (1161:13): [True: 0, False: 0]
  ------------------
 1162|      0|            if (s->pending + 2 > s->pending_buf_size) {
  ------------------
  |  Branch (1162:17): [True: 0, False: 0]
  ------------------
 1163|      0|                flush_pending(strm);
 1164|      0|                if (s->pending != 0) {
  ------------------
  |  Branch (1164:21): [True: 0, False: 0]
  ------------------
 1165|      0|                    s->last_flush = -1;
 1166|      0|                    return Z_OK;
  ------------------
  |  |  177|      0|#define Z_OK            0
  ------------------
 1167|      0|                }
 1168|      0|            }
 1169|      0|            put_byte(s, (Byte)(strm->adler & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1170|      0|            put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1171|      0|            strm->adler = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1172|      0|        }
 1173|      0|        s->status = BUSY_STATE;
  ------------------
  |  |   66|      0|#define BUSY_STATE   113    /* deflate -> FINISH_STATE */
  ------------------
 1174|       |
 1175|       |        /* Compression must start with an empty pending buffer */
 1176|      0|        flush_pending(strm);
 1177|      0|        if (s->pending != 0) {
  ------------------
  |  Branch (1177:13): [True: 0, False: 0]
  ------------------
 1178|      0|            s->last_flush = -1;
 1179|      0|            return Z_OK;
  ------------------
  |  |  177|      0|#define Z_OK            0
  ------------------
 1180|      0|        }
 1181|      0|    }
 1182|  3.80M|#endif
 1183|       |
 1184|       |    /* Start a new block or continue the current one.
 1185|       |     */
 1186|  3.80M|    if (strm->avail_in != 0 || s->lookahead != 0 ||
  ------------------
  |  Branch (1186:9): [True: 3.76M, False: 40.1k]
  |  Branch (1186:32): [True: 40.1k, False: 0]
  ------------------
 1187|  3.80M|        (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
  ------------------
  |  |  168|      0|#define Z_NO_FLUSH      0
  ------------------
                      (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
  ------------------
  |  |   67|      0|#define FINISH_STATE 666    /* stream complete */
  ------------------
  |  Branch (1187:10): [True: 0, False: 0]
  |  Branch (1187:33): [True: 0, False: 0]
  ------------------
 1188|  3.80M|        block_state bstate;
 1189|       |
 1190|  3.80M|        bstate = s->level == 0 ? deflate_stored(s, flush) :
  ------------------
  |  Branch (1190:18): [True: 0, False: 3.80M]
  ------------------
 1191|  3.80M|                 s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
  ------------------
  |  |  197|  3.80M|#define Z_HUFFMAN_ONLY        2
  ------------------
  |  Branch (1191:18): [True: 0, False: 3.80M]
  ------------------
 1192|  3.80M|                 s->strategy == Z_RLE ? deflate_rle(s, flush) :
  ------------------
  |  |  198|  3.80M|#define Z_RLE                 3
  ------------------
  |  Branch (1192:18): [True: 0, False: 3.80M]
  ------------------
 1193|  3.80M|                 (*(configuration_table[s->level].func))(s, flush);
 1194|       |
 1195|  3.80M|        if (bstate == finish_started || bstate == finish_done) {
  ------------------
  |  Branch (1195:13): [True: 0, False: 3.80M]
  |  Branch (1195:41): [True: 40.0k, False: 3.76M]
  ------------------
 1196|  40.0k|            s->status = FINISH_STATE;
  ------------------
  |  |   67|  40.0k|#define FINISH_STATE 666    /* stream complete */
  ------------------
 1197|  40.0k|        }
 1198|  3.80M|        if (bstate == need_more || bstate == finish_started) {
  ------------------
  |  Branch (1198:13): [True: 3.76M, False: 40.0k]
  |  Branch (1198:36): [True: 0, False: 40.0k]
  ------------------
 1199|  3.76M|            if (strm->avail_out == 0) {
  ------------------
  |  Branch (1199:17): [True: 223, False: 3.76M]
  ------------------
 1200|    223|                s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
 1201|    223|            }
 1202|  3.76M|            return Z_OK;
  ------------------
  |  |  177|  3.76M|#define Z_OK            0
  ------------------
 1203|       |            /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
 1204|       |             * of deflate should use the same flush parameter to make sure
 1205|       |             * that the flush is complete. So we don't have to output an
 1206|       |             * empty block here, this will be done at next call. This also
 1207|       |             * ensures that for a very small output buffer, we emit at most
 1208|       |             * one empty block.
 1209|       |             */
 1210|  3.76M|        }
 1211|  40.0k|        if (bstate == block_done) {
  ------------------
  |  Branch (1211:13): [True: 0, False: 40.0k]
  ------------------
 1212|      0|            if (flush == Z_PARTIAL_FLUSH) {
  ------------------
  |  |  169|      0|#define Z_PARTIAL_FLUSH 1
  ------------------
  |  Branch (1212:17): [True: 0, False: 0]
  ------------------
 1213|      0|                _tr_align(s);
 1214|      0|            } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
  ------------------
  |  |  173|      0|#define Z_BLOCK         5
  ------------------
  |  Branch (1214:24): [True: 0, False: 0]
  ------------------
 1215|      0|                _tr_stored_block(s, (char*)0, 0L, 0);
 1216|       |                /* For a full flush, this empty block will be recognized
 1217|       |                 * as a special marker by inflate_sync().
 1218|       |                 */
 1219|      0|                if (flush == Z_FULL_FLUSH) {
  ------------------
  |  |  171|      0|#define Z_FULL_FLUSH    3
  ------------------
  |  Branch (1219:21): [True: 0, False: 0]
  ------------------
 1220|      0|                    CLEAR_HASH(s);             /* forget history */
  ------------------
  |  |  171|      0|    do { \
  |  |  172|      0|        s->head[s->hash_size - 1] = NIL; \
  |  |  ------------------
  |  |  |  |   85|      0|#define NIL 0
  |  |  ------------------
  |  |  173|      0|        zmemzero((Bytef *)s->head, \
  |  |  ------------------
  |  |  |  |  212|      0|#    define zmemzero(dest, len) memset(dest, 0, len)
  |  |  ------------------
  |  |  174|      0|                 (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \
  |  |  175|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (175:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1221|      0|                    if (s->lookahead == 0) {
  ------------------
  |  Branch (1221:25): [True: 0, False: 0]
  ------------------
 1222|      0|                        s->strstart = 0;
 1223|      0|                        s->block_start = 0L;
 1224|      0|                        s->insert = 0;
 1225|      0|                    }
 1226|      0|                }
 1227|      0|            }
 1228|      0|            flush_pending(strm);
 1229|      0|            if (strm->avail_out == 0) {
  ------------------
  |  Branch (1229:17): [True: 0, False: 0]
  ------------------
 1230|      0|              s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
 1231|      0|              return Z_OK;
  ------------------
  |  |  177|      0|#define Z_OK            0
  ------------------
 1232|      0|            }
 1233|      0|        }
 1234|  40.0k|    }
 1235|       |
 1236|  40.0k|    if (flush != Z_FINISH) return Z_OK;
  ------------------
  |  |  172|  40.0k|#define Z_FINISH        4
  ------------------
                  if (flush != Z_FINISH) return Z_OK;
  ------------------
  |  |  177|      0|#define Z_OK            0
  ------------------
  |  Branch (1236:9): [True: 0, False: 40.0k]
  ------------------
 1237|  40.0k|    if (s->wrap <= 0) return Z_STREAM_END;
  ------------------
  |  |  178|      0|#define Z_STREAM_END    1
  ------------------
  |  Branch (1237:9): [True: 0, False: 40.0k]
  ------------------
 1238|       |
 1239|       |    /* Write the trailer */
 1240|  40.0k|#ifdef GZIP
 1241|  40.0k|    if (s->wrap == 2) {
  ------------------
  |  Branch (1241:9): [True: 0, False: 40.0k]
  ------------------
 1242|      0|        put_byte(s, (Byte)(strm->adler & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1243|      0|        put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1244|      0|        put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1245|      0|        put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1246|      0|        put_byte(s, (Byte)(strm->total_in & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1247|      0|        put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1248|      0|        put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1249|      0|        put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
  ------------------
  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
 1250|      0|    }
 1251|  40.0k|    else
 1252|  40.0k|#endif
 1253|  40.0k|    {
 1254|  40.0k|        putShortMSB(s, (uInt)(strm->adler >> 16));
 1255|  40.0k|        putShortMSB(s, (uInt)(strm->adler & 0xffff));
 1256|  40.0k|    }
 1257|  40.0k|    flush_pending(strm);
 1258|       |    /* If avail_out is zero, the application will call deflate again
 1259|       |     * to flush the rest.
 1260|       |     */
 1261|  40.0k|    if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
  ------------------
  |  Branch (1261:9): [True: 40.0k, False: 0]
  ------------------
 1262|  40.0k|    return s->pending != 0 ? Z_OK : Z_STREAM_END;
  ------------------
  |  |  177|      0|#define Z_OK            0
  ------------------
                  return s->pending != 0 ? Z_OK : Z_STREAM_END;
  ------------------
  |  |  178|  40.0k|#define Z_STREAM_END    1
  ------------------
  |  Branch (1262:12): [True: 0, False: 40.0k]
  ------------------
 1263|  40.0k|}
deflateEnd:
 1266|  40.2k|int ZEXPORT deflateEnd(z_streamp strm) {
 1267|  40.2k|    int status;
 1268|       |
 1269|  40.2k|    if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (1269:9): [True: 0, False: 40.2k]
  ------------------
 1270|       |
 1271|  40.2k|    status = strm->state->status;
 1272|       |
 1273|       |    /* Deallocate in reverse order of allocations: */
 1274|  40.2k|    TRY_FREE(strm, strm->state->pending_buf);
  ------------------
  |  |  249|  40.2k|#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
  |  |  ------------------
  |  |  |  |  248|  40.2k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  |  |  ------------------
  |  |  |  Branch (249:29): [True: 40.2k, False: 0]
  |  |  ------------------
  ------------------
 1275|  40.2k|    TRY_FREE(strm, strm->state->head);
  ------------------
  |  |  249|  40.2k|#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
  |  |  ------------------
  |  |  |  |  248|  40.2k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  |  |  ------------------
  |  |  |  Branch (249:29): [True: 40.2k, False: 0]
  |  |  ------------------
  ------------------
 1276|  40.2k|    TRY_FREE(strm, strm->state->prev);
  ------------------
  |  |  249|  40.2k|#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
  |  |  ------------------
  |  |  |  |  248|  40.2k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  |  |  ------------------
  |  |  |  Branch (249:29): [True: 40.2k, False: 0]
  |  |  ------------------
  ------------------
 1277|  40.2k|    TRY_FREE(strm, strm->state->window);
  ------------------
  |  |  249|  40.2k|#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
  |  |  ------------------
  |  |  |  |  248|  40.2k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  |  |  ------------------
  |  |  |  Branch (249:29): [True: 40.2k, False: 0]
  |  |  ------------------
  ------------------
 1278|       |
 1279|  40.2k|    ZFREE(strm, strm->state);
  ------------------
  |  |  248|  40.2k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
 1280|  40.2k|    strm->state = Z_NULL;
  ------------------
  |  |  212|  40.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1281|       |
 1282|  40.2k|    return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
  ------------------
  |  |   66|  40.2k|#define BUSY_STATE   113    /* deflate -> FINISH_STATE */
  ------------------
                  return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
  ------------------
  |  |  182|    171|#define Z_DATA_ERROR   (-3)
  ------------------
                  return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
  ------------------
  |  |  177|  40.0k|#define Z_OK            0
  ------------------
  |  Branch (1282:12): [True: 171, False: 40.0k]
  ------------------
 1283|  40.2k|}
deflate.c:deflateStateCheck:
  529|  3.88M|local int deflateStateCheck(z_streamp strm) {
  530|  3.88M|    deflate_state *s;
  531|  3.88M|    if (strm == Z_NULL ||
  ------------------
  |  |  212|  7.76M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (531:9): [True: 0, False: 3.88M]
  ------------------
  532|  3.88M|        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (532:9): [True: 0, False: 3.88M]
  |  Branch (532:42): [True: 0, False: 3.88M]
  ------------------
  533|      0|        return 1;
  534|  3.88M|    s = strm->state;
  535|  3.88M|    if (s == Z_NULL || s->strm != strm || (s->status != INIT_STATE &&
  ------------------
  |  |  212|  7.76M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (s == Z_NULL || s->strm != strm || (s->status != INIT_STATE &&
  ------------------
  |  |   58|  7.76M|#define INIT_STATE    42    /* zlib header -> BUSY_STATE */
  ------------------
  |  Branch (535:9): [True: 0, False: 3.88M]
  |  Branch (535:24): [True: 0, False: 3.88M]
  |  Branch (535:44): [True: 3.80M, False: 80.4k]
  ------------------
  536|  3.88M|#ifdef GZIP
  537|  3.88M|                                           s->status != GZIP_STATE &&
  ------------------
  |  |   60|  7.68M|#  define GZIP_STATE  57    /* gzip header -> BUSY_STATE | EXTRA_STATE */
  ------------------
  |  Branch (537:44): [True: 3.80M, False: 0]
  ------------------
  538|  3.88M|#endif
  539|  3.88M|                                           s->status != EXTRA_STATE &&
  ------------------
  |  |   62|  7.68M|#define EXTRA_STATE   69    /* gzip extra block -> NAME_STATE */
  ------------------
  |  Branch (539:44): [True: 3.80M, False: 0]
  ------------------
  540|  3.88M|                                           s->status != NAME_STATE &&
  ------------------
  |  |   63|  7.68M|#define NAME_STATE    73    /* gzip file name -> COMMENT_STATE */
  ------------------
  |  Branch (540:44): [True: 3.80M, False: 0]
  ------------------
  541|  3.88M|                                           s->status != COMMENT_STATE &&
  ------------------
  |  |   64|  7.68M|#define COMMENT_STATE 91    /* gzip comment -> HCRC_STATE */
  ------------------
  |  Branch (541:44): [True: 3.80M, False: 0]
  ------------------
  542|  3.88M|                                           s->status != HCRC_STATE &&
  ------------------
  |  |   65|  7.68M|#define HCRC_STATE   103    /* gzip header CRC -> BUSY_STATE */
  ------------------
  |  Branch (542:44): [True: 3.80M, False: 0]
  ------------------
  543|  3.88M|                                           s->status != BUSY_STATE &&
  ------------------
  |  |   66|  7.68M|#define BUSY_STATE   113    /* deflate -> FINISH_STATE */
  ------------------
  |  Branch (543:44): [True: 40.0k, False: 3.76M]
  ------------------
  544|  3.88M|                                           s->status != FINISH_STATE))
  ------------------
  |  |   67|  40.0k|#define FINISH_STATE 666    /* stream complete */
  ------------------
  |  Branch (544:44): [True: 0, False: 40.0k]
  ------------------
  545|      0|        return 1;
  546|  3.88M|    return 0;
  547|  3.88M|}
deflate.c:fill_window:
  251|  6.04M|local void fill_window(deflate_state *s) {
  252|  6.04M|    unsigned n;
  253|  6.04M|    unsigned more;    /* Amount of free space at the end of the window. */
  254|  6.04M|    uInt wsize = s->w_size;
  255|       |
  256|  6.04M|    Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
  257|       |
  258|  6.04M|    do {
  259|  6.04M|        more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
  260|       |
  261|       |        /* Deal with !@#$% 64K limit: */
  262|  6.04M|        if (sizeof(int) <= 2) {
  ------------------
  |  Branch (262:13): [Folded - Ignored]
  ------------------
  263|      0|            if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
  ------------------
  |  Branch (263:17): [True: 0, False: 0]
  |  Branch (263:30): [True: 0, False: 0]
  |  Branch (263:50): [True: 0, False: 0]
  ------------------
  264|      0|                more = wsize;
  265|       |
  266|      0|            } else if (more == (unsigned)(-1)) {
  ------------------
  |  Branch (266:24): [True: 0, False: 0]
  ------------------
  267|       |                /* Very unlikely, but possible on 16 bit machine if
  268|       |                 * strstart == 0 && lookahead == 1 (input done a byte at time)
  269|       |                 */
  270|      0|                more--;
  271|      0|            }
  272|      0|        }
  273|       |
  274|       |        /* If the window is almost full and there is insufficient lookahead,
  275|       |         * move the upper half to the lower one to make room in the upper half.
  276|       |         */
  277|  6.04M|        if (s->strstart >= wsize + MAX_DIST(s)) {
  ------------------
  |  |  298|  6.04M|#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  293|  6.04M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  6.04M|#define MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|  6.04M|#define MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (277:13): [True: 62.9k, False: 5.98M]
  ------------------
  278|       |
  279|  62.9k|            zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more);
  ------------------
  |  |  210|  62.9k|#    define zmemcpy memcpy
  ------------------
  280|  62.9k|            s->match_start -= wsize;
  281|  62.9k|            s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */
  282|  62.9k|            s->block_start -= (long) wsize;
  283|  62.9k|            if (s->insert > s->strstart)
  ------------------
  |  Branch (283:17): [True: 0, False: 62.9k]
  ------------------
  284|      0|                s->insert = s->strstart;
  285|  62.9k|            slide_hash(s);
  286|  62.9k|            more += wsize;
  287|  62.9k|        }
  288|  6.04M|        if (s->strm->avail_in == 0) break;
  ------------------
  |  Branch (288:13): [True: 2.21M, False: 3.82M]
  ------------------
  289|       |
  290|       |        /* If there was no sliding:
  291|       |         *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
  292|       |         *    more == window_size - lookahead - strstart
  293|       |         * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
  294|       |         * => more >= window_size - 2*WSIZE + 2
  295|       |         * In the BIG_MEM or MMAP case (not yet supported),
  296|       |         *   window_size == input_size + MIN_LOOKAHEAD  &&
  297|       |         *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
  298|       |         * Otherwise, window_size == 2*WSIZE so more >= 2.
  299|       |         * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
  300|       |         */
  301|  3.82M|        Assert(more >= 2, "more < 2");
  302|       |
  303|  3.82M|        n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
  304|  3.82M|        s->lookahead += n;
  305|       |
  306|       |        /* Initialize the hash value now that we have some input: */
  307|  3.82M|        if (s->lookahead + s->insert >= MIN_MATCH) {
  ------------------
  |  |   86|  3.82M|#define MIN_MATCH  3
  ------------------
  |  Branch (307:13): [True: 3.81M, False: 16.7k]
  ------------------
  308|  3.81M|            uInt str = s->strstart - s->insert;
  309|  3.81M|            s->ins_h = s->window[str];
  310|  3.81M|            UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
  ------------------
  |  |  141|  3.81M|#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask)
  ------------------
  311|       |#if MIN_MATCH != 3
  312|       |            Call UPDATE_HASH() MIN_MATCH-3 more times
  313|       |#endif
  314|  3.81M|            while (s->insert) {
  ------------------
  |  Branch (314:20): [True: 0, False: 3.81M]
  ------------------
  315|      0|                UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
  ------------------
  |  |  141|      0|#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask)
  ------------------
  316|      0|#ifndef FASTEST
  317|      0|                s->prev[str & s->w_mask] = s->head[s->ins_h];
  318|      0|#endif
  319|      0|                s->head[s->ins_h] = (Pos)str;
  320|      0|                str++;
  321|      0|                s->insert--;
  322|      0|                if (s->lookahead + s->insert < MIN_MATCH)
  ------------------
  |  |   86|      0|#define MIN_MATCH  3
  ------------------
  |  Branch (322:21): [True: 0, False: 0]
  ------------------
  323|      0|                    break;
  324|      0|            }
  325|  3.81M|        }
  326|       |        /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
  327|       |         * but this is not important since only literal bytes will be emitted.
  328|       |         */
  329|       |
  330|  3.82M|    } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
  ------------------
  |  |  293|  7.65M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  ------------------
  |  |  |  |   87|  3.82M|#define MAX_MATCH  258
  |  |  ------------------
  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  ------------------
  |  |  |  |   86|  3.82M|#define MIN_MATCH  3
  |  |  ------------------
  ------------------
  |  Branch (330:14): [True: 2.69M, False: 1.13M]
  |  Branch (330:46): [True: 0, False: 2.69M]
  ------------------
  331|       |
  332|       |    /* If the WIN_INIT bytes after the end of the current data have never been
  333|       |     * written, then zero those bytes in order to avoid memory check reports of
  334|       |     * the use of uninitialized (or uninitialised as Julian writes) bytes by
  335|       |     * the longest match routines.  Update the high water mark for the next
  336|       |     * time through here.  WIN_INIT is set to MAX_MATCH since the longest match
  337|       |     * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
  338|       |     */
  339|  6.04M|    if (s->high_water < s->window_size) {
  ------------------
  |  Branch (339:9): [True: 5.91M, False: 130k]
  ------------------
  340|  5.91M|        ulg curr = s->strstart + (ulg)(s->lookahead);
  341|  5.91M|        ulg init;
  342|       |
  343|  5.91M|        if (s->high_water < curr) {
  ------------------
  |  Branch (343:13): [True: 109k, False: 5.80M]
  ------------------
  344|       |            /* Previous high water mark below current data -- zero WIN_INIT
  345|       |             * bytes or up to end of window, whichever is less.
  346|       |             */
  347|   109k|            init = s->window_size - curr;
  348|   109k|            if (init > WIN_INIT)
  ------------------
  |  |  303|   109k|#define WIN_INIT MAX_MATCH
  |  |  ------------------
  |  |  |  |   87|   109k|#define MAX_MATCH  258
  |  |  ------------------
  ------------------
  |  Branch (348:17): [True: 108k, False: 410]
  ------------------
  349|   108k|                init = WIN_INIT;
  ------------------
  |  |  303|   108k|#define WIN_INIT MAX_MATCH
  |  |  ------------------
  |  |  |  |   87|   108k|#define MAX_MATCH  258
  |  |  ------------------
  ------------------
  350|   109k|            zmemzero(s->window + curr, (unsigned)init);
  ------------------
  |  |  212|   109k|#    define zmemzero(dest, len) memset(dest, 0, len)
  ------------------
  351|   109k|            s->high_water = curr + init;
  352|   109k|        }
  353|  5.80M|        else if (s->high_water < (ulg)curr + WIN_INIT) {
  ------------------
  |  |  303|  5.80M|#define WIN_INIT MAX_MATCH
  |  |  ------------------
  |  |  |  |   87|  5.80M|#define MAX_MATCH  258
  |  |  ------------------
  ------------------
  |  Branch (353:18): [True: 3.64M, False: 2.15M]
  ------------------
  354|       |            /* High water mark at or above current data, but below current data
  355|       |             * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
  356|       |             * to end of window, whichever is less.
  357|       |             */
  358|  3.64M|            init = (ulg)curr + WIN_INIT - s->high_water;
  ------------------
  |  |  303|  3.64M|#define WIN_INIT MAX_MATCH
  |  |  ------------------
  |  |  |  |   87|  3.64M|#define MAX_MATCH  258
  |  |  ------------------
  ------------------
  359|  3.64M|            if (init > s->window_size - s->high_water)
  ------------------
  |  Branch (359:17): [True: 0, False: 3.64M]
  ------------------
  360|      0|                init = s->window_size - s->high_water;
  361|  3.64M|            zmemzero(s->window + s->high_water, (unsigned)init);
  ------------------
  |  |  212|  3.64M|#    define zmemzero(dest, len) memset(dest, 0, len)
  ------------------
  362|  3.64M|            s->high_water += init;
  363|  3.64M|        }
  364|  5.91M|    }
  365|       |
  366|  6.04M|    Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
  367|  6.04M|           "not enough room for search");
  368|  6.04M|}
deflate.c:read_buf:
  218|  3.82M|local unsigned read_buf(z_streamp strm, Bytef *buf, unsigned size) {
  219|  3.82M|    unsigned len = strm->avail_in;
  220|       |
  221|  3.82M|    if (len > size) len = size;
  ------------------
  |  Branch (221:9): [True: 62.7k, False: 3.76M]
  ------------------
  222|  3.82M|    if (len == 0) return 0;
  ------------------
  |  Branch (222:9): [True: 0, False: 3.82M]
  ------------------
  223|       |
  224|  3.82M|    strm->avail_in  -= len;
  225|       |
  226|  3.82M|    zmemcpy(buf, strm->next_in, len);
  ------------------
  |  |  210|  3.82M|#    define zmemcpy memcpy
  ------------------
  227|  3.82M|    if (strm->state->wrap == 1) {
  ------------------
  |  Branch (227:9): [True: 3.82M, False: 0]
  ------------------
  228|  3.82M|        strm->adler = adler32(strm->adler, buf, len);
  229|  3.82M|    }
  230|      0|#ifdef GZIP
  231|      0|    else if (strm->state->wrap == 2) {
  ------------------
  |  Branch (231:14): [True: 0, False: 0]
  ------------------
  232|      0|        strm->adler = crc32(strm->adler, buf, len);
  233|      0|    }
  234|  3.82M|#endif
  235|  3.82M|    strm->next_in  += len;
  236|  3.82M|    strm->total_in += len;
  237|       |
  238|  3.82M|    return len;
  239|  3.82M|}
deflate.c:lm_init:
  673|  40.2k|local void lm_init(deflate_state *s) {
  674|  40.2k|    s->window_size = (ulg)2L*s->w_size;
  675|       |
  676|  40.2k|    CLEAR_HASH(s);
  ------------------
  |  |  171|  40.2k|    do { \
  |  |  172|  40.2k|        s->head[s->hash_size - 1] = NIL; \
  |  |  ------------------
  |  |  |  |   85|  40.2k|#define NIL 0
  |  |  ------------------
  |  |  173|  40.2k|        zmemzero((Bytef *)s->head, \
  |  |  ------------------
  |  |  |  |  212|  40.2k|#    define zmemzero(dest, len) memset(dest, 0, len)
  |  |  ------------------
  |  |  174|  40.2k|                 (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \
  |  |  175|  40.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (175:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  677|       |
  678|       |    /* Set the default configuration parameters:
  679|       |     */
  680|  40.2k|    s->max_lazy_match   = configuration_table[s->level].max_lazy;
  681|  40.2k|    s->good_match       = configuration_table[s->level].good_length;
  682|  40.2k|    s->nice_match       = configuration_table[s->level].nice_length;
  683|  40.2k|    s->max_chain_length = configuration_table[s->level].max_chain;
  684|       |
  685|  40.2k|    s->strstart = 0;
  686|  40.2k|    s->block_start = 0L;
  687|  40.2k|    s->lookahead = 0;
  688|  40.2k|    s->insert = 0;
  689|  40.2k|    s->match_length = s->prev_length = MIN_MATCH-1;
  ------------------
  |  |   86|  40.2k|#define MIN_MATCH  3
  ------------------
  690|  40.2k|    s->match_available = 0;
  691|  40.2k|    s->ins_h = 0;
  692|  40.2k|}
deflate.c:longest_match:
 1356|  17.2M|local uInt longest_match(deflate_state *s, IPos cur_match) {
 1357|  17.2M|    unsigned chain_length = s->max_chain_length;/* max hash chain length */
 1358|  17.2M|    register Bytef *scan = s->window + s->strstart; /* current string */
 1359|  17.2M|    register Bytef *match;                      /* matched string */
 1360|  17.2M|    register int len;                           /* length of current match */
 1361|  17.2M|    int best_len = (int)s->prev_length;         /* best match length so far */
 1362|  17.2M|    int nice_match = s->nice_match;             /* stop if match long enough */
 1363|  17.2M|    IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
  ------------------
  |  |  298|  17.2M|#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  293|  17.2M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  17.2M|#define MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|  17.2M|#define MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1363:18): [True: 14.2M, False: 2.96M]
  ------------------
 1364|  14.2M|        s->strstart - (IPos)MAX_DIST(s) : NIL;
  ------------------
  |  |  298|  14.2M|#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  293|  14.2M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  14.2M|#define MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|  14.2M|#define MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      s->strstart - (IPos)MAX_DIST(s) : NIL;
  ------------------
  |  |   85|  2.96M|#define NIL 0
  ------------------
 1365|       |    /* Stop when cur_match becomes <= limit. To simplify the code,
 1366|       |     * we prevent matches with the string of window index 0.
 1367|       |     */
 1368|  17.2M|    Posf *prev = s->prev;
 1369|  17.2M|    uInt wmask = s->w_mask;
 1370|       |
 1371|       |#ifdef UNALIGNED_OK
 1372|       |    /* Compare two bytes at a time. Note: this is not always beneficial.
 1373|       |     * Try with and without -DUNALIGNED_OK to check.
 1374|       |     */
 1375|       |    register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
 1376|       |    register ush scan_start = *(ushf*)scan;
 1377|       |    register ush scan_end   = *(ushf*)(scan + best_len - 1);
 1378|       |#else
 1379|  17.2M|    register Bytef *strend = s->window + s->strstart + MAX_MATCH;
  ------------------
  |  |   87|  17.2M|#define MAX_MATCH  258
  ------------------
 1380|  17.2M|    register Byte scan_end1  = scan[best_len - 1];
 1381|  17.2M|    register Byte scan_end   = scan[best_len];
 1382|  17.2M|#endif
 1383|       |
 1384|       |    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
 1385|       |     * It is easy to get rid of this optimization if necessary.
 1386|       |     */
 1387|  17.2M|    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
 1388|       |
 1389|       |    /* Do not waste too much time if we already have a good match: */
 1390|  17.2M|    if (s->prev_length >= s->good_match) {
  ------------------
  |  Branch (1390:9): [True: 291k, False: 16.9M]
  ------------------
 1391|   291k|        chain_length >>= 2;
 1392|   291k|    }
 1393|       |    /* Do not look for matches beyond the end of the input. This is necessary
 1394|       |     * to make deflate deterministic.
 1395|       |     */
 1396|  17.2M|    if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead;
  ------------------
  |  Branch (1396:9): [True: 206k, False: 17.0M]
  ------------------
 1397|       |
 1398|  17.2M|    Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
 1399|  17.2M|           "need lookahead");
 1400|       |
 1401|  95.1M|    do {
 1402|  95.1M|        Assert(cur_match < s->strstart, "no future");
 1403|  95.1M|        match = s->window + cur_match;
 1404|       |
 1405|       |        /* Skip to next match if the match length cannot increase
 1406|       |         * or if the match length is less than 2.  Note that the checks below
 1407|       |         * for insufficient lookahead only occur occasionally for performance
 1408|       |         * reasons.  Therefore uninitialized memory will be accessed, and
 1409|       |         * conditional jumps will be made that depend on those values.
 1410|       |         * However the length of the match is limited to the lookahead, so
 1411|       |         * the output of deflate is not affected by the uninitialized values.
 1412|       |         */
 1413|       |#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
 1414|       |        /* This code assumes sizeof(unsigned short) == 2. Do not use
 1415|       |         * UNALIGNED_OK if your compiler uses a different size.
 1416|       |         */
 1417|       |        if (*(ushf*)(match + best_len - 1) != scan_end ||
 1418|       |            *(ushf*)match != scan_start) continue;
 1419|       |
 1420|       |        /* It is not necessary to compare scan[2] and match[2] since they are
 1421|       |         * always equal when the other bytes match, given that the hash keys
 1422|       |         * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
 1423|       |         * strstart + 3, + 5, up to strstart + 257. We check for insufficient
 1424|       |         * lookahead only every 4th comparison; the 128th check will be made
 1425|       |         * at strstart + 257. If MAX_MATCH-2 is not a multiple of 8, it is
 1426|       |         * necessary to put more guard bytes at the end of the window, or
 1427|       |         * to check more often for insufficient lookahead.
 1428|       |         */
 1429|       |        Assert(scan[2] == match[2], "scan[2]?");
 1430|       |        scan++, match++;
 1431|       |        do {
 1432|       |        } while (*(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
 1433|       |                 *(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
 1434|       |                 *(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
 1435|       |                 *(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
 1436|       |                 scan < strend);
 1437|       |        /* The funny "do {}" generates better code on most compilers */
 1438|       |
 1439|       |        /* Here, scan <= window + strstart + 257 */
 1440|       |        Assert(scan <= s->window + (unsigned)(s->window_size - 1),
 1441|       |               "wild scan");
 1442|       |        if (*scan == *match) scan++;
 1443|       |
 1444|       |        len = (MAX_MATCH - 1) - (int)(strend - scan);
 1445|       |        scan = strend - (MAX_MATCH-1);
 1446|       |
 1447|       |#else /* UNALIGNED_OK */
 1448|       |
 1449|  95.1M|        if (match[best_len]     != scan_end  ||
  ------------------
  |  Branch (1449:13): [True: 65.3M, False: 29.7M]
  ------------------
 1450|  95.1M|            match[best_len - 1] != scan_end1 ||
  ------------------
  |  Branch (1450:13): [True: 6.70M, False: 23.0M]
  ------------------
 1451|  95.1M|            *match              != *scan     ||
  ------------------
  |  Branch (1451:13): [True: 1.15M, False: 21.8M]
  ------------------
 1452|  95.1M|            *++match            != scan[1])      continue;
  ------------------
  |  Branch (1452:13): [True: 767, False: 21.8M]
  ------------------
 1453|       |
 1454|       |        /* The check at best_len - 1 can be removed because it will be made
 1455|       |         * again later. (This heuristic is not always a win.)
 1456|       |         * It is not necessary to compare scan[2] and match[2] since they
 1457|       |         * are always equal when the other bytes match, given that
 1458|       |         * the hash keys are equal and that HASH_BITS >= 8.
 1459|       |         */
 1460|  21.8M|        scan += 2, match++;
 1461|  21.8M|        Assert(*scan == *match, "match[2]?");
 1462|       |
 1463|       |        /* We check for insufficient lookahead only every 8th comparison;
 1464|       |         * the 256th check will be made at strstart + 258.
 1465|       |         */
 1466|   323M|        do {
 1467|   323M|        } while (*++scan == *++match && *++scan == *++match &&
  ------------------
  |  Branch (1467:18): [True: 320M, False: 2.67M]
  |  Branch (1467:41): [True: 318M, False: 2.01M]
  ------------------
 1468|   323M|                 *++scan == *++match && *++scan == *++match &&
  ------------------
  |  Branch (1468:18): [True: 317M, False: 1.74M]
  |  Branch (1468:41): [True: 315M, False: 1.53M]
  ------------------
 1469|   323M|                 *++scan == *++match && *++scan == *++match &&
  ------------------
  |  Branch (1469:18): [True: 314M, False: 1.49M]
  |  Branch (1469:41): [True: 312M, False: 1.35M]
  ------------------
 1470|   323M|                 *++scan == *++match && *++scan == *++match &&
  ------------------
  |  Branch (1470:18): [True: 311M, False: 1.28M]
  |  Branch (1470:41): [True: 310M, False: 1.23M]
  ------------------
 1471|   323M|                 scan < strend);
  ------------------
  |  Branch (1471:18): [True: 301M, False: 8.53M]
  ------------------
 1472|       |
 1473|  21.8M|        Assert(scan <= s->window + (unsigned)(s->window_size - 1),
 1474|  21.8M|               "wild scan");
 1475|       |
 1476|  21.8M|        len = MAX_MATCH - (int)(strend - scan);
  ------------------
  |  |   87|  21.8M|#define MAX_MATCH  258
  ------------------
 1477|  21.8M|        scan = strend - MAX_MATCH;
  ------------------
  |  |   87|  21.8M|#define MAX_MATCH  258
  ------------------
 1478|       |
 1479|  21.8M|#endif /* UNALIGNED_OK */
 1480|       |
 1481|  21.8M|        if (len > best_len) {
  ------------------
  |  Branch (1481:13): [True: 19.5M, False: 2.36M]
  ------------------
 1482|  19.5M|            s->match_start = cur_match;
 1483|  19.5M|            best_len = len;
 1484|  19.5M|            if (len >= nice_match) break;
  ------------------
  |  Branch (1484:17): [True: 8.62M, False: 10.8M]
  ------------------
 1485|       |#ifdef UNALIGNED_OK
 1486|       |            scan_end = *(ushf*)(scan + best_len - 1);
 1487|       |#else
 1488|  10.8M|            scan_end1  = scan[best_len - 1];
 1489|  10.8M|            scan_end   = scan[best_len];
 1490|  10.8M|#endif
 1491|  10.8M|        }
 1492|  86.5M|    } while ((cur_match = prev[cur_match & wmask]) > limit
  ------------------
  |  Branch (1492:14): [True: 78.3M, False: 8.19M]
  ------------------
 1493|  86.5M|             && --chain_length != 0);
  ------------------
  |  Branch (1493:17): [True: 77.8M, False: 437k]
  ------------------
 1494|       |
 1495|  17.2M|    if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
  ------------------
  |  Branch (1495:9): [True: 17.2M, False: 2.65k]
  ------------------
 1496|  2.65k|    return s->lookahead;
 1497|  17.2M|}
deflate.c:deflate_slow:
 1923|  3.80M|local block_state deflate_slow(deflate_state *s, int flush) {
 1924|  3.80M|    IPos hash_head;          /* head of hash chain */
 1925|  3.80M|    int bflush;              /* set if current block must be flushed */
 1926|       |
 1927|       |    /* Process the input block. */
 1928|  48.0M|    for (;;) {
 1929|       |        /* Make sure that we always have enough lookahead, except
 1930|       |         * at the end of the input file. We need MAX_MATCH bytes
 1931|       |         * for the next match, plus MIN_MATCH bytes to insert the
 1932|       |         * string following the next match.
 1933|       |         */
 1934|  48.0M|        if (s->lookahead < MIN_LOOKAHEAD) {
  ------------------
  |  |  293|  48.0M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  ------------------
  |  |  |  |   87|  48.0M|#define MAX_MATCH  258
  |  |  ------------------
  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  ------------------
  |  |  |  |   86|  48.0M|#define MIN_MATCH  3
  |  |  ------------------
  ------------------
  |  Branch (1934:13): [True: 6.04M, False: 42.0M]
  ------------------
 1935|  6.04M|            fill_window(s);
 1936|  6.04M|            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
  ------------------
  |  |  293|  12.0M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  ------------------
  |  |  |  |   87|  6.04M|#define MAX_MATCH  258
  |  |  ------------------
  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  ------------------
  |  |  |  |   86|  6.04M|#define MIN_MATCH  3
  |  |  ------------------
  ------------------
                          if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
  ------------------
  |  |  168|  4.90M|#define Z_NO_FLUSH      0
  ------------------
  |  Branch (1936:17): [True: 4.90M, False: 1.13M]
  |  Branch (1936:49): [True: 3.76M, False: 1.14M]
  ------------------
 1937|  3.76M|                return need_more;
 1938|  3.76M|            }
 1939|  2.27M|            if (s->lookahead == 0) break; /* flush the current block */
  ------------------
  |  Branch (1939:17): [True: 40.0k, False: 2.23M]
  ------------------
 1940|  2.27M|        }
 1941|       |
 1942|       |        /* Insert the string window[strstart .. strstart + 2] in the
 1943|       |         * dictionary, and set hash_head to the head of the hash chain:
 1944|       |         */
 1945|  44.2M|        hash_head = NIL;
  ------------------
  |  |   85|  44.2M|#define NIL 0
  ------------------
 1946|  44.2M|        if (s->lookahead >= MIN_MATCH) {
  ------------------
  |  |   86|  44.2M|#define MIN_MATCH  3
  ------------------
  |  Branch (1946:13): [True: 44.2M, False: 22.0k]
  ------------------
 1947|  44.2M|            INSERT_STRING(s, s->strstart, hash_head);
  ------------------
  |  |  161|  44.2M|   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
  |  |  ------------------
  |  |  |  |  141|  44.2M|#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask)
  |  |  ------------------
  |  |  162|  44.2M|    match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
  |  |  163|  44.2M|    s->head[s->ins_h] = (Pos)(str))
  ------------------
 1948|  44.2M|        }
 1949|       |
 1950|       |        /* Find the longest match, discarding those <= prev_length.
 1951|       |         */
 1952|  44.2M|        s->prev_length = s->match_length, s->prev_match = s->match_start;
 1953|  44.2M|        s->match_length = MIN_MATCH-1;
  ------------------
  |  |   86|  44.2M|#define MIN_MATCH  3
  ------------------
 1954|       |
 1955|  44.2M|        if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
  ------------------
  |  |   85|  88.5M|#define NIL 0
  ------------------
  |  Branch (1955:13): [True: 27.7M, False: 16.5M]
  |  Branch (1955:33): [True: 18.5M, False: 9.18M]
  ------------------
 1956|  44.2M|            s->strstart - hash_head <= MAX_DIST(s)) {
  ------------------
  |  |  298|  18.5M|#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  293|  18.5M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  18.5M|#define MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|  18.5M|#define MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1956:13): [True: 17.2M, False: 1.30M]
  ------------------
 1957|       |            /* To simplify the code, we prevent matches with the string
 1958|       |             * of window index 0 (in particular we have to avoid a match
 1959|       |             * of the string with itself at the start of the input file).
 1960|       |             */
 1961|  17.2M|            s->match_length = longest_match (s, hash_head);
 1962|       |            /* longest_match() sets match_start */
 1963|       |
 1964|  17.2M|            if (s->match_length <= 5 && (s->strategy == Z_FILTERED
  ------------------
  |  |  196|  14.1M|#define Z_FILTERED            1
  ------------------
  |  Branch (1964:17): [True: 7.08M, False: 10.1M]
  |  Branch (1964:42): [True: 0, False: 7.08M]
  ------------------
 1965|  7.08M|#if TOO_FAR <= 32767
 1966|  7.08M|                || (s->match_length == MIN_MATCH &&
  ------------------
  |  |   86|  14.1M|#define MIN_MATCH  3
  ------------------
  |  Branch (1966:21): [True: 659k, False: 6.42M]
  ------------------
 1967|  7.08M|                    s->strstart - s->match_start > TOO_FAR)
  ------------------
  |  |   89|   659k|#  define TOO_FAR 4096
  ------------------
  |  Branch (1967:21): [True: 42.7k, False: 616k]
  ------------------
 1968|  7.08M|#endif
 1969|  7.08M|                )) {
 1970|       |
 1971|       |                /* If prev_match is also MIN_MATCH, match_start is garbage
 1972|       |                 * but we will ignore the current match anyway.
 1973|       |                 */
 1974|  42.7k|                s->match_length = MIN_MATCH-1;
  ------------------
  |  |   86|  42.7k|#define MIN_MATCH  3
  ------------------
 1975|  42.7k|            }
 1976|  17.2M|        }
 1977|       |        /* If there was a match at the previous step and the current
 1978|       |         * match is not better, output the previous match:
 1979|       |         */
 1980|  44.2M|        if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
  ------------------
  |  |   86|  88.5M|#define MIN_MATCH  3
  ------------------
  |  Branch (1980:13): [True: 10.6M, False: 33.6M]
  |  Branch (1980:44): [True: 10.4M, False: 220k]
  ------------------
 1981|  10.4M|            uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
  ------------------
  |  |   86|  10.4M|#define MIN_MATCH  3
  ------------------
 1982|       |            /* Do not insert strings in hash table beyond this. */
 1983|       |
 1984|  10.4M|            check_match(s, s->strstart - 1, s->prev_match, s->prev_length);
 1985|       |
 1986|  10.4M|            _tr_tally_dist(s, s->strstart - 1 - s->prev_match,
  ------------------
  |  |  363|  10.4M|  { uch len = (uch)(length); \
  |  |  364|  10.4M|    ush dist = (ush)(distance); \
  |  |  365|  10.4M|    s->sym_buf[s->sym_next++] = (uch)dist; \
  |  |  366|  10.4M|    s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \
  |  |  367|  10.4M|    s->sym_buf[s->sym_next++] = len; \
  |  |  368|  10.4M|    dist--; \
  |  |  369|  10.4M|    s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
  |  |  ------------------
  |  |  |  |   37|  10.4M|#define LITERALS  256
  |  |  ------------------
  |  |                   s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
  |  |  ------------------
  |  |  |  |   83|  10.4M|#define Freq fc.freq
  |  |  ------------------
  |  |  370|  10.4M|    s->dyn_dtree[d_code(dist)].Freq++; \
  |  |  ------------------
  |  |  |  |  318|  10.4M|   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (318:5): [True: 9.73M, False: 678k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   s->dyn_dtree[d_code(dist)].Freq++; \
  |  |  ------------------
  |  |  |  |   83|  10.4M|#define Freq fc.freq
  |  |  ------------------
  |  |  371|  10.4M|    flush = (s->sym_next == s->sym_end); \
  |  |  372|  10.4M|  }
  ------------------
 1987|  10.4M|                           s->prev_length - MIN_MATCH, bflush);
 1988|       |
 1989|       |            /* Insert in hash table all strings up to the end of the match.
 1990|       |             * strstart - 1 and strstart are already inserted. If there is not
 1991|       |             * enough lookahead, the last two strings are not inserted in
 1992|       |             * the hash table.
 1993|       |             */
 1994|  10.4M|            s->lookahead -= s->prev_length - 1;
 1995|  10.4M|            s->prev_length -= 2;
 1996|  2.23G|            do {
 1997|  2.23G|                if (++s->strstart <= max_insert) {
  ------------------
  |  Branch (1997:21): [True: 2.23G, False: 58.0k]
  ------------------
 1998|  2.23G|                    INSERT_STRING(s, s->strstart, hash_head);
  ------------------
  |  |  161|  2.23G|   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
  |  |  ------------------
  |  |  |  |  141|  2.23G|#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask)
  |  |  ------------------
  |  |  162|  2.23G|    match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
  |  |  163|  2.23G|    s->head[s->ins_h] = (Pos)(str))
  ------------------
 1999|  2.23G|                }
 2000|  2.23G|            } while (--s->prev_length != 0);
  ------------------
  |  Branch (2000:22): [True: 2.22G, False: 10.4M]
  ------------------
 2001|  10.4M|            s->match_available = 0;
 2002|  10.4M|            s->match_length = MIN_MATCH-1;
  ------------------
  |  |   86|  10.4M|#define MIN_MATCH  3
  ------------------
 2003|  10.4M|            s->strstart++;
 2004|       |
 2005|  10.4M|            if (bflush) FLUSH_BLOCK(s, 0);
  ------------------
  |  | 1609|    526|#define FLUSH_BLOCK(s, last) { \
  |  | 1610|    526|   FLUSH_BLOCK_ONLY(s, last); \
  |  |  ------------------
  |  |  |  | 1597|    526|#define FLUSH_BLOCK_ONLY(s, last) { \
  |  |  |  | 1598|    526|   _tr_flush_block(s, (s->block_start >= 0L ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1598:24): [True: 20, False: 506]
  |  |  |  |  ------------------
  |  |  |  | 1599|    526|                   (charf *)&s->window[(unsigned)s->block_start] : \
  |  |  |  | 1600|    526|                   (charf *)Z_NULL), \
  |  |  |  |  ------------------
  |  |  |  |  |  |  212|    506|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  |  |  |  |  ------------------
  |  |  |  | 1601|    526|                (ulg)((long)s->strstart - s->block_start), \
  |  |  |  | 1602|    526|                (last)); \
  |  |  |  | 1603|    526|   s->block_start = s->strstart; \
  |  |  |  | 1604|    526|   flush_pending(s->strm); \
  |  |  |  | 1605|    526|   Tracev((stderr,"[FLUSH]")); \
  |  |  |  | 1606|    526|}
  |  |  ------------------
  |  | 1611|    526|   if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (1611:8): [True: 34, False: 492]
  |  |  |  Branch (1611:40): [Folded - Ignored]
  |  |  ------------------
  |  | 1612|    526|}
  ------------------
  |  Branch (2005:17): [True: 526, False: 10.4M]
  ------------------
 2006|       |
 2007|  33.8M|        } else if (s->match_available) {
  ------------------
  |  Branch (2007:20): [True: 23.4M, False: 10.4M]
  ------------------
 2008|       |            /* If there was no match at the previous position, output a
 2009|       |             * single literal. If there was a match but the current match
 2010|       |             * is longer, truncate the previous match to a single literal.
 2011|       |             */
 2012|  23.4M|            Tracevv((stderr,"%c", s->window[s->strstart - 1]));
 2013|  23.4M|            _tr_tally_lit(s, s->window[s->strstart - 1], bflush);
  ------------------
  |  |  355|  23.4M|  { uch cc = (c); \
  |  |  356|  23.4M|    s->sym_buf[s->sym_next++] = 0; \
  |  |  357|  23.4M|    s->sym_buf[s->sym_next++] = 0; \
  |  |  358|  23.4M|    s->sym_buf[s->sym_next++] = cc; \
  |  |  359|  23.4M|    s->dyn_ltree[cc].Freq++; \
  |  |  ------------------
  |  |  |  |   83|  23.4M|#define Freq fc.freq
  |  |  ------------------
  |  |  360|  23.4M|    flush = (s->sym_next == s->sym_end); \
  |  |  361|  23.4M|   }
  ------------------
 2014|  23.4M|            if (bflush) {
  ------------------
  |  Branch (2014:17): [True: 1.10k, False: 23.4M]
  ------------------
 2015|  1.10k|                FLUSH_BLOCK_ONLY(s, 0);
  ------------------
  |  | 1597|  1.10k|#define FLUSH_BLOCK_ONLY(s, last) { \
  |  | 1598|  1.10k|   _tr_flush_block(s, (s->block_start >= 0L ? \
  |  |  ------------------
  |  |  |  Branch (1598:24): [True: 541, False: 565]
  |  |  ------------------
  |  | 1599|  1.10k|                   (charf *)&s->window[(unsigned)s->block_start] : \
  |  | 1600|  1.10k|                   (charf *)Z_NULL), \
  |  |  ------------------
  |  |  |  |  212|    565|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  |  |  ------------------
  |  | 1601|  1.10k|                (ulg)((long)s->strstart - s->block_start), \
  |  | 1602|  1.10k|                (last)); \
  |  | 1603|  1.10k|   s->block_start = s->strstart; \
  |  | 1604|  1.10k|   flush_pending(s->strm); \
  |  | 1605|  1.10k|   Tracev((stderr,"[FLUSH]")); \
  |  | 1606|  1.10k|}
  ------------------
 2016|  1.10k|            }
 2017|  23.4M|            s->strstart++;
 2018|  23.4M|            s->lookahead--;
 2019|  23.4M|            if (s->strm->avail_out == 0) return need_more;
  ------------------
  |  Branch (2019:17): [True: 189, False: 23.4M]
  ------------------
 2020|  23.4M|        } else {
 2021|       |            /* There is no previous match to compare with, wait for
 2022|       |             * the next step to decide.
 2023|       |             */
 2024|  10.4M|            s->match_available = 1;
 2025|  10.4M|            s->strstart++;
 2026|  10.4M|            s->lookahead--;
 2027|  10.4M|        }
 2028|  44.2M|    }
 2029|  40.0k|    Assert (flush != Z_NO_FLUSH, "no flush?");
 2030|  40.0k|    if (s->match_available) {
  ------------------
  |  Branch (2030:9): [True: 9.84k, False: 30.2k]
  ------------------
 2031|  9.84k|        Tracevv((stderr,"%c", s->window[s->strstart - 1]));
 2032|  9.84k|        _tr_tally_lit(s, s->window[s->strstart - 1], bflush);
  ------------------
  |  |  355|  9.84k|  { uch cc = (c); \
  |  |  356|  9.84k|    s->sym_buf[s->sym_next++] = 0; \
  |  |  357|  9.84k|    s->sym_buf[s->sym_next++] = 0; \
  |  |  358|  9.84k|    s->sym_buf[s->sym_next++] = cc; \
  |  |  359|  9.84k|    s->dyn_ltree[cc].Freq++; \
  |  |  ------------------
  |  |  |  |   83|  9.84k|#define Freq fc.freq
  |  |  ------------------
  |  |  360|  9.84k|    flush = (s->sym_next == s->sym_end); \
  |  |  361|  9.84k|   }
  ------------------
 2033|  9.84k|        s->match_available = 0;
 2034|  9.84k|    }
 2035|  40.0k|    s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
  ------------------
  |  |   86|  40.0k|#define MIN_MATCH  3
  ------------------
                  s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
  ------------------
  |  |   86|  40.0k|#define MIN_MATCH  3
  ------------------
  |  Branch (2035:17): [True: 50, False: 40.0k]
  ------------------
 2036|  40.0k|    if (flush == Z_FINISH) {
  ------------------
  |  |  172|  40.0k|#define Z_FINISH        4
  ------------------
  |  Branch (2036:9): [True: 40.0k, False: 0]
  ------------------
 2037|  40.0k|        FLUSH_BLOCK(s, 1);
  ------------------
  |  | 1609|  40.0k|#define FLUSH_BLOCK(s, last) { \
  |  | 1610|  40.0k|   FLUSH_BLOCK_ONLY(s, last); \
  |  |  ------------------
  |  |  |  | 1597|  40.0k|#define FLUSH_BLOCK_ONLY(s, last) { \
  |  |  |  | 1598|  40.0k|   _tr_flush_block(s, (s->block_start >= 0L ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1598:24): [True: 39.8k, False: 232]
  |  |  |  |  ------------------
  |  |  |  | 1599|  40.0k|                   (charf *)&s->window[(unsigned)s->block_start] : \
  |  |  |  | 1600|  40.0k|                   (charf *)Z_NULL), \
  |  |  |  |  ------------------
  |  |  |  |  |  |  212|    232|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  |  |  |  |  ------------------
  |  |  |  | 1601|  40.0k|                (ulg)((long)s->strstart - s->block_start), \
  |  |  |  | 1602|  40.0k|                (last)); \
  |  |  |  | 1603|  40.0k|   s->block_start = s->strstart; \
  |  |  |  | 1604|  40.0k|   flush_pending(s->strm); \
  |  |  |  | 1605|  40.0k|   Tracev((stderr,"[FLUSH]")); \
  |  |  |  | 1606|  40.0k|}
  |  |  ------------------
  |  | 1611|  40.0k|   if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (1611:8): [True: 0, False: 40.0k]
  |  |  |  Branch (1611:40): [Folded - Ignored]
  |  |  ------------------
  |  | 1612|  40.0k|}
  ------------------
 2038|  40.0k|        return finish_done;
 2039|  40.0k|    }
 2040|      0|    if (s->sym_next)
  ------------------
  |  Branch (2040:9): [True: 0, False: 0]
  ------------------
 2041|      0|        FLUSH_BLOCK(s, 0);
  ------------------
  |  | 1609|      0|#define FLUSH_BLOCK(s, last) { \
  |  | 1610|      0|   FLUSH_BLOCK_ONLY(s, last); \
  |  |  ------------------
  |  |  |  | 1597|      0|#define FLUSH_BLOCK_ONLY(s, last) { \
  |  |  |  | 1598|      0|   _tr_flush_block(s, (s->block_start >= 0L ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1598:24): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1599|      0|                   (charf *)&s->window[(unsigned)s->block_start] : \
  |  |  |  | 1600|      0|                   (charf *)Z_NULL), \
  |  |  |  |  ------------------
  |  |  |  |  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  |  |  |  |  ------------------
  |  |  |  | 1601|      0|                (ulg)((long)s->strstart - s->block_start), \
  |  |  |  | 1602|      0|                (last)); \
  |  |  |  | 1603|      0|   s->block_start = s->strstart; \
  |  |  |  | 1604|      0|   flush_pending(s->strm); \
  |  |  |  | 1605|      0|   Tracev((stderr,"[FLUSH]")); \
  |  |  |  | 1606|      0|}
  |  |  ------------------
  |  | 1611|      0|   if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (1611:8): [True: 0, False: 0]
  |  |  |  Branch (1611:40): [Folded - Ignored]
  |  |  ------------------
  |  | 1612|      0|}
  ------------------
 2042|      0|    return block_done;
 2043|      0|}
deflate.c:slide_hash:
  187|  62.9k|local void slide_hash(deflate_state *s) {
  188|  62.9k|    unsigned n, m;
  189|  62.9k|    Posf *p;
  190|  62.9k|    uInt wsize = s->w_size;
  191|       |
  192|  62.9k|    n = s->hash_size;
  193|  62.9k|    p = &s->head[n];
  194|  2.06G|    do {
  195|  2.06G|        m = *--p;
  196|  2.06G|        *p = (Pos)(m >= wsize ? m - wsize : NIL);
  ------------------
  |  |   85|  2.04G|#define NIL 0
  ------------------
  |  Branch (196:20): [True: 15.3M, False: 2.04G]
  ------------------
  197|  2.06G|    } while (--n);
  ------------------
  |  Branch (197:14): [True: 2.06G, False: 62.9k]
  ------------------
  198|  62.9k|    n = wsize;
  199|  62.9k|#ifndef FASTEST
  200|  62.9k|    p = &s->prev[n];
  201|  2.06G|    do {
  202|  2.06G|        m = *--p;
  203|  2.06G|        *p = (Pos)(m >= wsize ? m - wsize : NIL);
  ------------------
  |  |   85|  24.0M|#define NIL 0
  ------------------
  |  Branch (203:20): [True: 2.03G, False: 24.0M]
  ------------------
  204|       |        /* If n is not on any hash chain, prev[n] is garbage but
  205|       |         * its value will never be used.
  206|       |         */
  207|  2.06G|    } while (--n);
  ------------------
  |  Branch (207:14): [True: 2.06G, False: 62.9k]
  ------------------
  208|  62.9k|#endif
  209|  62.9k|}
deflate.c:flush_pending:
  923|   122k|local void flush_pending(z_streamp strm) {
  924|   122k|    unsigned len;
  925|   122k|    deflate_state *s = strm->state;
  926|       |
  927|   122k|    _tr_flush_bits(s);
  928|   122k|    len = s->pending;
  929|   122k|    if (len > strm->avail_out) len = strm->avail_out;
  ------------------
  |  Branch (929:9): [True: 223, False: 122k]
  ------------------
  930|   122k|    if (len == 0) return;
  ------------------
  |  Branch (930:9): [True: 0, False: 122k]
  ------------------
  931|       |
  932|   122k|    zmemcpy(strm->next_out, s->pending_out, len);
  ------------------
  |  |  210|   122k|#    define zmemcpy memcpy
  ------------------
  933|   122k|    strm->next_out  += len;
  934|   122k|    s->pending_out  += len;
  935|   122k|    strm->total_out += len;
  936|   122k|    strm->avail_out -= len;
  937|   122k|    s->pending      -= len;
  938|   122k|    if (s->pending == 0) {
  ------------------
  |  Branch (938:9): [True: 122k, False: 223]
  ------------------
  939|   122k|        s->pending_out = s->pending_buf;
  940|   122k|    }
  941|   122k|}
deflate.c:putShortMSB:
  912|   120k|local void putShortMSB(deflate_state *s, uInt b) {
  913|   120k|    put_byte(s, (Byte)(b >> 8));
  ------------------
  |  |  290|   120k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
  914|   120k|    put_byte(s, (Byte)(b & 0xff));
  ------------------
  |  |  290|   120k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
  915|   120k|}

inflate_fast:
   50|  2.57k|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
   51|  2.57k|    struct inflate_state FAR *state;
   52|  2.57k|    z_const unsigned char FAR *in;      /* local strm->next_in */
   53|  2.57k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
   54|  2.57k|    unsigned char FAR *out;     /* local strm->next_out */
   55|  2.57k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
   56|  2.57k|    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|  2.57k|    unsigned wsize;             /* window size or zero if not using window */
   61|  2.57k|    unsigned whave;             /* valid bytes in the window */
   62|  2.57k|    unsigned wnext;             /* window write index */
   63|  2.57k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
   64|  2.57k|    unsigned long hold;         /* local strm->hold */
   65|  2.57k|    unsigned bits;              /* local strm->bits */
   66|  2.57k|    code const FAR *lcode;      /* local strm->lencode */
   67|  2.57k|    code const FAR *dcode;      /* local strm->distcode */
   68|  2.57k|    unsigned lmask;             /* mask for first level of length codes */
   69|  2.57k|    unsigned dmask;             /* mask for first level of distance codes */
   70|  2.57k|    code const *here;           /* retrieved table entry */
   71|  2.57k|    unsigned op;                /* code bits, operation, extra bits, or */
   72|       |                                /*  window position, window bytes to copy */
   73|  2.57k|    unsigned len;               /* match length, unused bytes */
   74|  2.57k|    unsigned dist;              /* match distance */
   75|  2.57k|    unsigned char FAR *from;    /* where to copy match from */
   76|       |
   77|       |    /* copy state to local variables */
   78|  2.57k|    state = (struct inflate_state FAR *)strm->state;
   79|  2.57k|    in = strm->next_in;
   80|  2.57k|    last = in + (strm->avail_in - 5);
   81|  2.57k|    out = strm->next_out;
   82|  2.57k|    beg = out - (start - strm->avail_out);
   83|  2.57k|    end = out + (strm->avail_out - 257);
   84|       |#ifdef INFLATE_STRICT
   85|       |    dmax = state->dmax;
   86|       |#endif
   87|  2.57k|    wsize = state->wsize;
   88|  2.57k|    whave = state->whave;
   89|  2.57k|    wnext = state->wnext;
   90|  2.57k|    window = state->window;
   91|  2.57k|    hold = state->hold;
   92|  2.57k|    bits = state->bits;
   93|  2.57k|    lcode = state->lencode;
   94|  2.57k|    dcode = state->distcode;
   95|  2.57k|    lmask = (1U << state->lenbits) - 1;
   96|  2.57k|    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.02M|    do {
  101|  2.02M|        if (bits < 15) {
  ------------------
  |  Branch (101:13): [True: 1.19M, False: 824k]
  ------------------
  102|  1.19M|            hold += (unsigned long)(*in++) << bits;
  103|  1.19M|            bits += 8;
  104|  1.19M|            hold += (unsigned long)(*in++) << bits;
  105|  1.19M|            bits += 8;
  106|  1.19M|        }
  107|  2.02M|        here = lcode + (hold & lmask);
  108|  2.12M|      dolen:
  109|  2.12M|        op = (unsigned)(here->bits);
  110|  2.12M|        hold >>= op;
  111|  2.12M|        bits -= op;
  112|  2.12M|        op = (unsigned)(here->op);
  113|  2.12M|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (113:13): [True: 535k, False: 1.58M]
  ------------------
  114|   535k|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  115|   535k|                    "inflate:         literal '%c'\n" :
  116|   535k|                    "inflate:         literal 0x%02x\n", here->val));
  117|   535k|            *out++ = (unsigned char)(here->val);
  118|   535k|        }
  119|  1.58M|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (119:18): [True: 1.48M, False: 104k]
  ------------------
  120|  1.48M|            len = (unsigned)(here->val);
  121|  1.48M|            op &= 15;                           /* number of extra bits */
  122|  1.48M|            if (op) {
  ------------------
  |  Branch (122:17): [True: 186k, False: 1.29M]
  ------------------
  123|   186k|                if (bits < op) {
  ------------------
  |  Branch (123:21): [True: 7.50k, False: 179k]
  ------------------
  124|  7.50k|                    hold += (unsigned long)(*in++) << bits;
  125|  7.50k|                    bits += 8;
  126|  7.50k|                }
  127|   186k|                len += (unsigned)hold & ((1U << op) - 1);
  128|   186k|                hold >>= op;
  129|   186k|                bits -= op;
  130|   186k|            }
  131|  1.48M|            Tracevv((stderr, "inflate:         length %u\n", len));
  132|  1.48M|            if (bits < 15) {
  ------------------
  |  Branch (132:17): [True: 429k, False: 1.05M]
  ------------------
  133|   429k|                hold += (unsigned long)(*in++) << bits;
  134|   429k|                bits += 8;
  135|   429k|                hold += (unsigned long)(*in++) << bits;
  136|   429k|                bits += 8;
  137|   429k|            }
  138|  1.48M|            here = dcode + (hold & dmask);
  139|  1.51M|          dodist:
  140|  1.51M|            op = (unsigned)(here->bits);
  141|  1.51M|            hold >>= op;
  142|  1.51M|            bits -= op;
  143|  1.51M|            op = (unsigned)(here->op);
  144|  1.51M|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (144:17): [True: 1.48M, False: 29.5k]
  ------------------
  145|  1.48M|                dist = (unsigned)(here->val);
  146|  1.48M|                op &= 15;                       /* number of extra bits */
  147|  1.48M|                if (bits < op) {
  ------------------
  |  Branch (147:21): [True: 7.65k, False: 1.47M]
  ------------------
  148|  7.65k|                    hold += (unsigned long)(*in++) << bits;
  149|  7.65k|                    bits += 8;
  150|  7.65k|                    if (bits < op) {
  ------------------
  |  Branch (150:25): [True: 0, False: 7.65k]
  ------------------
  151|      0|                        hold += (unsigned long)(*in++) << bits;
  152|      0|                        bits += 8;
  153|      0|                    }
  154|  7.65k|                }
  155|  1.48M|                dist += (unsigned)hold & ((1U << op) - 1);
  156|       |#ifdef INFLATE_STRICT
  157|       |                if (dist > dmax) {
  158|       |                    strm->msg = (z_const char *)"invalid distance too far back";
  159|       |                    state->mode = BAD;
  160|       |                    break;
  161|       |                }
  162|       |#endif
  163|  1.48M|                hold >>= op;
  164|  1.48M|                bits -= op;
  165|  1.48M|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  166|  1.48M|                op = (unsigned)(out - beg);     /* max distance in output */
  167|  1.48M|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (167:21): [True: 27.6k, False: 1.45M]
  ------------------
  168|  27.6k|                    op = dist - op;             /* distance back in window */
  169|  27.6k|                    if (op > whave) {
  ------------------
  |  Branch (169:25): [True: 77, False: 27.6k]
  ------------------
  170|     77|                        if (state->sane) {
  ------------------
  |  Branch (170:29): [True: 77, False: 0]
  ------------------
  171|     77|                            strm->msg =
  172|     77|                                (z_const char *)"invalid distance too far back";
  173|     77|                            state->mode = BAD;
  174|     77|                            break;
  175|     77|                        }
  176|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  177|       |                        if (len <= op - whave) {
  178|       |                            do {
  179|       |                                *out++ = 0;
  180|       |                            } while (--len);
  181|       |                            continue;
  182|       |                        }
  183|       |                        len -= op - whave;
  184|       |                        do {
  185|       |                            *out++ = 0;
  186|       |                        } while (--op > whave);
  187|       |                        if (op == 0) {
  188|       |                            from = out - dist;
  189|       |                            do {
  190|       |                                *out++ = *from++;
  191|       |                            } while (--len);
  192|       |                            continue;
  193|       |                        }
  194|       |#endif
  195|     77|                    }
  196|  27.6k|                    from = window;
  197|  27.6k|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (197:25): [True: 27.6k, False: 0]
  ------------------
  198|  27.6k|                        from += wsize - op;
  199|  27.6k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (199:29): [True: 145, False: 27.4k]
  ------------------
  200|    145|                            len -= op;
  201|  5.22k|                            do {
  202|  5.22k|                                *out++ = *from++;
  203|  5.22k|                            } while (--op);
  ------------------
  |  Branch (203:38): [True: 5.07k, False: 145]
  ------------------
  204|    145|                            from = out - dist;  /* rest from output */
  205|    145|                        }
  206|  27.6k|                    }
  207|      0|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (207:30): [True: 0, False: 0]
  ------------------
  208|      0|                        from += wsize + wnext - op;
  209|      0|                        op -= wnext;
  210|      0|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (210:29): [True: 0, False: 0]
  ------------------
  211|      0|                            len -= op;
  212|      0|                            do {
  213|      0|                                *out++ = *from++;
  214|      0|                            } while (--op);
  ------------------
  |  Branch (214:38): [True: 0, False: 0]
  ------------------
  215|      0|                            from = window;
  216|      0|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (216:33): [True: 0, False: 0]
  ------------------
  217|      0|                                op = wnext;
  218|      0|                                len -= op;
  219|      0|                                do {
  220|      0|                                    *out++ = *from++;
  221|      0|                                } while (--op);
  ------------------
  |  Branch (221:42): [True: 0, False: 0]
  ------------------
  222|      0|                                from = out - dist;      /* rest from output */
  223|      0|                            }
  224|      0|                        }
  225|      0|                    }
  226|      0|                    else {                      /* contiguous in window */
  227|      0|                        from += wnext - op;
  228|      0|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (228:29): [True: 0, False: 0]
  ------------------
  229|      0|                            len -= op;
  230|      0|                            do {
  231|      0|                                *out++ = *from++;
  232|      0|                            } while (--op);
  ------------------
  |  Branch (232:38): [True: 0, False: 0]
  ------------------
  233|      0|                            from = out - dist;  /* rest from output */
  234|      0|                        }
  235|      0|                    }
  236|   117k|                    while (len > 2) {
  ------------------
  |  Branch (236:28): [True: 89.5k, False: 27.6k]
  ------------------
  237|  89.5k|                        *out++ = *from++;
  238|  89.5k|                        *out++ = *from++;
  239|  89.5k|                        *out++ = *from++;
  240|  89.5k|                        len -= 3;
  241|  89.5k|                    }
  242|  27.6k|                    if (len) {
  ------------------
  |  Branch (242:25): [True: 15.0k, False: 12.5k]
  ------------------
  243|  15.0k|                        *out++ = *from++;
  244|  15.0k|                        if (len > 1)
  ------------------
  |  Branch (244:29): [True: 5.46k, False: 9.57k]
  ------------------
  245|  5.46k|                            *out++ = *from++;
  246|  15.0k|                    }
  247|  27.6k|                }
  248|  1.45M|                else {
  249|  1.45M|                    from = out - dist;          /* copy direct from output */
  250|  6.52M|                    do {                        /* minimum length is three */
  251|  6.52M|                        *out++ = *from++;
  252|  6.52M|                        *out++ = *from++;
  253|  6.52M|                        *out++ = *from++;
  254|  6.52M|                        len -= 3;
  255|  6.52M|                    } while (len > 2);
  ------------------
  |  Branch (255:30): [True: 5.06M, False: 1.45M]
  ------------------
  256|  1.45M|                    if (len) {
  ------------------
  |  Branch (256:25): [True: 855k, False: 600k]
  ------------------
  257|   855k|                        *out++ = *from++;
  258|   855k|                        if (len > 1)
  ------------------
  |  Branch (258:29): [True: 140k, False: 714k]
  ------------------
  259|   140k|                            *out++ = *from++;
  260|   855k|                    }
  261|  1.45M|                }
  262|  1.48M|            }
  263|  29.5k|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (263:22): [True: 29.5k, False: 5]
  ------------------
  264|  29.5k|                here = dcode + here->val + (hold & ((1U << op) - 1));
  265|  29.5k|                goto dodist;
  266|  29.5k|            }
  267|      5|            else {
  268|      5|                strm->msg = (z_const char *)"invalid distance code";
  269|      5|                state->mode = BAD;
  270|      5|                break;
  271|      5|            }
  272|  1.51M|        }
  273|   104k|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (273:18): [True: 102k, False: 1.89k]
  ------------------
  274|   102k|            here = lcode + here->val + (hold & ((1U << op) - 1));
  275|   102k|            goto dolen;
  276|   102k|        }
  277|  1.89k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (277:18): [True: 1.89k, False: 0]
  ------------------
  278|  1.89k|            Tracevv((stderr, "inflate:         end of block\n"));
  279|  1.89k|            state->mode = TYPE;
  280|  1.89k|            break;
  281|  1.89k|        }
  282|      0|        else {
  283|      0|            strm->msg = (z_const char *)"invalid literal/length code";
  284|      0|            state->mode = BAD;
  285|      0|            break;
  286|      0|        }
  287|  2.12M|    } while (in < last && out < end);
  ------------------
  |  Branch (287:14): [True: 2.01M, False: 389]
  |  Branch (287:27): [True: 2.01M, False: 208]
  ------------------
  288|       |
  289|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  290|  2.57k|    len = bits >> 3;
  291|  2.57k|    in -= len;
  292|  2.57k|    bits -= len << 3;
  293|  2.57k|    hold &= (1U << bits) - 1;
  294|       |
  295|       |    /* update state and return */
  296|  2.57k|    strm->next_in = in;
  297|  2.57k|    strm->next_out = out;
  298|  2.57k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (298:33): [True: 1.85k, False: 722]
  ------------------
  299|  2.57k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (299:34): [True: 2.36k, False: 208]
  ------------------
  300|  2.36k|                                 257 + (end - out) : 257 - (out - end));
  301|  2.57k|    state->hold = hold;
  302|  2.57k|    state->bits = bits;
  303|  2.57k|    return;
  304|  2.57k|}

inflateResetKeep:
  106|  24.6k|int ZEXPORT inflateResetKeep(z_streamp strm) {
  107|  24.6k|    struct inflate_state FAR *state;
  108|       |
  109|  24.6k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (109:9): [True: 0, False: 24.6k]
  ------------------
  110|  24.6k|    state = (struct inflate_state FAR *)strm->state;
  111|  24.6k|    strm->total_in = strm->total_out = state->total = 0;
  112|  24.6k|    strm->msg = Z_NULL;
  ------------------
  |  |  212|  24.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  113|  24.6k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (113:9): [True: 24.6k, False: 0]
  ------------------
  114|  24.6k|        strm->adler = state->wrap & 1;
  115|  24.6k|    state->mode = HEAD;
  116|  24.6k|    state->last = 0;
  117|  24.6k|    state->havedict = 0;
  118|  24.6k|    state->flags = -1;
  119|  24.6k|    state->dmax = 32768U;
  120|  24.6k|    state->head = Z_NULL;
  ------------------
  |  |  212|  24.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  121|  24.6k|    state->hold = 0;
  122|  24.6k|    state->bits = 0;
  123|  24.6k|    state->lencode = state->distcode = state->next = state->codes;
  124|  24.6k|    state->sane = 1;
  125|  24.6k|    state->back = -1;
  126|  24.6k|    Tracev((stderr, "inflate: reset\n"));
  127|  24.6k|    return Z_OK;
  ------------------
  |  |  177|  24.6k|#define Z_OK            0
  ------------------
  128|  24.6k|}
inflateReset:
  130|  24.6k|int ZEXPORT inflateReset(z_streamp strm) {
  131|  24.6k|    struct inflate_state FAR *state;
  132|       |
  133|  24.6k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (133:9): [True: 0, False: 24.6k]
  ------------------
  134|  24.6k|    state = (struct inflate_state FAR *)strm->state;
  135|  24.6k|    state->wsize = 0;
  136|  24.6k|    state->whave = 0;
  137|  24.6k|    state->wnext = 0;
  138|  24.6k|    return inflateResetKeep(strm);
  139|  24.6k|}
inflateReset2:
  141|  24.6k|int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
  142|  24.6k|    int wrap;
  143|  24.6k|    struct inflate_state FAR *state;
  144|       |
  145|       |    /* get the state */
  146|  24.6k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (146:9): [True: 0, False: 24.6k]
  ------------------
  147|  24.6k|    state = (struct inflate_state FAR *)strm->state;
  148|       |
  149|       |    /* extract wrap request from windowBits parameter */
  150|  24.6k|    if (windowBits < 0) {
  ------------------
  |  Branch (150:9): [True: 0, False: 24.6k]
  ------------------
  151|      0|        if (windowBits < -15)
  ------------------
  |  Branch (151:13): [True: 0, False: 0]
  ------------------
  152|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  153|      0|        wrap = 0;
  154|      0|        windowBits = -windowBits;
  155|      0|    }
  156|  24.6k|    else {
  157|  24.6k|        wrap = (windowBits >> 4) + 5;
  158|  24.6k|#ifdef GUNZIP
  159|  24.6k|        if (windowBits < 48)
  ------------------
  |  Branch (159:13): [True: 24.6k, False: 0]
  ------------------
  160|  24.6k|            windowBits &= 15;
  161|  24.6k|#endif
  162|  24.6k|    }
  163|       |
  164|       |    /* set number of window bits, free window if different */
  165|  24.6k|    if (windowBits && (windowBits < 8 || windowBits > 15))
  ------------------
  |  Branch (165:9): [True: 24.6k, False: 0]
  |  Branch (165:24): [True: 0, False: 24.6k]
  |  Branch (165:42): [True: 0, False: 24.6k]
  ------------------
  166|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  167|  24.6k|    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
  ------------------
  |  |  212|  49.3k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (167:9): [True: 0, False: 24.6k]
  |  Branch (167:36): [True: 0, False: 0]
  ------------------
  168|      0|        ZFREE(strm, state->window);
  ------------------
  |  |  248|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  169|      0|        state->window = Z_NULL;
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  170|      0|    }
  171|       |
  172|       |    /* update state and reset the rest of it */
  173|  24.6k|    state->wrap = wrap;
  174|  24.6k|    state->wbits = (unsigned)windowBits;
  175|  24.6k|    return inflateReset(strm);
  176|  24.6k|}
inflateInit2_:
  179|  24.6k|                          const char *version, int stream_size) {
  180|  24.6k|    int ret;
  181|  24.6k|    struct inflate_state FAR *state;
  182|       |
  183|  24.6k|    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |  212|  49.3k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |   40|  24.6k|#define ZLIB_VERSION "1.3.1.1-motley"
  ------------------
  |  Branch (183:9): [True: 0, False: 24.6k]
  |  Branch (183:30): [True: 0, False: 24.6k]
  ------------------
  184|  24.6k|        stream_size != (int)(sizeof(z_stream)))
  ------------------
  |  Branch (184:9): [True: 0, False: 24.6k]
  ------------------
  185|      0|        return Z_VERSION_ERROR;
  ------------------
  |  |  185|      0|#define Z_VERSION_ERROR (-6)
  ------------------
  186|  24.6k|    if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  212|  24.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (186:9): [True: 0, False: 24.6k]
  ------------------
  187|  24.6k|    strm->msg = Z_NULL;                 /* in case we return an error */
  ------------------
  |  |  212|  24.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  188|  24.6k|    if (strm->zalloc == (alloc_func)0) {
  ------------------
  |  Branch (188:9): [True: 24.6k, False: 0]
  ------------------
  189|       |#ifdef Z_SOLO
  190|       |        return Z_STREAM_ERROR;
  191|       |#else
  192|  24.6k|        strm->zalloc = zcalloc;
  193|  24.6k|        strm->opaque = (voidpf)0;
  194|  24.6k|#endif
  195|  24.6k|    }
  196|  24.6k|    if (strm->zfree == (free_func)0)
  ------------------
  |  Branch (196:9): [True: 24.6k, False: 0]
  ------------------
  197|       |#ifdef Z_SOLO
  198|       |        return Z_STREAM_ERROR;
  199|       |#else
  200|  24.6k|        strm->zfree = zcfree;
  201|  24.6k|#endif
  202|  24.6k|    state = (struct inflate_state FAR *)
  203|  24.6k|            ZALLOC(strm, 1, sizeof(struct inflate_state));
  ------------------
  |  |  247|  24.6k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  204|  24.6k|    if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  212|  24.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  183|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  |  Branch (204:9): [True: 0, False: 24.6k]
  ------------------
  205|  24.6k|    Tracev((stderr, "inflate: allocated\n"));
  206|  24.6k|    strm->state = (struct internal_state FAR *)state;
  207|  24.6k|    state->strm = strm;
  208|  24.6k|    state->window = Z_NULL;
  ------------------
  |  |  212|  24.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  209|  24.6k|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  210|  24.6k|    ret = inflateReset2(strm, windowBits);
  211|  24.6k|    if (ret != Z_OK) {
  ------------------
  |  |  177|  24.6k|#define Z_OK            0
  ------------------
  |  Branch (211:9): [True: 0, False: 24.6k]
  ------------------
  212|      0|        ZFREE(strm, state);
  ------------------
  |  |  248|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  213|      0|        strm->state = Z_NULL;
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  214|      0|    }
  215|  24.6k|    return ret;
  216|  24.6k|}
inflateInit_:
  219|  24.6k|                         int stream_size) {
  220|  24.6k|    return inflateInit2_(strm, DEF_WBITS, version, stream_size);
  ------------------
  |  |   70|  24.6k|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |  278|  24.6k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  221|  24.6k|}
inflate:
  590|   412k|int ZEXPORT inflate(z_streamp strm, int flush) {
  591|   412k|    struct inflate_state FAR *state;
  592|   412k|    z_const unsigned char FAR *next;    /* next input */
  593|   412k|    unsigned char FAR *put;     /* next output */
  594|   412k|    unsigned have, left;        /* available input and output */
  595|   412k|    unsigned long hold;         /* bit buffer */
  596|   412k|    unsigned bits;              /* bits in bit buffer */
  597|   412k|    unsigned in, out;           /* save starting available input and output */
  598|   412k|    unsigned copy;              /* number of stored or match bytes to copy */
  599|   412k|    unsigned char FAR *from;    /* where to copy match bytes from */
  600|   412k|    code here;                  /* current decoding table entry */
  601|   412k|    code last;                  /* parent table entry */
  602|   412k|    unsigned len;               /* length to copy for repeats, bits to drop */
  603|   412k|    int ret;                    /* return code */
  604|   412k|#ifdef GUNZIP
  605|   412k|    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
  606|   412k|#endif
  607|   412k|    static const unsigned short order[19] = /* permutation of code lengths */
  608|   412k|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  609|       |
  610|   412k|    if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
  ------------------
  |  |  212|   825k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (610:9): [True: 0, False: 412k]
  |  Branch (610:36): [True: 0, False: 412k]
  ------------------
  611|   412k|        (strm->next_in == Z_NULL && strm->avail_in != 0))
  ------------------
  |  |  212|   825k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (611:10): [True: 0, False: 412k]
  |  Branch (611:37): [True: 0, False: 0]
  ------------------
  612|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  613|       |
  614|   412k|    state = (struct inflate_state FAR *)strm->state;
  615|   412k|    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
  ------------------
  |  Branch (615:9): [True: 5.08k, False: 407k]
  ------------------
  616|   412k|    LOAD();
  ------------------
  |  |  445|   412k|    do { \
  |  |  446|   412k|        put = strm->next_out; \
  |  |  447|   412k|        left = strm->avail_out; \
  |  |  448|   412k|        next = strm->next_in; \
  |  |  449|   412k|        have = strm->avail_in; \
  |  |  450|   412k|        hold = state->hold; \
  |  |  451|   412k|        bits = state->bits; \
  |  |  452|   412k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (452:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  617|   412k|    in = have;
  618|   412k|    out = left;
  619|   412k|    ret = Z_OK;
  ------------------
  |  |  177|   412k|#define Z_OK            0
  ------------------
  620|   412k|    for (;;)
  621|  2.44M|        switch (state->mode) {
  622|  24.6k|        case HEAD:
  ------------------
  |  Branch (622:9): [True: 24.6k, False: 2.42M]
  ------------------
  623|  24.6k|            if (state->wrap == 0) {
  ------------------
  |  Branch (623:17): [True: 0, False: 24.6k]
  ------------------
  624|      0|                state->mode = TYPEDO;
  625|      0|                break;
  626|      0|            }
  627|  24.6k|            NEEDBITS(16);
  ------------------
  |  |  485|  24.6k|    do { \
  |  |  486|  74.0k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 49.3k, False: 24.6k]
  |  |  ------------------
  |  |  487|  49.3k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  49.3k|    do { \
  |  |  |  |  476|  49.3k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 4, False: 49.3k]
  |  |  |  |  ------------------
  |  |  |  |  477|  49.3k|        have--; \
  |  |  |  |  478|  49.3k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  49.3k|        bits += 8; \
  |  |  |  |  480|  49.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  24.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  628|  24.6k|#ifdef GUNZIP
  629|  24.6k|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (629:17): [True: 0, False: 24.6k]
  |  Branch (629:38): [True: 0, False: 0]
  ------------------
  630|      0|                if (state->wbits == 0)
  ------------------
  |  Branch (630:21): [True: 0, False: 0]
  ------------------
  631|      0|                    state->wbits = 15;
  632|      0|                state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  633|      0|                CRC2(state->check, hold);
  ------------------
  |  |  427|      0|    do { \
  |  |  428|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  429|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  430|      0|        check = crc32(check, hbuf, 2); \
  |  |  431|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (431:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  634|      0|                INITBITS();
  ------------------
  |  |  467|      0|    do { \
  |  |  468|      0|        hold = 0; \
  |  |  469|      0|        bits = 0; \
  |  |  470|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  635|      0|                state->mode = FLAGS;
  636|      0|                break;
  637|      0|            }
  638|  24.6k|            if (state->head != Z_NULL)
  ------------------
  |  |  212|  24.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (638:17): [True: 0, False: 24.6k]
  ------------------
  639|      0|                state->head->done = -1;
  640|  24.6k|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (640:17): [True: 0, False: 24.6k]
  ------------------
  641|       |#else
  642|       |            if (
  643|       |#endif
  644|  24.6k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  492|  24.6k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  |  Branch (644:17): [True: 72, False: 24.6k]
  ------------------
  645|     72|                strm->msg = (z_const char *)"incorrect header check";
  646|     72|                state->mode = BAD;
  647|     72|                break;
  648|     72|            }
  649|  24.6k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  492|  24.6k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  209|  24.6k|#define Z_DEFLATED   8
  ------------------
  |  Branch (649:17): [True: 3, False: 24.6k]
  ------------------
  650|      3|                strm->msg = (z_const char *)"unknown compression method";
  651|      3|                state->mode = BAD;
  652|      3|                break;
  653|      3|            }
  654|  24.6k|            DROPBITS(4);
  ------------------
  |  |  496|  24.6k|    do { \
  |  |  497|  24.6k|        hold >>= (n); \
  |  |  498|  24.6k|        bits -= (unsigned)(n); \
  |  |  499|  24.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  655|  24.6k|            len = BITS(4) + 8;
  ------------------
  |  |  492|  24.6k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  656|  24.6k|            if (state->wbits == 0)
  ------------------
  |  Branch (656:17): [True: 0, False: 24.6k]
  ------------------
  657|      0|                state->wbits = len;
  658|  24.6k|            if (len > 15 || len > state->wbits) {
  ------------------
  |  Branch (658:17): [True: 0, False: 24.6k]
  |  Branch (658:29): [True: 0, False: 24.6k]
  ------------------
  659|      0|                strm->msg = (z_const char *)"invalid window size";
  660|      0|                state->mode = BAD;
  661|      0|                break;
  662|      0|            }
  663|  24.6k|            state->dmax = 1U << len;
  664|  24.6k|            state->flags = 0;               /* indicate zlib header */
  665|  24.6k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  666|  24.6k|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  212|  24.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  667|  24.6k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (667:27): [True: 19, False: 24.5k]
  ------------------
  668|  24.6k|            INITBITS();
  ------------------
  |  |  467|  24.6k|    do { \
  |  |  468|  24.6k|        hold = 0; \
  |  |  469|  24.6k|        bits = 0; \
  |  |  470|  24.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  669|  24.6k|            break;
  670|      0|#ifdef GUNZIP
  671|      0|        case FLAGS:
  ------------------
  |  Branch (671:9): [True: 0, False: 2.44M]
  ------------------
  672|      0|            NEEDBITS(16);
  ------------------
  |  |  485|      0|    do { \
  |  |  486|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  487|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|      0|    do { \
  |  |  |  |  476|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  477|      0|        have--; \
  |  |  |  |  478|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|      0|        bits += 8; \
  |  |  |  |  480|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  673|      0|            state->flags = (int)(hold);
  674|      0|            if ((state->flags & 0xff) != Z_DEFLATED) {
  ------------------
  |  |  209|      0|#define Z_DEFLATED   8
  ------------------
  |  Branch (674:17): [True: 0, False: 0]
  ------------------
  675|      0|                strm->msg = (z_const char *)"unknown compression method";
  676|      0|                state->mode = BAD;
  677|      0|                break;
  678|      0|            }
  679|      0|            if (state->flags & 0xe000) {
  ------------------
  |  Branch (679:17): [True: 0, False: 0]
  ------------------
  680|      0|                strm->msg = (z_const char *)"unknown header flags set";
  681|      0|                state->mode = BAD;
  682|      0|                break;
  683|      0|            }
  684|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (684:17): [True: 0, False: 0]
  ------------------
  685|      0|                state->head->text = (int)((hold >> 8) & 1);
  686|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (686:17): [True: 0, False: 0]
  |  Branch (686:44): [True: 0, False: 0]
  ------------------
  687|      0|                CRC2(state->check, hold);
  ------------------
  |  |  427|      0|    do { \
  |  |  428|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  429|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  430|      0|        check = crc32(check, hbuf, 2); \
  |  |  431|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (431:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  688|      0|            INITBITS();
  ------------------
  |  |  467|      0|    do { \
  |  |  468|      0|        hold = 0; \
  |  |  469|      0|        bits = 0; \
  |  |  470|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  689|      0|            state->mode = TIME;
  690|       |                /* fallthrough */
  691|      0|        case TIME:
  ------------------
  |  Branch (691:9): [True: 0, False: 2.44M]
  ------------------
  692|      0|            NEEDBITS(32);
  ------------------
  |  |  485|      0|    do { \
  |  |  486|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  487|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|      0|    do { \
  |  |  |  |  476|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  477|      0|        have--; \
  |  |  |  |  478|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|      0|        bits += 8; \
  |  |  |  |  480|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  693|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (693:17): [True: 0, False: 0]
  ------------------
  694|      0|                state->head->time = hold;
  695|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (695:17): [True: 0, False: 0]
  |  Branch (695:44): [True: 0, False: 0]
  ------------------
  696|      0|                CRC4(state->check, hold);
  ------------------
  |  |  434|      0|    do { \
  |  |  435|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  436|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  437|      0|        hbuf[2] = (unsigned char)((word) >> 16); \
  |  |  438|      0|        hbuf[3] = (unsigned char)((word) >> 24); \
  |  |  439|      0|        check = crc32(check, hbuf, 4); \
  |  |  440|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (440:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  697|      0|            INITBITS();
  ------------------
  |  |  467|      0|    do { \
  |  |  468|      0|        hold = 0; \
  |  |  469|      0|        bits = 0; \
  |  |  470|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  698|      0|            state->mode = OS;
  699|       |                /* fallthrough */
  700|      0|        case OS:
  ------------------
  |  Branch (700:9): [True: 0, False: 2.44M]
  ------------------
  701|      0|            NEEDBITS(16);
  ------------------
  |  |  485|      0|    do { \
  |  |  486|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  487|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|      0|    do { \
  |  |  |  |  476|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  477|      0|        have--; \
  |  |  |  |  478|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|      0|        bits += 8; \
  |  |  |  |  480|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  702|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (702:17): [True: 0, False: 0]
  ------------------
  703|      0|                state->head->xflags = (int)(hold & 0xff);
  704|      0|                state->head->os = (int)(hold >> 8);
  705|      0|            }
  706|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (706:17): [True: 0, False: 0]
  |  Branch (706:44): [True: 0, False: 0]
  ------------------
  707|      0|                CRC2(state->check, hold);
  ------------------
  |  |  427|      0|    do { \
  |  |  428|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  429|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  430|      0|        check = crc32(check, hbuf, 2); \
  |  |  431|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (431:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  708|      0|            INITBITS();
  ------------------
  |  |  467|      0|    do { \
  |  |  468|      0|        hold = 0; \
  |  |  469|      0|        bits = 0; \
  |  |  470|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  709|      0|            state->mode = EXLEN;
  710|       |                /* fallthrough */
  711|      0|        case EXLEN:
  ------------------
  |  Branch (711:9): [True: 0, False: 2.44M]
  ------------------
  712|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (712:17): [True: 0, False: 0]
  ------------------
  713|      0|                NEEDBITS(16);
  ------------------
  |  |  485|      0|    do { \
  |  |  486|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  487|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|      0|    do { \
  |  |  |  |  476|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  477|      0|        have--; \
  |  |  |  |  478|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|      0|        bits += 8; \
  |  |  |  |  480|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  714|      0|                state->length = (unsigned)(hold);
  715|      0|                if (state->head != Z_NULL)
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (715:21): [True: 0, False: 0]
  ------------------
  716|      0|                    state->head->extra_len = (unsigned)hold;
  717|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (717:21): [True: 0, False: 0]
  |  Branch (717:48): [True: 0, False: 0]
  ------------------
  718|      0|                    CRC2(state->check, hold);
  ------------------
  |  |  427|      0|    do { \
  |  |  428|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  429|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  430|      0|        check = crc32(check, hbuf, 2); \
  |  |  431|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (431:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  719|      0|                INITBITS();
  ------------------
  |  |  467|      0|    do { \
  |  |  468|      0|        hold = 0; \
  |  |  469|      0|        bits = 0; \
  |  |  470|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  720|      0|            }
  721|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (721:22): [True: 0, False: 0]
  ------------------
  722|      0|                state->head->extra = Z_NULL;
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  723|      0|            state->mode = EXTRA;
  724|       |                /* fallthrough */
  725|      0|        case EXTRA:
  ------------------
  |  Branch (725:9): [True: 0, False: 2.44M]
  ------------------
  726|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (726:17): [True: 0, False: 0]
  ------------------
  727|      0|                copy = state->length;
  728|      0|                if (copy > have) copy = have;
  ------------------
  |  Branch (728:21): [True: 0, False: 0]
  ------------------
  729|      0|                if (copy) {
  ------------------
  |  Branch (729:21): [True: 0, False: 0]
  ------------------
  730|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (730:25): [True: 0, False: 0]
  ------------------
  731|      0|                        state->head->extra != Z_NULL &&
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (731:25): [True: 0, False: 0]
  ------------------
  732|      0|                        (len = state->head->extra_len - state->length) <
  ------------------
  |  Branch (732:25): [True: 0, False: 0]
  ------------------
  733|      0|                            state->head->extra_max) {
  734|      0|                        zmemcpy(state->head->extra + len, next,
  ------------------
  |  |  210|      0|#    define zmemcpy memcpy
  ------------------
  735|      0|                                len + copy > state->head->extra_max ?
  ------------------
  |  Branch (735:33): [True: 0, False: 0]
  ------------------
  736|      0|                                state->head->extra_max - len : copy);
  737|      0|                    }
  738|      0|                    if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (738:25): [True: 0, False: 0]
  |  Branch (738:52): [True: 0, False: 0]
  ------------------
  739|      0|                        state->check = crc32(state->check, next, copy);
  740|      0|                    have -= copy;
  741|      0|                    next += copy;
  742|      0|                    state->length -= copy;
  743|      0|                }
  744|      0|                if (state->length) goto inf_leave;
  ------------------
  |  Branch (744:21): [True: 0, False: 0]
  ------------------
  745|      0|            }
  746|      0|            state->length = 0;
  747|      0|            state->mode = NAME;
  748|       |                /* fallthrough */
  749|      0|        case NAME:
  ------------------
  |  Branch (749:9): [True: 0, False: 2.44M]
  ------------------
  750|      0|            if (state->flags & 0x0800) {
  ------------------
  |  Branch (750:17): [True: 0, False: 0]
  ------------------
  751|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (751:21): [True: 0, False: 0]
  ------------------
  752|      0|                copy = 0;
  753|      0|                do {
  754|      0|                    len = (unsigned)(next[copy++]);
  755|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (755:25): [True: 0, False: 0]
  ------------------
  756|      0|                            state->head->name != Z_NULL &&
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (756:29): [True: 0, False: 0]
  ------------------
  757|      0|                            state->length < state->head->name_max)
  ------------------
  |  Branch (757:29): [True: 0, False: 0]
  ------------------
  758|      0|                        state->head->name[state->length++] = (Bytef)len;
  759|      0|                } while (len && copy < have);
  ------------------
  |  Branch (759:26): [True: 0, False: 0]
  |  Branch (759:33): [True: 0, False: 0]
  ------------------
  760|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (760:21): [True: 0, False: 0]
  |  Branch (760:48): [True: 0, False: 0]
  ------------------
  761|      0|                    state->check = crc32(state->check, next, copy);
  762|      0|                have -= copy;
  763|      0|                next += copy;
  764|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (764:21): [True: 0, False: 0]
  ------------------
  765|      0|            }
  766|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (766:22): [True: 0, False: 0]
  ------------------
  767|      0|                state->head->name = Z_NULL;
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  768|      0|            state->length = 0;
  769|      0|            state->mode = COMMENT;
  770|       |                /* fallthrough */
  771|      0|        case COMMENT:
  ------------------
  |  Branch (771:9): [True: 0, False: 2.44M]
  ------------------
  772|      0|            if (state->flags & 0x1000) {
  ------------------
  |  Branch (772:17): [True: 0, False: 0]
  ------------------
  773|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (773:21): [True: 0, False: 0]
  ------------------
  774|      0|                copy = 0;
  775|      0|                do {
  776|      0|                    len = (unsigned)(next[copy++]);
  777|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (777:25): [True: 0, False: 0]
  ------------------
  778|      0|                            state->head->comment != Z_NULL &&
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (778:29): [True: 0, False: 0]
  ------------------
  779|      0|                            state->length < state->head->comm_max)
  ------------------
  |  Branch (779:29): [True: 0, False: 0]
  ------------------
  780|      0|                        state->head->comment[state->length++] = (Bytef)len;
  781|      0|                } while (len && copy < have);
  ------------------
  |  Branch (781:26): [True: 0, False: 0]
  |  Branch (781:33): [True: 0, False: 0]
  ------------------
  782|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (782:21): [True: 0, False: 0]
  |  Branch (782:48): [True: 0, False: 0]
  ------------------
  783|      0|                    state->check = crc32(state->check, next, copy);
  784|      0|                have -= copy;
  785|      0|                next += copy;
  786|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (786:21): [True: 0, False: 0]
  ------------------
  787|      0|            }
  788|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (788:22): [True: 0, False: 0]
  ------------------
  789|      0|                state->head->comment = Z_NULL;
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  790|      0|            state->mode = HCRC;
  791|       |                /* fallthrough */
  792|      0|        case HCRC:
  ------------------
  |  Branch (792:9): [True: 0, False: 2.44M]
  ------------------
  793|      0|            if (state->flags & 0x0200) {
  ------------------
  |  Branch (793:17): [True: 0, False: 0]
  ------------------
  794|      0|                NEEDBITS(16);
  ------------------
  |  |  485|      0|    do { \
  |  |  486|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  487|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|      0|    do { \
  |  |  |  |  476|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  477|      0|        have--; \
  |  |  |  |  478|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|      0|        bits += 8; \
  |  |  |  |  480|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  795|      0|                if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
  ------------------
  |  Branch (795:21): [True: 0, False: 0]
  |  Branch (795:42): [True: 0, False: 0]
  ------------------
  796|      0|                    strm->msg = (z_const char *)"header crc mismatch";
  797|      0|                    state->mode = BAD;
  798|      0|                    break;
  799|      0|                }
  800|      0|                INITBITS();
  ------------------
  |  |  467|      0|    do { \
  |  |  468|      0|        hold = 0; \
  |  |  469|      0|        bits = 0; \
  |  |  470|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  801|      0|            }
  802|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (802:17): [True: 0, False: 0]
  ------------------
  803|      0|                state->head->hcrc = (int)((state->flags >> 9) & 1);
  804|      0|                state->head->done = 1;
  805|      0|            }
  806|      0|            strm->adler = state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  807|      0|            state->mode = TYPE;
  808|      0|            break;
  809|      0|#endif
  810|     38|        case DICTID:
  ------------------
  |  Branch (810:9): [True: 38, False: 2.44M]
  ------------------
  811|     38|            NEEDBITS(32);
  ------------------
  |  |  485|     38|    do { \
  |  |  486|    114|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 95, False: 19]
  |  |  ------------------
  |  |  487|     95|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|     95|    do { \
  |  |  |  |  476|     95|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 19, False: 76]
  |  |  |  |  ------------------
  |  |  |  |  477|     95|        have--; \
  |  |  |  |  478|     76|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|     76|        bits += 8; \
  |  |  |  |  480|     76|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|     38|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  812|     19|            strm->adler = state->check = ZSWAP32(hold);
  ------------------
  |  |  252|     19|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  253|     19|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
  813|     19|            INITBITS();
  ------------------
  |  |  467|     19|    do { \
  |  |  468|     19|        hold = 0; \
  |  |  469|     19|        bits = 0; \
  |  |  470|     19|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  814|     19|            state->mode = DICT;
  815|       |                /* fallthrough */
  816|     37|        case DICT:
  ------------------
  |  Branch (816:9): [True: 18, False: 2.44M]
  ------------------
  817|     37|            if (state->havedict == 0) {
  ------------------
  |  Branch (817:17): [True: 37, False: 0]
  ------------------
  818|     37|                RESTORE();
  ------------------
  |  |  456|     37|    do { \
  |  |  457|     37|        strm->next_out = put; \
  |  |  458|     37|        strm->avail_out = left; \
  |  |  459|     37|        strm->next_in = next; \
  |  |  460|     37|        strm->avail_in = have; \
  |  |  461|     37|        state->hold = hold; \
  |  |  462|     37|        state->bits = bits; \
  |  |  463|     37|    } while (0)
  |  |  ------------------
  |  |  |  Branch (463:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  819|     37|                return Z_NEED_DICT;
  ------------------
  |  |  179|     37|#define Z_NEED_DICT     2
  ------------------
  820|     37|            }
  821|      0|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  822|      0|            state->mode = TYPE;
  823|       |                /* fallthrough */
  824|  94.0k|        case TYPE:
  ------------------
  |  Branch (824:9): [True: 94.0k, False: 2.35M]
  ------------------
  825|  94.0k|            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  173|   188k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  174|  94.0k|#define Z_TREES         6
  ------------------
  |  Branch (825:17): [True: 0, False: 94.0k]
  |  Branch (825:37): [True: 0, False: 94.0k]
  ------------------
  826|       |                /* fallthrough */
  827|  99.1k|        case TYPEDO:
  ------------------
  |  Branch (827:9): [True: 5.08k, False: 2.44M]
  ------------------
  828|  99.1k|            if (state->last) {
  ------------------
  |  Branch (828:17): [True: 23.0k, False: 76.0k]
  ------------------
  829|  23.0k|                BYTEBITS();
  ------------------
  |  |  503|  23.0k|    do { \
  |  |  504|  23.0k|        hold >>= bits & 7; \
  |  |  505|  23.0k|        bits -= bits & 7; \
  |  |  506|  23.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (506:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  830|  23.0k|                state->mode = CHECK;
  831|  23.0k|                break;
  832|  23.0k|            }
  833|  76.0k|            NEEDBITS(3);
  ------------------
  |  |  485|  76.0k|    do { \
  |  |  486|   112k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 42.0k, False: 70.9k]
  |  |  ------------------
  |  |  487|  76.0k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  42.0k|    do { \
  |  |  |  |  476|  42.0k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 5.16k, False: 36.8k]
  |  |  |  |  ------------------
  |  |  |  |  477|  42.0k|        have--; \
  |  |  |  |  478|  36.8k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  36.8k|        bits += 8; \
  |  |  |  |  480|  36.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  76.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  834|  70.9k|            state->last = BITS(1);
  ------------------
  |  |  492|  70.9k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  835|  70.9k|            DROPBITS(1);
  ------------------
  |  |  496|  70.9k|    do { \
  |  |  497|  70.9k|        hold >>= (n); \
  |  |  498|  70.9k|        bits -= (unsigned)(n); \
  |  |  499|  70.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  836|  70.9k|            switch (BITS(2)) {
  ------------------
  |  |  492|  70.9k|    ((unsigned)hold & ((1U << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (492:5): [True: 0, False: 70.9k]
  |  |  ------------------
  ------------------
  837|     58|            case 0:                             /* stored block */
  ------------------
  |  Branch (837:13): [True: 58, False: 70.8k]
  ------------------
  838|     58|                Tracev((stderr, "inflate:     stored block%s\n",
  839|     58|                        state->last ? " (last)" : ""));
  840|     58|                state->mode = STORED;
  841|     58|                break;
  842|  46.6k|            case 1:                             /* fixed block */
  ------------------
  |  Branch (842:13): [True: 46.6k, False: 24.2k]
  ------------------
  843|  46.6k|                fixedtables(state);
  844|  46.6k|                Tracev((stderr, "inflate:     fixed codes block%s\n",
  845|  46.6k|                        state->last ? " (last)" : ""));
  846|  46.6k|                state->mode = LEN_;             /* decode codes */
  847|  46.6k|                if (flush == Z_TREES) {
  ------------------
  |  |  174|  46.6k|#define Z_TREES         6
  ------------------
  |  Branch (847:21): [True: 0, False: 46.6k]
  ------------------
  848|      0|                    DROPBITS(2);
  ------------------
  |  |  496|      0|    do { \
  |  |  497|      0|        hold >>= (n); \
  |  |  498|      0|        bits -= (unsigned)(n); \
  |  |  499|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  849|      0|                    goto inf_leave;
  850|      0|                }
  851|  46.6k|                break;
  852|  46.6k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (852:13): [True: 24.1k, False: 46.7k]
  ------------------
  853|  24.1k|                Tracev((stderr, "inflate:     dynamic codes block%s\n",
  854|  24.1k|                        state->last ? " (last)" : ""));
  855|  24.1k|                state->mode = TABLE;
  856|  24.1k|                break;
  857|     63|            case 3:
  ------------------
  |  Branch (857:13): [True: 63, False: 70.8k]
  ------------------
  858|     63|                strm->msg = (z_const char *)"invalid block type";
  859|     63|                state->mode = BAD;
  860|  70.9k|            }
  861|  70.9k|            DROPBITS(2);
  ------------------
  |  |  496|  70.9k|    do { \
  |  |  497|  70.9k|        hold >>= (n); \
  |  |  498|  70.9k|        bits -= (unsigned)(n); \
  |  |  499|  70.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  862|  70.9k|            break;
  863|    113|        case STORED:
  ------------------
  |  Branch (863:9): [True: 113, False: 2.44M]
  ------------------
  864|    113|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  503|    113|    do { \
  |  |  504|    113|        hold >>= bits & 7; \
  |  |  505|    113|        bits -= bits & 7; \
  |  |  506|    113|    } while (0)
  |  |  ------------------
  |  |  |  Branch (506:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  865|    113|            NEEDBITS(32);
  ------------------
  |  |  485|    113|    do { \
  |  |  486|    325|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 278, False: 47]
  |  |  ------------------
  |  |  487|    278|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|    278|    do { \
  |  |  |  |  476|    278|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 66, False: 212]
  |  |  |  |  ------------------
  |  |  |  |  477|    278|        have--; \
  |  |  |  |  478|    212|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|    212|        bits += 8; \
  |  |  |  |  480|    212|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|    113|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  866|     47|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (866:17): [True: 42, False: 5]
  ------------------
  867|     42|                strm->msg = (z_const char *)"invalid stored block lengths";
  868|     42|                state->mode = BAD;
  869|     42|                break;
  870|     42|            }
  871|      5|            state->length = (unsigned)hold & 0xffff;
  872|      5|            Tracev((stderr, "inflate:       stored length %u\n",
  873|      5|                    state->length));
  874|      5|            INITBITS();
  ------------------
  |  |  467|      5|    do { \
  |  |  468|      5|        hold = 0; \
  |  |  469|      5|        bits = 0; \
  |  |  470|      5|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  875|      5|            state->mode = COPY_;
  876|      5|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  174|      5|#define Z_TREES         6
  ------------------
  |  Branch (876:17): [True: 0, False: 5]
  ------------------
  877|       |                /* fallthrough */
  878|      5|        case COPY_:
  ------------------
  |  Branch (878:9): [True: 0, False: 2.44M]
  ------------------
  879|      5|            state->mode = COPY;
  880|       |                /* fallthrough */
  881|     15|        case COPY:
  ------------------
  |  Branch (881:9): [True: 10, False: 2.44M]
  ------------------
  882|     15|            copy = state->length;
  883|     15|            if (copy) {
  ------------------
  |  Branch (883:17): [True: 15, False: 0]
  ------------------
  884|     15|                if (copy > have) copy = have;
  ------------------
  |  Branch (884:21): [True: 15, False: 0]
  ------------------
  885|     15|                if (copy > left) copy = left;
  ------------------
  |  Branch (885:21): [True: 0, False: 15]
  ------------------
  886|     15|                if (copy == 0) goto inf_leave;
  ------------------
  |  Branch (886:21): [True: 10, False: 5]
  ------------------
  887|      5|                zmemcpy(put, next, copy);
  ------------------
  |  |  210|      5|#    define zmemcpy memcpy
  ------------------
  888|      5|                have -= copy;
  889|      5|                next += copy;
  890|      5|                left -= copy;
  891|      5|                put += copy;
  892|      5|                state->length -= copy;
  893|      5|                break;
  894|     15|            }
  895|      0|            Tracev((stderr, "inflate:       stored end\n"));
  896|      0|            state->mode = TYPE;
  897|      0|            break;
  898|  47.4k|        case TABLE:
  ------------------
  |  Branch (898:9): [True: 47.4k, False: 2.40M]
  ------------------
  899|  47.4k|            NEEDBITS(14);
  ------------------
  |  |  485|  47.4k|    do { \
  |  |  486|  95.7k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 71.5k, False: 24.1k]
  |  |  ------------------
  |  |  487|  71.5k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  71.5k|    do { \
  |  |  |  |  476|  71.5k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 23.3k, False: 48.2k]
  |  |  |  |  ------------------
  |  |  |  |  477|  71.5k|        have--; \
  |  |  |  |  478|  48.2k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  48.2k|        bits += 8; \
  |  |  |  |  480|  48.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  47.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  900|  24.1k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  492|  24.1k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  901|  24.1k|            DROPBITS(5);
  ------------------
  |  |  496|  24.1k|    do { \
  |  |  497|  24.1k|        hold >>= (n); \
  |  |  498|  24.1k|        bits -= (unsigned)(n); \
  |  |  499|  24.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  902|  24.1k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  492|  24.1k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  903|  24.1k|            DROPBITS(5);
  ------------------
  |  |  496|  24.1k|    do { \
  |  |  497|  24.1k|        hold >>= (n); \
  |  |  498|  24.1k|        bits -= (unsigned)(n); \
  |  |  499|  24.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  904|  24.1k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  492|  24.1k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  905|  24.1k|            DROPBITS(4);
  ------------------
  |  |  496|  24.1k|    do { \
  |  |  497|  24.1k|        hold >>= (n); \
  |  |  498|  24.1k|        bits -= (unsigned)(n); \
  |  |  499|  24.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  906|  24.1k|#ifndef PKZIP_BUG_WORKAROUND
  907|  24.1k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (907:17): [True: 2, False: 24.1k]
  |  Branch (907:38): [True: 1, False: 24.1k]
  ------------------
  908|      3|                strm->msg = (z_const char *)"too many length or distance symbols";
  909|      3|                state->mode = BAD;
  910|      3|                break;
  911|      3|            }
  912|  24.1k|#endif
  913|  24.1k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  914|  24.1k|            state->have = 0;
  915|  24.1k|            state->mode = LENLENS;
  916|       |                /* fallthrough */
  917|  47.4k|        case LENLENS:
  ------------------
  |  Branch (917:9): [True: 23.3k, False: 2.42M]
  ------------------
  918|   478k|            while (state->have < state->ncode) {
  ------------------
  |  Branch (918:20): [True: 454k, False: 24.1k]
  ------------------
  919|   454k|                NEEDBITS(3);
  ------------------
  |  |  485|   454k|    do { \
  |  |  486|   598k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 167k, False: 431k]
  |  |  ------------------
  |  |  487|   454k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|   167k|    do { \
  |  |  |  |  476|   167k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 23.3k, False: 144k]
  |  |  |  |  ------------------
  |  |  |  |  477|   167k|        have--; \
  |  |  |  |  478|   144k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|   144k|        bits += 8; \
  |  |  |  |  480|   144k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|   454k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  920|   431k|                state->lens[order[state->have++]] = (unsigned short)BITS(3);
  ------------------
  |  |  492|   431k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  921|   431k|                DROPBITS(3);
  ------------------
  |  |  496|   431k|    do { \
  |  |  497|   431k|        hold >>= (n); \
  |  |  498|   431k|        bits -= (unsigned)(n); \
  |  |  499|   431k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  922|   431k|            }
  923|  51.5k|            while (state->have < 19)
  ------------------
  |  Branch (923:20): [True: 27.3k, False: 24.1k]
  ------------------
  924|  27.3k|                state->lens[order[state->have++]] = 0;
  925|  24.1k|            state->next = state->codes;
  926|  24.1k|            state->lencode = state->distcode = (const code FAR *)(state->next);
  927|  24.1k|            state->lenbits = 7;
  928|  24.1k|            ret = inflate_table(CODES, state->lens, 19, &(state->next),
  929|  24.1k|                                &(state->lenbits), state->work);
  930|  24.1k|            if (ret) {
  ------------------
  |  Branch (930:17): [True: 157, False: 23.9k]
  ------------------
  931|    157|                strm->msg = (z_const char *)"invalid code lengths set";
  932|    157|                state->mode = BAD;
  933|    157|                break;
  934|    157|            }
  935|  23.9k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  936|  23.9k|            state->have = 0;
  937|  23.9k|            state->mode = CODELENS;
  938|       |                /* fallthrough */
  939|   132k|        case CODELENS:
  ------------------
  |  Branch (939:9): [True: 108k, False: 2.34M]
  ------------------
  940|   939k|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (940:20): [True: 916k, False: 23.6k]
  ------------------
  941|  1.25M|                for (;;) {
  942|  1.25M|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  492|  1.25M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  943|  1.25M|                    if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (943:25): [True: 850k, False: 400k]
  ------------------
  944|   400k|                    PULLBYTE();
  ------------------
  |  |  475|   400k|    do { \
  |  |  476|   400k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (476:13): [True: 65.3k, False: 334k]
  |  |  ------------------
  |  |  477|   400k|        have--; \
  |  |  478|   334k|        hold += (unsigned long)(*next++) << bits; \
  |  |  479|   334k|        bits += 8; \
  |  |  480|   334k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  945|   400k|                }
  946|   850k|                if (here.val < 16) {
  ------------------
  |  Branch (946:21): [True: 606k, False: 244k]
  ------------------
  947|   606k|                    DROPBITS(here.bits);
  ------------------
  |  |  496|   606k|    do { \
  |  |  497|   606k|        hold >>= (n); \
  |  |  498|   606k|        bits -= (unsigned)(n); \
  |  |  499|   606k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  948|   606k|                    state->lens[state->have++] = here.val;
  949|   606k|                }
  950|   244k|                else {
  951|   244k|                    if (here.val == 16) {
  ------------------
  |  Branch (951:25): [True: 7.52k, False: 237k]
  ------------------
  952|  7.52k|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  485|  7.52k|    do { \
  |  |  486|  8.91k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 1.38k, False: 7.52k]
  |  |  ------------------
  |  |  487|  7.52k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  1.38k|    do { \
  |  |  |  |  476|  1.38k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 0, False: 1.38k]
  |  |  |  |  ------------------
  |  |  |  |  477|  1.38k|        have--; \
  |  |  |  |  478|  1.38k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  1.38k|        bits += 8; \
  |  |  |  |  480|  1.38k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  7.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  953|  7.52k|                        DROPBITS(here.bits);
  ------------------
  |  |  496|  7.52k|    do { \
  |  |  497|  7.52k|        hold >>= (n); \
  |  |  498|  7.52k|        bits -= (unsigned)(n); \
  |  |  499|  7.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  954|  7.52k|                        if (state->have == 0) {
  ------------------
  |  Branch (954:29): [True: 2, False: 7.52k]
  ------------------
  955|      2|                            strm->msg = (z_const char *)"invalid bit length repeat";
  956|      2|                            state->mode = BAD;
  957|      2|                            break;
  958|      2|                        }
  959|  7.52k|                        len = state->lens[state->have - 1];
  960|  7.52k|                        copy = 3 + BITS(2);
  ------------------
  |  |  492|  7.52k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  961|  7.52k|                        DROPBITS(2);
  ------------------
  |  |  496|  7.52k|    do { \
  |  |  497|  7.52k|        hold >>= (n); \
  |  |  498|  7.52k|        bits -= (unsigned)(n); \
  |  |  499|  7.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  962|  7.52k|                    }
  963|   237k|                    else if (here.val == 17) {
  ------------------
  |  Branch (963:30): [True: 53.1k, False: 184k]
  ------------------
  964|  53.1k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  485|  53.1k|    do { \
  |  |  486|  71.6k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 18.5k, False: 53.1k]
  |  |  ------------------
  |  |  487|  53.1k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  18.5k|    do { \
  |  |  |  |  476|  18.5k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 5, False: 18.5k]
  |  |  |  |  ------------------
  |  |  |  |  477|  18.5k|        have--; \
  |  |  |  |  478|  18.5k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  18.5k|        bits += 8; \
  |  |  |  |  480|  18.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  53.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  965|  53.1k|                        DROPBITS(here.bits);
  ------------------
  |  |  496|  53.1k|    do { \
  |  |  497|  53.1k|        hold >>= (n); \
  |  |  498|  53.1k|        bits -= (unsigned)(n); \
  |  |  499|  53.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  966|  53.1k|                        len = 0;
  967|  53.1k|                        copy = 3 + BITS(3);
  ------------------
  |  |  492|  53.1k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  968|  53.1k|                        DROPBITS(3);
  ------------------
  |  |  496|  53.1k|    do { \
  |  |  497|  53.1k|        hold >>= (n); \
  |  |  498|  53.1k|        bits -= (unsigned)(n); \
  |  |  499|  53.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  969|  53.1k|                    }
  970|   184k|                    else {
  971|   184k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  485|   184k|    do { \
  |  |  486|   281k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 141k, False: 140k]
  |  |  ------------------
  |  |  487|   184k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|   141k|    do { \
  |  |  |  |  476|   141k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 43.6k, False: 97.6k]
  |  |  |  |  ------------------
  |  |  |  |  477|   141k|        have--; \
  |  |  |  |  478|  97.6k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  97.6k|        bits += 8; \
  |  |  |  |  480|  97.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|   184k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  972|   140k|                        DROPBITS(here.bits);
  ------------------
  |  |  496|   140k|    do { \
  |  |  497|   140k|        hold >>= (n); \
  |  |  498|   140k|        bits -= (unsigned)(n); \
  |  |  499|   140k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  973|   140k|                        len = 0;
  974|   140k|                        copy = 11 + BITS(7);
  ------------------
  |  |  492|   140k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  975|   140k|                        DROPBITS(7);
  ------------------
  |  |  496|   140k|    do { \
  |  |  497|   140k|        hold >>= (n); \
  |  |  498|   140k|        bits -= (unsigned)(n); \
  |  |  499|   140k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  976|   140k|                    }
  977|   201k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (977:25): [True: 149, False: 200k]
  ------------------
  978|    149|                        strm->msg = (z_const char *)"invalid bit length repeat";
  979|    149|                        state->mode = BAD;
  980|    149|                        break;
  981|    149|                    }
  982|  6.78M|                    while (copy--)
  ------------------
  |  Branch (982:28): [True: 6.58M, False: 200k]
  ------------------
  983|  6.58M|                        state->lens[state->have++] = (unsigned short)len;
  984|   200k|                }
  985|   850k|            }
  986|       |
  987|       |            /* handle error breaks in while */
  988|  23.8k|            if (state->mode == BAD) break;
  ------------------
  |  Branch (988:17): [True: 151, False: 23.6k]
  ------------------
  989|       |
  990|       |            /* check for end-of-block code (better have one) */
  991|  23.6k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (991:17): [True: 2, False: 23.6k]
  ------------------
  992|      2|                strm->msg = (z_const char *)"invalid code -- missing end-of-block";
  993|      2|                state->mode = BAD;
  994|      2|                break;
  995|      2|            }
  996|       |
  997|       |            /* build code tables -- note: do not change the lenbits or distbits
  998|       |               values here (9 and 6) without reading the comments in inftrees.h
  999|       |               concerning the ENOUGH constants, which depend on those values */
 1000|  23.6k|            state->next = state->codes;
 1001|  23.6k|            state->lencode = (const code FAR *)(state->next);
 1002|  23.6k|            state->lenbits = 9;
 1003|  23.6k|            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
 1004|  23.6k|                                &(state->lenbits), state->work);
 1005|  23.6k|            if (ret) {
  ------------------
  |  Branch (1005:17): [True: 29, False: 23.6k]
  ------------------
 1006|     29|                strm->msg = (z_const char *)"invalid literal/lengths set";
 1007|     29|                state->mode = BAD;
 1008|     29|                break;
 1009|     29|            }
 1010|  23.6k|            state->distcode = (const code FAR *)(state->next);
 1011|  23.6k|            state->distbits = 6;
 1012|  23.6k|            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
 1013|  23.6k|                            &(state->next), &(state->distbits), state->work);
 1014|  23.6k|            if (ret) {
  ------------------
  |  Branch (1014:17): [True: 21, False: 23.6k]
  ------------------
 1015|     21|                strm->msg = (z_const char *)"invalid distances set";
 1016|     21|                state->mode = BAD;
 1017|     21|                break;
 1018|     21|            }
 1019|  23.6k|            Tracev((stderr, "inflate:       codes ok\n"));
 1020|  23.6k|            state->mode = LEN_;
 1021|  23.6k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  174|  23.6k|#define Z_TREES         6
  ------------------
  |  Branch (1021:17): [True: 0, False: 23.6k]
  ------------------
 1022|       |                /* fallthrough */
 1023|  70.2k|        case LEN_:
  ------------------
  |  Branch (1023:9): [True: 46.6k, False: 2.40M]
  ------------------
 1024|  70.2k|            state->mode = LEN;
 1025|       |                /* fallthrough */
 1026|  1.51M|        case LEN:
  ------------------
  |  Branch (1026:9): [True: 1.44M, False: 1.00M]
  ------------------
 1027|  1.51M|            if (have >= 6 && left >= 258) {
  ------------------
  |  Branch (1027:17): [True: 9.08k, False: 1.50M]
  |  Branch (1027:30): [True: 2.57k, False: 6.51k]
  ------------------
 1028|  2.57k|                RESTORE();
  ------------------
  |  |  456|  2.57k|    do { \
  |  |  457|  2.57k|        strm->next_out = put; \
  |  |  458|  2.57k|        strm->avail_out = left; \
  |  |  459|  2.57k|        strm->next_in = next; \
  |  |  460|  2.57k|        strm->avail_in = have; \
  |  |  461|  2.57k|        state->hold = hold; \
  |  |  462|  2.57k|        state->bits = bits; \
  |  |  463|  2.57k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (463:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1029|  2.57k|                inflate_fast(strm, out);
 1030|  2.57k|                LOAD();
  ------------------
  |  |  445|  2.57k|    do { \
  |  |  446|  2.57k|        put = strm->next_out; \
  |  |  447|  2.57k|        left = strm->avail_out; \
  |  |  448|  2.57k|        next = strm->next_in; \
  |  |  449|  2.57k|        have = strm->avail_in; \
  |  |  450|  2.57k|        hold = state->hold; \
  |  |  451|  2.57k|        bits = state->bits; \
  |  |  452|  2.57k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (452:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1031|  2.57k|                if (state->mode == TYPE)
  ------------------
  |  Branch (1031:21): [True: 1.89k, False: 679]
  ------------------
 1032|  1.89k|                    state->back = -1;
 1033|  2.57k|                break;
 1034|  2.57k|            }
 1035|  1.51M|            state->back = 0;
 1036|  1.99M|            for (;;) {
 1037|  1.99M|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  492|  1.99M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1038|  1.99M|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (1038:21): [True: 1.38M, False: 610k]
  ------------------
 1039|   610k|                PULLBYTE();
  ------------------
  |  |  475|   610k|    do { \
  |  |  476|   610k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (476:13): [True: 125k, False: 485k]
  |  |  ------------------
  |  |  477|   610k|        have--; \
  |  |  478|   485k|        hold += (unsigned long)(*next++) << bits; \
  |  |  479|   485k|        bits += 8; \
  |  |  480|   485k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1040|   610k|            }
 1041|  1.38M|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (1041:17): [True: 922k, False: 462k]
  |  Branch (1041:28): [True: 308, False: 921k]
  ------------------
 1042|    308|                last = here;
 1043|    474|                for (;;) {
 1044|    474|                    here = state->lencode[last.val +
 1045|    474|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  492|    474|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1046|    474|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (1046:25): [True: 308, False: 166]
  ------------------
 1047|    166|                    PULLBYTE();
  ------------------
  |  |  475|    166|    do { \
  |  |  476|    166|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (476:13): [True: 0, False: 166]
  |  |  ------------------
  |  |  477|    166|        have--; \
  |  |  478|    166|        hold += (unsigned long)(*next++) << bits; \
  |  |  479|    166|        bits += 8; \
  |  |  480|    166|    } while (0)
  |  |  ------------------
  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1048|    166|                }
 1049|    308|                DROPBITS(last.bits);
  ------------------
  |  |  496|    308|    do { \
  |  |  497|    308|        hold >>= (n); \
  |  |  498|    308|        bits -= (unsigned)(n); \
  |  |  499|    308|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1050|    308|                state->back += last.bits;
 1051|    308|            }
 1052|  1.38M|            DROPBITS(here.bits);
  ------------------
  |  |  496|  1.38M|    do { \
  |  |  497|  1.38M|        hold >>= (n); \
  |  |  498|  1.38M|        bits -= (unsigned)(n); \
  |  |  499|  1.38M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1053|  1.38M|            state->back += here.bits;
 1054|  1.38M|            state->length = (unsigned)here.val;
 1055|  1.38M|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (1055:17): [True: 462k, False: 922k]
  ------------------
 1056|   462k|                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
 1057|   462k|                        "inflate:         literal '%c'\n" :
 1058|   462k|                        "inflate:         literal 0x%02x\n", here.val));
 1059|   462k|                state->mode = LIT;
 1060|   462k|                break;
 1061|   462k|            }
 1062|   922k|            if (here.op & 32) {
  ------------------
  |  Branch (1062:17): [True: 67.5k, False: 854k]
  ------------------
 1063|  67.5k|                Tracevv((stderr, "inflate:         end of block\n"));
 1064|  67.5k|                state->back = -1;
 1065|  67.5k|                state->mode = TYPE;
 1066|  67.5k|                break;
 1067|  67.5k|            }
 1068|   854k|            if (here.op & 64) {
  ------------------
  |  Branch (1068:17): [True: 3, False: 854k]
  ------------------
 1069|      3|                strm->msg = (z_const char *)"invalid literal/length code";
 1070|      3|                state->mode = BAD;
 1071|      3|                break;
 1072|      3|            }
 1073|   854k|            state->extra = (unsigned)(here.op) & 15;
 1074|   854k|            state->mode = LENEXT;
 1075|       |                /* fallthrough */
 1076|   860k|        case LENEXT:
  ------------------
  |  Branch (1076:9): [True: 6.31k, False: 2.44M]
  ------------------
 1077|   860k|            if (state->extra) {
  ------------------
  |  Branch (1077:17): [True: 122k, False: 738k]
  ------------------
 1078|   122k|                NEEDBITS(state->extra);
  ------------------
  |  |  485|   122k|    do { \
  |  |  486|   165k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 50.1k, False: 115k]
  |  |  ------------------
  |  |  487|   122k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  50.1k|    do { \
  |  |  |  |  476|  50.1k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 6.40k, False: 43.7k]
  |  |  |  |  ------------------
  |  |  |  |  477|  50.1k|        have--; \
  |  |  |  |  478|  43.7k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  43.7k|        bits += 8; \
  |  |  |  |  480|  43.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|   122k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1079|   115k|                state->length += BITS(state->extra);
  ------------------
  |  |  492|   115k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1080|   115k|                DROPBITS(state->extra);
  ------------------
  |  |  496|   115k|    do { \
  |  |  497|   115k|        hold >>= (n); \
  |  |  498|   115k|        bits -= (unsigned)(n); \
  |  |  499|   115k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1081|   115k|                state->back += state->extra;
 1082|   115k|            }
 1083|   854k|            Tracevv((stderr, "inflate:         length %u\n", state->length));
 1084|   854k|            state->was = state->length;
 1085|   854k|            state->mode = DIST;
 1086|       |                /* fallthrough */
 1087|   893k|        case DIST:
  ------------------
  |  Branch (1087:9): [True: 38.9k, False: 2.41M]
  ------------------
 1088|  1.04M|            for (;;) {
 1089|  1.04M|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  492|  1.04M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1090|  1.04M|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (1090:21): [True: 854k, False: 192k]
  ------------------
 1091|   192k|                PULLBYTE();
  ------------------
  |  |  475|   192k|    do { \
  |  |  476|   192k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (476:13): [True: 39.0k, False: 153k]
  |  |  ------------------
  |  |  477|   192k|        have--; \
  |  |  478|   153k|        hold += (unsigned long)(*next++) << bits; \
  |  |  479|   153k|        bits += 8; \
  |  |  480|   153k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1092|   192k|            }
 1093|   854k|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (1093:17): [True: 93, False: 854k]
  ------------------
 1094|     93|                last = here;
 1095|    123|                for (;;) {
 1096|    123|                    here = state->distcode[last.val +
 1097|    123|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  492|    123|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1098|    123|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (1098:25): [True: 93, False: 30]
  ------------------
 1099|     30|                    PULLBYTE();
  ------------------
  |  |  475|     30|    do { \
  |  |  476|     30|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (476:13): [True: 0, False: 30]
  |  |  ------------------
  |  |  477|     30|        have--; \
  |  |  478|     30|        hold += (unsigned long)(*next++) << bits; \
  |  |  479|     30|        bits += 8; \
  |  |  480|     30|    } while (0)
  |  |  ------------------
  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1100|     30|                }
 1101|     93|                DROPBITS(last.bits);
  ------------------
  |  |  496|     93|    do { \
  |  |  497|     93|        hold >>= (n); \
  |  |  498|     93|        bits -= (unsigned)(n); \
  |  |  499|     93|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1102|     93|                state->back += last.bits;
 1103|     93|            }
 1104|   854k|            DROPBITS(here.bits);
  ------------------
  |  |  496|   854k|    do { \
  |  |  497|   854k|        hold >>= (n); \
  |  |  498|   854k|        bits -= (unsigned)(n); \
  |  |  499|   854k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1105|   854k|            state->back += here.bits;
 1106|   854k|            if (here.op & 64) {
  ------------------
  |  Branch (1106:17): [True: 5, False: 854k]
  ------------------
 1107|      5|                strm->msg = (z_const char *)"invalid distance code";
 1108|      5|                state->mode = BAD;
 1109|      5|                break;
 1110|      5|            }
 1111|   854k|            state->offset = (unsigned)here.val;
 1112|   854k|            state->extra = (unsigned)(here.op) & 15;
 1113|   854k|            state->mode = DISTEXT;
 1114|       |                /* fallthrough */
 1115|   865k|        case DISTEXT:
  ------------------
  |  Branch (1115:9): [True: 10.8k, False: 2.43M]
  ------------------
 1116|   865k|            if (state->extra) {
  ------------------
  |  Branch (1116:17): [True: 159k, False: 705k]
  ------------------
 1117|   159k|                NEEDBITS(state->extra);
  ------------------
  |  |  485|   159k|    do { \
  |  |  486|   233k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 84.6k, False: 148k]
  |  |  ------------------
  |  |  487|   159k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  84.6k|    do { \
  |  |  |  |  476|  84.6k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 10.9k, False: 73.6k]
  |  |  |  |  ------------------
  |  |  |  |  477|  84.6k|        have--; \
  |  |  |  |  478|  73.6k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  73.6k|        bits += 8; \
  |  |  |  |  480|  73.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|   159k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1118|   148k|                state->offset += BITS(state->extra);
  ------------------
  |  |  492|   148k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1119|   148k|                DROPBITS(state->extra);
  ------------------
  |  |  496|   148k|    do { \
  |  |  497|   148k|        hold >>= (n); \
  |  |  498|   148k|        bits -= (unsigned)(n); \
  |  |  499|   148k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1120|   148k|                state->back += state->extra;
 1121|   148k|            }
 1122|       |#ifdef INFLATE_STRICT
 1123|       |            if (state->offset > state->dmax) {
 1124|       |                strm->msg = (z_const char *)"invalid distance too far back";
 1125|       |                state->mode = BAD;
 1126|       |                break;
 1127|       |            }
 1128|       |#endif
 1129|   854k|            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 1130|   854k|            state->mode = MATCH;
 1131|       |                /* fallthrough */
 1132|   920k|        case MATCH:
  ------------------
  |  Branch (1132:9): [True: 66.3k, False: 2.38M]
  ------------------
 1133|   920k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1133:17): [True: 199, False: 920k]
  ------------------
 1134|   920k|            copy = out - left;
 1135|   920k|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1135:17): [True: 172k, False: 747k]
  ------------------
 1136|   172k|                copy = state->offset - copy;
 1137|   172k|                if (copy > state->whave) {
  ------------------
  |  Branch (1137:21): [True: 15, False: 172k]
  ------------------
 1138|     15|                    if (state->sane) {
  ------------------
  |  Branch (1138:25): [True: 15, False: 0]
  ------------------
 1139|     15|                        strm->msg = (z_const char *)"invalid distance too far back";
 1140|     15|                        state->mode = BAD;
 1141|     15|                        break;
 1142|     15|                    }
 1143|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
 1144|       |                    Trace((stderr, "inflate.c too far\n"));
 1145|       |                    copy -= state->whave;
 1146|       |                    if (copy > state->length) copy = state->length;
 1147|       |                    if (copy > left) copy = left;
 1148|       |                    left -= copy;
 1149|       |                    state->length -= copy;
 1150|       |                    do {
 1151|       |                        *put++ = 0;
 1152|       |                    } while (--copy);
 1153|       |                    if (state->length == 0) state->mode = LEN;
 1154|       |                    break;
 1155|       |#endif
 1156|     15|                }
 1157|   172k|                if (copy > state->wnext) {
  ------------------
  |  Branch (1157:21): [True: 207, False: 172k]
  ------------------
 1158|    207|                    copy -= state->wnext;
 1159|    207|                    from = state->window + (state->wsize - copy);
 1160|    207|                }
 1161|   172k|                else
 1162|   172k|                    from = state->window + (state->wnext - copy);
 1163|   172k|                if (copy > state->length) copy = state->length;
  ------------------
  |  Branch (1163:21): [True: 102k, False: 70.8k]
  ------------------
 1164|   172k|            }
 1165|   747k|            else {                              /* copy from output */
 1166|   747k|                from = put - state->offset;
 1167|   747k|                copy = state->length;
 1168|   747k|            }
 1169|   920k|            if (copy > left) copy = left;
  ------------------
  |  Branch (1169:17): [True: 163, False: 920k]
  ------------------
 1170|   920k|            left -= copy;
 1171|   920k|            state->length -= copy;
 1172|   172M|            do {
 1173|   172M|                *put++ = *from++;
 1174|   172M|            } while (--copy);
  ------------------
  |  Branch (1174:22): [True: 171M, False: 920k]
  ------------------
 1175|   920k|            if (state->length == 0) state->mode = LEN;
  ------------------
  |  Branch (1175:17): [True: 854k, False: 66.1k]
  ------------------
 1176|   920k|            break;
 1177|   462k|        case LIT:
  ------------------
  |  Branch (1177:9): [True: 462k, False: 1.98M]
  ------------------
 1178|   462k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1178:17): [True: 9, False: 462k]
  ------------------
 1179|   462k|            *put++ = (unsigned char)(state->length);
 1180|   462k|            left--;
 1181|   462k|            state->mode = LEN;
 1182|   462k|            break;
 1183|  45.2k|        case CHECK:
  ------------------
  |  Branch (1183:9): [True: 45.2k, False: 2.40M]
  ------------------
 1184|  45.2k|            if (state->wrap) {
  ------------------
  |  Branch (1184:17): [True: 45.2k, False: 0]
  ------------------
 1185|  45.2k|                NEEDBITS(32);
  ------------------
  |  |  485|  45.2k|    do { \
  |  |  486|   137k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 114k, False: 23.0k]
  |  |  ------------------
  |  |  487|   114k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|   114k|    do { \
  |  |  |  |  476|   114k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 22.1k, False: 92.2k]
  |  |  |  |  ------------------
  |  |  |  |  477|   114k|        have--; \
  |  |  |  |  478|  92.2k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  92.2k|        bits += 8; \
  |  |  |  |  480|  92.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  45.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1186|  23.0k|                out -= left;
 1187|  23.0k|                strm->total_out += out;
 1188|  23.0k|                state->total += out;
 1189|  23.0k|                if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1189:21): [True: 23.0k, False: 0]
  |  Branch (1189:42): [True: 915, False: 22.1k]
  ------------------
 1190|    915|                    strm->adler = state->check =
 1191|    915|                        UPDATE_CHECK(state->check, put - out, out);
  ------------------
  |  |  419|    915|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (419:6): [True: 0, False: 915]
  |  |  ------------------
  ------------------
 1192|  23.0k|                out = left;
 1193|  23.0k|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1193:21): [True: 23.0k, False: 0]
  |  Branch (1193:42): [True: 836, False: 22.2k]
  ------------------
 1194|  23.0k|#ifdef GUNZIP
 1195|  23.0k|                     state->flags ? hold :
  ------------------
  |  Branch (1195:22): [True: 0, False: 23.0k]
  ------------------
 1196|  23.0k|#endif
 1197|  23.0k|                     ZSWAP32(hold)) != state->check) {
  ------------------
  |  |  252|  23.0k|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  253|  23.0k|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
 1198|    836|                    strm->msg = (z_const char *)"incorrect data check";
 1199|    836|                    state->mode = BAD;
 1200|    836|                    break;
 1201|    836|                }
 1202|  22.2k|                INITBITS();
  ------------------
  |  |  467|  22.2k|    do { \
  |  |  468|  22.2k|        hold = 0; \
  |  |  469|  22.2k|        bits = 0; \
  |  |  470|  22.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1203|  22.2k|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1204|  22.2k|            }
 1205|  22.2k|#ifdef GUNZIP
 1206|  22.2k|            state->mode = LENGTH;
 1207|       |                /* fallthrough */
 1208|  22.2k|        case LENGTH:
  ------------------
  |  Branch (1208:9): [True: 0, False: 2.44M]
  ------------------
 1209|  22.2k|            if (state->wrap && state->flags) {
  ------------------
  |  Branch (1209:17): [True: 22.2k, False: 0]
  |  Branch (1209:32): [True: 0, False: 22.2k]
  ------------------
 1210|      0|                NEEDBITS(32);
  ------------------
  |  |  485|      0|    do { \
  |  |  486|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  487|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|      0|    do { \
  |  |  |  |  476|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  477|      0|        have--; \
  |  |  |  |  478|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|      0|        bits += 8; \
  |  |  |  |  480|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1211|      0|                if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) {
  ------------------
  |  Branch (1211:21): [True: 0, False: 0]
  |  Branch (1211:42): [True: 0, False: 0]
  ------------------
 1212|      0|                    strm->msg = (z_const char *)"incorrect length check";
 1213|      0|                    state->mode = BAD;
 1214|      0|                    break;
 1215|      0|                }
 1216|      0|                INITBITS();
  ------------------
  |  |  467|      0|    do { \
  |  |  468|      0|        hold = 0; \
  |  |  469|      0|        bits = 0; \
  |  |  470|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1217|      0|                Tracev((stderr, "inflate:   length matches trailer\n"));
 1218|      0|            }
 1219|  22.2k|#endif
 1220|  22.2k|            state->mode = DONE;
 1221|       |                /* fallthrough */
 1222|  44.4k|        case DONE:
  ------------------
  |  Branch (1222:9): [True: 22.2k, False: 2.42M]
  ------------------
 1223|  44.4k|            ret = Z_STREAM_END;
  ------------------
  |  |  178|  44.4k|#define Z_STREAM_END    1
  ------------------
 1224|  44.4k|            goto inf_leave;
 1225|  3.57k|        case BAD:
  ------------------
  |  Branch (1225:9): [True: 3.57k, False: 2.44M]
  ------------------
 1226|  3.57k|            ret = Z_DATA_ERROR;
  ------------------
  |  |  182|  3.57k|#define Z_DATA_ERROR   (-3)
  ------------------
 1227|  3.57k|            goto inf_leave;
 1228|      0|        case MEM:
  ------------------
  |  Branch (1228:9): [True: 0, False: 2.44M]
  ------------------
 1229|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  183|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1230|      0|        case SYNC:
  ------------------
  |  Branch (1230:9): [True: 0, False: 2.44M]
  ------------------
 1231|       |                /* fallthrough */
 1232|      0|        default:
  ------------------
  |  Branch (1232:9): [True: 0, False: 2.44M]
  ------------------
 1233|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1234|  2.44M|        }
 1235|       |
 1236|       |    /*
 1237|       |       Return from inflate(), updating the total counts and the check value.
 1238|       |       If there was no progress during the inflate() call, return a buffer
 1239|       |       error.  Call updatewindow() to create and/or update the window state.
 1240|       |       Note: a memory error from inflate() is non-recoverable.
 1241|       |     */
 1242|   412k|  inf_leave:
 1243|   412k|    RESTORE();
  ------------------
  |  |  456|   412k|    do { \
  |  |  457|   412k|        strm->next_out = put; \
  |  |  458|   412k|        strm->avail_out = left; \
  |  |  459|   412k|        strm->next_in = next; \
  |  |  460|   412k|        strm->avail_in = have; \
  |  |  461|   412k|        state->hold = hold; \
  |  |  462|   412k|        state->bits = bits; \
  |  |  463|   412k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (463:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1244|   412k|    if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1244:9): [True: 227k, False: 184k]
  |  Branch (1244:26): [True: 23.2k, False: 161k]
  |  Branch (1244:52): [True: 23.1k, False: 105]
  ------------------
 1245|   184k|            (state->mode < CHECK || flush != Z_FINISH)))
  ------------------
  |  |  172|      0|#define Z_FINISH        4
  ------------------
  |  Branch (1245:14): [True: 23.1k, False: 0]
  |  Branch (1245:37): [True: 0, False: 0]
  ------------------
 1246|   250k|        if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
  ------------------
  |  Branch (1246:13): [True: 0, False: 250k]
  ------------------
 1247|      0|            state->mode = MEM;
 1248|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  183|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1249|      0|        }
 1250|   412k|    in -= strm->avail_in;
 1251|   412k|    out -= strm->avail_out;
 1252|   412k|    strm->total_in += in;
 1253|   412k|    strm->total_out += out;
 1254|   412k|    state->total += out;
 1255|   412k|    if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1255:9): [True: 412k, False: 0]
  |  Branch (1255:30): [True: 184k, False: 227k]
  ------------------
 1256|   184k|        strm->adler = state->check =
 1257|   184k|            UPDATE_CHECK(state->check, strm->next_out - out, out);
  ------------------
  |  |  419|   184k|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (419:6): [True: 0, False: 184k]
  |  |  ------------------
  ------------------
 1258|   412k|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1258:43): [True: 72.5k, False: 340k]
  ------------------
 1259|   412k|                      (state->mode == TYPE ? 128 : 0) +
  ------------------
  |  Branch (1259:24): [True: 5.08k, False: 407k]
  ------------------
 1260|   412k|                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1260:24): [True: 0, False: 412k]
  |  Branch (1260:47): [True: 0, False: 412k]
  ------------------
 1261|   412k|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  172|   387k|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  177|  25.2k|#define Z_OK            0
  ------------------
  |  Branch (1261:11): [True: 25.2k, False: 387k]
  |  Branch (1261:22): [True: 25.2k, False: 0]
  |  Branch (1261:35): [True: 0, False: 387k]
  |  Branch (1261:57): [True: 966, False: 24.3k]
  ------------------
 1262|    966|        ret = Z_BUF_ERROR;
  ------------------
  |  |  184|    966|#define Z_BUF_ERROR    (-5)
  ------------------
 1263|   412k|    return ret;
 1264|   412k|}
inflateEnd:
 1266|  24.6k|int ZEXPORT inflateEnd(z_streamp strm) {
 1267|  24.6k|    struct inflate_state FAR *state;
 1268|  24.6k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1268:9): [True: 0, False: 24.6k]
  ------------------
 1269|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1270|  24.6k|    state = (struct inflate_state FAR *)strm->state;
 1271|  24.6k|    if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  212|  24.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  248|  23.1k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  |  Branch (1271:9): [True: 23.1k, False: 1.56k]
  ------------------
 1272|  24.6k|    ZFREE(strm, strm->state);
  ------------------
  |  |  248|  24.6k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
 1273|  24.6k|    strm->state = Z_NULL;
  ------------------
  |  |  212|  24.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1274|  24.6k|    Tracev((stderr, "inflate: end\n"));
 1275|  24.6k|    return Z_OK;
  ------------------
  |  |  177|  24.6k|#define Z_OK            0
  ------------------
 1276|  24.6k|}
inflate.c:inflateStateCheck:
   94|   511k|local int inflateStateCheck(z_streamp strm) {
   95|   511k|    struct inflate_state FAR *state;
   96|   511k|    if (strm == Z_NULL ||
  ------------------
  |  |  212|  1.02M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (96:9): [True: 0, False: 511k]
  ------------------
   97|   511k|        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (97:9): [True: 0, False: 511k]
  |  Branch (97:42): [True: 0, False: 511k]
  ------------------
   98|      0|        return 1;
   99|   511k|    state = (struct inflate_state FAR *)strm->state;
  100|   511k|    if (state == Z_NULL || state->strm != strm ||
  ------------------
  |  |  212|  1.02M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (100:9): [True: 0, False: 511k]
  |  Branch (100:28): [True: 0, False: 511k]
  ------------------
  101|   511k|        state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (101:9): [True: 0, False: 511k]
  |  Branch (101:31): [True: 0, False: 511k]
  ------------------
  102|      0|        return 1;
  103|   511k|    return 0;
  104|   511k|}
inflate.c:fixedtables:
  252|  46.6k|local void fixedtables(struct inflate_state FAR *state) {
  253|       |#ifdef BUILDFIXED
  254|       |    static int virgin = 1;
  255|       |    static code *lenfix, *distfix;
  256|       |    static code fixed[544];
  257|       |
  258|       |    /* build fixed huffman tables if first call (may not be thread safe) */
  259|       |    if (virgin) {
  260|       |        unsigned sym, bits;
  261|       |        static code *next;
  262|       |
  263|       |        /* literal/length table */
  264|       |        sym = 0;
  265|       |        while (sym < 144) state->lens[sym++] = 8;
  266|       |        while (sym < 256) state->lens[sym++] = 9;
  267|       |        while (sym < 280) state->lens[sym++] = 7;
  268|       |        while (sym < 288) state->lens[sym++] = 8;
  269|       |        next = fixed;
  270|       |        lenfix = next;
  271|       |        bits = 9;
  272|       |        inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
  273|       |
  274|       |        /* distance table */
  275|       |        sym = 0;
  276|       |        while (sym < 32) state->lens[sym++] = 5;
  277|       |        distfix = next;
  278|       |        bits = 5;
  279|       |        inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
  280|       |
  281|       |        /* do this just once */
  282|       |        virgin = 0;
  283|       |    }
  284|       |#else /* !BUILDFIXED */
  285|  46.6k|#   include "inffixed.h"
  ------------------
  |  |    1|       |    /* inffixed.h -- table for decoding fixed codes
  |  |    2|       |     * Generated automatically by makefixed().
  |  |    3|       |     */
  |  |    4|       |
  |  |    5|       |    /* WARNING: this file should *not* be used by applications.
  |  |    6|       |       It is part of the implementation of this library and is
  |  |    7|       |       subject to change. Applications should only use zlib.h.
  |  |    8|       |     */
  |  |    9|       |
  |  |   10|  46.6k|    static const code lenfix[512] = {
  |  |   11|  46.6k|        {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
  |  |   12|  46.6k|        {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
  |  |   13|  46.6k|        {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
  |  |   14|  46.6k|        {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
  |  |   15|  46.6k|        {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
  |  |   16|  46.6k|        {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
  |  |   17|  46.6k|        {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
  |  |   18|  46.6k|        {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
  |  |   19|  46.6k|        {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
  |  |   20|  46.6k|        {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
  |  |   21|  46.6k|        {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
  |  |   22|  46.6k|        {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
  |  |   23|  46.6k|        {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
  |  |   24|  46.6k|        {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
  |  |   25|  46.6k|        {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
  |  |   26|  46.6k|        {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
  |  |   27|  46.6k|        {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
  |  |   28|  46.6k|        {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
  |  |   29|  46.6k|        {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
  |  |   30|  46.6k|        {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
  |  |   31|  46.6k|        {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
  |  |   32|  46.6k|        {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
  |  |   33|  46.6k|        {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
  |  |   34|  46.6k|        {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
  |  |   35|  46.6k|        {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
  |  |   36|  46.6k|        {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
  |  |   37|  46.6k|        {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
  |  |   38|  46.6k|        {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
  |  |   39|  46.6k|        {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
  |  |   40|  46.6k|        {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
  |  |   41|  46.6k|        {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
  |  |   42|  46.6k|        {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
  |  |   43|  46.6k|        {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
  |  |   44|  46.6k|        {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
  |  |   45|  46.6k|        {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
  |  |   46|  46.6k|        {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
  |  |   47|  46.6k|        {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
  |  |   48|  46.6k|        {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
  |  |   49|  46.6k|        {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
  |  |   50|  46.6k|        {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
  |  |   51|  46.6k|        {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
  |  |   52|  46.6k|        {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
  |  |   53|  46.6k|        {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
  |  |   54|  46.6k|        {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
  |  |   55|  46.6k|        {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
  |  |   56|  46.6k|        {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
  |  |   57|  46.6k|        {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
  |  |   58|  46.6k|        {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
  |  |   59|  46.6k|        {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
  |  |   60|  46.6k|        {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
  |  |   61|  46.6k|        {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
  |  |   62|  46.6k|        {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
  |  |   63|  46.6k|        {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
  |  |   64|  46.6k|        {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
  |  |   65|  46.6k|        {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
  |  |   66|  46.6k|        {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
  |  |   67|  46.6k|        {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
  |  |   68|  46.6k|        {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
  |  |   69|  46.6k|        {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
  |  |   70|  46.6k|        {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
  |  |   71|  46.6k|        {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
  |  |   72|  46.6k|        {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
  |  |   73|  46.6k|        {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
  |  |   74|  46.6k|        {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
  |  |   75|  46.6k|        {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
  |  |   76|  46.6k|        {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
  |  |   77|  46.6k|        {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
  |  |   78|  46.6k|        {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
  |  |   79|  46.6k|        {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
  |  |   80|  46.6k|        {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
  |  |   81|  46.6k|        {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
  |  |   82|  46.6k|        {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
  |  |   83|  46.6k|        {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
  |  |   84|  46.6k|        {0,9,255}
  |  |   85|  46.6k|    };
  |  |   86|       |
  |  |   87|  46.6k|    static const code distfix[32] = {
  |  |   88|  46.6k|        {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
  |  |   89|  46.6k|        {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
  |  |   90|  46.6k|        {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
  |  |   91|  46.6k|        {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
  |  |   92|  46.6k|        {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
  |  |   93|  46.6k|        {22,5,193},{64,5,0}
  |  |   94|  46.6k|    };
  ------------------
  286|  46.6k|#endif /* BUILDFIXED */
  287|  46.6k|    state->lencode = lenfix;
  288|  46.6k|    state->lenbits = 9;
  289|  46.6k|    state->distcode = distfix;
  290|  46.6k|    state->distbits = 5;
  291|  46.6k|}
inflate.c:updatewindow:
  368|   250k|local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
  369|   250k|    struct inflate_state FAR *state;
  370|   250k|    unsigned dist;
  371|       |
  372|   250k|    state = (struct inflate_state FAR *)strm->state;
  373|       |
  374|       |    /* if it hasn't been done already, allocate space for the window */
  375|   250k|    if (state->window == Z_NULL) {
  ------------------
  |  |  212|   250k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (375:9): [True: 23.1k, False: 227k]
  ------------------
  376|  23.1k|        state->window = (unsigned char FAR *)
  377|  23.1k|                        ZALLOC(strm, 1U << state->wbits,
  ------------------
  |  |  247|  23.1k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  378|  23.1k|                               sizeof(unsigned char));
  379|  23.1k|        if (state->window == Z_NULL) return 1;
  ------------------
  |  |  212|  23.1k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (379:13): [True: 0, False: 23.1k]
  ------------------
  380|  23.1k|    }
  381|       |
  382|       |    /* if window not in use yet, initialize */
  383|   250k|    if (state->wsize == 0) {
  ------------------
  |  Branch (383:9): [True: 23.1k, False: 227k]
  ------------------
  384|  23.1k|        state->wsize = 1U << state->wbits;
  385|  23.1k|        state->wnext = 0;
  386|  23.1k|        state->whave = 0;
  387|  23.1k|    }
  388|       |
  389|       |    /* copy state->wsize or less output bytes into the circular window */
  390|   250k|    if (copy >= state->wsize) {
  ------------------
  |  Branch (390:9): [True: 232, False: 250k]
  ------------------
  391|    232|        zmemcpy(state->window, end - state->wsize, state->wsize);
  ------------------
  |  |  210|    232|#    define zmemcpy memcpy
  ------------------
  392|    232|        state->wnext = 0;
  393|    232|        state->whave = state->wsize;
  394|    232|    }
  395|   250k|    else {
  396|   250k|        dist = state->wsize - state->wnext;
  397|   250k|        if (dist > copy) dist = copy;
  ------------------
  |  Branch (397:13): [True: 250k, False: 30]
  ------------------
  398|   250k|        zmemcpy(state->window + state->wnext, end - copy, dist);
  ------------------
  |  |  210|   250k|#    define zmemcpy memcpy
  ------------------
  399|   250k|        copy -= dist;
  400|   250k|        if (copy) {
  ------------------
  |  Branch (400:13): [True: 30, False: 250k]
  ------------------
  401|     30|            zmemcpy(state->window, end - copy, copy);
  ------------------
  |  |  210|     30|#    define zmemcpy memcpy
  ------------------
  402|     30|            state->wnext = copy;
  403|     30|            state->whave = state->wsize;
  404|     30|        }
  405|   250k|        else {
  406|   250k|            state->wnext += dist;
  407|   250k|            if (state->wnext == state->wsize) state->wnext = 0;
  ------------------
  |  Branch (407:17): [True: 0, False: 250k]
  ------------------
  408|   250k|            if (state->whave < state->wsize) state->whave += dist;
  ------------------
  |  Branch (408:17): [True: 249k, False: 926]
  ------------------
  409|   250k|        }
  410|   250k|    }
  411|   250k|    return 0;
  412|   250k|}

inflate_table:
   34|  71.4k|                                unsigned FAR *bits, unsigned short FAR *work) {
   35|  71.4k|    unsigned len;               /* a code's length in bits */
   36|  71.4k|    unsigned sym;               /* index of code symbols */
   37|  71.4k|    unsigned min, max;          /* minimum and maximum code lengths */
   38|  71.4k|    unsigned root;              /* number of index bits for root table */
   39|  71.4k|    unsigned curr;              /* number of index bits for current table */
   40|  71.4k|    unsigned drop;              /* code bits to drop for sub-table */
   41|  71.4k|    int left;                   /* number of prefix codes available */
   42|  71.4k|    unsigned used;              /* code entries in table used */
   43|  71.4k|    unsigned huff;              /* Huffman code */
   44|  71.4k|    unsigned incr;              /* for incrementing code, index */
   45|  71.4k|    unsigned fill;              /* index for replicating entries */
   46|  71.4k|    unsigned low;               /* low bits for current root entry */
   47|  71.4k|    unsigned mask;              /* mask for low root bits */
   48|  71.4k|    code here;                  /* table entry for duplication */
   49|  71.4k|    code FAR *next;             /* next available space in table */
   50|  71.4k|    const unsigned short FAR *base;     /* base value table to use */
   51|  71.4k|    const unsigned short FAR *extra;    /* extra bits table to use */
   52|  71.4k|    unsigned match;             /* use base and extra for symbol >= match */
   53|  71.4k|    unsigned short count[MAXBITS+1];    /* number of codes of each length */
   54|  71.4k|    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
   55|  71.4k|    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
   56|  71.4k|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   57|  71.4k|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   58|  71.4k|    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
   59|  71.4k|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   60|  71.4k|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 200};
   61|  71.4k|    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
   62|  71.4k|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   63|  71.4k|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   64|  71.4k|        8193, 12289, 16385, 24577, 0, 0};
   65|  71.4k|    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
   66|  71.4k|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   67|  71.4k|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   68|  71.4k|        28, 28, 29, 29, 64, 64};
   69|       |
   70|       |    /*
   71|       |       Process a set of code lengths to create a canonical Huffman code.  The
   72|       |       code lengths are lens[0..codes-1].  Each length corresponds to the
   73|       |       symbols 0..codes-1.  The Huffman code is generated by first sorting the
   74|       |       symbols by length from short to long, and retaining the symbol order
   75|       |       for codes with equal lengths.  Then the code starts with all zero bits
   76|       |       for the first code of the shortest length, and the codes are integer
   77|       |       increments for the same length, and zeros are appended as the length
   78|       |       increases.  For the deflate format, these bits are stored backwards
   79|       |       from their more natural integer increment ordering, and so when the
   80|       |       decoding tables are built in the large loop below, the integer codes
   81|       |       are incremented backwards.
   82|       |
   83|       |       This routine assumes, but does not check, that all of the entries in
   84|       |       lens[] are in the range 0..MAXBITS.  The caller must assure this.
   85|       |       1..MAXBITS is interpreted as that code length.  zero means that that
   86|       |       symbol does not occur in this code.
   87|       |
   88|       |       The codes are sorted by computing a count of codes for each length,
   89|       |       creating from that a table of starting indices for each length in the
   90|       |       sorted table, and then entering the symbols in order in the sorted
   91|       |       table.  The sorted table is work[], with that space being provided by
   92|       |       the caller.
   93|       |
   94|       |       The length counts are used for other purposes as well, i.e. finding
   95|       |       the minimum and maximum length codes, determining if there are any
   96|       |       codes at all, checking for a valid set of lengths, and looking ahead
   97|       |       at length counts to determine sub-table sizes when building the
   98|       |       decoding tables.
   99|       |     */
  100|       |
  101|       |    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
  102|  1.21M|    for (len = 0; len <= MAXBITS; len++)
  ------------------
  |  |    9|  1.21M|#define MAXBITS 15
  ------------------
  |  Branch (102:19): [True: 1.14M, False: 71.4k]
  ------------------
  103|  1.14M|        count[len] = 0;
  104|  7.65M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (104:19): [True: 7.58M, False: 71.4k]
  ------------------
  105|  7.58M|        count[lens[sym]]++;
  106|       |
  107|       |    /* bound code lengths, force root to be within code lengths */
  108|  71.4k|    root = *bits;
  109|   813k|    for (max = MAXBITS; max >= 1; max--)
  ------------------
  |  |    9|  71.4k|#define MAXBITS 15
  ------------------
  |  Branch (109:25): [True: 813k, False: 20]
  ------------------
  110|   813k|        if (count[max] != 0) break;
  ------------------
  |  Branch (110:13): [True: 71.4k, False: 741k]
  ------------------
  111|  71.4k|    if (root > max) root = max;
  ------------------
  |  Branch (111:9): [True: 70.5k, False: 908]
  ------------------
  112|  71.4k|    if (max == 0) {                     /* no symbols to code at all */
  ------------------
  |  Branch (112:9): [True: 20, False: 71.4k]
  ------------------
  113|     20|        here.op = (unsigned char)64;    /* invalid code marker */
  114|     20|        here.bits = (unsigned char)1;
  115|     20|        here.val = (unsigned short)0;
  116|     20|        *(*table)++ = here;             /* make a table to force an error */
  117|     20|        *(*table)++ = here;
  118|     20|        *bits = 1;
  119|     20|        return 0;     /* no symbols, but wait for decoding to report error */
  120|     20|    }
  121|  98.9k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (121:19): [True: 98.9k, False: 5]
  ------------------
  122|  98.9k|        if (count[min] != 0) break;
  ------------------
  |  Branch (122:13): [True: 71.4k, False: 27.4k]
  ------------------
  123|  71.4k|    if (root < min) root = min;
  ------------------
  |  Branch (123:9): [True: 0, False: 71.4k]
  ------------------
  124|       |
  125|       |    /* check for an over-subscribed or incomplete set of lengths */
  126|  71.4k|    left = 1;
  127|  1.14M|    for (len = 1; len <= MAXBITS; len++) {
  ------------------
  |  |    9|  1.14M|#define MAXBITS 15
  ------------------
  |  Branch (127:19): [True: 1.06M, False: 71.2k]
  ------------------
  128|  1.06M|        left <<= 1;
  129|  1.06M|        left -= count[len];
  130|  1.06M|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (130:13): [True: 160, False: 1.06M]
  ------------------
  131|  1.06M|    }
  132|  71.2k|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (132:9): [True: 49, False: 71.2k]
  |  Branch (132:22): [True: 22, False: 27]
  |  Branch (132:39): [True: 25, False: 2]
  ------------------
  133|     47|        return -1;                      /* incomplete set */
  134|       |
  135|       |    /* generate offsets into symbol table for each length for sorting */
  136|  71.2k|    offs[1] = 0;
  137|  1.06M|    for (len = 1; len < MAXBITS; len++)
  ------------------
  |  |    9|  1.06M|#define MAXBITS 15
  ------------------
  |  Branch (137:19): [True: 997k, False: 71.2k]
  ------------------
  138|   997k|        offs[len + 1] = offs[len] + count[len];
  139|       |
  140|       |    /* sort symbols by length, by symbol order within each length */
  141|  7.64M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (141:19): [True: 7.57M, False: 71.2k]
  ------------------
  142|  7.57M|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
  ------------------
  |  Branch (142:13): [True: 684k, False: 6.88M]
  ------------------
  143|       |
  144|       |    /*
  145|       |       Create and fill in decoding tables.  In this loop, the table being
  146|       |       filled is at next and has curr index bits.  The code being used is huff
  147|       |       with length len.  That code is converted to an index by dropping drop
  148|       |       bits off of the bottom.  For codes where len is less than drop + curr,
  149|       |       those top drop + curr - len bits are incremented through all values to
  150|       |       fill the table with replicated entries.
  151|       |
  152|       |       root is the number of index bits for the root table.  When len exceeds
  153|       |       root, sub-tables are created pointed to by the root entry with an index
  154|       |       of the low root bits of huff.  This is saved in low to check for when a
  155|       |       new sub-table should be started.  drop is zero when the root table is
  156|       |       being filled, and drop is root when sub-tables are being filled.
  157|       |
  158|       |       When a new sub-table is needed, it is necessary to look ahead in the
  159|       |       code lengths to determine what size sub-table is needed.  The length
  160|       |       counts are used for this, and so count[] is decremented as codes are
  161|       |       entered in the tables.
  162|       |
  163|       |       used keeps track of how many table entries have been allocated from the
  164|       |       provided *table space.  It is checked for LENS and DIST tables against
  165|       |       the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
  166|       |       the initial root table size constants.  See the comments in inftrees.h
  167|       |       for more information.
  168|       |
  169|       |       sym increments through all symbols, and the loop terminates when
  170|       |       all codes of length max, i.e. all codes, have been processed.  This
  171|       |       routine permits incomplete codes, so another loop after this one fills
  172|       |       in the rest of the decoding tables with invalid code markers.
  173|       |     */
  174|       |
  175|       |    /* set up for code type */
  176|  71.2k|    switch (type) {
  177|  23.9k|    case CODES:
  ------------------
  |  Branch (177:5): [True: 23.9k, False: 47.2k]
  ------------------
  178|  23.9k|        base = extra = work;    /* dummy value--not used */
  179|  23.9k|        match = 20;
  180|  23.9k|        break;
  181|  23.6k|    case LENS:
  ------------------
  |  Branch (181:5): [True: 23.6k, False: 47.5k]
  ------------------
  182|  23.6k|        base = lbase;
  183|  23.6k|        extra = lext;
  184|  23.6k|        match = 257;
  185|  23.6k|        break;
  186|  23.6k|    default:    /* DISTS */
  ------------------
  |  Branch (186:5): [True: 23.6k, False: 47.6k]
  ------------------
  187|  23.6k|        base = dbase;
  188|  23.6k|        extra = dext;
  189|  23.6k|        match = 0;
  190|  71.2k|    }
  191|       |
  192|       |    /* initialize state for loop */
  193|  71.2k|    huff = 0;                   /* starting code */
  194|  71.2k|    sym = 0;                    /* starting code symbol */
  195|  71.2k|    len = min;                  /* starting code length */
  196|  71.2k|    next = *table;              /* current table to fill in */
  197|  71.2k|    curr = root;                /* current table index bits */
  198|  71.2k|    drop = 0;                   /* current bits to drop from code for index */
  199|  71.2k|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  200|  71.2k|    used = 1U << root;          /* use root table entries */
  201|  71.2k|    mask = used - 1;            /* mask for comparing low */
  202|       |
  203|       |    /* check available table space */
  204|  71.2k|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   49|  23.6k|#define ENOUGH_LENS 852
  ------------------
  |  Branch (204:10): [True: 23.6k, False: 47.5k]
  |  Branch (204:26): [True: 0, False: 23.6k]
  ------------------
  205|  71.2k|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   50|  23.6k|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (205:10): [True: 23.6k, False: 47.6k]
  |  Branch (205:27): [True: 0, False: 23.6k]
  ------------------
  206|      0|        return 1;
  207|       |
  208|       |    /* process all codes and make table entries */
  209|   684k|    for (;;) {
  210|       |        /* create table entry */
  211|   684k|        here.bits = (unsigned char)(len - drop);
  212|   684k|        if (work[sym] + 1U < match) {
  ------------------
  |  Branch (212:13): [True: 374k, False: 309k]
  ------------------
  213|   374k|            here.op = (unsigned char)0;
  214|   374k|            here.val = work[sym];
  215|   374k|        }
  216|   309k|        else if (work[sym] >= match) {
  ------------------
  |  Branch (216:18): [True: 286k, False: 23.6k]
  ------------------
  217|   286k|            here.op = (unsigned char)(extra[work[sym] - match]);
  218|   286k|            here.val = base[work[sym] - match];
  219|   286k|        }
  220|  23.6k|        else {
  221|  23.6k|            here.op = (unsigned char)(32 + 64);         /* end of block */
  222|  23.6k|            here.val = 0;
  223|  23.6k|        }
  224|       |
  225|       |        /* replicate for those indices with low len bits equal to huff */
  226|   684k|        incr = 1U << (len - drop);
  227|   684k|        fill = 1U << curr;
  228|   684k|        min = fill;                 /* save offset to next table */
  229|  2.50M|        do {
  230|  2.50M|            fill -= incr;
  231|  2.50M|            next[(huff >> drop) + fill] = here;
  232|  2.50M|        } while (fill != 0);
  ------------------
  |  Branch (232:18): [True: 1.82M, False: 684k]
  ------------------
  233|       |
  234|       |        /* backwards increment the len-bit code huff */
  235|   684k|        incr = 1U << (len - 1);
  236|  1.29M|        while (huff & incr)
  ------------------
  |  Branch (236:16): [True: 613k, False: 684k]
  ------------------
  237|   613k|            incr >>= 1;
  238|   684k|        if (incr != 0) {
  ------------------
  |  Branch (238:13): [True: 613k, False: 71.2k]
  ------------------
  239|   613k|            huff &= incr - 1;
  240|   613k|            huff += incr;
  241|   613k|        }
  242|  71.2k|        else
  243|  71.2k|            huff = 0;
  244|       |
  245|       |        /* go to next symbol, update count, len */
  246|   684k|        sym++;
  247|   684k|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (247:13): [True: 259k, False: 424k]
  ------------------
  248|   259k|            if (len == max) break;
  ------------------
  |  Branch (248:17): [True: 71.2k, False: 188k]
  ------------------
  249|   188k|            len = lens[work[sym]];
  250|   188k|        }
  251|       |
  252|       |        /* create new sub-table if needed */
  253|   613k|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (253:13): [True: 45.2k, False: 568k]
  |  Branch (253:27): [True: 4.16k, False: 41.0k]
  ------------------
  254|       |            /* if first time, transition to sub-tables */
  255|  4.16k|            if (drop == 0)
  ------------------
  |  Branch (255:17): [True: 647, False: 3.51k]
  ------------------
  256|    647|                drop = root;
  257|       |
  258|       |            /* increment past last table */
  259|  4.16k|            next += min;            /* here min is 1 << curr */
  260|       |
  261|       |            /* determine length of next table */
  262|  4.16k|            curr = len - drop;
  263|  4.16k|            left = (int)(1 << curr);
  264|  5.45k|            while (curr + drop < max) {
  ------------------
  |  Branch (264:20): [True: 3.73k, False: 1.72k]
  ------------------
  265|  3.73k|                left -= count[curr + drop];
  266|  3.73k|                if (left <= 0) break;
  ------------------
  |  Branch (266:21): [True: 2.44k, False: 1.29k]
  ------------------
  267|  1.29k|                curr++;
  268|  1.29k|                left <<= 1;
  269|  1.29k|            }
  270|       |
  271|       |            /* check for enough space */
  272|  4.16k|            used += 1U << curr;
  273|  4.16k|            if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   49|  3.61k|#define ENOUGH_LENS 852
  ------------------
  |  Branch (273:18): [True: 3.61k, False: 548]
  |  Branch (273:34): [True: 0, False: 3.61k]
  ------------------
  274|  4.16k|                (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   50|    548|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (274:18): [True: 548, False: 3.61k]
  |  Branch (274:35): [True: 0, False: 548]
  ------------------
  275|      0|                return 1;
  276|       |
  277|       |            /* point entry in root table to sub-table */
  278|  4.16k|            low = huff & mask;
  279|  4.16k|            (*table)[low].op = (unsigned char)curr;
  280|  4.16k|            (*table)[low].bits = (unsigned char)root;
  281|  4.16k|            (*table)[low].val = (unsigned short)(next - *table);
  282|  4.16k|        }
  283|   613k|    }
  284|       |
  285|       |    /* fill in remaining table entry if code is incomplete (guaranteed to have
  286|       |       at most one remaining entry, since if the code is incomplete, the
  287|       |       maximum code length that was allowed to get this far is one bit) */
  288|  71.2k|    if (huff != 0) {
  ------------------
  |  Branch (288:9): [True: 2, False: 71.2k]
  ------------------
  289|      2|        here.op = (unsigned char)64;            /* invalid code marker */
  290|      2|        here.bits = (unsigned char)(len - drop);
  291|      2|        here.val = (unsigned short)0;
  292|      2|        next[huff] = here;
  293|      2|    }
  294|       |
  295|       |    /* set return parameters */
  296|  71.2k|    *table += used;
  297|  71.2k|    *bits = root;
  298|  71.2k|    return 0;
  299|  71.2k|}

_tr_init:
  456|  40.2k|void ZLIB_INTERNAL _tr_init(deflate_state *s) {
  457|  40.2k|    tr_static_init();
  458|       |
  459|  40.2k|    s->l_desc.dyn_tree = s->dyn_ltree;
  460|  40.2k|    s->l_desc.stat_desc = &static_l_desc;
  461|       |
  462|  40.2k|    s->d_desc.dyn_tree = s->dyn_dtree;
  463|  40.2k|    s->d_desc.stat_desc = &static_d_desc;
  464|       |
  465|  40.2k|    s->bl_desc.dyn_tree = s->bl_tree;
  466|  40.2k|    s->bl_desc.stat_desc = &static_bl_desc;
  467|       |
  468|  40.2k|    s->bi_buf = 0;
  469|  40.2k|    s->bi_valid = 0;
  470|  40.2k|    s->bi_used = 0;
  471|       |#ifdef ZLIB_DEBUG
  472|       |    s->compressed_len = 0L;
  473|       |    s->bits_sent = 0L;
  474|       |#endif
  475|       |
  476|       |    /* Initialize the first block of the first file: */
  477|  40.2k|    init_block(s);
  478|  40.2k|}
_tr_stored_block:
  861|    230|                                    ulg stored_len, int last) {
  862|    230|    send_bits(s, (STORED_BLOCK<<1) + last, 3);  /* send block type */
  ------------------
  |  |  274|    230|#define send_bits(s, value, length) \
  |  |  275|    230|{ int len = length;\
  |  |  276|    230|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|    230|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 0, False: 230]
  |  |  ------------------
  |  |  277|      0|    int val = (int)value;\
  |  |  278|      0|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|      0|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|      0|#define put_short(s, w) { \
  |  |  |  |  145|      0|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|      0|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|      0|}
  |  |  ------------------
  |  |  280|      0|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|      0|#define Buf_size 16
  |  |  ------------------
  |  |  281|      0|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|      0|#define Buf_size 16
  |  |  ------------------
  |  |  282|    230|  } else {\
  |  |  283|    230|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|    230|    s->bi_valid += len;\
  |  |  285|    230|  }\
  |  |  286|    230|}
  ------------------
  863|    230|    bi_windup(s);        /* align on byte boundary */
  864|    230|    put_short(s, (ush)stored_len);
  ------------------
  |  |  144|    230|#define put_short(s, w) { \
  |  |  145|    230|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  ------------------
  |  |  |  |  290|    230|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  146|    230|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  ------------------
  |  |  |  |  290|    230|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  147|    230|}
  ------------------
  865|    230|    put_short(s, (ush)~stored_len);
  ------------------
  |  |  144|    230|#define put_short(s, w) { \
  |  |  145|    230|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  ------------------
  |  |  |  |  290|    230|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  146|    230|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  ------------------
  |  |  |  |  290|    230|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  147|    230|}
  ------------------
  866|    230|    if (stored_len)
  ------------------
  |  Branch (866:9): [True: 230, False: 0]
  ------------------
  867|    230|        zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len);
  ------------------
  |  |  210|    230|#    define zmemcpy memcpy
  ------------------
  868|    230|    s->pending += stored_len;
  869|       |#ifdef ZLIB_DEBUG
  870|       |    s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
  871|       |    s->compressed_len += (stored_len + 4) << 3;
  872|       |    s->bits_sent += 2*16;
  873|       |    s->bits_sent += stored_len << 3;
  874|       |#endif
  875|    230|}
_tr_flush_bits:
  880|   122k|void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s) {
  881|   122k|    bi_flush(s);
  882|   122k|}
_tr_flush_block:
  998|  41.7k|                                   ulg stored_len, int last) {
  999|  41.7k|    ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
 1000|  41.7k|    int max_blindex = 0;  /* index of last bit length code of non zero freq */
 1001|       |
 1002|       |    /* Build the Huffman trees unless a stored block is forced */
 1003|  41.7k|    if (s->level > 0) {
  ------------------
  |  Branch (1003:9): [True: 41.7k, False: 0]
  ------------------
 1004|       |
 1005|       |        /* Check if the file is binary or text */
 1006|  41.7k|        if (s->strm->data_type == Z_UNKNOWN)
  ------------------
  |  |  206|  41.7k|#define Z_UNKNOWN  2
  ------------------
  |  Branch (1006:13): [True: 40.0k, False: 1.63k]
  ------------------
 1007|  40.0k|            s->strm->data_type = detect_data_type(s);
 1008|       |
 1009|       |        /* Construct the literal and distance trees */
 1010|  41.7k|        build_tree(s, (tree_desc *)(&(s->l_desc)));
 1011|  41.7k|        Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
 1012|  41.7k|                s->static_len));
 1013|       |
 1014|  41.7k|        build_tree(s, (tree_desc *)(&(s->d_desc)));
 1015|  41.7k|        Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
 1016|  41.7k|                s->static_len));
 1017|       |        /* At this point, opt_len and static_len are the total bit lengths of
 1018|       |         * the compressed block data, excluding the tree representations.
 1019|       |         */
 1020|       |
 1021|       |        /* Build the bit length tree for the above two trees, and get the index
 1022|       |         * in bl_order of the last bit length code to send.
 1023|       |         */
 1024|  41.7k|        max_blindex = build_bl_tree(s);
 1025|       |
 1026|       |        /* Determine the best encoding. Compute the block lengths in bytes. */
 1027|  41.7k|        opt_lenb = (s->opt_len + 3 + 7) >> 3;
 1028|  41.7k|        static_lenb = (s->static_len + 3 + 7) >> 3;
 1029|       |
 1030|  41.7k|        Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
 1031|  41.7k|                opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
 1032|  41.7k|                s->sym_next / 3));
 1033|       |
 1034|  41.7k|#ifndef FORCE_STATIC
 1035|  41.7k|        if (static_lenb <= opt_lenb || s->strategy == Z_FIXED)
  ------------------
  |  |  199|  29.9k|#define Z_FIXED               4
  ------------------
  |  Branch (1035:13): [True: 11.7k, False: 29.9k]
  |  Branch (1035:40): [True: 0, False: 29.9k]
  ------------------
 1036|  11.7k|#endif
 1037|  11.7k|            opt_lenb = static_lenb;
 1038|       |
 1039|  41.7k|    } else {
 1040|      0|        Assert(buf != (char*)0, "lost buf");
 1041|      0|        opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
 1042|      0|    }
 1043|       |
 1044|       |#ifdef FORCE_STORED
 1045|       |    if (buf != (char*)0) { /* force stored block */
 1046|       |#else
 1047|  41.7k|    if (stored_len + 4 <= opt_lenb && buf != (char*)0) {
  ------------------
  |  Branch (1047:9): [True: 230, False: 41.4k]
  |  Branch (1047:39): [True: 230, False: 0]
  ------------------
 1048|       |                       /* 4: two words for the lengths */
 1049|    230|#endif
 1050|       |        /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
 1051|       |         * Otherwise we can't have processed more than WSIZE input bytes since
 1052|       |         * the last block flush, because compression would have been
 1053|       |         * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
 1054|       |         * transform a block into a stored block.
 1055|       |         */
 1056|    230|        _tr_stored_block(s, buf, stored_len, last);
 1057|       |
 1058|  41.4k|    } else if (static_lenb == opt_lenb) {
  ------------------
  |  Branch (1058:16): [True: 11.5k, False: 29.9k]
  ------------------
 1059|  11.5k|        send_bits(s, (STATIC_TREES<<1) + last, 3);
  ------------------
  |  |  274|  11.5k|#define send_bits(s, value, length) \
  |  |  275|  11.5k|{ int len = length;\
  |  |  276|  11.5k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  11.5k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 0, False: 11.5k]
  |  |  ------------------
  |  |  277|      0|    int val = (int)value;\
  |  |  278|      0|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|      0|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|      0|#define put_short(s, w) { \
  |  |  |  |  145|      0|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|      0|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|      0|}
  |  |  ------------------
  |  |  280|      0|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|      0|#define Buf_size 16
  |  |  ------------------
  |  |  281|      0|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|      0|#define Buf_size 16
  |  |  ------------------
  |  |  282|  11.5k|  } else {\
  |  |  283|  11.5k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  11.5k|    s->bi_valid += len;\
  |  |  285|  11.5k|  }\
  |  |  286|  11.5k|}
  ------------------
 1060|  11.5k|        compress_block(s, (const ct_data *)static_ltree,
 1061|  11.5k|                       (const ct_data *)static_dtree);
 1062|       |#ifdef ZLIB_DEBUG
 1063|       |        s->compressed_len += 3 + s->static_len;
 1064|       |#endif
 1065|  29.9k|    } else {
 1066|  29.9k|        send_bits(s, (DYN_TREES<<1) + last, 3);
  ------------------
  |  |  274|  29.9k|#define send_bits(s, value, length) \
  |  |  275|  29.9k|{ int len = length;\
  |  |  276|  29.9k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  29.9k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 0, False: 29.9k]
  |  |  ------------------
  |  |  277|      0|    int val = (int)value;\
  |  |  278|      0|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|      0|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|      0|#define put_short(s, w) { \
  |  |  |  |  145|      0|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|      0|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|      0|}
  |  |  ------------------
  |  |  280|      0|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|      0|#define Buf_size 16
  |  |  ------------------
  |  |  281|      0|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|      0|#define Buf_size 16
  |  |  ------------------
  |  |  282|  29.9k|  } else {\
  |  |  283|  29.9k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  29.9k|    s->bi_valid += len;\
  |  |  285|  29.9k|  }\
  |  |  286|  29.9k|}
  ------------------
 1067|  29.9k|        send_all_trees(s, s->l_desc.max_code + 1, s->d_desc.max_code + 1,
 1068|  29.9k|                       max_blindex + 1);
 1069|  29.9k|        compress_block(s, (const ct_data *)s->dyn_ltree,
 1070|  29.9k|                       (const ct_data *)s->dyn_dtree);
 1071|       |#ifdef ZLIB_DEBUG
 1072|       |        s->compressed_len += 3 + s->opt_len;
 1073|       |#endif
 1074|  29.9k|    }
 1075|  41.7k|    Assert (s->compressed_len == s->bits_sent, "bad compressed size");
 1076|       |    /* The above check is made mod 2^32, for files larger than 512 MB
 1077|       |     * and uLong implemented on 32 bits.
 1078|       |     */
 1079|  41.7k|    init_block(s);
 1080|       |
 1081|  41.7k|    if (last) {
  ------------------
  |  Branch (1081:9): [True: 40.0k, False: 1.63k]
  ------------------
 1082|  40.0k|        bi_windup(s);
 1083|       |#ifdef ZLIB_DEBUG
 1084|       |        s->compressed_len += 7;  /* align on byte boundary */
 1085|       |#endif
 1086|  40.0k|    }
 1087|  41.7k|    Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len >> 3,
 1088|  41.7k|           s->compressed_len - 7*last));
 1089|  41.7k|}
trees.c:tr_static_init:
  295|  40.2k|local void tr_static_init(void) {
  296|       |#if defined(GEN_TREES_H) || !defined(STDC)
  297|       |    static int static_init_done = 0;
  298|       |    int n;        /* iterates over tree elements */
  299|       |    int bits;     /* bit counter */
  300|       |    int length;   /* length value */
  301|       |    int code;     /* code value */
  302|       |    int dist;     /* distance index */
  303|       |    ush bl_count[MAX_BITS+1];
  304|       |    /* number of codes at each bit length for an optimal tree */
  305|       |
  306|       |    if (static_init_done) return;
  307|       |
  308|       |    /* For some embedded targets, global variables are not initialized: */
  309|       |#ifdef NO_INIT_GLOBAL_POINTERS
  310|       |    static_l_desc.static_tree = static_ltree;
  311|       |    static_l_desc.extra_bits = extra_lbits;
  312|       |    static_d_desc.static_tree = static_dtree;
  313|       |    static_d_desc.extra_bits = extra_dbits;
  314|       |    static_bl_desc.extra_bits = extra_blbits;
  315|       |#endif
  316|       |
  317|       |    /* Initialize the mapping length (0..255) -> length code (0..28) */
  318|       |    length = 0;
  319|       |    for (code = 0; code < LENGTH_CODES-1; code++) {
  320|       |        base_length[code] = length;
  321|       |        for (n = 0; n < (1 << extra_lbits[code]); n++) {
  322|       |            _length_code[length++] = (uch)code;
  323|       |        }
  324|       |    }
  325|       |    Assert (length == 256, "tr_static_init: length != 256");
  326|       |    /* Note that the length 255 (match length 258) can be represented
  327|       |     * in two different ways: code 284 + 5 bits or code 285, so we
  328|       |     * overwrite length_code[255] to use the best encoding:
  329|       |     */
  330|       |    _length_code[length - 1] = (uch)code;
  331|       |
  332|       |    /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
  333|       |    dist = 0;
  334|       |    for (code = 0 ; code < 16; code++) {
  335|       |        base_dist[code] = dist;
  336|       |        for (n = 0; n < (1 << extra_dbits[code]); n++) {
  337|       |            _dist_code[dist++] = (uch)code;
  338|       |        }
  339|       |    }
  340|       |    Assert (dist == 256, "tr_static_init: dist != 256");
  341|       |    dist >>= 7; /* from now on, all distances are divided by 128 */
  342|       |    for ( ; code < D_CODES; code++) {
  343|       |        base_dist[code] = dist << 7;
  344|       |        for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {
  345|       |            _dist_code[256 + dist++] = (uch)code;
  346|       |        }
  347|       |    }
  348|       |    Assert (dist == 256, "tr_static_init: 256 + dist != 512");
  349|       |
  350|       |    /* Construct the codes of the static literal tree */
  351|       |    for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
  352|       |    n = 0;
  353|       |    while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
  354|       |    while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
  355|       |    while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
  356|       |    while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
  357|       |    /* Codes 286 and 287 do not exist, but we must include them in the
  358|       |     * tree construction to get a canonical Huffman tree (longest code
  359|       |     * all ones)
  360|       |     */
  361|       |    gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
  362|       |
  363|       |    /* The static distance tree is trivial: */
  364|       |    for (n = 0; n < D_CODES; n++) {
  365|       |        static_dtree[n].Len = 5;
  366|       |        static_dtree[n].Code = bi_reverse((unsigned)n, 5);
  367|       |    }
  368|       |    static_init_done = 1;
  369|       |
  370|       |#  ifdef GEN_TREES_H
  371|       |    gen_trees_header();
  372|       |#  endif
  373|       |#endif /* defined(GEN_TREES_H) || !defined(STDC) */
  374|  40.2k|}
trees.c:init_block:
  440|  81.9k|local void init_block(deflate_state *s) {
  441|  81.9k|    int n; /* iterates over tree elements */
  442|       |
  443|       |    /* Initialize the trees. */
  444|  23.5M|    for (n = 0; n < L_CODES;  n++) s->dyn_ltree[n].Freq = 0;
  ------------------
  |  |   40|  23.5M|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   37|  23.5M|#define LITERALS  256
  |  |  ------------------
  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   34|  23.5M|#define LENGTH_CODES 29
  |  |  ------------------
  ------------------
                  for (n = 0; n < L_CODES;  n++) s->dyn_ltree[n].Freq = 0;
  ------------------
  |  |   83|  23.4M|#define Freq fc.freq
  ------------------
  |  Branch (444:17): [True: 23.4M, False: 81.9k]
  ------------------
  445|  2.54M|    for (n = 0; n < D_CODES;  n++) s->dyn_dtree[n].Freq = 0;
  ------------------
  |  |   43|  2.54M|#define D_CODES   30
  ------------------
                  for (n = 0; n < D_CODES;  n++) s->dyn_dtree[n].Freq = 0;
  ------------------
  |  |   83|  2.45M|#define Freq fc.freq
  ------------------
  |  Branch (445:17): [True: 2.45M, False: 81.9k]
  ------------------
  446|  1.63M|    for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
  ------------------
  |  |   46|  1.63M|#define BL_CODES  19
  ------------------
                  for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
  ------------------
  |  |   83|  1.55M|#define Freq fc.freq
  ------------------
  |  Branch (446:17): [True: 1.55M, False: 81.9k]
  ------------------
  447|       |
  448|  81.9k|    s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |   50|  81.9k|#define END_BLOCK 256
  ------------------
                  s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |   83|  81.9k|#define Freq fc.freq
  ------------------
  449|  81.9k|    s->opt_len = s->static_len = 0L;
  450|  81.9k|    s->sym_next = s->matches = 0;
  451|  81.9k|}
trees.c:bi_windup:
  181|  40.3k|local void bi_windup(deflate_state *s) {
  182|  40.3k|    if (s->bi_valid > 8) {
  ------------------
  |  Branch (182:9): [True: 22.6k, False: 17.6k]
  ------------------
  183|  22.6k|        put_short(s, s->bi_buf);
  ------------------
  |  |  144|  22.6k|#define put_short(s, w) { \
  |  |  145|  22.6k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  ------------------
  |  |  |  |  290|  22.6k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  146|  22.6k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  ------------------
  |  |  |  |  290|  22.6k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  147|  22.6k|}
  ------------------
  184|  22.6k|    } else if (s->bi_valid > 0) {
  ------------------
  |  Branch (184:16): [True: 17.5k, False: 147]
  ------------------
  185|  17.5k|        put_byte(s, (Byte)s->bi_buf);
  ------------------
  |  |  290|  17.5k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
  186|  17.5k|    }
  187|  40.3k|    s->bi_used = ((s->bi_valid - 1) & 7) + 1;
  188|  40.3k|    s->bi_buf = 0;
  189|  40.3k|    s->bi_valid = 0;
  190|       |#ifdef ZLIB_DEBUG
  191|       |    s->bits_sent = (s->bits_sent + 7) & ~7;
  192|       |#endif
  193|  40.3k|}
trees.c:bi_flush:
  166|   122k|local void bi_flush(deflate_state *s) {
  167|   122k|    if (s->bi_valid == 16) {
  ------------------
  |  Branch (167:9): [True: 102, False: 122k]
  ------------------
  168|    102|        put_short(s, s->bi_buf);
  ------------------
  |  |  144|    102|#define put_short(s, w) { \
  |  |  145|    102|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  ------------------
  |  |  |  |  290|    102|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  146|    102|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  ------------------
  |  |  |  |  290|    102|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  147|    102|}
  ------------------
  169|    102|        s->bi_buf = 0;
  170|    102|        s->bi_valid = 0;
  171|   122k|    } else if (s->bi_valid >= 8) {
  ------------------
  |  Branch (171:16): [True: 789, False: 121k]
  ------------------
  172|    789|        put_byte(s, (Byte)s->bi_buf);
  ------------------
  |  |  290|    789|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
  173|    789|        s->bi_buf >>= 8;
  174|    789|        s->bi_valid -= 8;
  175|    789|    }
  176|   122k|}
trees.c:detect_data_type:
  966|  40.0k|local int detect_data_type(deflate_state *s) {
  967|       |    /* block_mask is the bit mask of block-listed bytes
  968|       |     * set bits 0..6, 14..25, and 28..31
  969|       |     * 0xf3ffc07f = binary 11110011111111111100000001111111
  970|       |     */
  971|  40.0k|    unsigned long block_mask = 0xf3ffc07fUL;
  972|  40.0k|    int n;
  973|       |
  974|       |    /* Check for non-textual ("block-listed") bytes. */
  975|  1.07M|    for (n = 0; n <= 31; n++, block_mask >>= 1)
  ------------------
  |  Branch (975:17): [True: 1.04M, False: 32.1k]
  ------------------
  976|  1.04M|        if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
  ------------------
  |  |   83|   749k|#define Freq fc.freq
  ------------------
  |  Branch (976:13): [True: 749k, False: 290k]
  |  Branch (976:33): [True: 7.91k, False: 741k]
  ------------------
  977|  7.91k|            return Z_BINARY;
  ------------------
  |  |  203|  7.91k|#define Z_BINARY   0
  ------------------
  978|       |
  979|       |    /* Check for textual ("allow-listed") bytes. */
  980|  32.1k|    if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
  ------------------
  |  |   83|  32.1k|#define Freq fc.freq
  ------------------
                  if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
  ------------------
  |  |   83|  32.1k|#define Freq fc.freq
  ------------------
  |  Branch (980:9): [True: 38, False: 32.1k]
  |  Branch (980:38): [True: 9.23k, False: 22.8k]
  ------------------
  981|  32.1k|            || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |   83|  22.8k|#define Freq fc.freq
  ------------------
  |  Branch (981:16): [True: 8, False: 22.8k]
  ------------------
  982|  9.28k|        return Z_TEXT;
  ------------------
  |  |  204|  9.28k|#define Z_TEXT     1
  ------------------
  983|  1.26M|    for (n = 32; n < LITERALS; n++)
  ------------------
  |  |   37|  1.26M|#define LITERALS  256
  ------------------
  |  Branch (983:18): [True: 1.26M, False: 0]
  ------------------
  984|  1.26M|        if (s->dyn_ltree[n].Freq != 0)
  ------------------
  |  |   83|  1.26M|#define Freq fc.freq
  ------------------
  |  Branch (984:13): [True: 22.8k, False: 1.24M]
  ------------------
  985|  22.8k|            return Z_TEXT;
  ------------------
  |  |  204|  45.7k|#define Z_TEXT     1
  ------------------
  986|       |
  987|       |    /* There are no "block-listed" or "allow-listed" bytes:
  988|       |     * this stream either is empty or has tolerated ("gray-listed") bytes only.
  989|       |     */
  990|      0|    return Z_BINARY;
  ------------------
  |  |  203|      0|#define Z_BINARY   0
  ------------------
  991|  22.8k|}
trees.c:build_tree:
  627|   125k|local void build_tree(deflate_state *s, tree_desc *desc) {
  628|   125k|    ct_data *tree         = desc->dyn_tree;
  629|   125k|    const ct_data *stree  = desc->stat_desc->static_tree;
  630|   125k|    int elems             = desc->stat_desc->elems;
  631|   125k|    int n, m;          /* iterate over heap elements */
  632|   125k|    int max_code = -1; /* largest code with non zero frequency */
  633|   125k|    int node;          /* new node being created */
  634|       |
  635|       |    /* Construct the initial heap, with least frequent element in
  636|       |     * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n + 1].
  637|       |     * heap[0] is not used.
  638|       |     */
  639|   125k|    s->heap_len = 0, s->heap_max = HEAP_SIZE;
  ------------------
  |  |   49|   125k|#define HEAP_SIZE (2*L_CODES+1)
  |  |  ------------------
  |  |  |  |   40|   125k|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|   125k|#define LITERALS  256
  |  |  |  |  ------------------
  |  |  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|   125k|#define LENGTH_CODES 29
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  640|       |
  641|  14.0M|    for (n = 0; n < elems; n++) {
  ------------------
  |  Branch (641:17): [True: 13.9M, False: 125k]
  ------------------
  642|  13.9M|        if (tree[n].Freq != 0) {
  ------------------
  |  |   83|  13.9M|#define Freq fc.freq
  ------------------
  |  Branch (642:13): [True: 1.99M, False: 11.9M]
  ------------------
  643|  1.99M|            s->heap[++(s->heap_len)] = max_code = n;
  644|  1.99M|            s->depth[n] = 0;
  645|  11.9M|        } else {
  646|  11.9M|            tree[n].Len = 0;
  ------------------
  |  |   86|  11.9M|#define Len  dl.len
  ------------------
  647|  11.9M|        }
  648|  13.9M|    }
  649|       |
  650|       |    /* The pkzip format requires that at least one distance code exists,
  651|       |     * and that at least one bit should be sent even if there is only one
  652|       |     * possible code. So to avoid special checks later on we force at least
  653|       |     * two codes of non zero frequency.
  654|       |     */
  655|   130k|    while (s->heap_len < 2) {
  ------------------
  |  Branch (655:12): [True: 4.92k, False: 125k]
  ------------------
  656|  4.92k|        node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
  ------------------
  |  Branch (656:44): [True: 3.98k, False: 945]
  ------------------
  657|  4.92k|        tree[node].Freq = 1;
  ------------------
  |  |   83|  4.92k|#define Freq fc.freq
  ------------------
  658|  4.92k|        s->depth[node] = 0;
  659|  4.92k|        s->opt_len--; if (stree) s->static_len -= stree[node].Len;
  ------------------
  |  |   86|  4.92k|#define Len  dl.len
  ------------------
  |  Branch (659:27): [True: 4.92k, False: 0]
  ------------------
  660|       |        /* node is 0 or 1 so it does not have extra bits */
  661|  4.92k|    }
  662|   125k|    desc->max_code = max_code;
  663|       |
  664|       |    /* The elements heap[heap_len/2 + 1 .. heap_len] are leaves of the tree,
  665|       |     * establish sub-heaps of increasing lengths:
  666|       |     */
  667|  1.09M|    for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
  ------------------
  |  Branch (667:29): [True: 966k, False: 125k]
  ------------------
  668|       |
  669|       |    /* Construct the Huffman tree by repeatedly combining the least two
  670|       |     * frequent nodes.
  671|       |     */
  672|   125k|    node = elems;              /* next internal node of the tree */
  673|  1.87M|    do {
  674|  1.87M|        pqremove(s, tree, n);  /* n = node of least frequency */
  ------------------
  |  |  488|  1.87M|#define pqremove(s, tree, top) \
  |  |  489|  1.87M|{\
  |  |  490|  1.87M|    top = s->heap[SMALLEST]; \
  |  |  ------------------
  |  |  |  |  480|  1.87M|#define SMALLEST 1
  |  |  ------------------
  |  |  491|  1.87M|    s->heap[SMALLEST] = s->heap[s->heap_len--]; \
  |  |  ------------------
  |  |  |  |  480|  1.87M|#define SMALLEST 1
  |  |  ------------------
  |  |  492|  1.87M|    pqdownheap(s, tree, SMALLEST); \
  |  |  ------------------
  |  |  |  |  480|  1.87M|#define SMALLEST 1
  |  |  ------------------
  |  |  493|  1.87M|}
  ------------------
  675|  1.87M|        m = s->heap[SMALLEST]; /* m = node of next least frequency */
  ------------------
  |  |  480|  1.87M|#define SMALLEST 1
  ------------------
  676|       |
  677|  1.87M|        s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
  678|  1.87M|        s->heap[--(s->heap_max)] = m;
  679|       |
  680|       |        /* Create a new node father of n and m */
  681|  1.87M|        tree[node].Freq = tree[n].Freq + tree[m].Freq;
  ------------------
  |  |   83|  1.87M|#define Freq fc.freq
  ------------------
                      tree[node].Freq = tree[n].Freq + tree[m].Freq;
  ------------------
  |  |   83|  1.87M|#define Freq fc.freq
  ------------------
                      tree[node].Freq = tree[n].Freq + tree[m].Freq;
  ------------------
  |  |   83|  1.87M|#define Freq fc.freq
  ------------------
  682|  1.87M|        s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
  ------------------
  |  Branch (682:33): [True: 1.45M, False: 418k]
  ------------------
  683|  1.45M|                                s->depth[n] : s->depth[m]) + 1);
  684|  1.87M|        tree[n].Dad = tree[m].Dad = (ush)node;
  ------------------
  |  |   85|  1.87M|#define Dad  dl.dad
  ------------------
                      tree[n].Dad = tree[m].Dad = (ush)node;
  ------------------
  |  |   85|  1.87M|#define Dad  dl.dad
  ------------------
  685|       |#ifdef DUMP_BL_TREE
  686|       |        if (tree == s->bl_tree) {
  687|       |            fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
  688|       |                    node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
  689|       |        }
  690|       |#endif
  691|       |        /* and insert the new node in the heap */
  692|  1.87M|        s->heap[SMALLEST] = node++;
  ------------------
  |  |  480|  1.87M|#define SMALLEST 1
  ------------------
  693|  1.87M|        pqdownheap(s, tree, SMALLEST);
  ------------------
  |  |  480|  1.87M|#define SMALLEST 1
  ------------------
  694|       |
  695|  1.87M|    } while (s->heap_len >= 2);
  ------------------
  |  Branch (695:14): [True: 1.74M, False: 125k]
  ------------------
  696|       |
  697|   125k|    s->heap[--(s->heap_max)] = s->heap[SMALLEST];
  ------------------
  |  |  480|   125k|#define SMALLEST 1
  ------------------
  698|       |
  699|       |    /* At this point, the fields freq and dad are set. We can now
  700|       |     * generate the bit lengths.
  701|       |     */
  702|   125k|    gen_bitlen(s, (tree_desc *)desc);
  703|       |
  704|       |    /* The field len is now set, we can generate the bit codes */
  705|   125k|    gen_codes ((ct_data *)tree, max_code, s->bl_count);
  706|   125k|}
trees.c:pqdownheap:
  509|  4.71M|local void pqdownheap(deflate_state *s, ct_data *tree, int k) {
  510|  4.71M|    int v = s->heap[k];
  511|  4.71M|    int j = k << 1;  /* left son of k */
  512|  17.0M|    while (j <= s->heap_len) {
  ------------------
  |  Branch (512:12): [True: 13.5M, False: 3.48M]
  ------------------
  513|       |        /* Set j to the smallest of the two sons: */
  514|  13.5M|        if (j < s->heap_len &&
  ------------------
  |  Branch (514:13): [True: 12.8M, False: 720k]
  ------------------
  515|  13.5M|            smaller(tree, s->heap[j + 1], s->heap[j], s->depth)) {
  ------------------
  |  |  500|  12.8M|   (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |   83|  12.8M|#define Freq fc.freq
  |  |  ------------------
  |  |                  (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |   83|  25.6M|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (500:5): [True: 2.94M, False: 9.85M]
  |  |  ------------------
  |  |  501|  12.8M|   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |   83|  9.85M|#define Freq fc.freq
  |  |  ------------------
  |  |                  (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |   83|  19.7M|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (501:5): [True: 3.70M, False: 6.15M]
  |  |  |  Branch (501:37): [True: 3.08M, False: 626k]
  |  |  ------------------
  ------------------
  516|  6.02M|            j++;
  517|  6.02M|        }
  518|       |        /* Exit if v is smaller than both sons */
  519|  13.5M|        if (smaller(tree, v, s->heap[j], s->depth)) break;
  ------------------
  |  |  500|  13.5M|   (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |   83|  13.5M|#define Freq fc.freq
  |  |  ------------------
  |  |                  (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |   83|  27.0M|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (500:5): [True: 777k, False: 12.7M]
  |  |  ------------------
  |  |  501|  13.5M|   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |   83|  12.7M|#define Freq fc.freq
  |  |  ------------------
  |  |                  (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |   83|  25.4M|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (501:5): [True: 827k, False: 11.9M]
  |  |  |  Branch (501:37): [True: 453k, False: 374k]
  |  |  ------------------
  ------------------
  520|       |
  521|       |        /* Exchange v with the smallest son */
  522|  12.2M|        s->heap[k] = s->heap[j];  k = j;
  523|       |
  524|       |        /* And continue down the tree, setting j to the left son of k */
  525|  12.2M|        j <<= 1;
  526|  12.2M|    }
  527|  4.71M|    s->heap[k] = v;
  528|  4.71M|}
trees.c:gen_bitlen:
  540|   125k|local void gen_bitlen(deflate_state *s, tree_desc *desc) {
  541|   125k|    ct_data *tree        = desc->dyn_tree;
  542|   125k|    int max_code         = desc->max_code;
  543|   125k|    const ct_data *stree = desc->stat_desc->static_tree;
  544|   125k|    const intf *extra    = desc->stat_desc->extra_bits;
  545|   125k|    int base             = desc->stat_desc->extra_base;
  546|   125k|    int max_length       = desc->stat_desc->max_length;
  547|   125k|    int h;              /* heap index */
  548|   125k|    int n, m;           /* iterate over the tree elements */
  549|   125k|    int bits;           /* bit length */
  550|   125k|    int xbits;          /* extra bits */
  551|   125k|    ush f;              /* frequency */
  552|   125k|    int overflow = 0;   /* number of elements with bit length too large */
  553|       |
  554|  2.12M|    for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
  ------------------
  |  |   52|  2.12M|#define MAX_BITS 15
  ------------------
  |  Branch (554:20): [True: 2.00M, False: 125k]
  ------------------
  555|       |
  556|       |    /* In a first pass, compute the optimal bit lengths (which may
  557|       |     * overflow in the case of the bit length tree).
  558|       |     */
  559|   125k|    tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
  ------------------
  |  |   86|   125k|#define Len  dl.len
  ------------------
  560|       |
  561|  3.87M|    for (h = s->heap_max + 1; h < HEAP_SIZE; h++) {
  ------------------
  |  |   49|  3.87M|#define HEAP_SIZE (2*L_CODES+1)
  |  |  ------------------
  |  |  |  |   40|  3.87M|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  3.87M|#define LITERALS  256
  |  |  |  |  ------------------
  |  |  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  3.87M|#define LENGTH_CODES 29
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (561:31): [True: 3.74M, False: 125k]
  ------------------
  562|  3.74M|        n = s->heap[h];
  563|  3.74M|        bits = tree[tree[n].Dad].Len + 1;
  ------------------
  |  |   85|  3.74M|#define Dad  dl.dad
  ------------------
                      bits = tree[tree[n].Dad].Len + 1;
  ------------------
  |  |   86|  3.74M|#define Len  dl.len
  ------------------
  564|  3.74M|        if (bits > max_length) bits = max_length, overflow++;
  ------------------
  |  Branch (564:13): [True: 1.20k, False: 3.74M]
  ------------------
  565|  3.74M|        tree[n].Len = (ush)bits;
  ------------------
  |  |   86|  3.74M|#define Len  dl.len
  ------------------
  566|       |        /* We overwrite tree[n].Dad which is no longer needed */
  567|       |
  568|  3.74M|        if (n > max_code) continue; /* not a leaf node */
  ------------------
  |  Branch (568:13): [True: 1.74M, False: 1.99M]
  ------------------
  569|       |
  570|  1.99M|        s->bl_count[bits]++;
  571|  1.99M|        xbits = 0;
  572|  1.99M|        if (n >= base) xbits = extra[n - base];
  ------------------
  |  Branch (572:13): [True: 884k, False: 1.11M]
  ------------------
  573|  1.99M|        f = tree[n].Freq;
  ------------------
  |  |   83|  1.99M|#define Freq fc.freq
  ------------------
  574|  1.99M|        s->opt_len += (ulg)f * (unsigned)(bits + xbits);
  575|  1.99M|        if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits);
  ------------------
  |  |   86|  1.64M|#define Len  dl.len
  ------------------
  |  Branch (575:13): [True: 1.64M, False: 355k]
  ------------------
  576|  1.99M|    }
  577|   125k|    if (overflow == 0) return;
  ------------------
  |  Branch (577:9): [True: 124k, False: 388]
  ------------------
  578|       |
  579|    388|    Tracev((stderr,"\nbit length overflow\n"));
  580|       |    /* This happens for example on obj2 and pic of the Calgary corpus */
  581|       |
  582|       |    /* Find the first bit length which could increase: */
  583|    602|    do {
  584|    602|        bits = max_length - 1;
  585|    709|        while (s->bl_count[bits] == 0) bits--;
  ------------------
  |  Branch (585:16): [True: 107, False: 602]
  ------------------
  586|    602|        s->bl_count[bits]--;        /* move one leaf down the tree */
  587|    602|        s->bl_count[bits + 1] += 2; /* move one overflow item as its brother */
  588|    602|        s->bl_count[max_length]--;
  589|       |        /* The brother of the overflow item also moves one step up,
  590|       |         * but this does not affect bl_count[max_length]
  591|       |         */
  592|    602|        overflow -= 2;
  593|    602|    } while (overflow > 0);
  ------------------
  |  Branch (593:14): [True: 214, False: 388]
  ------------------
  594|       |
  595|       |    /* Now recompute all bit lengths, scanning in increasing frequency.
  596|       |     * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
  597|       |     * lengths instead of fixing only the wrong ones. This idea is taken
  598|       |     * from 'ar' written by Haruhiko Okumura.)
  599|       |     */
  600|  3.10k|    for (bits = max_length; bits != 0; bits--) {
  ------------------
  |  Branch (600:29): [True: 2.71k, False: 388]
  ------------------
  601|  2.71k|        n = s->bl_count[bits];
  602|  12.4k|        while (n != 0) {
  ------------------
  |  Branch (602:16): [True: 9.73k, False: 2.71k]
  ------------------
  603|  9.73k|            m = s->heap[--h];
  604|  9.73k|            if (m > max_code) continue;
  ------------------
  |  Branch (604:17): [True: 4.16k, False: 5.56k]
  ------------------
  605|  5.56k|            if ((unsigned) tree[m].Len != (unsigned) bits) {
  ------------------
  |  |   86|  5.56k|#define Len  dl.len
  ------------------
  |  Branch (605:17): [True: 627, False: 4.93k]
  ------------------
  606|    627|                Tracev((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
  607|    627|                s->opt_len += ((ulg)bits - tree[m].Len) * tree[m].Freq;
  ------------------
  |  |   86|    627|#define Len  dl.len
  ------------------
                              s->opt_len += ((ulg)bits - tree[m].Len) * tree[m].Freq;
  ------------------
  |  |   83|    627|#define Freq fc.freq
  ------------------
  608|    627|                tree[m].Len = (ush)bits;
  ------------------
  |  |   86|    627|#define Len  dl.len
  ------------------
  609|    627|            }
  610|  5.56k|            n--;
  611|  5.56k|        }
  612|  2.71k|    }
  613|    388|}
trees.c:gen_codes:
  203|   125k|local void gen_codes(ct_data *tree, int max_code, ushf *bl_count) {
  204|   125k|    ush next_code[MAX_BITS+1]; /* next code value for each bit length */
  205|   125k|    unsigned code = 0;         /* running code value */
  206|   125k|    int bits;                  /* bit index */
  207|   125k|    int n;                     /* code index */
  208|       |
  209|       |    /* The distribution counts are first used to generate the code values
  210|       |     * without bit reversal.
  211|       |     */
  212|  2.00M|    for (bits = 1; bits <= MAX_BITS; bits++) {
  ------------------
  |  |   52|  2.00M|#define MAX_BITS 15
  ------------------
  |  Branch (212:20): [True: 1.87M, False: 125k]
  ------------------
  213|  1.87M|        code = (code + bl_count[bits - 1]) << 1;
  214|  1.87M|        next_code[bits] = (ush)code;
  215|  1.87M|    }
  216|       |    /* Check that the bit counts in bl_count are consistent. The last code
  217|       |     * must be all ones.
  218|       |     */
  219|   125k|    Assert (code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1,
  220|   125k|            "inconsistent bit counts");
  221|   125k|    Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
  222|       |
  223|  13.1M|    for (n = 0;  n <= max_code; n++) {
  ------------------
  |  Branch (223:18): [True: 13.0M, False: 125k]
  ------------------
  224|  13.0M|        int len = tree[n].Len;
  ------------------
  |  |   86|  13.0M|#define Len  dl.len
  ------------------
  225|  13.0M|        if (len == 0) continue;
  ------------------
  |  Branch (225:13): [True: 11.0M, False: 1.99M]
  ------------------
  226|       |        /* Now reverse the bits */
  227|  1.99M|        tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
  ------------------
  |  |   84|  1.99M|#define Code fc.code
  ------------------
  228|       |
  229|  1.99M|        Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
  230|  1.99M|            n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1));
  231|  1.99M|    }
  232|   125k|}
trees.c:bi_reverse:
  154|  1.99M|local unsigned bi_reverse(unsigned code, int len) {
  155|  1.99M|    register unsigned res = 0;
  156|  11.4M|    do {
  157|  11.4M|        res |= code & 1;
  158|  11.4M|        code >>= 1, res <<= 1;
  159|  11.4M|    } while (--len > 0);
  ------------------
  |  Branch (159:14): [True: 9.42M, False: 1.99M]
  ------------------
  160|  1.99M|    return res >> 1;
  161|  1.99M|}
trees.c:build_bl_tree:
  800|  41.7k|local int build_bl_tree(deflate_state *s) {
  801|  41.7k|    int max_blindex;  /* index of last bit length code of non zero freq */
  802|       |
  803|       |    /* Determine the bit length frequencies for literal and distance trees */
  804|  41.7k|    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
  805|  41.7k|    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
  806|       |
  807|       |    /* Build the bit length tree: */
  808|  41.7k|    build_tree(s, (tree_desc *)(&(s->bl_desc)));
  809|       |    /* opt_len now includes the length of the tree representations, except the
  810|       |     * lengths of the bit lengths codes and the 5 + 5 + 4 bits for the counts.
  811|       |     */
  812|       |
  813|       |    /* Determine the number of bit length codes to send. The pkzip format
  814|       |     * requires that at least 4 bit length codes be sent. (appnote.txt says
  815|       |     * 3 but the actual value used is 4.)
  816|       |     */
  817|   101k|    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
  ------------------
  |  |   46|  41.7k|#define BL_CODES  19
  ------------------
  |  Branch (817:36): [True: 101k, False: 0]
  ------------------
  818|   101k|        if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
  ------------------
  |  |   86|   101k|#define Len  dl.len
  ------------------
  |  Branch (818:13): [True: 41.7k, False: 60.1k]
  ------------------
  819|   101k|    }
  820|       |    /* Update opt_len to include the bit length tree and counts */
  821|  41.7k|    s->opt_len += 3*((ulg)max_blindex + 1) + 5 + 5 + 4;
  822|  41.7k|    Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
  823|  41.7k|            s->opt_len, s->static_len));
  824|       |
  825|  41.7k|    return max_blindex;
  826|  41.7k|}
trees.c:scan_tree:
  712|  83.4k|local void scan_tree(deflate_state *s, ct_data *tree, int max_code) {
  713|  83.4k|    int n;                     /* iterates over all tree elements */
  714|  83.4k|    int prevlen = -1;          /* last emitted length */
  715|  83.4k|    int curlen;                /* length of current code */
  716|  83.4k|    int nextlen = tree[0].Len; /* length of next code */
  ------------------
  |  |   86|  83.4k|#define Len  dl.len
  ------------------
  717|  83.4k|    int count = 0;             /* repeat count of the current code */
  718|  83.4k|    int max_count = 7;         /* max repeat count */
  719|  83.4k|    int min_count = 4;         /* min repeat count */
  720|       |
  721|  83.4k|    if (nextlen == 0) max_count = 138, min_count = 3;
  ------------------
  |  Branch (721:9): [True: 41.0k, False: 42.3k]
  ------------------
  722|  83.4k|    tree[max_code + 1].Len = (ush)0xffff; /* guard */
  ------------------
  |  |   86|  83.4k|#define Len  dl.len
  ------------------
  723|       |
  724|  12.2M|    for (n = 0; n <= max_code; n++) {
  ------------------
  |  Branch (724:17): [True: 12.2M, False: 83.4k]
  ------------------
  725|  12.2M|        curlen = nextlen; nextlen = tree[n + 1].Len;
  ------------------
  |  |   86|  12.2M|#define Len  dl.len
  ------------------
  726|  12.2M|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (726:13): [True: 12.1M, False: 50.0k]
  |  Branch (726:36): [True: 10.4M, False: 1.69M]
  ------------------
  727|  10.4M|            continue;
  728|  10.4M|        } else if (count < min_count) {
  ------------------
  |  Branch (728:20): [True: 1.29M, False: 451k]
  ------------------
  729|  1.29M|            s->bl_tree[curlen].Freq += (ush)count;
  ------------------
  |  |   83|  1.29M|#define Freq fc.freq
  ------------------
  730|  1.29M|        } else if (curlen != 0) {
  ------------------
  |  Branch (730:20): [True: 72.4k, False: 379k]
  ------------------
  731|  72.4k|            if (curlen != prevlen) s->bl_tree[curlen].Freq++;
  ------------------
  |  |   83|  35.5k|#define Freq fc.freq
  ------------------
  |  Branch (731:17): [True: 35.5k, False: 36.9k]
  ------------------
  732|  72.4k|            s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |   53|  72.4k|#define REP_3_6      16
  ------------------
                          s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |   83|  72.4k|#define Freq fc.freq
  ------------------
  733|   379k|        } else if (count <= 10) {
  ------------------
  |  Branch (733:20): [True: 158k, False: 220k]
  ------------------
  734|   158k|            s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |   56|   158k|#define REPZ_3_10    17
  ------------------
                          s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |   83|   158k|#define Freq fc.freq
  ------------------
  735|   220k|        } else {
  736|   220k|            s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |   59|   220k|#define REPZ_11_138  18
  ------------------
                          s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |   83|   220k|#define Freq fc.freq
  ------------------
  737|   220k|        }
  738|  1.74M|        count = 0; prevlen = curlen;
  739|  1.74M|        if (nextlen == 0) {
  ------------------
  |  Branch (739:13): [True: 577k, False: 1.17M]
  ------------------
  740|   577k|            max_count = 138, min_count = 3;
  741|  1.17M|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (741:20): [True: 42.8k, False: 1.12M]
  ------------------
  742|  42.8k|            max_count = 6, min_count = 3;
  743|  1.12M|        } else {
  744|  1.12M|            max_count = 7, min_count = 4;
  745|  1.12M|        }
  746|  1.74M|    }
  747|  83.4k|}
trees.c:compress_block:
  901|  41.4k|                          const ct_data *dtree) {
  902|  41.4k|    unsigned dist;      /* distance of matched string */
  903|  41.4k|    int lc;             /* match length or unmatched char (if dist == 0) */
  904|  41.4k|    unsigned sx = 0;    /* running index in symbol buffers */
  905|  41.4k|    unsigned code;      /* the code to send */
  906|  41.4k|    int extra;          /* number of extra bits to send */
  907|       |
  908|  32.3M|    if (s->sym_next != 0) do {
  ------------------
  |  Branch (908:9): [True: 41.4k, False: 0]
  ------------------
  909|       |#ifdef LIT_MEM
  910|       |        dist = s->d_buf[sx];
  911|       |        lc = s->l_buf[sx++];
  912|       |#else
  913|  32.3M|        dist = s->sym_buf[sx++] & 0xff;
  914|  32.3M|        dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
  915|  32.3M|        lc = s->sym_buf[sx++];
  916|  32.3M|#endif
  917|  32.3M|        if (dist == 0) {
  ------------------
  |  Branch (917:13): [True: 21.9M, False: 10.3M]
  ------------------
  918|  21.9M|            send_code(s, lc, ltree); /* send a literal byte */
  ------------------
  |  |  239|  21.9M|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  21.9M|#define send_bits(s, value, length) \
  |  |  |  |  275|  21.9M|{ int len = length;\
  |  |  |  |  276|  21.9M|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  21.9M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 10.8M, False: 11.1M]
  |  |  |  |  ------------------
  |  |  |  |  277|  10.8M|    int val = (int)value;\
  |  |  |  |  278|  10.8M|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  10.8M|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  10.8M|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  10.8M|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  10.8M|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  10.8M|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  10.8M|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  10.8M|}
  |  |  |  |  ------------------
  |  |  |  |  280|  10.8M|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  10.8M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  10.8M|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  10.8M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  11.1M|  } else {\
  |  |  |  |  283|  11.1M|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  11.1M|    s->bi_valid += len;\
  |  |  |  |  285|  11.1M|  }\
  |  |  |  |  286|  21.9M|}
  |  |  ------------------
  ------------------
  919|  21.9M|            Tracecv(isgraph(lc), (stderr," '%c' ", lc));
  920|  21.9M|        } else {
  921|       |            /* Here, lc is the match length - MIN_MATCH */
  922|  10.3M|            code = _length_code[lc];
  923|  10.3M|            send_code(s, code + LITERALS + 1, ltree);   /* send length code */
  ------------------
  |  |  239|  10.3M|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  10.3M|#define send_bits(s, value, length) \
  |  |  |  |  275|  10.3M|{ int len = length;\
  |  |  |  |  276|  10.3M|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  10.3M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 1.30M, False: 9.05M]
  |  |  |  |  ------------------
  |  |  |  |  277|  1.30M|    int val = (int)value;\
  |  |  |  |  278|  1.30M|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  1.30M|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  1.30M|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  1.30M|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  1.30M|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.30M|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  1.30M|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.30M|}
  |  |  |  |  ------------------
  |  |  |  |  280|  1.30M|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  1.30M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  1.30M|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  1.30M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  9.05M|  } else {\
  |  |  |  |  283|  9.05M|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  9.05M|    s->bi_valid += len;\
  |  |  |  |  285|  9.05M|  }\
  |  |  |  |  286|  10.3M|}
  |  |  ------------------
  ------------------
  924|  10.3M|            extra = extra_lbits[code];
  925|  10.3M|            if (extra != 0) {
  ------------------
  |  Branch (925:17): [True: 752k, False: 9.60M]
  ------------------
  926|   752k|                lc -= base_length[code];
  927|   752k|                send_bits(s, lc, extra);       /* send the extra length bits */
  ------------------
  |  |  274|   752k|#define send_bits(s, value, length) \
  |  |  275|   752k|{ int len = length;\
  |  |  276|   752k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|   752k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 125k, False: 627k]
  |  |  ------------------
  |  |  277|   125k|    int val = (int)value;\
  |  |  278|   125k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|   125k|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|   125k|#define put_short(s, w) { \
  |  |  |  |  145|   125k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|   125k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|   125k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|   125k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|   125k|}
  |  |  ------------------
  |  |  280|   125k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|   125k|#define Buf_size 16
  |  |  ------------------
  |  |  281|   125k|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|   125k|#define Buf_size 16
  |  |  ------------------
  |  |  282|   627k|  } else {\
  |  |  283|   627k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|   627k|    s->bi_valid += len;\
  |  |  285|   627k|  }\
  |  |  286|   752k|}
  ------------------
  928|   752k|            }
  929|  10.3M|            dist--; /* dist is now the match distance - 1 */
  930|  10.3M|            code = d_code(dist);
  ------------------
  |  |  318|  10.3M|   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
  |  |  ------------------
  |  |  |  Branch (318:5): [True: 9.69M, False: 670k]
  |  |  ------------------
  ------------------
  931|  10.3M|            Assert (code < D_CODES, "bad d_code");
  932|       |
  933|  10.3M|            send_code(s, code, dtree);       /* send the distance code */
  ------------------
  |  |  239|  10.3M|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  10.3M|#define send_bits(s, value, length) \
  |  |  |  |  275|  10.3M|{ int len = length;\
  |  |  |  |  276|  10.3M|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  10.3M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 942k, False: 9.41M]
  |  |  |  |  ------------------
  |  |  |  |  277|   942k|    int val = (int)value;\
  |  |  |  |  278|   942k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|   942k|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|   942k|#define put_short(s, w) { \
  |  |  |  |  |  |  145|   942k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|   942k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   942k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|   942k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   942k|}
  |  |  |  |  ------------------
  |  |  |  |  280|   942k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   942k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|   942k|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   942k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  9.41M|  } else {\
  |  |  |  |  283|  9.41M|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  9.41M|    s->bi_valid += len;\
  |  |  |  |  285|  9.41M|  }\
  |  |  |  |  286|  10.3M|}
  |  |  ------------------
  ------------------
  934|  10.3M|            extra = extra_dbits[code];
  935|  10.3M|            if (extra != 0) {
  ------------------
  |  Branch (935:17): [True: 1.50M, False: 8.85M]
  ------------------
  936|  1.50M|                dist -= (unsigned)base_dist[code];
  937|  1.50M|                send_bits(s, dist, extra);   /* send the extra distance bits */
  ------------------
  |  |  274|  1.50M|#define send_bits(s, value, length) \
  |  |  275|  1.50M|{ int len = length;\
  |  |  276|  1.50M|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  1.50M|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 608k, False: 895k]
  |  |  ------------------
  |  |  277|   608k|    int val = (int)value;\
  |  |  278|   608k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|   608k|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|   608k|#define put_short(s, w) { \
  |  |  |  |  145|   608k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|   608k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|   608k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|   608k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|   608k|}
  |  |  ------------------
  |  |  280|   608k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|   608k|#define Buf_size 16
  |  |  ------------------
  |  |  281|   608k|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|   608k|#define Buf_size 16
  |  |  ------------------
  |  |  282|   895k|  } else {\
  |  |  283|   895k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|   895k|    s->bi_valid += len;\
  |  |  285|   895k|  }\
  |  |  286|  1.50M|}
  ------------------
  938|  1.50M|            }
  939|  10.3M|        } /* literal or match pair ? */
  940|       |
  941|       |        /* Check for no overlay of pending_buf on needed symbols */
  942|       |#ifdef LIT_MEM
  943|       |        Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow");
  944|       |#else
  945|  32.3M|        Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
  946|  32.3M|#endif
  947|       |
  948|  32.3M|    } while (sx < s->sym_next);
  ------------------
  |  Branch (948:14): [True: 32.2M, False: 41.4k]
  ------------------
  949|       |
  950|  41.4k|    send_code(s, END_BLOCK, ltree);
  ------------------
  |  |  239|  41.4k|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  41.4k|#define send_bits(s, value, length) \
  |  |  |  |  275|  41.4k|{ int len = length;\
  |  |  |  |  276|  41.4k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  41.4k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 14.1k, False: 27.3k]
  |  |  |  |  ------------------
  |  |  |  |  277|  14.1k|    int val = (int)value;\
  |  |  |  |  278|  14.1k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  14.1k|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  14.1k|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  14.1k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  14.1k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  14.1k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  14.1k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  14.1k|}
  |  |  |  |  ------------------
  |  |  |  |  280|  14.1k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  14.1k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  14.1k|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  14.1k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  27.3k|  } else {\
  |  |  |  |  283|  27.3k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  27.3k|    s->bi_valid += len;\
  |  |  |  |  285|  27.3k|  }\
  |  |  |  |  286|  41.4k|}
  |  |  ------------------
  ------------------
  951|  41.4k|}
trees.c:send_all_trees:
  834|  29.9k|                          int blcodes) {
  835|  29.9k|    int rank;                    /* index in bl_order */
  836|       |
  837|  29.9k|    Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
  838|  29.9k|    Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
  839|  29.9k|            "too many codes");
  840|  29.9k|    Tracev((stderr, "\nbl counts: "));
  841|  29.9k|    send_bits(s, lcodes - 257, 5);  /* not +255 as stated in appnote.txt */
  ------------------
  |  |  274|  29.9k|#define send_bits(s, value, length) \
  |  |  275|  29.9k|{ int len = length;\
  |  |  276|  29.9k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  29.9k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 0, False: 29.9k]
  |  |  ------------------
  |  |  277|      0|    int val = (int)value;\
  |  |  278|      0|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|      0|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|      0|#define put_short(s, w) { \
  |  |  |  |  145|      0|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|      0|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|      0|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|      0|}
  |  |  ------------------
  |  |  280|      0|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|      0|#define Buf_size 16
  |  |  ------------------
  |  |  281|      0|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|      0|#define Buf_size 16
  |  |  ------------------
  |  |  282|  29.9k|  } else {\
  |  |  283|  29.9k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  29.9k|    s->bi_valid += len;\
  |  |  285|  29.9k|  }\
  |  |  286|  29.9k|}
  ------------------
  842|  29.9k|    send_bits(s, dcodes - 1,   5);
  ------------------
  |  |  274|  29.9k|#define send_bits(s, value, length) \
  |  |  275|  29.9k|{ int len = length;\
  |  |  276|  29.9k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  29.9k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 715, False: 29.1k]
  |  |  ------------------
  |  |  277|    715|    int val = (int)value;\
  |  |  278|    715|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|    715|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|    715|#define put_short(s, w) { \
  |  |  |  |  145|    715|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|    715|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|    715|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|    715|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|    715|}
  |  |  ------------------
  |  |  280|    715|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|    715|#define Buf_size 16
  |  |  ------------------
  |  |  281|    715|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|    715|#define Buf_size 16
  |  |  ------------------
  |  |  282|  29.1k|  } else {\
  |  |  283|  29.1k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  29.1k|    s->bi_valid += len;\
  |  |  285|  29.1k|  }\
  |  |  286|  29.9k|}
  ------------------
  843|  29.9k|    send_bits(s, blcodes - 4,  4);  /* not -3 as stated in appnote.txt */
  ------------------
  |  |  274|  29.9k|#define send_bits(s, value, length) \
  |  |  275|  29.9k|{ int len = length;\
  |  |  276|  29.9k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  29.9k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 29.1k, False: 715]
  |  |  ------------------
  |  |  277|  29.1k|    int val = (int)value;\
  |  |  278|  29.1k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|  29.1k|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|  29.1k|#define put_short(s, w) { \
  |  |  |  |  145|  29.1k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  29.1k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|  29.1k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  29.1k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|  29.1k|}
  |  |  ------------------
  |  |  280|  29.1k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|  29.1k|#define Buf_size 16
  |  |  ------------------
  |  |  281|  29.1k|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|  29.1k|#define Buf_size 16
  |  |  ------------------
  |  |  282|  29.1k|  } else {\
  |  |  283|    715|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|    715|    s->bi_valid += len;\
  |  |  285|    715|  }\
  |  |  286|  29.9k|}
  ------------------
  844|   553k|    for (rank = 0; rank < blcodes; rank++) {
  ------------------
  |  Branch (844:20): [True: 523k, False: 29.9k]
  ------------------
  845|   523k|        Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
  846|   523k|        send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
  ------------------
  |  |  274|   523k|#define send_bits(s, value, length) \
  |  |  275|   523k|{ int len = length;\
  |  |  276|   523k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|   523k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 86.9k, False: 436k]
  |  |  ------------------
  |  |  277|  86.9k|    int val = (int)value;\
  |  |  278|  86.9k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|  86.9k|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|  86.9k|#define put_short(s, w) { \
  |  |  |  |  145|  86.9k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  86.9k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|  86.9k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  86.9k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|  86.9k|}
  |  |  ------------------
  |  |  280|  86.9k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|  86.9k|#define Buf_size 16
  |  |  ------------------
  |  |  281|  86.9k|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|  86.9k|#define Buf_size 16
  |  |  ------------------
  |  |  282|   436k|  } else {\
  |  |  283|   436k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|   436k|    s->bi_valid += len;\
  |  |  285|   436k|  }\
  |  |  286|   523k|}
  ------------------
  847|   523k|    }
  848|  29.9k|    Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
  849|       |
  850|  29.9k|    send_tree(s, (ct_data *)s->dyn_ltree, lcodes - 1);  /* literal tree */
  851|  29.9k|    Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
  852|       |
  853|  29.9k|    send_tree(s, (ct_data *)s->dyn_dtree, dcodes - 1);  /* distance tree */
  854|  29.9k|    Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
  855|  29.9k|}
trees.c:send_tree:
  753|  59.8k|local void send_tree(deflate_state *s, ct_data *tree, int max_code) {
  754|  59.8k|    int n;                     /* iterates over all tree elements */
  755|  59.8k|    int prevlen = -1;          /* last emitted length */
  756|  59.8k|    int curlen;                /* length of current code */
  757|  59.8k|    int nextlen = tree[0].Len; /* length of next code */
  ------------------
  |  |   86|  59.8k|#define Len  dl.len
  ------------------
  758|  59.8k|    int count = 0;             /* repeat count of the current code */
  759|  59.8k|    int max_count = 7;         /* max repeat count */
  760|  59.8k|    int min_count = 4;         /* min repeat count */
  761|       |
  762|       |    /* tree[max_code + 1].Len = -1; */  /* guard already set */
  763|  59.8k|    if (nextlen == 0) max_count = 138, min_count = 3;
  ------------------
  |  Branch (763:9): [True: 29.2k, False: 30.5k]
  ------------------
  764|       |
  765|  9.05M|    for (n = 0; n <= max_code; n++) {
  ------------------
  |  Branch (765:17): [True: 8.99M, False: 59.8k]
  ------------------
  766|  8.99M|        curlen = nextlen; nextlen = tree[n + 1].Len;
  ------------------
  |  |   86|  8.99M|#define Len  dl.len
  ------------------
  767|  8.99M|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (767:13): [True: 8.95M, False: 42.5k]
  |  Branch (767:36): [True: 7.73M, False: 1.22M]
  ------------------
  768|  7.73M|            continue;
  769|  7.73M|        } else if (count < min_count) {
  ------------------
  |  Branch (769:20): [True: 951k, False: 312k]
  ------------------
  770|  1.13M|            do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
  ------------------
  |  |  239|  1.13M|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  1.13M|#define send_bits(s, value, length) \
  |  |  |  |  275|  1.13M|{ int len = length;\
  |  |  |  |  276|  1.13M|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  1.13M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 217k, False: 915k]
  |  |  |  |  ------------------
  |  |  |  |  277|   217k|    int val = (int)value;\
  |  |  |  |  278|   217k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|   217k|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|   217k|#define put_short(s, w) { \
  |  |  |  |  |  |  145|   217k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|   217k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   217k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|   217k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   217k|}
  |  |  |  |  ------------------
  |  |  |  |  280|   217k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   217k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|   217k|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   217k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|   915k|  } else {\
  |  |  |  |  283|   915k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|   915k|    s->bi_valid += len;\
  |  |  |  |  285|   915k|  }\
  |  |  |  |  286|  1.13M|}
  |  |  ------------------
  ------------------
  |  Branch (770:61): [True: 180k, False: 951k]
  ------------------
  771|       |
  772|   951k|        } else if (curlen != 0) {
  ------------------
  |  Branch (772:20): [True: 65.6k, False: 246k]
  ------------------
  773|  65.6k|            if (curlen != prevlen) {
  ------------------
  |  Branch (773:17): [True: 32.1k, False: 33.4k]
  ------------------
  774|  32.1k|                send_code(s, curlen, s->bl_tree); count--;
  ------------------
  |  |  239|  32.1k|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  32.1k|#define send_bits(s, value, length) \
  |  |  |  |  275|  32.1k|{ int len = length;\
  |  |  |  |  276|  32.1k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  32.1k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 4.55k, False: 27.6k]
  |  |  |  |  ------------------
  |  |  |  |  277|  4.55k|    int val = (int)value;\
  |  |  |  |  278|  4.55k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  4.55k|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  4.55k|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  4.55k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  4.55k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  4.55k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  4.55k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  4.55k|}
  |  |  |  |  ------------------
  |  |  |  |  280|  4.55k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  4.55k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  4.55k|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  4.55k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  27.6k|  } else {\
  |  |  |  |  283|  27.6k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  27.6k|    s->bi_valid += len;\
  |  |  |  |  285|  27.6k|  }\
  |  |  |  |  286|  32.1k|}
  |  |  ------------------
  ------------------
  775|  32.1k|            }
  776|  65.6k|            Assert(count >= 3 && count <= 6, " 3_6?");
  777|  65.6k|            send_code(s, REP_3_6, s->bl_tree); send_bits(s, count - 3, 2);
  ------------------
  |  |  239|  65.6k|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  65.6k|#define send_bits(s, value, length) \
  |  |  |  |  275|  65.6k|{ int len = length;\
  |  |  |  |  276|  65.6k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  65.6k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 10.2k, False: 55.4k]
  |  |  |  |  ------------------
  |  |  |  |  277|  10.2k|    int val = (int)value;\
  |  |  |  |  278|  10.2k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  10.2k|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  10.2k|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  10.2k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  10.2k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  10.2k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  10.2k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  10.2k|}
  |  |  |  |  ------------------
  |  |  |  |  280|  10.2k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  10.2k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  10.2k|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  10.2k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  55.4k|  } else {\
  |  |  |  |  283|  55.4k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  55.4k|    s->bi_valid += len;\
  |  |  |  |  285|  55.4k|  }\
  |  |  |  |  286|  65.6k|}
  |  |  ------------------
  ------------------
                          send_code(s, REP_3_6, s->bl_tree); send_bits(s, count - 3, 2);
  ------------------
  |  |  274|  65.6k|#define send_bits(s, value, length) \
  |  |  275|  65.6k|{ int len = length;\
  |  |  276|  65.6k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  65.6k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 8.16k, False: 57.5k]
  |  |  ------------------
  |  |  277|  8.16k|    int val = (int)value;\
  |  |  278|  8.16k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|  8.16k|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|  8.16k|#define put_short(s, w) { \
  |  |  |  |  145|  8.16k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  8.16k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|  8.16k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  8.16k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|  8.16k|}
  |  |  ------------------
  |  |  280|  8.16k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|  8.16k|#define Buf_size 16
  |  |  ------------------
  |  |  281|  8.16k|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|  8.16k|#define Buf_size 16
  |  |  ------------------
  |  |  282|  57.5k|  } else {\
  |  |  283|  57.5k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  57.5k|    s->bi_valid += len;\
  |  |  285|  57.5k|  }\
  |  |  286|  65.6k|}
  ------------------
  778|       |
  779|   246k|        } else if (count <= 10) {
  ------------------
  |  Branch (779:20): [True: 82.3k, False: 164k]
  ------------------
  780|  82.3k|            send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count - 3, 3);
  ------------------
  |  |  239|  82.3k|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  82.3k|#define send_bits(s, value, length) \
  |  |  |  |  275|  82.3k|{ int len = length;\
  |  |  |  |  276|  82.3k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  82.3k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 11.3k, False: 71.0k]
  |  |  |  |  ------------------
  |  |  |  |  277|  11.3k|    int val = (int)value;\
  |  |  |  |  278|  11.3k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  11.3k|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  11.3k|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  11.3k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  11.3k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  11.3k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  11.3k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  11.3k|}
  |  |  |  |  ------------------
  |  |  |  |  280|  11.3k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  11.3k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  11.3k|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  11.3k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  71.0k|  } else {\
  |  |  |  |  283|  71.0k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  71.0k|    s->bi_valid += len;\
  |  |  |  |  285|  71.0k|  }\
  |  |  |  |  286|  82.3k|}
  |  |  ------------------
  ------------------
                          send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count - 3, 3);
  ------------------
  |  |  274|  82.3k|#define send_bits(s, value, length) \
  |  |  275|  82.3k|{ int len = length;\
  |  |  276|  82.3k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  82.3k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 14.7k, False: 67.5k]
  |  |  ------------------
  |  |  277|  14.7k|    int val = (int)value;\
  |  |  278|  14.7k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|  14.7k|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|  14.7k|#define put_short(s, w) { \
  |  |  |  |  145|  14.7k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  14.7k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|  14.7k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  14.7k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|  14.7k|}
  |  |  ------------------
  |  |  280|  14.7k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|  14.7k|#define Buf_size 16
  |  |  ------------------
  |  |  281|  14.7k|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|  14.7k|#define Buf_size 16
  |  |  ------------------
  |  |  282|  67.5k|  } else {\
  |  |  283|  67.5k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  67.5k|    s->bi_valid += len;\
  |  |  285|  67.5k|  }\
  |  |  286|  82.3k|}
  ------------------
  781|       |
  782|   164k|        } else {
  783|   164k|            send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count - 11, 7);
  ------------------
  |  |  239|   164k|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|   164k|#define send_bits(s, value, length) \
  |  |  |  |  275|   164k|{ int len = length;\
  |  |  |  |  276|   164k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   164k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 31.0k, False: 133k]
  |  |  |  |  ------------------
  |  |  |  |  277|  31.0k|    int val = (int)value;\
  |  |  |  |  278|  31.0k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  31.0k|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  31.0k|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  31.0k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  31.0k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  31.0k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  31.0k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  31.0k|}
  |  |  |  |  ------------------
  |  |  |  |  280|  31.0k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  31.0k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  31.0k|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  31.0k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|   133k|  } else {\
  |  |  |  |  283|   133k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|   133k|    s->bi_valid += len;\
  |  |  |  |  285|   133k|  }\
  |  |  |  |  286|   164k|}
  |  |  ------------------
  ------------------
                          send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count - 11, 7);
  ------------------
  |  |  274|   164k|#define send_bits(s, value, length) \
  |  |  275|   164k|{ int len = length;\
  |  |  276|   164k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|   164k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 70.5k, False: 93.7k]
  |  |  ------------------
  |  |  277|  70.5k|    int val = (int)value;\
  |  |  278|  70.5k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|  70.5k|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|  70.5k|#define put_short(s, w) { \
  |  |  |  |  145|  70.5k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  70.5k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|  70.5k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  70.5k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|  70.5k|}
  |  |  ------------------
  |  |  280|  70.5k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|  70.5k|#define Buf_size 16
  |  |  ------------------
  |  |  281|  70.5k|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|  70.5k|#define Buf_size 16
  |  |  ------------------
  |  |  282|  93.7k|  } else {\
  |  |  283|  93.7k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  93.7k|    s->bi_valid += len;\
  |  |  285|  93.7k|  }\
  |  |  286|   164k|}
  ------------------
  784|   164k|        }
  785|  1.26M|        count = 0; prevlen = curlen;
  786|  1.26M|        if (nextlen == 0) {
  ------------------
  |  Branch (786:13): [True: 380k, False: 882k]
  ------------------
  787|   380k|            max_count = 138, min_count = 3;
  788|   882k|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (788:20): [True: 39.2k, False: 843k]
  ------------------
  789|  39.2k|            max_count = 6, min_count = 3;
  790|   843k|        } else {
  791|   843k|            max_count = 7, min_count = 4;
  792|   843k|        }
  793|  1.26M|    }
  794|  59.8k|}

zcalloc:
  286|   249k|voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
  287|   249k|    (void)opaque;
  288|   249k|    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
  ------------------
  |  Branch (288:12): [Folded - Ignored]
  ------------------
  289|   249k|                              (voidpf)calloc(items, size);
  290|   249k|}
zcfree:
  292|   249k|void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
  293|   249k|    (void)opaque;
  294|   249k|    free(ptr);
  295|   249k|}

