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

jpeg_CreateDecompress:
   37|  2.58k|{
   38|  2.58k|  int i;
   39|       |
   40|       |  /* Guard against version mismatches between library and caller. */
   41|  2.58k|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   42|  2.58k|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|  2.58k|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (42:7): [True: 0, False: 2.58k]
  ------------------
   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|  2.58k|  if (structsize != sizeof(struct jpeg_decompress_struct))
  ------------------
  |  Branch (44:7): [True: 0, False: 2.58k]
  ------------------
   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|  2.58k|             (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|  2.58k|  {
   55|  2.58k|    struct jpeg_error_mgr *err = cinfo->err;
   56|  2.58k|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   57|  2.58k|    memset(cinfo, 0, sizeof(struct jpeg_decompress_struct));
   58|  2.58k|    cinfo->err = err;
   59|  2.58k|    cinfo->client_data = client_data;
   60|  2.58k|  }
   61|  2.58k|  cinfo->is_decompressor = TRUE;
  ------------------
  |  |  209|  2.58k|#define TRUE    1
  ------------------
   62|       |
   63|       |  /* Initialize a memory manager instance for this object */
   64|  2.58k|  jinit_memory_mgr((j_common_ptr)cinfo);
   65|       |
   66|       |  /* Zero out pointers to permanent structures. */
   67|  2.58k|  cinfo->progress = NULL;
   68|  2.58k|  cinfo->src = NULL;
   69|       |
   70|  12.9k|  for (i = 0; i < NUM_QUANT_TBLS; i++)
  ------------------
  |  |   68|  12.9k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (70:15): [True: 10.3k, False: 2.58k]
  ------------------
   71|  10.3k|    cinfo->quant_tbl_ptrs[i] = NULL;
   72|       |
   73|  12.9k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  12.9k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (73:15): [True: 10.3k, False: 2.58k]
  ------------------
   74|  10.3k|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   75|  10.3k|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   76|  10.3k|  }
   77|       |
   78|       |  /* Initialize marker processor so application can override methods
   79|       |   * for COM, APPn markers before calling jpeg_read_header.
   80|       |   */
   81|  2.58k|  cinfo->marker_list = NULL;
   82|  2.58k|  jinit_marker_reader(cinfo);
   83|       |
   84|       |  /* And initialize the overall input controller. */
   85|  2.58k|  jinit_input_controller(cinfo);
   86|       |
   87|  2.58k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  |   34|  2.58k|#define BITS_IN_JSAMPLE  8
  ------------------
   88|       |
   89|       |  /* OK, I'm ready */
   90|  2.58k|  cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|  2.58k|#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|  2.58k|  cinfo->master = (struct jpeg_decomp_master *)
   96|  2.58k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  883|  2.58k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
   97|  2.58k|                                sizeof(my_decomp_master));
   98|  2.58k|  memset(cinfo->master, 0, sizeof(my_decomp_master));
   99|  2.58k|}
jpeg_destroy_decompress:
  108|  2.58k|{
  109|  2.58k|  jpeg_destroy((j_common_ptr)cinfo); /* use common routine */
  110|  2.58k|}
jpeg_read_header:
  264|  2.58k|{
  265|  2.58k|  int retcode;
  266|       |
  267|  2.58k|  if (cinfo->global_state != DSTATE_START &&
  ------------------
  |  |   48|  5.17k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (267:7): [True: 0, False: 2.58k]
  ------------------
  268|  2.58k|      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|  2.58k|  retcode = jpeg_consume_input(cinfo);
  272|       |
  273|  2.58k|  switch (retcode) {
  ------------------
  |  Branch (273:11): [True: 884, False: 1.70k]
  ------------------
  274|  1.70k|  case JPEG_REACHED_SOS:
  ------------------
  |  | 1106|  1.70k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (274:3): [True: 1.70k, False: 887]
  ------------------
  275|  1.70k|    retcode = JPEG_HEADER_OK;
  ------------------
  |  | 1061|  1.70k|#define JPEG_HEADER_OK           1 /* Found valid image datastream */
  ------------------
  276|  1.70k|    break;
  277|      3|  case JPEG_REACHED_EOI:
  ------------------
  |  | 1107|      3|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (277:3): [True: 3, False: 2.58k]
  ------------------
  278|      3|    if (require_image)          /* Complain if application wanted an image */
  ------------------
  |  Branch (278:9): [True: 3, False: 0]
  ------------------
  279|      3|      ERREXIT(cinfo, JERR_NO_IMAGE);
  ------------------
  |  |  240|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      3|   (*(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|      3|    jpeg_abort((j_common_ptr)cinfo); /* sets state = DSTATE_START */
  285|      3|    retcode = JPEG_HEADER_TABLES_ONLY;
  ------------------
  |  | 1062|      3|#define JPEG_HEADER_TABLES_ONLY  2 /* Found valid table-specs-only datastream */
  ------------------
  286|      3|    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: 2.58k]
  ------------------
  288|       |    /* no work */
  289|      0|    break;
  290|  2.58k|  }
  291|       |
  292|  1.70k|  return retcode;
  293|  2.58k|}
jpeg_consume_input:
  310|  2.58k|{
  311|  2.58k|  int retcode = JPEG_SUSPENDED;
  ------------------
  |  | 1060|  2.58k|#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|  2.58k|  switch (cinfo->global_state) {
  315|  2.58k|  case DSTATE_START:
  ------------------
  |  |   48|  2.58k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (315:3): [True: 2.58k, False: 0]
  ------------------
  316|       |    /* Start-of-datastream actions: reset appropriate modules */
  317|  2.58k|    (*cinfo->inputctl->reset_input_controller) (cinfo);
  318|       |    /* Initialize application's data source module */
  319|  2.58k|    (*cinfo->src->init_source) (cinfo);
  320|  2.58k|    cinfo->global_state = DSTATE_INHEADER;
  ------------------
  |  |   49|  2.58k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  321|       |    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|  2.58k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  322|  2.58k|  case DSTATE_INHEADER:
  ------------------
  |  |   49|  2.58k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (322:3): [True: 0, False: 2.58k]
  ------------------
  323|  2.58k|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  324|  2.58k|    if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
  ------------------
  |  | 1106|  2.58k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (324:9): [True: 1.70k, False: 880]
  ------------------
  325|       |      /* Set up default parameters based on header data */
  326|  1.70k|      default_decompress_parms(cinfo);
  327|       |      /* Set global state: ready for start_decompress */
  328|  1.70k|      cinfo->global_state = DSTATE_READY;
  ------------------
  |  |   50|  1.70k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  329|  1.70k|    }
  330|  2.58k|    break;
  331|      0|  case DSTATE_READY:
  ------------------
  |  |   50|      0|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (331:3): [True: 0, False: 2.58k]
  ------------------
  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: 2.58k]
  ------------------
  336|      0|  case DSTATE_PRESCAN:
  ------------------
  |  |   52|      0|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (336:3): [True: 0, False: 2.58k]
  ------------------
  337|      0|  case DSTATE_SCANNING:
  ------------------
  |  |   53|      0|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (337:3): [True: 0, False: 2.58k]
  ------------------
  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: 2.58k]
  ------------------
  339|      0|  case DSTATE_BUFIMAGE:
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (339:3): [True: 0, False: 2.58k]
  ------------------
  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: 2.58k]
  ------------------
  341|      0|  case DSTATE_STOPPING:
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (341:3): [True: 0, False: 2.58k]
  ------------------
  342|      0|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  343|      0|    break;
  344|      0|  default:
  ------------------
  |  Branch (344:3): [True: 0, False: 2.58k]
  ------------------
  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|  2.58k|  }
  347|  1.70k|  return retcode;
  348|  2.58k|}
jpeg_finish_decompress:
  392|    734|{
  393|    734|  if ((cinfo->global_state == DSTATE_SCANNING ||
  ------------------
  |  |   53|  1.46k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (393:8): [True: 734, False: 0]
  ------------------
  394|    734|       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: 734, False: 0]
  ------------------
  395|       |    /* Terminate final pass of non-buffered mode */
  396|    734|    if (cinfo->output_scanline < cinfo->output_height)
  ------------------
  |  Branch (396:9): [True: 0, False: 734]
  ------------------
  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|    734|    (*cinfo->master->finish_output_pass) (cinfo);
  399|    734|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|    734|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  400|    734|  } 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|  1.39k|  while (!cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (408:10): [True: 662, False: 734]
  ------------------
  409|    662|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1060|    662|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (409:9): [True: 0, False: 662]
  ------------------
  410|      0|      return FALSE;             /* Suspend, come back later */
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  411|    662|  }
  412|       |  /* Do final cleanup */
  413|    734|  (*cinfo->src->term_source) (cinfo);
  414|       |  /* We can use jpeg_abort to release memory and reset global_state */
  415|    734|  jpeg_abort((j_common_ptr)cinfo);
  416|    734|  return TRUE;
  ------------------
  |  |  209|    734|#define TRUE    1
  ------------------
  417|    734|}
jdapimin.c:default_decompress_parms:
  131|  1.70k|{
  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|  1.70k|  switch (cinfo->num_components) {
  136|     29|  case 1:
  ------------------
  |  Branch (136:3): [True: 29, False: 1.68k]
  ------------------
  137|     29|    cinfo->jpeg_color_space = JCS_GRAYSCALE;
  138|     29|    cinfo->out_color_space = JCS_GRAYSCALE;
  139|     29|    break;
  140|       |
  141|  1.25k|  case 3:
  ------------------
  |  Branch (141:3): [True: 1.25k, False: 455]
  ------------------
  142|  1.25k|    if (cinfo->saw_JFIF_marker) {
  ------------------
  |  Branch (142:9): [True: 534, False: 720]
  ------------------
  143|    534|      cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
  144|    720|    } else if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (144:16): [True: 664, False: 56]
  ------------------
  145|    664|      switch (cinfo->Adobe_transform) {
  146|     51|      case 0:
  ------------------
  |  Branch (146:7): [True: 51, False: 613]
  ------------------
  147|     51|        cinfo->jpeg_color_space = JCS_RGB;
  148|     51|        break;
  149|    611|      case 1:
  ------------------
  |  Branch (149:7): [True: 611, False: 53]
  ------------------
  150|    611|        cinfo->jpeg_color_space = JCS_YCbCr;
  151|    611|        break;
  152|      2|      default:
  ------------------
  |  Branch (152:7): [True: 2, False: 662]
  ------------------
  153|      2|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  287|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|      2|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  154|      2|        cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  155|      2|        break;
  156|    664|      }
  157|    664|    } else {
  158|       |      /* Saw no special markers, try to guess from the component IDs */
  159|     56|      int cid0 = cinfo->comp_info[0].component_id;
  160|     56|      int cid1 = cinfo->comp_info[1].component_id;
  161|     56|      int cid2 = cinfo->comp_info[2].component_id;
  162|       |
  163|     56|      if (cid0 == 1 && cid1 == 2 && cid2 == 3) {
  ------------------
  |  Branch (163:11): [True: 56, False: 0]
  |  Branch (163:24): [True: 56, False: 0]
  |  Branch (163:37): [True: 56, False: 0]
  ------------------
  164|     56|        if (cinfo->master->lossless)
  ------------------
  |  Branch (164:13): [True: 0, False: 56]
  ------------------
  165|      0|          cinfo->jpeg_color_space = JCS_RGB; /* assume RGB w/out marker */
  166|     56|        else
  167|     56|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
  168|     56|      } 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|     56|    }
  178|       |    /* Always guess RGB is proper output colorspace. */
  179|  1.25k|    cinfo->out_color_space = JCS_RGB;
  180|  1.25k|    break;
  181|       |
  182|    426|  case 4:
  ------------------
  |  Branch (182:3): [True: 426, False: 1.28k]
  ------------------
  183|    426|    if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (183:9): [True: 384, False: 42]
  ------------------
  184|    384|      switch (cinfo->Adobe_transform) {
  185|    371|      case 0:
  ------------------
  |  Branch (185:7): [True: 371, False: 13]
  ------------------
  186|    371|        cinfo->jpeg_color_space = JCS_CMYK;
  187|    371|        break;
  188|      8|      case 2:
  ------------------
  |  Branch (188:7): [True: 8, False: 376]
  ------------------
  189|      8|        cinfo->jpeg_color_space = JCS_YCCK;
  190|      8|        break;
  191|      5|      default:
  ------------------
  |  Branch (191:7): [True: 5, False: 379]
  ------------------
  192|      5|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  287|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|      5|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  193|      5|        cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
  194|      5|        break;
  195|    384|      }
  196|    384|    } else {
  197|       |      /* No special markers, assume straight CMYK. */
  198|     42|      cinfo->jpeg_color_space = JCS_CMYK;
  199|     42|    }
  200|    421|    cinfo->out_color_space = JCS_CMYK;
  201|    421|    break;
  202|       |
  203|      0|  default:
  ------------------
  |  Branch (203:3): [True: 0, False: 1.70k]
  ------------------
  204|      0|    cinfo->jpeg_color_space = JCS_UNKNOWN;
  205|      0|    cinfo->out_color_space = JCS_UNKNOWN;
  206|      0|    break;
  207|  1.70k|  }
  208|       |
  209|       |  /* Set defaults for other decompression parameters. */
  210|  1.70k|  cinfo->scale_num = 1;         /* 1:1 scaling */
  211|  1.70k|  cinfo->scale_denom = 1;
  212|  1.70k|  cinfo->output_gamma = 1.0;
  213|  1.70k|  cinfo->buffered_image = FALSE;
  ------------------
  |  |  206|  1.70k|#define FALSE   0               /* values of boolean */
  ------------------
  214|  1.70k|  cinfo->raw_data_out = FALSE;
  ------------------
  |  |  206|  1.70k|#define FALSE   0               /* values of boolean */
  ------------------
  215|  1.70k|  cinfo->dct_method = JDCT_DEFAULT;
  ------------------
  |  |  297|  1.70k|#define JDCT_DEFAULT  JDCT_ISLOW
  ------------------
  216|  1.70k|  cinfo->do_fancy_upsampling = TRUE;
  ------------------
  |  |  209|  1.70k|#define TRUE    1
  ------------------
  217|  1.70k|  cinfo->do_block_smoothing = TRUE;
  ------------------
  |  |  209|  1.70k|#define TRUE    1
  ------------------
  218|  1.70k|  cinfo->quantize_colors = FALSE;
  ------------------
  |  |  206|  1.70k|#define FALSE   0               /* values of boolean */
  ------------------
  219|       |  /* We set these in case application only sets quantize_colors. */
  220|  1.70k|  cinfo->dither_mode = JDITHER_FS;
  221|  1.70k|#ifdef QUANT_2PASS_SUPPORTED
  222|  1.70k|  cinfo->two_pass_quantize = TRUE;
  ------------------
  |  |  209|  1.70k|#define TRUE    1
  ------------------
  223|       |#else
  224|       |  cinfo->two_pass_quantize = FALSE;
  225|       |#endif
  226|  1.70k|  cinfo->desired_number_of_colors = 256;
  227|  1.70k|  cinfo->colormap = NULL;
  228|       |  /* Initialize for no mode change in buffered-image mode. */
  229|  1.70k|  cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  206|  1.70k|#define FALSE   0               /* values of boolean */
  ------------------
  230|  1.70k|  cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  206|  1.70k|#define FALSE   0               /* values of boolean */
  ------------------
  231|  1.70k|  cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  206|  1.70k|#define FALSE   0               /* values of boolean */
  ------------------
  232|  1.70k|}

jpeg_start_decompress:
   53|  1.69k|{
   54|  1.69k|  if (cinfo->global_state == DSTATE_READY) {
  ------------------
  |  |   50|  1.69k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (54:7): [True: 1.69k, False: 0]
  ------------------
   55|       |    /* First call: initialize master control, select active modules */
   56|  1.69k|    jinit_master_decompress(cinfo);
   57|  1.69k|    if (cinfo->buffered_image) {
  ------------------
  |  Branch (57:9): [True: 0, False: 1.69k]
  ------------------
   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|  1.69k|    cinfo->global_state = DSTATE_PRELOAD;
  ------------------
  |  |   51|  1.69k|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
   63|  1.69k|  }
   64|  1.69k|  if (cinfo->global_state == DSTATE_PRELOAD) {
  ------------------
  |  |   51|  1.69k|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (64:7): [True: 1.55k, False: 145]
  ------------------
   65|       |    /* If file has multiple scans, absorb them all into the coef buffer */
   66|  1.55k|    if (cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (66:9): [True: 168, False: 1.38k]
  ------------------
   67|    168|#ifdef D_MULTISCAN_FILES_SUPPORTED
   68|  20.6k|      for (;;) {
   69|  20.6k|        int retcode;
   70|       |        /* Call progress monitor hook if present */
   71|  20.6k|        if (cinfo->progress != NULL)
  ------------------
  |  Branch (71:13): [True: 20.6k, False: 0]
  ------------------
   72|  20.6k|          (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
   73|       |        /* Absorb some more input */
   74|  20.6k|        retcode = (*cinfo->inputctl->consume_input) (cinfo);
   75|  20.6k|        if (retcode == JPEG_SUSPENDED)
  ------------------
  |  | 1060|  20.6k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (75:13): [True: 0, False: 20.6k]
  ------------------
   76|      0|          return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
   77|  20.6k|        if (retcode == JPEG_REACHED_EOI)
  ------------------
  |  | 1107|  20.6k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (77:13): [True: 72, False: 20.5k]
  ------------------
   78|     72|          break;
   79|       |        /* Advance progress counter if appropriate */
   80|  20.5k|        if (cinfo->progress != NULL &&
  ------------------
  |  Branch (80:13): [True: 20.4k, False: 96]
  ------------------
   81|  20.5k|            (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1108|  40.8k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
                          (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1106|  1.43k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (81:14): [True: 19.0k, False: 1.43k]
  |  Branch (81:47): [True: 672, False: 764]
  ------------------
   82|  19.6k|          if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
  ------------------
  |  Branch (82:15): [True: 0, False: 19.6k]
  ------------------
   83|       |            /* jdmaster underestimated number of scans; ratchet up one scan */
   84|      0|            cinfo->progress->pass_limit += (long)cinfo->total_iMCU_rows;
   85|      0|          }
   86|  19.6k|        }
   87|  20.5k|      }
   88|       |#else
   89|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
   90|       |#endif /* D_MULTISCAN_FILES_SUPPORTED */
   91|    168|    }
   92|  1.55k|    cinfo->output_scan_number = cinfo->input_scan_number;
   93|  1.55k|  } else if (cinfo->global_state != DSTATE_PRESCAN)
  ------------------
  |  |   52|    145|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (93:14): [True: 0, False: 145]
  ------------------
   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|  1.69k|  return output_pass_setup(cinfo);
   97|  1.69k|}
jpeg_read_scanlines:
  313|   159k|{
  314|   159k|#if BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED)
  315|   159k|  JDIMENSION row_ctr;
  316|       |
  317|   159k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   34|   159k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (317:7): [True: 2, False: 159k]
  ------------------
  318|      2|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  319|       |
  320|   159k|  if (cinfo->global_state != DSTATE_SCANNING)
  ------------------
  |  |   53|   159k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (320:7): [True: 0, False: 159k]
  ------------------
  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|   159k|  if (cinfo->output_scanline >= cinfo->output_height) {
  ------------------
  |  Branch (322:7): [True: 0, False: 159k]
  ------------------
  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|   159k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (328:7): [True: 159k, False: 2]
  ------------------
  329|   159k|    cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  330|   159k|    cinfo->progress->pass_limit = (long)cinfo->output_height;
  331|   159k|    (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  332|   159k|  }
  333|       |
  334|       |  /* Process some data */
  335|   159k|  row_ctr = 0;
  336|   159k|  (*cinfo->main->_process_data) (cinfo, scanlines, &row_ctr, max_lines);
  ------------------
  |  |  254|   159k|#define _process_data  process_data
  ------------------
  337|   159k|  cinfo->output_scanline += row_ctr;
  338|   159k|  return row_ctr;
  339|       |#else
  340|       |  ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  341|       |  return 0;
  342|       |#endif
  343|   159k|}
jdapistd.c:output_pass_setup:
  110|  1.45k|{
  111|  1.45k|  if (cinfo->global_state != DSTATE_PRESCAN) {
  ------------------
  |  |   52|  1.45k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (111:7): [True: 1.45k, False: 0]
  ------------------
  112|       |    /* First call: do pass setup */
  113|  1.45k|    (*cinfo->master->prepare_for_output_pass) (cinfo);
  114|  1.45k|    cinfo->output_scanline = 0;
  115|  1.45k|    cinfo->global_state = DSTATE_PRESCAN;
  ------------------
  |  |   52|  1.45k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  116|  1.45k|  }
  117|       |  /* Loop over any required dummy passes */
  118|  1.45k|  while (cinfo->master->is_dummy_pass) {
  ------------------
  |  Branch (118:10): [True: 0, False: 1.45k]
  ------------------
  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|  1.45k|  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|  2.91k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (159:25): [True: 0, False: 1.45k]
  ------------------
  160|  1.45k|  return TRUE;
  ------------------
  |  |  209|  1.45k|#define TRUE    1
  ------------------
  161|  1.45k|}

j12init_d_coef_controller:
  818|      2|{
  819|      2|  my_coef_ptr coef;
  820|       |
  821|      2|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  Branch (821:7): [True: 0, False: 2]
  ------------------
  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|      2|  coef = (my_coef_ptr)
  825|      2|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  826|      2|                                sizeof(my_coef_controller));
  827|      2|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  828|      2|  coef->pub.start_input_pass = start_input_pass;
  829|      2|  coef->pub.start_output_pass = start_output_pass;
  830|      2|#ifdef BLOCK_SMOOTHING_SUPPORTED
  831|      2|  coef->coef_bits_latch = NULL;
  832|      2|#endif
  833|       |
  834|       |  /* Create the coefficient buffer. */
  835|      2|  if (need_full_buffer) {
  ------------------
  |  Branch (835:7): [True: 0, False: 2]
  ------------------
  836|      0|#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|      0|    int ci, access_rows;
  841|      0|    jpeg_component_info *compptr;
  842|       |
  843|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (843:46): [True: 0, False: 0]
  ------------------
  844|      0|         ci++, compptr++) {
  845|      0|      access_rows = compptr->v_samp_factor;
  846|      0|#ifdef BLOCK_SMOOTHING_SUPPORTED
  847|       |      /* If block smoothing could be used, need a bigger window */
  848|      0|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (848:11): [True: 0, False: 0]
  ------------------
  849|      0|        access_rows *= 5;
  850|      0|#endif
  851|      0|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  852|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  884|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  853|      0|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  854|      0|                               (long)compptr->h_samp_factor),
  855|      0|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  856|      0|                               (long)compptr->v_samp_factor),
  857|      0|         (JDIMENSION)access_rows);
  858|      0|    }
  859|      0|    coef->pub.consume_data = consume_data;
  860|      0|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  141|      0|#define _decompress_data  decompress_data_12
  ------------------
  861|      0|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  862|       |#else
  863|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  864|       |#endif
  865|      2|  } else {
  866|       |    /* We only need a single-MCU buffer. */
  867|      2|    JBLOCKROW buffer;
  868|      2|    int i;
  869|       |
  870|      2|    buffer = (JBLOCKROW)
  871|      2|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  872|      2|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|      2|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  873|     22|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|     22|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (873:17): [True: 20, False: 2]
  ------------------
  874|     20|      coef->MCU_buffer[i] = buffer + i;
  875|     20|    }
  876|      2|    coef->pub.consume_data = dummy_consume_data;
  877|      2|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  141|      2|#define _decompress_data  decompress_data_12
  ------------------
  878|      2|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  879|      2|  }
  880|       |
  881|       |  /* Allocate the workspace buffer */
  882|      2|  coef->workspace = (JCOEF *)
  883|      2|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  884|      2|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|      2|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  885|      2|}
jdcoefct.c:start_input_pass:
   47|  2.22k|{
   48|  2.22k|  cinfo->input_iMCU_row = 0;
   49|  2.22k|  start_iMCU_row(cinfo);
   50|  2.22k|}
jdcoefct.c:start_output_pass:
   59|  1.45k|{
   60|  1.45k|#ifdef BLOCK_SMOOTHING_SUPPORTED
   61|  1.45k|  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|  1.45k|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (64:7): [True: 72, False: 1.38k]
  ------------------
   65|     72|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (65:9): [True: 72, False: 0]
  |  Branch (65:38): [True: 0, False: 72]
  ------------------
   66|      0|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  141|      0|#define _decompress_data  decompress_data_12
  ------------------
   67|     72|    else
   68|     72|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  141|     72|#define _decompress_data  decompress_data_12
  ------------------
   69|     72|  }
   70|  1.45k|#endif
   71|  1.45k|  cinfo->output_iMCU_row = 0;
   72|  1.45k|}
jdcoefct.c:smoothing_ok:
  361|     72|{
  362|     72|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  363|     72|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  206|     72|#define FALSE   0               /* values of boolean */
  ------------------
  364|     72|  int ci, coefi;
  365|     72|  jpeg_component_info *compptr;
  366|     72|  JQUANT_TBL *qtable;
  367|     72|  int *coef_bits, *prev_coef_bits;
  368|     72|  int *coef_bits_latch, *prev_coef_bits_latch;
  369|       |
  370|     72|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (370:7): [True: 0, False: 72]
  |  Branch (370:35): [True: 0, False: 72]
  ------------------
  371|      0|    return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  372|       |
  373|       |  /* Allocate latch area if not already done */
  374|     72|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (374:7): [True: 72, False: 0]
  ------------------
  375|     72|    coef->coef_bits_latch = (int *)
  376|     72|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|     72|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  377|     72|                                  cinfo->num_components * 2 *
  378|     72|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|     72|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  379|     72|  coef_bits_latch = coef->coef_bits_latch;
  380|     72|  prev_coef_bits_latch =
  381|     72|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|     72|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  382|       |
  383|    288|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (383:44): [True: 216, False: 72]
  ------------------
  384|    216|       ci++, compptr++) {
  385|       |    /* All components' quantization values must already be latched. */
  386|    216|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (386:9): [True: 0, False: 216]
  ------------------
  387|      0|      return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  388|       |    /* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
  389|    216|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (389:9): [True: 0, False: 216]
  ------------------
  390|    216|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  341|    216|#define Q01_POS  1
  ------------------
  |  Branch (390:9): [True: 0, False: 216]
  ------------------
  391|    216|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  342|    216|#define Q10_POS  8
  ------------------
  |  Branch (391:9): [True: 0, False: 216]
  ------------------
  392|    216|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  343|    216|#define Q20_POS  16
  ------------------
  |  Branch (392:9): [True: 0, False: 216]
  ------------------
  393|    216|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  344|    216|#define Q11_POS  9
  ------------------
  |  Branch (393:9): [True: 0, False: 216]
  ------------------
  394|    216|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  345|    216|#define Q02_POS  2
  ------------------
  |  Branch (394:9): [True: 0, False: 216]
  ------------------
  395|    216|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  346|    216|#define Q03_POS  3
  ------------------
  |  Branch (395:9): [True: 0, False: 216]
  ------------------
  396|    216|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  347|    216|#define Q12_POS  10
  ------------------
  |  Branch (396:9): [True: 0, False: 216]
  ------------------
  397|    216|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  348|    216|#define Q21_POS  17
  ------------------
  |  Branch (397:9): [True: 0, False: 216]
  ------------------
  398|    216|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  349|    216|#define Q30_POS  24
  ------------------
  |  Branch (398:9): [True: 0, False: 216]
  ------------------
  399|      0|      return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  400|       |    /* DC values must be at least partly known for all components. */
  401|    216|    coef_bits = cinfo->coef_bits[ci];
  402|    216|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  403|    216|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (403:9): [True: 0, False: 216]
  ------------------
  404|      0|      return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  405|    216|    coef_bits_latch[0] = coef_bits[0];
  406|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  407|  2.16k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|  2.16k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (407:21): [True: 1.94k, False: 216]
  ------------------
  408|  1.94k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (408:11): [True: 1.94k, False: 0]
  ------------------
  409|  1.94k|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  410|      0|      else
  411|      0|        prev_coef_bits_latch[coefi] = -1;
  412|  1.94k|      coef_bits_latch[coefi] = coef_bits[coefi];
  413|  1.94k|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (413:11): [True: 0, False: 1.94k]
  ------------------
  414|      0|        smoothing_useful = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  415|  1.94k|    }
  416|    216|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    216|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  417|    216|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    216|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  418|    216|  }
  419|       |
  420|     72|  return smoothing_useful;
  421|     72|}
jdcoefct.c:consume_data:
  194|  19.8k|{
  195|  19.8k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  196|  19.8k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  197|  19.8k|  int blkn, ci, xindex, yindex, yoffset;
  198|  19.8k|  JDIMENSION start_col;
  199|  19.8k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  200|  19.8k|  JBLOCKROW buffer_ptr;
  201|  19.8k|  jpeg_component_info *compptr;
  202|       |
  203|       |  /* Align the virtual buffers for the components used in this scan. */
  204|  46.7k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (204:16): [True: 26.9k, False: 19.8k]
  ------------------
  205|  26.9k|    compptr = cinfo->cur_comp_info[ci];
  206|  26.9k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  207|  26.9k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  208|  26.9k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  209|  26.9k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  209|  26.9k|#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|  26.9k|  }
  215|       |
  216|       |  /* Loop to process one whole iMCU row */
  217|  39.6k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (217:41): [True: 19.8k, False: 19.8k]
  ------------------
  218|  19.8k|       yoffset++) {
  219|   514k|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (219:39): [True: 495k, False: 19.8k]
  ------------------
  220|   495k|         MCU_col_num++) {
  221|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  222|   495k|      blkn = 0;                 /* index of current DCT block within MCU */
  223|  1.16M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (223:20): [True: 670k, False: 495k]
  ------------------
  224|   670k|        compptr = cinfo->cur_comp_info[ci];
  225|   670k|        start_col = MCU_col_num * compptr->MCU_width;
  226|  1.34M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (226:26): [True: 670k, False: 670k]
  ------------------
  227|   670k|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  228|  1.34M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (228:28): [True: 670k, False: 670k]
  ------------------
  229|   670k|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  230|   670k|          }
  231|   670k|        }
  232|   670k|      }
  233|   495k|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (233:11): [True: 495k, False: 0]
  ------------------
  234|   495k|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  235|       |      /* Try to fetch the MCU. */
  236|   495k|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (236:11): [True: 0, False: 495k]
  ------------------
  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|   495k|    }
  243|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  244|  19.8k|    coef->MCU_ctr = 0;
  245|  19.8k|  }
  246|       |  /* Completed the iMCU row, advance counters for next one */
  247|  19.8k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (247:7): [True: 19.0k, False: 840]
  ------------------
  248|  19.0k|    start_iMCU_row(cinfo);
  249|  19.0k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1108|  19.0k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  250|  19.0k|  }
  251|       |  /* Completed the scan */
  252|    840|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  253|    840|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1109|    840|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  254|  19.8k|}
jdcoefct.c:decompress_data:
  267|  1.80k|{
  268|  1.80k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  269|  1.80k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  270|  1.80k|  JDIMENSION block_num;
  271|  1.80k|  int ci, block_row, block_rows;
  272|  1.80k|  JBLOCKARRAY buffer;
  273|  1.80k|  JBLOCKROW buffer_ptr;
  274|  1.80k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  113|  1.80k|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  275|  1.80k|  JDIMENSION output_col;
  276|  1.80k|  jpeg_component_info *compptr;
  277|  1.80k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  145|  1.80k|#define _inverse_DCT_method_ptr  inverse_DCT_12_method_ptr
  ------------------
  278|       |
  279|       |  /* Force some input to be done if we are getting ahead of the input. */
  280|  1.80k|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (280:10): [True: 0, False: 1.80k]
  ------------------
  281|  1.80k|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (281:11): [True: 1.80k, False: 0]
  ------------------
  282|  1.80k|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (282:11): [True: 0, False: 1.80k]
  ------------------
  283|      0|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (283:9): [True: 0, False: 0]
  ------------------
  284|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  285|      0|  }
  286|       |
  287|       |  /* OK, output from the virtual arrays. */
  288|  7.20k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (288:44): [True: 5.40k, False: 1.80k]
  ------------------
  289|  5.40k|       ci++, compptr++) {
  290|       |    /* Don't bother to IDCT an uninteresting component. */
  291|  5.40k|    if (!compptr->component_needed)
  ------------------
  |  Branch (291:9): [True: 0, False: 5.40k]
  ------------------
  292|      0|      continue;
  293|       |    /* Align the virtual buffer for this component. */
  294|  5.40k|    buffer = (*cinfo->mem->access_virt_barray)
  295|  5.40k|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  296|  5.40k|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  297|  5.40k|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  206|  5.40k|#define FALSE   0               /* values of boolean */
  ------------------
  298|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  299|  5.40k|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (299:9): [True: 5.18k, False: 216]
  ------------------
  300|  5.18k|      block_rows = compptr->v_samp_factor;
  301|    216|    else {
  302|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  303|    216|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  304|    216|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (304:11): [True: 216, False: 0]
  ------------------
  305|    216|    }
  306|  5.40k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  146|  5.40k|#define _inverse_DCT  inverse_DCT_12
  ------------------
  307|  5.40k|    output_ptr = output_buf[ci];
  308|       |    /* Loop over all DCT blocks to be processed. */
  309|  10.8k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (309:25): [True: 5.40k, False: 5.40k]
  ------------------
  310|  5.40k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  311|  5.40k|      output_col = 0;
  312|  5.40k|      for (block_num = cinfo->master->first_MCU_col[ci];
  313|   140k|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (313:12): [True: 135k, False: 5.40k]
  ------------------
  314|   135k|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
  315|   135k|                        output_col);
  316|   135k|        buffer_ptr++;
  317|   135k|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   135k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  318|   135k|      }
  319|  5.40k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  5.40k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  320|  5.40k|    }
  321|  5.40k|  }
  322|       |
  323|  1.80k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (323:7): [True: 1.72k, False: 72]
  ------------------
  324|  1.72k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1108|  1.72k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  325|     72|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1109|     72|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  326|  1.80k|}
jdcoefct.c:decompress_onepass:
   87|  18.5k|{
   88|  18.5k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   89|  18.5k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   90|  18.5k|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   91|  18.5k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   92|  18.5k|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   93|  18.5k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  113|  18.5k|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
   94|  18.5k|  JDIMENSION start_col, output_col;
   95|  18.5k|  jpeg_component_info *compptr;
   96|  18.5k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  145|  18.5k|#define _inverse_DCT_method_ptr  inverse_DCT_12_method_ptr
  ------------------
   97|       |
   98|       |  /* Loop to process as much as one whole iMCU row */
   99|  37.0k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (99:41): [True: 18.5k, False: 18.5k]
  ------------------
  100|  18.5k|       yoffset++) {
  101|   443k|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (101:39): [True: 425k, False: 18.5k]
  ------------------
  102|   425k|         MCU_col_num++) {
  103|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  104|   425k|      jzero_far((void *)coef->MCU_buffer[0],
  105|   425k|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  106|   425k|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (106:11): [True: 425k, False: 0]
  ------------------
  107|   425k|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  108|   425k|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (108:11): [True: 0, False: 425k]
  ------------------
  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|   425k|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (118:11): [True: 424k, False: 720]
  ------------------
  119|   425k|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (119:11): [True: 424k, 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|   424k|        blkn = 0;               /* index of current DCT block within MCU */
  126|  1.70M|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (126:22): [True: 1.27M, False: 424k]
  ------------------
  127|  1.27M|          compptr = cinfo->cur_comp_info[ci];
  128|       |          /* Don't bother to IDCT an uninteresting component. */
  129|  1.27M|          if (!compptr->component_needed) {
  ------------------
  |  Branch (129:15): [True: 0, False: 1.27M]
  ------------------
  130|      0|            blkn += compptr->MCU_blocks;
  131|      0|            continue;
  132|      0|          }
  133|  1.27M|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  146|  1.27M|#define _inverse_DCT  inverse_DCT_12
  ------------------
  134|  1.27M|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (134:26): [True: 1.22M, False: 54.6k]
  ------------------
  135|  1.22M|                         compptr->MCU_width : compptr->last_col_width;
  136|  1.27M|          output_ptr = output_buf[compptr->component_index] +
  137|  1.27M|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  1.27M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  138|  1.27M|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  139|  1.27M|                      compptr->MCU_sample_width;
  140|  2.56M|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (140:28): [True: 1.28M, False: 1.27M]
  ------------------
  141|  1.28M|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (141:17): [True: 1.24M, False: 39.2k]
  ------------------
  142|  1.28M|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (142:17): [True: 39.2k, False: 12]
  ------------------
  143|  1.28M|              output_col = start_col;
  144|  2.56M|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (144:32): [True: 1.28M, False: 1.28M]
  ------------------
  145|  1.28M|                (*inverse_DCT) (cinfo, compptr,
  146|  1.28M|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  147|  1.28M|                                output_ptr, output_col);
  148|  1.28M|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  1.28M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  149|  1.28M|              }
  150|  1.28M|            }
  151|  1.28M|            blkn += compptr->MCU_width;
  152|  1.28M|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  1.28M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  153|  1.28M|          }
  154|  1.27M|        }
  155|   424k|      }
  156|   425k|    }
  157|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  158|  18.5k|    coef->MCU_ctr = 0;
  159|  18.5k|  }
  160|       |  /* Completed the iMCU row, advance counters for next one */
  161|  18.5k|  cinfo->output_iMCU_row++;
  162|  18.5k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (162:7): [True: 17.1k, False: 1.38k]
  ------------------
  163|  17.1k|    start_iMCU_row(cinfo);
  164|  17.1k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1108|  17.1k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  165|  17.1k|  }
  166|       |  /* Completed the scan */
  167|  1.38k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  168|  1.38k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1109|  1.38k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  169|  18.5k|}
jinit_d_coef_controller:
  818|  1.68k|{
  819|  1.68k|  my_coef_ptr coef;
  820|       |
  821|  1.68k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   34|  1.68k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (821:7): [True: 0, False: 1.68k]
  ------------------
  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|  1.68k|  coef = (my_coef_ptr)
  825|  1.68k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.68k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  826|  1.68k|                                sizeof(my_coef_controller));
  827|  1.68k|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  828|  1.68k|  coef->pub.start_input_pass = start_input_pass;
  829|  1.68k|  coef->pub.start_output_pass = start_output_pass;
  830|  1.68k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  831|  1.68k|  coef->coef_bits_latch = NULL;
  832|  1.68k|#endif
  833|       |
  834|       |  /* Create the coefficient buffer. */
  835|  1.68k|  if (need_full_buffer) {
  ------------------
  |  Branch (835:7): [True: 168, False: 1.52k]
  ------------------
  836|    168|#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|    168|    int ci, access_rows;
  841|    168|    jpeg_component_info *compptr;
  842|       |
  843|    672|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (843:46): [True: 504, False: 168]
  ------------------
  844|    504|         ci++, compptr++) {
  845|    504|      access_rows = compptr->v_samp_factor;
  846|    504|#ifdef BLOCK_SMOOTHING_SUPPORTED
  847|       |      /* If block smoothing could be used, need a bigger window */
  848|    504|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (848:11): [True: 504, False: 0]
  ------------------
  849|    504|        access_rows *= 5;
  850|    504|#endif
  851|    504|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  852|    504|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  884|    504|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  209|    504|#define TRUE    1
  ------------------
  853|    504|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  854|    504|                               (long)compptr->h_samp_factor),
  855|    504|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  856|    504|                               (long)compptr->v_samp_factor),
  857|    504|         (JDIMENSION)access_rows);
  858|    504|    }
  859|    168|    coef->pub.consume_data = consume_data;
  860|    168|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  256|    168|#define _decompress_data  decompress_data
  ------------------
  861|    168|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  862|       |#else
  863|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  864|       |#endif
  865|  1.52k|  } else {
  866|       |    /* We only need a single-MCU buffer. */
  867|  1.52k|    JBLOCKROW buffer;
  868|  1.52k|    int i;
  869|       |
  870|  1.52k|    buffer = (JBLOCKROW)
  871|  1.52k|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.52k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  872|  1.52k|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|  1.52k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  873|  16.7k|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|  16.7k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (873:17): [True: 15.2k, False: 1.52k]
  ------------------
  874|  15.2k|      coef->MCU_buffer[i] = buffer + i;
  875|  15.2k|    }
  876|  1.52k|    coef->pub.consume_data = dummy_consume_data;
  877|  1.52k|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  256|  1.52k|#define _decompress_data  decompress_data
  ------------------
  878|  1.52k|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  879|  1.52k|  }
  880|       |
  881|       |  /* Allocate the workspace buffer */
  882|  1.68k|  coef->workspace = (JCOEF *)
  883|  1.68k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.68k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  884|  1.68k|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|  1.68k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  885|  1.68k|}

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

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

j12init_color_deconverter:
  758|      2|{
  759|      2|  my_cconvert_ptr cconvert;
  760|      2|  int ci;
  761|       |
  762|      2|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  Branch (762:7): [True: 0, False: 2]
  ------------------
  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|      2|  cconvert = (my_cconvert_ptr)
  766|      2|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  767|      2|                                sizeof(my_color_deconverter));
  768|      2|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  769|      2|  cconvert->pub.start_pass = start_pass_dcolor;
  770|       |
  771|       |  /* Make sure num_components agrees with jpeg_color_space */
  772|      2|  switch (cinfo->jpeg_color_space) {
  773|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (773:3): [True: 0, False: 2]
  ------------------
  774|      0|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (774:9): [True: 0, False: 0]
  ------------------
  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|      0|    break;
  777|       |
  778|      0|  case JCS_RGB:
  ------------------
  |  Branch (778:3): [True: 0, False: 2]
  ------------------
  779|      2|  case JCS_YCbCr:
  ------------------
  |  Branch (779:3): [True: 2, False: 0]
  ------------------
  780|      2|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (780:9): [True: 0, False: 2]
  ------------------
  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|      2|    break;
  783|       |
  784|      0|  case JCS_CMYK:
  ------------------
  |  Branch (784:3): [True: 0, False: 2]
  ------------------
  785|      0|  case JCS_YCCK:
  ------------------
  |  Branch (785:3): [True: 0, False: 2]
  ------------------
  786|      0|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (786:9): [True: 0, False: 0]
  ------------------
  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|      0|    break;
  789|       |
  790|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (790:3): [True: 0, False: 2]
  ------------------
  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|      2|  }
  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|      2|  switch (cinfo->out_color_space) {
  804|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (804:3): [True: 0, False: 2]
  ------------------
  805|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (805:9): [True: 0, False: 0]
  ------------------
  806|      0|        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|      0|    cinfo->out_color_components = 1;
  809|      0|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (809:9): [True: 0, False: 0]
  ------------------
  810|      0|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (810:9): [True: 0, False: 0]
  ------------------
  811|      0|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  812|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  813|      0|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (813:20): [True: 0, False: 0]
  ------------------
  814|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  815|      0|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (815:16): [True: 0, False: 0]
  ------------------
  816|      0|      cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  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|      0|    break;
  821|       |
  822|      2|  case JCS_RGB:
  ------------------
  |  Branch (822:3): [True: 2, False: 0]
  ------------------
  823|      2|  case JCS_EXT_RGB:
  ------------------
  |  Branch (823:3): [True: 0, False: 2]
  ------------------
  824|      2|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (824:3): [True: 0, False: 2]
  ------------------
  825|      2|  case JCS_EXT_BGR:
  ------------------
  |  Branch (825:3): [True: 0, False: 2]
  ------------------
  826|      2|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (826:3): [True: 0, False: 2]
  ------------------
  827|      2|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (827:3): [True: 0, False: 2]
  ------------------
  828|      2|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (828:3): [True: 0, False: 2]
  ------------------
  829|      2|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (829:3): [True: 0, False: 2]
  ------------------
  830|      2|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (830:3): [True: 0, False: 2]
  ------------------
  831|      2|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (831:3): [True: 0, False: 2]
  ------------------
  832|      2|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (832:3): [True: 0, False: 2]
  ------------------
  833|      2|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (833:9): [True: 0, False: 2]
  |  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|      2|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  836|      2|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (836:9): [True: 2, False: 0]
  ------------------
  837|       |#ifdef WITH_SIMD
  838|       |      if (jsimd_can_ycc_rgb())
  839|       |        cconvert->pub._color_convert = jsimd_ycc_rgb_convert;
  840|       |      else
  841|       |#endif
  842|      2|      {
  843|      2|        cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  150|      2|#define _color_convert  color_convert_12
  ------------------
  844|      2|        build_ycc_rgb_table(cinfo);
  845|      2|      }
  846|      2|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (846:16): [True: 0, False: 0]
  ------------------
  847|      0|      cconvert->pub._color_convert = gray_rgb_convert;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  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;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  854|      0|      else
  855|      0|        cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  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|      2|    break;
  859|       |
  860|      0|  case JCS_RGB565:
  ------------------
  |  Branch (860:3): [True: 0, False: 2]
  ------------------
  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|       |#ifdef WITH_SIMD
  867|       |        if (jsimd_can_ycc_rgb565())
  868|       |          cconvert->pub._color_convert = jsimd_ycc_rgb565_convert;
  869|       |        else
  870|       |#endif
  871|      0|        {
  872|      0|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  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;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  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;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  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;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  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;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  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;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  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|      0|  case JCS_CMYK:
  ------------------
  |  Branch (895:3): [True: 0, False: 2]
  ------------------
  896|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (896:9): [True: 0, False: 0]
  ------------------
  897|      0|        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|      0|    cinfo->out_color_components = 4;
  900|      0|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (900:9): [True: 0, False: 0]
  ------------------
  901|      0|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  902|      0|      build_ycc_rgb_table(cinfo);
  903|      0|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (903:16): [True: 0, False: 0]
  ------------------
  904|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  905|      0|    } 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|      0|    break;
  908|       |
  909|      0|  default:
  ------------------
  |  Branch (909:3): [True: 0, False: 2]
  ------------------
  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;
  ------------------
  |  |  150|      0|#define _color_convert  color_convert_12
  ------------------
  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|      2|  }
  918|       |
  919|      2|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (919:7): [True: 0, False: 2]
  ------------------
  920|      0|    cinfo->output_components = 1; /* single colormapped output component */
  921|      2|  else
  922|      2|    cinfo->output_components = cinfo->out_color_components;
  923|      2|}
jdcolor.c:start_pass_dcolor:
  747|  1.45k|{
  748|       |  /* no work needed */
  749|  1.45k|}
jdcolor.c:grayscale_convert:
  440|  1.31k|{
  441|  1.31k|  _jcopy_sample_rows(input_buf[0], (int)input_row, output_buf, 0, num_rows,
  ------------------
  |  |  180|  1.31k|#define _jcopy_sample_rows  j12copy_sample_rows
  ------------------
  442|  1.31k|                     cinfo->output_width);
  443|  1.31k|}
jdcolor.c:ycc_rgb_convert:
  264|   135k|{
  265|   135k|  switch (cinfo->out_color_space) {
  266|      0|  case JCS_EXT_RGB:
  ------------------
  |  Branch (266:3): [True: 0, False: 135k]
  ------------------
  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: 135k]
  ------------------
  271|      0|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (271:3): [True: 0, False: 135k]
  ------------------
  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: 135k]
  ------------------
  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: 135k]
  ------------------
  280|      0|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (280:3): [True: 0, False: 135k]
  ------------------
  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: 135k]
  ------------------
  285|      0|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (285:3): [True: 0, False: 135k]
  ------------------
  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: 135k]
  ------------------
  290|      0|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (290:3): [True: 0, False: 135k]
  ------------------
  291|      0|    ycc_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
  292|      0|                                 num_rows);
  293|      0|    break;
  294|   135k|  default:
  ------------------
  |  Branch (294:3): [True: 135k, False: 0]
  ------------------
  295|   135k|    ycc_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
  296|   135k|                             num_rows);
  297|   135k|    break;
  298|   135k|  }
  299|   135k|}
jdcolor.c:build_ycc_rgb_table:
  216|  1.20k|{
  217|  1.20k|#if BITS_IN_JSAMPLE != 16
  218|  1.20k|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  219|  1.20k|  int i;
  220|  1.20k|  JLONG x;
  221|  1.20k|  SHIFT_TEMPS
  222|       |
  223|  1.20k|  cconvert->Cr_r_tab = (int *)
  224|  1.20k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.20k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  225|  1.20k|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  109|  1.20k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   59|  1.20k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  226|  1.20k|  cconvert->Cb_b_tab = (int *)
  227|  1.20k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.20k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  228|  1.20k|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  109|  1.20k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   59|  1.20k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  229|  1.20k|  cconvert->Cr_g_tab = (JLONG *)
  230|  1.20k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.20k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  231|  1.20k|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  109|  1.20k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   59|  1.20k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  232|  1.20k|  cconvert->Cb_g_tab = (JLONG *)
  233|  1.20k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.20k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  234|  1.20k|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  109|  1.20k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   59|  1.20k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  235|       |
  236|   318k|  for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  110|  1.20k|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|  1.20k|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
                for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  109|   318k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   59|   318k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  |  Branch (236:36): [True: 316k, False: 1.20k]
  ------------------
  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|   316k|    cconvert->Cr_r_tab[i] = (int)
  241|   316k|                    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  474|   316k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  242|       |    /* Cb=>B value is nearest int to 1.77200 * x */
  243|   316k|    cconvert->Cb_b_tab[i] = (int)
  244|   316k|                    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  474|   316k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  245|       |    /* Cr=>G value is scaled-up -0.71414 * x */
  246|   316k|    cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
  ------------------
  |  |   82|   316k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   80|   316k|#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|   316k|    cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   82|   316k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   80|   316k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   81|   316k|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   80|   316k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  250|   316k|  }
  251|       |#else
  252|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  253|       |#endif
  254|  1.20k|}
jdcolor.c:null_convert:
  379|  21.6k|{
  380|  21.6k|  register _JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
  381|  21.6k|  register JDIMENSION col;
  382|  21.6k|  register int num_components = cinfo->num_components;
  383|  21.6k|  JDIMENSION num_cols = cinfo->output_width;
  384|  21.6k|  int ci;
  385|       |
  386|  21.6k|  if (num_components == 3) {
  ------------------
  |  Branch (386:7): [True: 8.78k, False: 12.9k]
  ------------------
  387|  17.5k|    while (--num_rows >= 0) {
  ------------------
  |  Branch (387:12): [True: 8.78k, False: 8.78k]
  ------------------
  388|  8.78k|      inptr0 = input_buf[0][input_row];
  389|  8.78k|      inptr1 = input_buf[1][input_row];
  390|  8.78k|      inptr2 = input_buf[2][input_row];
  391|  8.78k|      input_row++;
  392|  8.78k|      outptr = *output_buf++;
  393|  1.77M|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (393:21): [True: 1.76M, False: 8.78k]
  ------------------
  394|  1.76M|        *outptr++ = inptr0[col];
  395|  1.76M|        *outptr++ = inptr1[col];
  396|  1.76M|        *outptr++ = inptr2[col];
  397|  1.76M|      }
  398|  8.78k|    }
  399|  12.9k|  } else if (num_components == 4) {
  ------------------
  |  Branch (399:14): [True: 12.9k, False: 0]
  ------------------
  400|  25.8k|    while (--num_rows >= 0) {
  ------------------
  |  Branch (400:12): [True: 12.9k, False: 12.9k]
  ------------------
  401|  12.9k|      inptr0 = input_buf[0][input_row];
  402|  12.9k|      inptr1 = input_buf[1][input_row];
  403|  12.9k|      inptr2 = input_buf[2][input_row];
  404|  12.9k|      inptr3 = input_buf[3][input_row];
  405|  12.9k|      input_row++;
  406|  12.9k|      outptr = *output_buf++;
  407|   529k|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (407:21): [True: 516k, False: 12.9k]
  ------------------
  408|   516k|        *outptr++ = inptr0[col];
  409|   516k|        *outptr++ = inptr1[col];
  410|   516k|        *outptr++ = inptr2[col];
  411|   516k|        *outptr++ = inptr3[col];
  412|   516k|      }
  413|  12.9k|    }
  414|  12.9k|  } 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|  21.6k|}
jdcolor.c:ycck_cmyk_convert:
  546|    288|{
  547|    288|#if BITS_IN_JSAMPLE != 16
  548|    288|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  549|    288|  register int y, cb, cr;
  550|    288|  register _JSAMPROW outptr;
  551|    288|  register _JSAMPROW inptr0, inptr1, inptr2, inptr3;
  552|    288|  register JDIMENSION col;
  553|    288|  JDIMENSION num_cols = cinfo->output_width;
  554|       |  /* copy these pointers into registers if possible */
  555|    288|  register _JSAMPLE *range_limit = (_JSAMPLE *)cinfo->sample_range_limit;
  556|    288|  register int *Crrtab = cconvert->Cr_r_tab;
  557|    288|  register int *Cbbtab = cconvert->Cb_b_tab;
  558|    288|  register JLONG *Crgtab = cconvert->Cr_g_tab;
  559|    288|  register JLONG *Cbgtab = cconvert->Cb_g_tab;
  560|    288|  SHIFT_TEMPS
  561|       |
  562|    576|  while (--num_rows >= 0) {
  ------------------
  |  Branch (562:10): [True: 288, False: 288]
  ------------------
  563|    288|    inptr0 = input_buf[0][input_row];
  564|    288|    inptr1 = input_buf[1][input_row];
  565|    288|    inptr2 = input_buf[2][input_row];
  566|    288|    inptr3 = input_buf[3][input_row];
  567|    288|    input_row++;
  568|    288|    outptr = *output_buf++;
  569|  11.8k|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (569:19): [True: 11.5k, False: 288]
  ------------------
  570|  11.5k|      y  = inptr0[col];
  571|  11.5k|      cb = inptr1[col];
  572|  11.5k|      cr = inptr2[col];
  573|       |      /* Range-limiting is essential due to noise introduced by DCT losses. */
  574|  11.5k|      outptr[0] = range_limit[_MAXJSAMPLE - (y + Crrtab[cr])];  /* red */
  ------------------
  |  |  109|  11.5k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   59|  11.5k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  575|  11.5k|      outptr[1] = range_limit[_MAXJSAMPLE - (y +                /* green */
  ------------------
  |  |  109|  11.5k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   59|  11.5k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  576|  11.5k|                              ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
  ------------------
  |  |  474|  11.5k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  577|  11.5k|                                                 SCALEBITS)))];
  578|  11.5k|      outptr[2] = range_limit[_MAXJSAMPLE - (y + Cbbtab[cb])];  /* blue */
  ------------------
  |  |  109|  11.5k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   59|  11.5k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  579|       |      /* K passes through unchanged */
  580|  11.5k|      outptr[3] = inptr3[col];
  581|  11.5k|      outptr += 4;
  582|  11.5k|    }
  583|    288|  }
  584|       |#else
  585|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  586|       |#endif
  587|    288|}
jinit_color_deconverter:
  758|  1.69k|{
  759|  1.69k|  my_cconvert_ptr cconvert;
  760|  1.69k|  int ci;
  761|       |
  762|  1.69k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   34|  1.69k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (762:7): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|  cconvert = (my_cconvert_ptr)
  766|  1.69k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.69k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  767|  1.69k|                                sizeof(my_color_deconverter));
  768|  1.69k|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  769|  1.69k|  cconvert->pub.start_pass = start_pass_dcolor;
  770|       |
  771|       |  /* Make sure num_components agrees with jpeg_color_space */
  772|  1.69k|  switch (cinfo->jpeg_color_space) {
  773|     29|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (773:3): [True: 29, False: 1.66k]
  ------------------
  774|     29|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (774:9): [True: 0, False: 29]
  ------------------
  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|     29|    break;
  777|       |
  778|     51|  case JCS_RGB:
  ------------------
  |  Branch (778:3): [True: 51, False: 1.64k]
  ------------------
  779|  1.24k|  case JCS_YCbCr:
  ------------------
  |  Branch (779:3): [True: 1.19k, False: 497]
  ------------------
  780|  1.24k|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (780:9): [True: 0, False: 1.24k]
  ------------------
  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|  1.24k|    break;
  783|       |
  784|    409|  case JCS_CMYK:
  ------------------
  |  Branch (784:3): [True: 409, False: 1.28k]
  ------------------
  785|    417|  case JCS_YCCK:
  ------------------
  |  Branch (785:3): [True: 8, False: 1.68k]
  ------------------
  786|    417|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (786:9): [True: 0, False: 417]
  ------------------
  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|    417|    break;
  789|       |
  790|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (790:3): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|  }
  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|  1.69k|  switch (cinfo->out_color_space) {
  804|     29|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (804:3): [True: 29, False: 1.66k]
  ------------------
  805|     29|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (805:9): [True: 0, False: 29]
  ------------------
  806|     29|        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|     29|    cinfo->out_color_components = 1;
  809|     29|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (809:9): [True: 29, False: 0]
  ------------------
  810|     29|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (810:9): [True: 0, False: 0]
  ------------------
  811|     29|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  265|     29|#define _color_convert  color_convert
  ------------------
  812|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  813|     29|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (813:20): [True: 0, False: 29]
  ------------------
  814|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  815|     29|    } 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|     29|    break;
  821|       |
  822|  1.24k|  case JCS_RGB:
  ------------------
  |  Branch (822:3): [True: 1.24k, False: 446]
  ------------------
  823|  1.24k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (823:3): [True: 0, False: 1.69k]
  ------------------
  824|  1.24k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (824:3): [True: 0, False: 1.69k]
  ------------------
  825|  1.24k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (825:3): [True: 0, False: 1.69k]
  ------------------
  826|  1.24k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (826:3): [True: 0, False: 1.69k]
  ------------------
  827|  1.24k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (827:3): [True: 0, False: 1.69k]
  ------------------
  828|  1.24k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (828:3): [True: 0, False: 1.69k]
  ------------------
  829|  1.24k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (829:3): [True: 0, False: 1.69k]
  ------------------
  830|  1.24k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (830:3): [True: 0, False: 1.69k]
  ------------------
  831|  1.24k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (831:3): [True: 0, False: 1.69k]
  ------------------
  832|  1.24k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (832:3): [True: 0, False: 1.69k]
  ------------------
  833|  1.24k|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (833:9): [True: 0, False: 1.24k]
  |  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|  1.24k|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  836|  1.24k|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (836:9): [True: 1.19k, False: 51]
  ------------------
  837|  1.19k|#ifdef WITH_SIMD
  838|  1.19k|      if (jsimd_can_ycc_rgb())
  ------------------
  |  Branch (838:11): [True: 0, False: 1.19k]
  ------------------
  839|      0|        cconvert->pub._color_convert = jsimd_ycc_rgb_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  840|  1.19k|      else
  841|  1.19k|#endif
  842|  1.19k|      {
  843|  1.19k|        cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  265|  1.19k|#define _color_convert  color_convert
  ------------------
  844|  1.19k|        build_ycc_rgb_table(cinfo);
  845|  1.19k|      }
  846|  1.19k|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (846:16): [True: 0, False: 51]
  ------------------
  847|      0|      cconvert->pub._color_convert = gray_rgb_convert;
  ------------------
  |  |  265|      0|#define _color_convert  color_convert
  ------------------
  848|     51|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (848:16): [True: 51, False: 0]
  ------------------
  849|     51|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (849:11): [True: 51, False: 0]
  ------------------
  850|     51|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (850:11): [True: 51, False: 0]
  ------------------
  851|     51|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (851:11): [True: 51, False: 0]
  ------------------
  852|     51|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (852:11): [True: 51, False: 0]
  ------------------
  853|     51|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  265|     51|#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|     51|    } 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|  1.24k|    break;
  859|       |
  860|      0|  case JCS_RGB565:
  ------------------
  |  Branch (860:3): [True: 0, False: 1.69k]
  ------------------
  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|    417|  case JCS_CMYK:
  ------------------
  |  Branch (895:3): [True: 417, False: 1.27k]
  ------------------
  896|    417|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (896:9): [True: 5, False: 412]
  ------------------
  897|    417|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (897:9): [True: 0, False: 5]
  ------------------
  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|    417|    cinfo->out_color_components = 4;
  900|    417|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (900:9): [True: 8, False: 409]
  ------------------
  901|      8|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  265|      8|#define _color_convert  color_convert
  ------------------
  902|      8|      build_ycc_rgb_table(cinfo);
  903|    409|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (903:16): [True: 409, False: 0]
  ------------------
  904|    409|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  265|    409|#define _color_convert  color_convert
  ------------------
  905|    409|    } 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|    417|    break;
  908|       |
  909|      0|  default:
  ------------------
  |  Branch (909:3): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|  }
  918|       |
  919|  1.69k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (919:7): [True: 0, False: 1.69k]
  ------------------
  920|      0|    cinfo->output_components = 1; /* single colormapped output component */
  921|  1.69k|  else
  922|  1.69k|    cinfo->output_components = cinfo->out_color_components;
  923|  1.69k|}

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

jddiffct.c:start_input_pass:
   94|      3|{
   95|      3|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
   96|       |
   97|       |  /* Because it is hitching a ride on the jpeg_inverse_dct struct,
   98|       |   * start_pass_lossless() will be called at the start of the output pass.
   99|       |   * This ensures that it will be called at the start of the input pass as
  100|       |   * well.
  101|       |   */
  102|      3|  (*cinfo->idct->start_pass) (cinfo);
  103|       |
  104|       |  /* Check that the restart interval is an integer multiple of the number
  105|       |   * of MCUs in an MCU row.
  106|       |   */
  107|      3|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 0, False: 3]
  ------------------
  108|      0|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|      3|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|      3|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|      3|  cinfo->input_iMCU_row = 0;
  115|      3|  start_iMCU_row(cinfo);
  116|      3|}
jinit_d_diff_controller:
  348|      5|{
  349|      5|  my_diff_ptr diff;
  350|      5|  int ci;
  351|      5|  jpeg_component_info *compptr;
  352|       |
  353|      5|  diff = (my_diff_ptr)
  354|      5|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      5|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  355|      5|                                sizeof(my_diff_controller));
  356|      5|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  357|      5|  diff->pub.start_input_pass = start_input_pass;
  358|      5|  diff->pub.start_output_pass = start_output_pass;
  359|       |
  360|       |  /* Create the [un]difference buffers. */
  361|     25|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (361:44): [True: 20, False: 5]
  ------------------
  362|     20|       ci++, compptr++) {
  363|     20|    diff->diff_buf[ci] =
  364|     20|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|     20|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|     20|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|     20|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  365|     20|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  366|     20|                                         (long)compptr->h_samp_factor),
  367|     20|                   (JDIMENSION)compptr->v_samp_factor);
  368|     20|    diff->undiff_buf[ci] =
  369|     20|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|     20|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|     20|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|     20|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  370|     20|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  371|     20|                                         (long)compptr->h_samp_factor),
  372|     20|                   (JDIMENSION)compptr->v_samp_factor);
  373|     20|  }
  374|       |
  375|      5|  if (need_full_buffer) {
  ------------------
  |  Branch (375:7): [True: 0, False: 5]
  ------------------
  376|      0|#ifdef D_MULTISCAN_FILES_SUPPORTED
  377|       |    /* Allocate a full-image virtual array for each component. */
  378|      0|    int access_rows;
  379|       |
  380|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (380:46): [True: 0, False: 0]
  ------------------
  381|      0|         ci++, compptr++) {
  382|      0|      access_rows = compptr->v_samp_factor;
  383|      0|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  384|      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 */
  ------------------
  385|      0|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  386|      0|                               (long)compptr->h_samp_factor),
  387|      0|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  388|      0|                               (long)compptr->v_samp_factor),
  389|      0|         (JDIMENSION)access_rows);
  390|      0|    }
  391|      0|    diff->pub.consume_data = consume_data;
  392|      0|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  256|      0|#define _decompress_data  decompress_data
  ------------------
  393|       |#else
  394|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  395|       |#endif
  396|      5|  } else {
  397|      5|    diff->pub.consume_data = dummy_consume_data;
  398|      5|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  256|      5|#define _decompress_data  decompress_data
  ------------------
  399|      5|    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  400|      5|  }
  401|      5|}

jpeg_make_d_derived_tbl:
  145|  10.2k|{
  146|  10.2k|  JHUFF_TBL *htbl;
  147|  10.2k|  d_derived_tbl *dtbl;
  148|  10.2k|  int p, i, l, si, numsymbols;
  149|  10.2k|  int lookbits, ctr;
  150|  10.2k|  char huffsize[257];
  151|  10.2k|  unsigned int huffcode[257];
  152|  10.2k|  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|  10.2k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  10.2k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (159:7): [True: 0, False: 10.2k]
  |  Branch (159:20): [True: 21, False: 10.2k]
  ------------------
  160|     21|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|     21|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     21|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     21|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  161|  10.2k|  htbl =
  162|  10.2k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (162:5): [True: 5.05k, False: 5.19k]
  ------------------
  163|  10.2k|  if (htbl == NULL)
  ------------------
  |  Branch (163:7): [True: 6, False: 10.2k]
  ------------------
  164|      6|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  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)))
  ------------------
  165|       |
  166|       |  /* Allocate a workspace if we haven't already done so. */
  167|  10.2k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (167:7): [True: 5.29k, False: 4.95k]
  ------------------
  168|  5.29k|    *pdtbl = (d_derived_tbl *)
  169|  5.29k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  5.29k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  170|  5.29k|                                  sizeof(d_derived_tbl));
  171|  10.2k|  dtbl = *pdtbl;
  172|  10.2k|  dtbl->pub = htbl;             /* fill in back link */
  173|       |
  174|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  175|       |
  176|  10.2k|  p = 0;
  177|   173k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (177:15): [True: 163k, False: 10.2k]
  ------------------
  178|   163k|    i = (int)htbl->bits[l];
  179|   163k|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (179:9): [True: 0, False: 163k]
  |  Branch (179:18): [True: 0, False: 163k]
  ------------------
  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|   974k|    while (i--)
  ------------------
  |  Branch (181:12): [True: 811k, False: 163k]
  ------------------
  182|   811k|      huffsize[p++] = (char)l;
  183|   163k|  }
  184|  10.2k|  huffsize[p] = 0;
  185|  10.2k|  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|  10.2k|  code = 0;
  191|  10.2k|  si = huffsize[0];
  192|  10.2k|  p = 0;
  193|   127k|  while (huffsize[p]) {
  ------------------
  |  Branch (193:10): [True: 117k, False: 10.2k]
  ------------------
  194|   927k|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (194:12): [True: 809k, False: 117k]
  ------------------
  195|   809k|      huffcode[p++] = code;
  196|   809k|      code++;
  197|   809k|    }
  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|   117k|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (201:9): [True: 12, False: 117k]
  ------------------
  202|     12|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|     12|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     12|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|   117k|    code <<= 1;
  204|   117k|    si++;
  205|   117k|  }
  206|       |
  207|       |  /* Figure F.15: generate decoding tables for bit-sequential decoding */
  208|       |
  209|  10.2k|  p = 0;
  210|   173k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (210:15): [True: 163k, False: 10.2k]
  ------------------
  211|   163k|    if (htbl->bits[l]) {
  ------------------
  |  Branch (211:9): [True: 110k, False: 53.1k]
  ------------------
  212|       |      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
  213|       |       * minus the minimum code of length l
  214|       |       */
  215|   110k|      dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
  216|   110k|      p += htbl->bits[l];
  217|   110k|      dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
  218|   110k|    } else {
  219|  53.1k|      dtbl->maxcode[l] = -1;    /* -1 if no codes of this length */
  220|  53.1k|    }
  221|   163k|  }
  222|  10.2k|  dtbl->valoffset[17] = 0;
  223|  10.2k|  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|  2.62M|  for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
  ------------------
  |  |   25|  2.62M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (232:15): [True: 2.61M, False: 10.2k]
  ------------------
  233|  2.61M|    dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  2.61M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
                  dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  2.61M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  234|       |
  235|  10.2k|  p = 0;
  236|  91.9k|  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
  ------------------
  |  |   25|  91.9k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (236:15): [True: 81.7k, False: 10.2k]
  ------------------
  237|   229k|    for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
  ------------------
  |  Branch (237:17): [True: 147k, False: 81.7k]
  ------------------
  238|       |      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
  239|       |      /* Generate left-justified code followed by all possible bit sequences */
  240|   147k|      lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
  ------------------
  |  |   25|   147k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  241|  2.72M|      for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
  ------------------
  |  |   25|   147k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (241:45): [True: 2.58M, False: 147k]
  ------------------
  242|  2.58M|        dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
  ------------------
  |  |   25|  2.58M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  243|  2.58M|        lookbits++;
  244|  2.58M|      }
  245|   147k|    }
  246|  81.7k|  }
  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|  10.2k|  if (isDC) {
  ------------------
  |  Branch (254:7): [True: 5.04k, False: 5.20k]
  ------------------
  255|  63.8k|    for (i = 0; i < numsymbols; i++) {
  ------------------
  |  Branch (255:17): [True: 58.7k, False: 5.04k]
  ------------------
  256|  58.7k|      int sym = htbl->huffval[i];
  257|  58.7k|      if (sym < 0 || sym > (cinfo->master->lossless ? 16 : 15))
  ------------------
  |  Branch (257:11): [True: 0, False: 58.7k]
  |  Branch (257:22): [True: 9, False: 58.7k]
  |  Branch (257:29): [True: 144, False: 58.6k]
  ------------------
  258|      9|        ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  259|  58.7k|    }
  260|  5.04k|  }
  261|  10.2k|}
jpeg_fill_bit_buffer:
  291|   583k|{
  292|       |  /* Copy heavily used state fields into locals (hopefully registers) */
  293|   583k|  register const JOCTET *next_input_byte = state->next_input_byte;
  294|   583k|  register size_t bytes_in_buffer = state->bytes_in_buffer;
  295|   583k|  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|   583k|  if (cinfo->unread_marker == 0) {      /* cannot advance past a marker */
  ------------------
  |  Branch (301:7): [True: 579k, False: 4.08k]
  ------------------
  302|  4.66M|    while (bits_left < MIN_GET_BITS) {
  ------------------
  |  |  282|  4.66M|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|  4.66M|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  |  Branch (302:12): [True: 4.08M, False: 576k]
  ------------------
  303|  4.08M|      register int c;
  304|       |
  305|       |      /* Attempt to read a byte */
  306|  4.08M|      if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (306:11): [True: 124, False: 4.08M]
  ------------------
  307|    124|        if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (307:13): [True: 0, False: 124]
  ------------------
  308|      0|          return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  309|    124|        next_input_byte = cinfo->src->next_input_byte;
  310|    124|        bytes_in_buffer = cinfo->src->bytes_in_buffer;
  311|    124|      }
  312|  4.08M|      bytes_in_buffer--;
  313|  4.08M|      c = *next_input_byte++;
  314|       |
  315|       |      /* If it's 0xFF, check and discard stuffed zero byte */
  316|  4.08M|      if (c == 0xFF) {
  ------------------
  |  Branch (316:11): [True: 35.8k, False: 4.04M]
  ------------------
  317|       |        /* Loop here to discard any padding FF's on terminating marker,
  318|       |         * so that we can save a valid unread_marker value.  NOTE: we will
  319|       |         * accept multiple FF's followed by a 0 as meaning a single FF data
  320|       |         * byte.  This data pattern is not valid according to the standard.
  321|       |         */
  322|  49.2k|        do {
  323|  49.2k|          if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (323:15): [True: 0, False: 49.2k]
  ------------------
  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|  49.2k|          bytes_in_buffer--;
  330|  49.2k|          c = *next_input_byte++;
  331|  49.2k|        } while (c == 0xFF);
  ------------------
  |  Branch (331:18): [True: 13.3k, False: 35.8k]
  ------------------
  332|       |
  333|  35.8k|        if (c == 0) {
  ------------------
  |  Branch (333:13): [True: 32.6k, False: 3.17k]
  ------------------
  334|       |          /* Found FF/00, which represents an FF data byte */
  335|  32.6k|          c = 0xFF;
  336|  32.6k|        } 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|  3.17k|          cinfo->unread_marker = c;
  346|       |          /* See if we need to insert some fake zero bits. */
  347|  3.17k|          goto no_more_bytes;
  348|  3.17k|        }
  349|  35.8k|      }
  350|       |
  351|       |      /* OK, load c into get_buffer */
  352|  4.08M|      get_buffer = (get_buffer << 8) | c;
  353|  4.08M|      bits_left += 8;
  354|  4.08M|    } /* end while */
  355|   579k|  } else {
  356|  7.25k|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|  7.25k|    if (nbits > bits_left) {
  ------------------
  |  Branch (361:9): [True: 528, False: 6.73k]
  ------------------
  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|    528|      if (!cinfo->entropy->insufficient_data) {
  ------------------
  |  Branch (367:11): [True: 528, False: 0]
  ------------------
  368|    528|        WARNMS(cinfo, JWRN_HIT_MARKER);
  ------------------
  |  |  283|    528|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    528|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  369|    528|        cinfo->entropy->insufficient_data = TRUE;
  ------------------
  |  |  209|    528|#define TRUE    1
  ------------------
  370|    528|      }
  371|       |      /* Fill the buffer with zero bits */
  372|    528|      get_buffer <<= MIN_GET_BITS - bits_left;
  ------------------
  |  |  282|    528|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|    528|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  373|    528|      bits_left = MIN_GET_BITS;
  ------------------
  |  |  282|    528|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|    528|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  374|    528|    }
  375|  7.25k|  }
  376|       |
  377|       |  /* Unload the local registers */
  378|   583k|  state->next_input_byte = next_input_byte;
  379|   583k|  state->bytes_in_buffer = bytes_in_buffer;
  380|   583k|  state->get_buffer = get_buffer;
  381|   583k|  state->bits_left = bits_left;
  382|       |
  383|   583k|  return TRUE;
  ------------------
  |  |  209|   583k|#define TRUE    1
  ------------------
  384|   583k|}
jpeg_huff_decode:
  439|   206k|{
  440|   206k|  register int l = min_bits;
  441|   206k|  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|   206k|  CHECK_BIT_BUFFER(*state, l, return -1);
  ------------------
  |  |  160|   206k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   206k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 4.00k, False: 202k]
  |  |  ------------------
  |  |  162|  4.00k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 4.00k]
  |  |  ------------------
  |  |  163|  4.00k|      { action; } \
  |  |  164|  4.00k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  4.00k|  } \
  |  |  166|   206k|}
  ------------------
  447|   206k|  code = GET_BITS(l);
  ------------------
  |  |  169|   206k|  (((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|   491k|  while (code > htbl->maxcode[l]) {
  ------------------
  |  Branch (452:10): [True: 284k, False: 206k]
  ------------------
  453|   284k|    code <<= 1;
  454|   284k|    CHECK_BIT_BUFFER(*state, 1, return -1);
  ------------------
  |  |  160|   284k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   284k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 4.64k, False: 280k]
  |  |  ------------------
  |  |  162|  4.64k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 4.64k]
  |  |  ------------------
  |  |  163|  4.64k|      { action; } \
  |  |  164|  4.64k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  4.64k|  } \
  |  |  166|   284k|}
  ------------------
  455|   284k|    code |= GET_BITS(1);
  ------------------
  |  |  169|   284k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  456|   284k|    l++;
  457|   284k|  }
  458|       |
  459|       |  /* Unload the local registers */
  460|   206k|  state->get_buffer = get_buffer;
  461|   206k|  state->bits_left = bits_left;
  462|       |
  463|       |  /* With garbage input we may reach the sentinel value l = 17. */
  464|       |
  465|   206k|  if (l > 16) {
  ------------------
  |  Branch (465:7): [True: 92, False: 206k]
  ------------------
  466|     92|    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|     92|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     92|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  467|     92|    return 0;                   /* fake a zero as the safest result */
  468|     92|  }
  469|       |
  470|   206k|  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
  471|   206k|}
jinit_huff_decoder:
  815|  1.52k|{
  816|  1.52k|  huff_entropy_ptr entropy;
  817|  1.52k|  int i;
  818|       |
  819|       |  /* Motion JPEG frames typically do not include the Huffman tables if they
  820|       |     are the default tables.  Thus, if the tables are not set by the time
  821|       |     the Huffman decoder is initialized (usually within the body of
  822|       |     jpeg_start_decompress()), we set them to default values. */
  823|  1.52k|  std_huff_tables((j_common_ptr)cinfo);
  824|       |
  825|  1.52k|  entropy = (huff_entropy_ptr)
  826|  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 */
  ------------------
  827|  1.52k|                                sizeof(huff_entropy_decoder));
  828|  1.52k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  829|  1.52k|  entropy->pub.start_pass = start_pass_huff_decoder;
  830|  1.52k|  entropy->pub.decode_mcu = decode_mcu;
  831|       |
  832|       |  /* Mark tables unallocated */
  833|  7.61k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  7.61k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (833:15): [True: 6.08k, False: 1.52k]
  ------------------
  834|  6.08k|    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
  835|  6.08k|  }
  836|  1.52k|}
jdhuff.c:start_pass_huff_decoder:
   80|  1.50k|{
   81|  1.50k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   82|  1.50k|  int ci, blkn, dctbl, actbl;
   83|  1.50k|  d_derived_tbl **pdtbl;
   84|  1.50k|  jpeg_component_info *compptr;
   85|       |
   86|       |  /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
   87|       |   * This ought to be an error condition, but we make it a warning because
   88|       |   * there are some baseline files out there with all zeroes in these bytes.
   89|       |   */
   90|  1.50k|  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|  1.44k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (90:7): [True: 63, False: 1.44k]
  |  Branch (90:25): [True: 6, False: 1.43k]
  ------------------
   91|  1.50k|      cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (91:7): [True: 5, False: 1.43k]
  |  Branch (91:25): [True: 2, False: 1.43k]
  ------------------
   92|     76|    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|     76|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     76|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
   93|       |
   94|  6.05k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (94:16): [True: 4.54k, False: 1.50k]
  ------------------
   95|  4.54k|    compptr = cinfo->cur_comp_info[ci];
   96|  4.54k|    dctbl = compptr->dc_tbl_no;
   97|  4.54k|    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|  4.54k|    pdtbl = (d_derived_tbl **)(entropy->dc_derived_tbls) + dctbl;
  101|  4.54k|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
  ------------------
  |  |  209|  4.54k|#define TRUE    1
  ------------------
  102|  4.54k|    pdtbl = (d_derived_tbl **)(entropy->ac_derived_tbls) + actbl;
  103|  4.54k|    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
  ------------------
  |  |  206|  4.54k|#define FALSE   0               /* values of boolean */
  ------------------
  104|       |    /* Initialize DC predictions to 0 */
  105|  4.54k|    entropy->saved.last_dc_val[ci] = 0;
  106|  4.54k|  }
  107|       |
  108|       |  /* Precalculate decoding info for each block in an MCU of this scan */
  109|  6.65k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (109:18): [True: 5.14k, False: 1.50k]
  ------------------
  110|  5.14k|    ci = cinfo->MCU_membership[blkn];
  111|  5.14k|    compptr = cinfo->cur_comp_info[ci];
  112|       |    /* Precalculate which table to use for each block */
  113|  5.14k|    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
  114|  5.14k|    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
  115|       |    /* Decide whether we really care about the coefficient values */
  116|  5.14k|    if (compptr->component_needed) {
  ------------------
  |  Branch (116:9): [True: 5.14k, False: 0]
  ------------------
  117|  5.14k|      entropy->dc_needed[blkn] = TRUE;
  ------------------
  |  |  209|  5.14k|#define TRUE    1
  ------------------
  118|       |      /* we don't need the ACs if producing a 1/8th-size image */
  119|  5.14k|      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
  ------------------
  |  |   24|  5.14k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  120|  5.14k|    } else {
  121|      0|      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  122|      0|    }
  123|  5.14k|  }
  124|       |
  125|       |  /* Initialize bitread state variables */
  126|  1.50k|  entropy->bitstate.bits_left = 0;
  127|  1.50k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  128|  1.50k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|  1.50k|#define FALSE   0               /* values of boolean */
  ------------------
  129|       |
  130|       |  /* Initialize restart counter */
  131|  1.50k|  entropy->restarts_to_go = cinfo->restart_interval;
  132|  1.50k|}
jdhuff.c:decode_mcu:
  771|   425k|{
  772|   425k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  773|   425k|  int usefast = 1;
  774|       |
  775|       |  /* Process restart marker if needed; may have to suspend */
  776|   425k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (776:7): [True: 40.2k, False: 384k]
  ------------------
  777|  40.2k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (777:9): [True: 1.56k, False: 38.6k]
  ------------------
  778|  1.56k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (778:11): [True: 0, False: 1.56k]
  ------------------
  779|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  780|  40.2k|    usefast = 0;
  781|  40.2k|  }
  782|       |
  783|   425k|  if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
  ------------------
  |  |  767|   425k|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  ------------------
  |  |  |  |   67|   425k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  ------------------
  |  Branch (783:7): [True: 130k, False: 294k]
  ------------------
  784|   425k|      cinfo->unread_marker != 0)
  ------------------
  |  Branch (784:7): [True: 72, False: 294k]
  ------------------
  785|   130k|    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|   425k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (790:7): [True: 424k, False: 52]
  ------------------
  791|       |
  792|   424k|    if (usefast) {
  ------------------
  |  Branch (792:9): [True: 256k, False: 168k]
  ------------------
  793|   256k|      if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
  ------------------
  |  Branch (793:11): [True: 495, False: 256k]
  ------------------
  794|   256k|    } else {
  795|   168k|use_slow:
  796|   168k|      if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (796:11): [True: 0, False: 168k]
  ------------------
  797|   168k|    }
  798|       |
  799|   424k|  }
  800|       |
  801|       |  /* Account for restart interval (no-op if not using restarts) */
  802|   425k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (802:7): [True: 40.1k, False: 384k]
  ------------------
  803|  40.1k|    entropy->restarts_to_go--;
  804|       |
  805|   425k|  return TRUE;
  ------------------
  |  |  209|   425k|#define TRUE    1
  ------------------
  806|   425k|}
jdhuff.c:process_restart:
  513|  1.56k|{
  514|  1.56k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  515|  1.56k|  int ci;
  516|       |
  517|       |  /* Throw away any unused bits remaining in bit buffer; */
  518|       |  /* include any full bytes in next_marker's count of discarded bytes */
  519|  1.56k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  520|  1.56k|  entropy->bitstate.bits_left = 0;
  521|       |
  522|       |  /* Advance past the RSTn marker */
  523|  1.56k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (523:7): [True: 0, False: 1.56k]
  ------------------
  524|      0|    return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  525|       |
  526|       |  /* Re-initialize DC predictions to 0 */
  527|  6.10k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (527:16): [True: 4.54k, False: 1.56k]
  ------------------
  528|  4.54k|    entropy->saved.last_dc_val[ci] = 0;
  529|       |
  530|       |  /* Reset restart counter */
  531|  1.56k|  entropy->restarts_to_go = cinfo->restart_interval;
  532|       |
  533|       |  /* Reset out-of-data flag, unless read_restart_marker left us smack up
  534|       |   * against a marker.  In that case we will end up treating the next data
  535|       |   * segment as empty, and we can avoid producing bogus output pixels by
  536|       |   * leaving the flag set.
  537|       |   */
  538|  1.56k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (538:7): [True: 1.51k, False: 52]
  ------------------
  539|  1.51k|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|  1.51k|#define FALSE   0               /* values of boolean */
  ------------------
  540|       |
  541|  1.56k|  return TRUE;
  ------------------
  |  |  209|  1.56k|#define TRUE    1
  ------------------
  542|  1.56k|}
jdhuff.c:decode_mcu_fast:
  664|   256k|{
  665|   256k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  666|   256k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   256k|  register bit_buf_type get_buffer; \
  |  |  126|   256k|  register int bits_left; \
  |  |  127|   256k|  bitread_working_state br_state
  ------------------
  667|   256k|  JOCTET *buffer;
  668|   256k|  int blkn;
  669|   256k|  savable_state state;
  670|       |  /* Outer loop handles each block in the MCU */
  671|       |
  672|       |  /* Load up working state */
  673|   256k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   256k|  br_state.cinfo = cinfop; \
  |  |  131|   256k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   256k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   256k|  get_buffer = permstate.get_buffer; \
  |  |  134|   256k|  bits_left = permstate.bits_left;
  ------------------
  674|   256k|  buffer = (JOCTET *)br_state.next_input_byte;
  675|   256k|  state = entropy->saved;
  676|       |
  677|  1.03M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (677:18): [True: 773k, False: 256k]
  ------------------
  678|   773k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (678:23): [True: 773k, False: 0]
  ------------------
  679|   773k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  680|   773k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  681|   773k|    register int s, k, r, l;
  682|       |
  683|   773k|    HUFF_DECODE_FAST(s, l, dctbl);
  ------------------
  |  |  224|   773k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   773k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 44.7k, False: 728k]
  |  |  |  |  ------------------
  |  |  |  |  416|  44.7k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  44.7k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  44.7k|  register int c0, c1; \
  |  |  |  |  |  |  393|  44.7k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  44.7k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  44.7k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  44.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  44.7k|  bits_left += 8; \
  |  |  |  |  |  |  398|  44.7k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 489, False: 44.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    489|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    489|    buffer++; \
  |  |  |  |  |  |  401|    489|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 61, False: 428]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     61|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     61|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     61|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     61|      buffer -= 2; \
  |  |  |  |  |  |  406|     61|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     61|    } \
  |  |  |  |  |  |  408|    489|  } \
  |  |  |  |  |  |  409|  44.7k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  44.7k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  44.7k|  register int c0, c1; \
  |  |  |  |  |  |  393|  44.7k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  44.7k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  44.7k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  44.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  44.7k|  bits_left += 8; \
  |  |  |  |  |  |  398|  44.7k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 643, False: 44.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    643|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    643|    buffer++; \
  |  |  |  |  |  |  401|    643|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 89, False: 554]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     89|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     89|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     89|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     89|      buffer -= 2; \
  |  |  |  |  |  |  406|     89|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     89|    } \
  |  |  |  |  |  |  408|    643|  } \
  |  |  |  |  |  |  409|  44.7k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  44.7k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  44.7k|  register int c0, c1; \
  |  |  |  |  |  |  393|  44.7k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  44.7k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  44.7k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  44.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  44.7k|  bits_left += 8; \
  |  |  |  |  |  |  398|  44.7k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 402, False: 44.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    402|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    402|    buffer++; \
  |  |  |  |  |  |  401|    402|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 116, False: 286]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    116|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    116|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    116|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    116|      buffer -= 2; \
  |  |  |  |  |  |  406|    116|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    116|    } \
  |  |  |  |  |  |  408|    402|  } \
  |  |  |  |  |  |  409|  44.7k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  44.7k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  44.7k|  register int c0, c1; \
  |  |  |  |  |  |  393|  44.7k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  44.7k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  44.7k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  44.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  44.7k|  bits_left += 8; \
  |  |  |  |  |  |  398|  44.7k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 406, False: 44.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    406|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    406|    buffer++; \
  |  |  |  |  |  |  401|    406|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 122, False: 284]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    122|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    122|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    122|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    122|      buffer -= 2; \
  |  |  |  |  |  |  406|    122|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    122|    } \
  |  |  |  |  |  |  408|    406|  } \
  |  |  |  |  |  |  409|  44.7k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  44.7k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  44.7k|  register int c0, c1; \
  |  |  |  |  |  |  393|  44.7k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  44.7k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  44.7k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  44.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  44.7k|  bits_left += 8; \
  |  |  |  |  |  |  398|  44.7k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 382, False: 44.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    382|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    382|    buffer++; \
  |  |  |  |  |  |  401|    382|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 123, False: 259]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    123|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    123|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    123|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    123|      buffer -= 2; \
  |  |  |  |  |  |  406|    123|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    123|    } \
  |  |  |  |  |  |  408|    382|  } \
  |  |  |  |  |  |  409|  44.7k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  44.7k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  44.7k|  register int c0, c1; \
  |  |  |  |  |  |  393|  44.7k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  44.7k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  44.7k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  44.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  44.7k|  bits_left += 8; \
  |  |  |  |  |  |  398|  44.7k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 442, False: 44.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    442|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    442|    buffer++; \
  |  |  |  |  |  |  401|    442|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 139, False: 303]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    139|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    139|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    139|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    139|      buffer -= 2; \
  |  |  |  |  |  |  406|    139|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    139|    } \
  |  |  |  |  |  |  408|    442|  } \
  |  |  |  |  |  |  409|  44.7k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  44.7k|  }
  |  |  ------------------
  |  |  225|   773k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   773k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   773k|  s = htbl->lookup[s]; \
  |  |  227|   773k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   773k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   773k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   773k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   773k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   773k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   773k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   773k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.54M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 452, False: 773k]
  |  |  ------------------
  |  |  232|    452|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|    452|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|    452|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|  3.28k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 2.82k, False: 452]
  |  |  ------------------
  |  |  236|  2.82k|      s <<= 1; \
  |  |  237|  2.82k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|  2.82k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|  2.82k|      nb++; \
  |  |  239|  2.82k|    } \
  |  |  240|    452|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 345, False: 107]
  |  |  ------------------
  |  |  241|    452|      s = 0; \
  |  |  242|    452|    else \
  |  |  243|    452|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|    452|  }
  ------------------
  684|   773k|    if (s) {
  ------------------
  |  Branch (684:9): [True: 97.3k, False: 676k]
  ------------------
  685|  97.3k|      FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  97.3k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 8.92k, False: 88.3k]
  |  |  ------------------
  |  |  416|  8.92k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  8.92k|#define GET_BYTE { \
  |  |  |  |  392|  8.92k|  register int c0, c1; \
  |  |  |  |  393|  8.92k|  c0 = *buffer++; \
  |  |  |  |  394|  8.92k|  c1 = *buffer; \
  |  |  |  |  395|  8.92k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  8.92k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  8.92k|  bits_left += 8; \
  |  |  |  |  398|  8.92k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 324, False: 8.59k]
  |  |  |  |  ------------------
  |  |  |  |  399|    324|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    324|    buffer++; \
  |  |  |  |  401|    324|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 41, False: 283]
  |  |  |  |  ------------------
  |  |  |  |  402|     41|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     41|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     41|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     41|      buffer -= 2; \
  |  |  |  |  406|     41|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     41|    } \
  |  |  |  |  408|    324|  } \
  |  |  |  |  409|  8.92k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  8.92k|#define GET_BYTE { \
  |  |  |  |  392|  8.92k|  register int c0, c1; \
  |  |  |  |  393|  8.92k|  c0 = *buffer++; \
  |  |  |  |  394|  8.92k|  c1 = *buffer; \
  |  |  |  |  395|  8.92k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  8.92k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  8.92k|  bits_left += 8; \
  |  |  |  |  398|  8.92k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 147, False: 8.77k]
  |  |  |  |  ------------------
  |  |  |  |  399|    147|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    147|    buffer++; \
  |  |  |  |  401|    147|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 41, False: 106]
  |  |  |  |  ------------------
  |  |  |  |  402|     41|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     41|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     41|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     41|      buffer -= 2; \
  |  |  |  |  406|     41|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     41|    } \
  |  |  |  |  408|    147|  } \
  |  |  |  |  409|  8.92k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  8.92k|#define GET_BYTE { \
  |  |  |  |  392|  8.92k|  register int c0, c1; \
  |  |  |  |  393|  8.92k|  c0 = *buffer++; \
  |  |  |  |  394|  8.92k|  c1 = *buffer; \
  |  |  |  |  395|  8.92k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  8.92k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  8.92k|  bits_left += 8; \
  |  |  |  |  398|  8.92k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 409, False: 8.51k]
  |  |  |  |  ------------------
  |  |  |  |  399|    409|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    409|    buffer++; \
  |  |  |  |  401|    409|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 45, False: 364]
  |  |  |  |  ------------------
  |  |  |  |  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|    409|  } \
  |  |  |  |  409|  8.92k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  8.92k|#define GET_BYTE { \
  |  |  |  |  392|  8.92k|  register int c0, c1; \
  |  |  |  |  393|  8.92k|  c0 = *buffer++; \
  |  |  |  |  394|  8.92k|  c1 = *buffer; \
  |  |  |  |  395|  8.92k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  8.92k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  8.92k|  bits_left += 8; \
  |  |  |  |  398|  8.92k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 57, False: 8.86k]
  |  |  |  |  ------------------
  |  |  |  |  399|     57|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|     57|    buffer++; \
  |  |  |  |  401|     57|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 47, False: 10]
  |  |  |  |  ------------------
  |  |  |  |  402|     47|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     47|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     47|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     47|      buffer -= 2; \
  |  |  |  |  406|     47|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     47|    } \
  |  |  |  |  408|     57|  } \
  |  |  |  |  409|  8.92k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  8.92k|#define GET_BYTE { \
  |  |  |  |  392|  8.92k|  register int c0, c1; \
  |  |  |  |  393|  8.92k|  c0 = *buffer++; \
  |  |  |  |  394|  8.92k|  c1 = *buffer; \
  |  |  |  |  395|  8.92k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  8.92k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  8.92k|  bits_left += 8; \
  |  |  |  |  398|  8.92k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 169, False: 8.75k]
  |  |  |  |  ------------------
  |  |  |  |  399|    169|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    169|    buffer++; \
  |  |  |  |  401|    169|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 49, False: 120]
  |  |  |  |  ------------------
  |  |  |  |  402|     49|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     49|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     49|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     49|      buffer -= 2; \
  |  |  |  |  406|     49|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     49|    } \
  |  |  |  |  408|    169|  } \
  |  |  |  |  409|  8.92k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  8.92k|#define GET_BYTE { \
  |  |  |  |  392|  8.92k|  register int c0, c1; \
  |  |  |  |  393|  8.92k|  c0 = *buffer++; \
  |  |  |  |  394|  8.92k|  c1 = *buffer; \
  |  |  |  |  395|  8.92k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  8.92k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  8.92k|  bits_left += 8; \
  |  |  |  |  398|  8.92k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 83, False: 8.83k]
  |  |  |  |  ------------------
  |  |  |  |  399|     83|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|     83|    buffer++; \
  |  |  |  |  401|     83|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 49, False: 34]
  |  |  |  |  ------------------
  |  |  |  |  402|     49|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     49|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     49|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     49|      buffer -= 2; \
  |  |  |  |  406|     49|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     49|    } \
  |  |  |  |  408|     83|  } \
  |  |  |  |  409|  8.92k|}
  |  |  ------------------
  |  |  417|  8.92k|  }
  ------------------
  686|  97.3k|      r = GET_BITS(s);
  ------------------
  |  |  169|  97.3k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  687|  97.3k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  97.3k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  97.3k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  688|  97.3k|    }
  689|       |
  690|   773k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (690:9): [True: 773k, False: 0]
  ------------------
  691|   773k|      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|   773k|      s += state.last_dc_val[ci];
  696|   773k|      state.last_dc_val[ci] = s;
  697|   773k|      if (block)
  ------------------
  |  Branch (697:11): [True: 773k, False: 0]
  ------------------
  698|   773k|        (*block)[0] = (JCOEF)s;
  699|   773k|    }
  700|       |
  701|   773k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (701:9): [True: 773k, False: 0]
  |  Branch (701:37): [True: 773k, False: 0]
  ------------------
  702|       |
  703|  2.30M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  2.30M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (703:19): [True: 2.29M, False: 7.30k]
  ------------------
  704|  2.29M|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|  2.29M|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|  2.29M|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 124k, False: 2.17M]
  |  |  |  |  ------------------
  |  |  |  |  416|   124k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   124k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   124k|  register int c0, c1; \
  |  |  |  |  |  |  393|   124k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   124k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   124k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   124k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   124k|  bits_left += 8; \
  |  |  |  |  |  |  398|   124k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.85k, False: 122k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.85k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.85k|    buffer++; \
  |  |  |  |  |  |  401|  1.85k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.06k, False: 790]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.06k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.06k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.06k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.06k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.06k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.06k|    } \
  |  |  |  |  |  |  408|  1.85k|  } \
  |  |  |  |  |  |  409|   124k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   124k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   124k|  register int c0, c1; \
  |  |  |  |  |  |  393|   124k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   124k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   124k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   124k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   124k|  bits_left += 8; \
  |  |  |  |  |  |  398|   124k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.57k, False: 121k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.57k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.57k|    buffer++; \
  |  |  |  |  |  |  401|  2.57k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.08k, False: 1.49k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.08k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.08k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.08k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.08k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.08k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.08k|    } \
  |  |  |  |  |  |  408|  2.57k|  } \
  |  |  |  |  |  |  409|   124k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   124k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   124k|  register int c0, c1; \
  |  |  |  |  |  |  393|   124k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   124k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   124k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   124k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   124k|  bits_left += 8; \
  |  |  |  |  |  |  398|   124k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.85k, False: 122k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.85k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.85k|    buffer++; \
  |  |  |  |  |  |  401|  1.85k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.10k, False: 752]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.10k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.10k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.10k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.10k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.10k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.10k|    } \
  |  |  |  |  |  |  408|  1.85k|  } \
  |  |  |  |  |  |  409|   124k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   124k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   124k|  register int c0, c1; \
  |  |  |  |  |  |  393|   124k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   124k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   124k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   124k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   124k|  bits_left += 8; \
  |  |  |  |  |  |  398|   124k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.80k, False: 122k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.80k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.80k|    buffer++; \
  |  |  |  |  |  |  401|  1.80k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.11k, False: 692]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.11k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.11k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.11k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.11k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.11k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.11k|    } \
  |  |  |  |  |  |  408|  1.80k|  } \
  |  |  |  |  |  |  409|   124k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   124k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   124k|  register int c0, c1; \
  |  |  |  |  |  |  393|   124k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   124k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   124k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   124k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   124k|  bits_left += 8; \
  |  |  |  |  |  |  398|   124k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.70k, False: 122k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.70k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.70k|    buffer++; \
  |  |  |  |  |  |  401|  1.70k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.13k, False: 576]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.13k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.13k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.13k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.13k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.13k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.13k|    } \
  |  |  |  |  |  |  408|  1.70k|  } \
  |  |  |  |  |  |  409|   124k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   124k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   124k|  register int c0, c1; \
  |  |  |  |  |  |  393|   124k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   124k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   124k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   124k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   124k|  bits_left += 8; \
  |  |  |  |  |  |  398|   124k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.61k, False: 122k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.61k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.61k|    buffer++; \
  |  |  |  |  |  |  401|  1.61k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.17k, False: 440]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.17k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.17k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.17k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.17k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.17k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.17k|    } \
  |  |  |  |  |  |  408|  1.61k|  } \
  |  |  |  |  |  |  409|   124k|}
  |  |  |  |  ------------------
  |  |  |  |  417|   124k|  }
  |  |  ------------------
  |  |  225|  2.29M|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  2.29M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|  2.29M|  s = htbl->lookup[s]; \
  |  |  227|  2.29M|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|  2.29M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|  2.29M|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|  2.29M|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  2.29M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|  2.29M|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  2.29M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|  2.29M|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  4.59M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 68.1k, False: 2.22M]
  |  |  ------------------
  |  |  232|  68.1k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  68.1k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  68.1k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|   221k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 153k, False: 68.1k]
  |  |  ------------------
  |  |  236|   153k|      s <<= 1; \
  |  |  237|   153k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|   153k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|   153k|      nb++; \
  |  |  239|   153k|    } \
  |  |  240|  68.1k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 283, False: 67.8k]
  |  |  ------------------
  |  |  241|  68.1k|      s = 0; \
  |  |  242|  68.1k|    else \
  |  |  243|  68.1k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  68.1k|  }
  ------------------
  705|  2.29M|        r = s >> 4;
  706|  2.29M|        s &= 15;
  707|       |
  708|  2.29M|        if (s) {
  ------------------
  |  Branch (708:13): [True: 1.52M, False: 766k]
  ------------------
  709|  1.52M|          k += r;
  710|  1.52M|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  1.52M|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 122k, False: 1.40M]
  |  |  ------------------
  |  |  416|   122k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   122k|#define GET_BYTE { \
  |  |  |  |  392|   122k|  register int c0, c1; \
  |  |  |  |  393|   122k|  c0 = *buffer++; \
  |  |  |  |  394|   122k|  c1 = *buffer; \
  |  |  |  |  395|   122k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   122k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   122k|  bits_left += 8; \
  |  |  |  |  398|   122k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 2.62k, False: 120k]
  |  |  |  |  ------------------
  |  |  |  |  399|  2.62k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  2.62k|    buffer++; \
  |  |  |  |  401|  2.62k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 1.78k, False: 840]
  |  |  |  |  ------------------
  |  |  |  |  402|  1.78k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  1.78k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  1.78k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  1.78k|      buffer -= 2; \
  |  |  |  |  406|  1.78k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  1.78k|    } \
  |  |  |  |  408|  2.62k|  } \
  |  |  |  |  409|   122k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   122k|#define GET_BYTE { \
  |  |  |  |  392|   122k|  register int c0, c1; \
  |  |  |  |  393|   122k|  c0 = *buffer++; \
  |  |  |  |  394|   122k|  c1 = *buffer; \
  |  |  |  |  395|   122k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   122k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   122k|  bits_left += 8; \
  |  |  |  |  398|   122k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 2.27k, False: 120k]
  |  |  |  |  ------------------
  |  |  |  |  399|  2.27k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  2.27k|    buffer++; \
  |  |  |  |  401|  2.27k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 1.89k, False: 381]
  |  |  |  |  ------------------
  |  |  |  |  402|  1.89k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  1.89k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  1.89k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  1.89k|      buffer -= 2; \
  |  |  |  |  406|  1.89k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  1.89k|    } \
  |  |  |  |  408|  2.27k|  } \
  |  |  |  |  409|   122k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   122k|#define GET_BYTE { \
  |  |  |  |  392|   122k|  register int c0, c1; \
  |  |  |  |  393|   122k|  c0 = *buffer++; \
  |  |  |  |  394|   122k|  c1 = *buffer; \
  |  |  |  |  395|   122k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   122k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   122k|  bits_left += 8; \
  |  |  |  |  398|   122k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.02k, False: 119k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.02k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.02k|    buffer++; \
  |  |  |  |  401|  3.02k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 1.90k, False: 1.11k]
  |  |  |  |  ------------------
  |  |  |  |  402|  1.90k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  1.90k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  1.90k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  1.90k|      buffer -= 2; \
  |  |  |  |  406|  1.90k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  1.90k|    } \
  |  |  |  |  408|  3.02k|  } \
  |  |  |  |  409|   122k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   122k|#define GET_BYTE { \
  |  |  |  |  392|   122k|  register int c0, c1; \
  |  |  |  |  393|   122k|  c0 = *buffer++; \
  |  |  |  |  394|   122k|  c1 = *buffer; \
  |  |  |  |  395|   122k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   122k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   122k|  bits_left += 8; \
  |  |  |  |  398|   122k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 2.70k, False: 120k]
  |  |  |  |  ------------------
  |  |  |  |  399|  2.70k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  2.70k|    buffer++; \
  |  |  |  |  401|  2.70k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 1.92k, False: 788]
  |  |  |  |  ------------------
  |  |  |  |  402|  1.92k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  1.92k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  1.92k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  1.92k|      buffer -= 2; \
  |  |  |  |  406|  1.92k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  1.92k|    } \
  |  |  |  |  408|  2.70k|  } \
  |  |  |  |  409|   122k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   122k|#define GET_BYTE { \
  |  |  |  |  392|   122k|  register int c0, c1; \
  |  |  |  |  393|   122k|  c0 = *buffer++; \
  |  |  |  |  394|   122k|  c1 = *buffer; \
  |  |  |  |  395|   122k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   122k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   122k|  bits_left += 8; \
  |  |  |  |  398|   122k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.48k, False: 119k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.48k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.48k|    buffer++; \
  |  |  |  |  401|  3.48k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 1.92k, False: 1.55k]
  |  |  |  |  ------------------
  |  |  |  |  402|  1.92k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  1.92k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  1.92k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  1.92k|      buffer -= 2; \
  |  |  |  |  406|  1.92k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  1.92k|    } \
  |  |  |  |  408|  3.48k|  } \
  |  |  |  |  409|   122k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   122k|#define GET_BYTE { \
  |  |  |  |  392|   122k|  register int c0, c1; \
  |  |  |  |  393|   122k|  c0 = *buffer++; \
  |  |  |  |  394|   122k|  c1 = *buffer; \
  |  |  |  |  395|   122k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   122k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   122k|  bits_left += 8; \
  |  |  |  |  398|   122k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 2.95k, False: 119k]
  |  |  |  |  ------------------
  |  |  |  |  399|  2.95k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  2.95k|    buffer++; \
  |  |  |  |  401|  2.95k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 1.93k, False: 1.02k]
  |  |  |  |  ------------------
  |  |  |  |  402|  1.93k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  1.93k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  1.93k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  1.93k|      buffer -= 2; \
  |  |  |  |  406|  1.93k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  1.93k|    } \
  |  |  |  |  408|  2.95k|  } \
  |  |  |  |  409|   122k|}
  |  |  ------------------
  |  |  417|   122k|  }
  ------------------
  711|  1.52M|          r = GET_BITS(s);
  ------------------
  |  |  169|  1.52M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  712|  1.52M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  1.52M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  1.52M|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  713|  1.52M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  714|  1.52M|        } else {
  715|   766k|          if (r != 15) break;
  ------------------
  |  Branch (715:15): [True: 766k, False: 298]
  ------------------
  716|    298|          k += 15;
  717|    298|        }
  718|  2.29M|      }
  719|       |
  720|   773k|    } 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|   773k|  }
  738|       |
  739|   256k|  if (cinfo->unread_marker != 0) {
  ------------------
  |  Branch (739:7): [True: 495, False: 256k]
  ------------------
  740|    495|    cinfo->unread_marker = 0;
  741|    495|    return FALSE;
  ------------------
  |  |  206|    495|#define FALSE   0               /* values of boolean */
  ------------------
  742|    495|  }
  743|       |
  744|   256k|  br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
  745|   256k|  br_state.next_input_byte = buffer;
  746|   256k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   256k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   256k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   256k|  permstate.get_buffer = get_buffer; \
  |  |  140|   256k|  permstate.bits_left = bits_left
  ------------------
  747|   256k|  entropy->saved = state;
  748|   256k|  return TRUE;
  ------------------
  |  |  209|   256k|#define TRUE    1
  ------------------
  749|   256k|}
jdhuff.c:decode_mcu_slow:
  553|   168k|{
  554|   168k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  555|   168k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   168k|  register bit_buf_type get_buffer; \
  |  |  126|   168k|  register int bits_left; \
  |  |  127|   168k|  bitread_working_state br_state
  ------------------
  556|   168k|  int blkn;
  557|   168k|  savable_state state;
  558|       |  /* Outer loop handles each block in the MCU */
  559|       |
  560|       |  /* Load up working state */
  561|   168k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   168k|  br_state.cinfo = cinfop; \
  |  |  131|   168k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   168k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   168k|  get_buffer = permstate.get_buffer; \
  |  |  134|   168k|  bits_left = permstate.bits_left;
  ------------------
  562|   168k|  state = entropy->saved;
  563|       |
  564|   683k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (564:18): [True: 514k, False: 168k]
  ------------------
  565|   514k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (565:23): [True: 514k, False: 0]
  ------------------
  566|   514k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  567|   514k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  568|   514k|    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|   514k|    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
  ------------------
  |  |  200|   514k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   514k|  register int nb, look; \
  |  |  202|   514k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   514k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 28.5k, False: 486k]
  |  |  ------------------
  |  |  203|  28.5k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 28.5k]
  |  |  ------------------
  |  |  204|  28.5k|      { failaction; } \
  |  |  205|  28.5k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  28.5k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  28.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 676, False: 27.8k]
  |  |  ------------------
  |  |  207|    676|      nb = 1;  goto slowlabel; \
  |  |  208|    676|    } \
  |  |  209|  28.5k|  } \
  |  |  210|   514k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   514k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   514k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   514k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   514k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 513k, False: 237]
  |  |  ------------------
  |  |  212|   513k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   513k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   513k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   513k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   513k|  } else { \
  |  |  215|    911|slowlabel: \
  |  |  216|    911|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 911]
  |  |  ------------------
  |  |  217|    911|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|    911|      { failaction; } \
  |  |  219|    911|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|    911|  } \
  |  |  221|   514k|}
  ------------------
  574|   514k|    if (s) {
  ------------------
  |  Branch (574:9): [True: 136k, False: 378k]
  ------------------
  575|   136k|      CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|   136k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   136k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 5.00k, False: 131k]
  |  |  ------------------
  |  |  162|  5.00k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  163|  5.00k|      { action; } \
  |  |  164|  5.00k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  5.00k|  } \
  |  |  166|   136k|}
  ------------------
  576|   136k|      r = GET_BITS(s);
  ------------------
  |  |  169|   136k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  577|   136k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   136k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   136k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  578|   136k|    }
  579|       |
  580|   514k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (580:9): [True: 514k, False: 224]
  ------------------
  581|       |      /* Convert DC difference to actual value, update last_dc_val */
  582|   514k|      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|   514k|      s += state.last_dc_val[ci];
  592|   514k|      state.last_dc_val[ci] = s;
  593|   514k|      if (block) {
  ------------------
  |  Branch (593:11): [True: 514k, False: 0]
  ------------------
  594|       |        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
  595|   514k|        (*block)[0] = (JCOEF)s;
  596|   514k|      }
  597|   514k|    }
  598|       |
  599|   514k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (599:9): [True: 514k, False: 224]
  |  Branch (599:37): [True: 514k, 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|  3.28M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  3.28M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (603:19): [True: 3.27M, False: 10.6k]
  ------------------
  604|  3.27M|        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
  ------------------
  |  |  200|  3.27M|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  3.27M|  register int nb, look; \
  |  |  202|  3.27M|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  3.27M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 298k, False: 2.97M]
  |  |  ------------------
  |  |  203|   298k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 298k]
  |  |  ------------------
  |  |  204|   298k|      { failaction; } \
  |  |  205|   298k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|   298k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   298k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2.43k, False: 295k]
  |  |  ------------------
  |  |  207|  2.43k|      nb = 1;  goto slowlabel; \
  |  |  208|  2.43k|    } \
  |  |  209|   298k|  } \
  |  |  210|  3.27M|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  3.27M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  3.27M|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  3.27M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  3.27M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 3.10M, False: 167k]
  |  |  ------------------
  |  |  212|  3.10M|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  3.10M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  3.10M|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  3.10M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  3.10M|  } else { \
  |  |  215|   170k|slowlabel: \
  |  |  216|   170k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 170k]
  |  |  ------------------
  |  |  217|   170k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|   170k|      { failaction; } \
  |  |  219|   170k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|   170k|  } \
  |  |  221|  3.27M|}
  ------------------
  605|       |
  606|  3.27M|        r = s >> 4;
  607|  3.27M|        s &= 15;
  608|       |
  609|  3.27M|        if (s) {
  ------------------
  |  Branch (609:13): [True: 2.74M, False: 531k]
  ------------------
  610|  2.74M|          k += r;
  611|  2.74M|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  2.74M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  2.74M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 25.9k, False: 2.71M]
  |  |  ------------------
  |  |  162|  25.9k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 25.9k]
  |  |  ------------------
  |  |  163|  25.9k|      { action; } \
  |  |  164|  25.9k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  25.9k|  } \
  |  |  166|  2.74M|}
  ------------------
  612|  2.74M|          r = GET_BITS(s);
  ------------------
  |  |  169|  2.74M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  613|  2.74M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  2.74M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  2.74M|#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|  2.74M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  619|  2.74M|        } else {
  620|   531k|          if (r != 15)
  ------------------
  |  Branch (620:15): [True: 503k, False: 27.9k]
  ------------------
  621|   503k|            break;
  622|  27.9k|          k += 15;
  623|  27.9k|        }
  624|  3.27M|      }
  625|       |
  626|   514k|    } else {
  627|       |
  628|       |      /* Section F.2.2.2: decode the AC coefficients */
  629|       |      /* In this path we just discard the values */
  630|    224|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|    224|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (630:19): [True: 0, False: 224]
  ------------------
  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|    224|    }
  647|   514k|  }
  648|       |
  649|       |  /* Completed MCU, so update state */
  650|   168k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   168k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   168k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   168k|  permstate.get_buffer = get_buffer; \
  |  |  140|   168k|  permstate.bits_left = bits_left
  ------------------
  651|   168k|  entropy->saved = state;
  652|   168k|  return TRUE;
  ------------------
  |  |  209|   168k|#define TRUE    1
  ------------------
  653|   168k|}

jinit_input_controller:
  400|  2.58k|{
  401|  2.58k|  my_inputctl_ptr inputctl;
  402|       |
  403|       |  /* Create subobject in permanent pool */
  404|  2.58k|  inputctl = (my_inputctl_ptr)
  405|  2.58k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  883|  2.58k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  406|  2.58k|                                sizeof(my_input_controller));
  407|  2.58k|  cinfo->inputctl = (struct jpeg_input_controller *)inputctl;
  408|       |  /* Initialize method pointers */
  409|  2.58k|  inputctl->pub.consume_input = consume_markers;
  410|  2.58k|  inputctl->pub.reset_input_controller = reset_input_controller;
  411|  2.58k|  inputctl->pub.start_input_pass = start_input_pass;
  412|  2.58k|  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|  2.58k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  206|  2.58k|#define FALSE   0               /* values of boolean */
  ------------------
  417|  2.58k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  206|  2.58k|#define FALSE   0               /* values of boolean */
  ------------------
  418|  2.58k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  209|  2.58k|#define TRUE    1
  ------------------
  419|  2.58k|}
jdinput.c:consume_markers:
  327|  4.01k|{
  328|  4.01k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  329|  4.01k|  int val;
  330|       |
  331|  4.01k|  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
  ------------------
  |  Branch (331:7): [True: 0, False: 4.01k]
  ------------------
  332|      0|    return JPEG_REACHED_EOI;
  ------------------
  |  | 1107|      0|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  333|       |
  334|  4.01k|  val = (*cinfo->marker->read_markers) (cinfo);
  335|       |
  336|  4.01k|  switch (val) {
  ------------------
  |  Branch (336:11): [True: 979, False: 3.03k]
  ------------------
  337|  2.41k|  case JPEG_REACHED_SOS:        /* Found SOS */
  ------------------
  |  | 1106|  2.41k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (337:3): [True: 2.41k, False: 1.60k]
  ------------------
  338|  2.41k|    if (inputctl->inheaders) {  /* 1st SOS */
  ------------------
  |  Branch (338:9): [True: 1.73k, False: 674]
  ------------------
  339|  1.73k|      initial_setup(cinfo);
  340|  1.73k|      inputctl->inheaders = FALSE;
  ------------------
  |  |  206|  1.73k|#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|  1.73k|    } else {                    /* 2nd or later SOS marker */
  346|    674|      if (!inputctl->pub.has_multiple_scans)
  ------------------
  |  Branch (346:11): [True: 0, False: 674]
  ------------------
  347|      0|        ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  348|    674|      start_input_pass(cinfo);
  349|    674|    }
  350|  2.41k|    break;
  351|    626|  case JPEG_REACHED_EOI:        /* Found EOI */
  ------------------
  |  | 1107|    626|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (351:3): [True: 626, False: 3.38k]
  ------------------
  352|    626|    inputctl->pub.eoi_reached = TRUE;
  ------------------
  |  |  209|    626|#define TRUE    1
  ------------------
  353|    626|    if (inputctl->inheaders) {  /* Tables-only datastream, apparently */
  ------------------
  |  Branch (353:9): [True: 6, False: 620]
  ------------------
  354|      6|      if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (354:11): [True: 3, False: 3]
  ------------------
  355|      3|        ERREXIT(cinfo, JERR_SOF_NO_SOS);
  ------------------
  |  |  240|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      3|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  356|    620|    } 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|    620|      if (cinfo->output_scan_number > cinfo->input_scan_number)
  ------------------
  |  Branch (360:11): [True: 0, False: 620]
  ------------------
  361|      0|        cinfo->output_scan_number = cinfo->input_scan_number;
  362|    620|    }
  363|    626|    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: 4.01k]
  ------------------
  365|      0|    break;
  366|  4.01k|  }
  367|       |
  368|  3.00k|  return val;
  369|  4.01k|}
jdinput.c:initial_setup:
   49|  1.73k|{
   50|  1.73k|  int ci;
   51|  1.73k|  jpeg_component_info *compptr;
   52|  1.73k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  1.73k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (52:19): [True: 5, False: 1.73k]
  ------------------
   53|       |
   54|       |  /* Make sure image isn't bigger than I can handle */
   55|  1.73k|  if ((long)cinfo->image_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |  157|  3.47k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (55:7): [True: 0, False: 1.73k]
  ------------------
   56|  1.73k|      (long)cinfo->image_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |  157|  1.73k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (56:7): [True: 0, False: 1.73k]
  ------------------
   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|  1.73k|#ifdef D_LOSSLESS_SUPPORTED
   61|  1.73k|  if (cinfo->data_precision != 8 && cinfo->data_precision != 12 &&
  ------------------
  |  Branch (61:7): [True: 9, False: 1.72k]
  |  Branch (61:37): [True: 7, False: 2]
  ------------------
   62|  1.73k|      cinfo->data_precision != 16)
  ------------------
  |  Branch (62:7): [True: 7, False: 0]
  ------------------
   63|       |#else
   64|       |  if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
   65|       |#endif
   66|      7|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      7|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   67|       |
   68|       |  /* Check that number of components won't exceed internal array sizes */
   69|  1.73k|  if (cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   29|  1.73k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (69:7): [True: 0, False: 1.73k]
  ------------------
   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|  1.73k|             MAX_COMPONENTS);
   72|       |
   73|       |  /* Compute maximum sampling factors; check factor validity */
   74|  1.73k|  cinfo->max_h_samp_factor = 1;
   75|  1.73k|  cinfo->max_v_samp_factor = 1;
   76|  7.28k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (76:44): [True: 5.55k, False: 1.73k]
  ------------------
   77|  5.55k|       ci++, compptr++) {
   78|  5.55k|    if (compptr->h_samp_factor <= 0 ||
  ------------------
  |  Branch (78:9): [True: 2, False: 5.54k]
  ------------------
   79|  5.55k|        compptr->h_samp_factor > MAX_SAMP_FACTOR ||
  ------------------
  |  |   72|  11.1k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (79:9): [True: 4, False: 5.54k]
  ------------------
   80|  5.55k|        compptr->v_samp_factor <= 0 ||
  ------------------
  |  Branch (80:9): [True: 8, False: 5.53k]
  ------------------
   81|  5.55k|        compptr->v_samp_factor > MAX_SAMP_FACTOR)
  ------------------
  |  |   72|  5.53k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (81:9): [True: 6, False: 5.53k]
  ------------------
   82|     20|      ERREXIT(cinfo, JERR_BAD_SAMPLING);
  ------------------
  |  |  240|     20|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     20|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   83|  5.55k|    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  ------------------
  |  |  445|  5.55k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (445:26): [True: 596, False: 4.95k]
  |  |  ------------------
  ------------------
   84|  5.55k|                                   compptr->h_samp_factor);
   85|  5.55k|    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  ------------------
  |  |  445|  5.55k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (445:26): [True: 604, False: 4.94k]
  |  |  ------------------
  ------------------
   86|  5.55k|                                   compptr->v_samp_factor);
   87|  5.55k|  }
   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|  1.73k|  cinfo->min_DCT_scaled_size = data_unit;
  103|  1.73k|#endif
  104|       |
  105|       |  /* Compute dimensions of components */
  106|  7.23k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (106:44): [True: 5.49k, False: 1.73k]
  ------------------
  107|  5.49k|       ci++, compptr++) {
  108|       |#if JPEG_LIB_VERSION >= 70
  109|       |    compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = data_unit;
  110|       |#else
  111|  5.49k|    compptr->DCT_scaled_size = data_unit;
  112|  5.49k|#endif
  113|       |    /* Size in data units */
  114|  5.49k|    compptr->width_in_blocks = (JDIMENSION)
  115|  5.49k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  116|  5.49k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  117|  5.49k|    compptr->height_in_blocks = (JDIMENSION)
  118|  5.49k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  119|  5.49k|                    (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|  5.49k|    cinfo->master->first_MCU_col[ci] = 0;
  124|  5.49k|    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|  5.49k|    compptr->downsampled_width = (JDIMENSION)
  131|  5.49k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  132|  5.49k|                    (long)cinfo->max_h_samp_factor);
  133|  5.49k|    compptr->downsampled_height = (JDIMENSION)
  134|  5.49k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  135|  5.49k|                    (long)cinfo->max_v_samp_factor);
  136|       |    /* Mark component needed, until color conversion says otherwise */
  137|  5.49k|    compptr->component_needed = TRUE;
  ------------------
  |  |  209|  5.49k|#define TRUE    1
  ------------------
  138|       |    /* Mark no quantization table yet saved for component */
  139|  5.49k|    compptr->quant_table = NULL;
  140|  5.49k|  }
  141|       |
  142|       |  /* Compute number of fully interleaved MCU rows. */
  143|  1.73k|  cinfo->total_iMCU_rows = (JDIMENSION)
  144|  1.73k|    jdiv_round_up((long)cinfo->image_height,
  145|  1.73k|                  (long)(cinfo->max_v_samp_factor * data_unit));
  146|       |
  147|       |  /* Decide whether file contains multiple scans */
  148|  1.73k|  if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
  ------------------
  |  Branch (148:7): [True: 27, False: 1.70k]
  |  Branch (148:55): [True: 168, False: 1.54k]
  ------------------
  149|    168|    cinfo->inputctl->has_multiple_scans = TRUE;
  ------------------
  |  |  209|    168|#define TRUE    1
  ------------------
  150|  1.56k|  else
  151|  1.56k|    cinfo->inputctl->has_multiple_scans = FALSE;
  ------------------
  |  |  206|  1.56k|#define FALSE   0               /* values of boolean */
  ------------------
  152|  1.73k|}
jdinput.c:reset_input_controller:
  378|  2.58k|{
  379|  2.58k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  380|       |
  381|  2.58k|  inputctl->pub.consume_input = consume_markers;
  382|  2.58k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  206|  2.58k|#define FALSE   0               /* values of boolean */
  ------------------
  383|  2.58k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  206|  2.58k|#define FALSE   0               /* values of boolean */
  ------------------
  384|  2.58k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  209|  2.58k|#define TRUE    1
  ------------------
  385|       |  /* Reset other modules */
  386|  2.58k|  (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
  387|  2.58k|  (*cinfo->marker->reset_marker_reader) (cinfo);
  388|       |  /* Reset progression state -- would be cleaner if entropy decoder did this */
  389|  2.58k|  cinfo->coef_bits = NULL;
  390|  2.58k|}
jdinput.c:start_input_pass:
  292|  2.36k|{
  293|  2.36k|  per_scan_setup(cinfo);
  294|  2.36k|  if (!cinfo->master->lossless)
  ------------------
  |  Branch (294:7): [True: 2.36k, False: 5]
  ------------------
  295|  2.36k|    latch_quant_tables(cinfo);
  296|  2.36k|  (*cinfo->entropy->start_pass) (cinfo);
  297|  2.36k|  (*cinfo->coef->start_input_pass) (cinfo);
  298|  2.36k|  cinfo->inputctl->consume_input = cinfo->coef->consume_data;
  299|  2.36k|}
jdinput.c:per_scan_setup:
  159|  2.36k|{
  160|  2.36k|  int ci, mcublks, tmp;
  161|  2.36k|  jpeg_component_info *compptr;
  162|  2.36k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  2.36k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (162:19): [True: 5, False: 2.36k]
  ------------------
  163|       |
  164|  2.36k|  if (cinfo->comps_in_scan == 1) {
  ------------------
  |  Branch (164:7): [True: 703, False: 1.66k]
  ------------------
  165|       |
  166|       |    /* Noninterleaved (single-component) scan */
  167|    703|    compptr = cinfo->cur_comp_info[0];
  168|       |
  169|       |    /* Overall image size in MCUs */
  170|    703|    cinfo->MCUs_per_row = compptr->width_in_blocks;
  171|    703|    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
  172|       |
  173|       |    /* For noninterleaved scan, always one data unit per MCU */
  174|    703|    compptr->MCU_width = 1;
  175|    703|    compptr->MCU_height = 1;
  176|    703|    compptr->MCU_blocks = 1;
  177|    703|    compptr->MCU_sample_width = compptr->_DCT_scaled_size;
  ------------------
  |  |   24|    703|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  178|    703|    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|    703|    tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  183|    703|    if (tmp == 0) tmp = compptr->v_samp_factor;
  ------------------
  |  Branch (183:9): [True: 703, False: 0]
  ------------------
  184|    703|    compptr->last_row_height = tmp;
  185|       |
  186|       |    /* Prepare array describing MCU composition */
  187|    703|    cinfo->blocks_in_MCU = 1;
  188|    703|    cinfo->MCU_membership[0] = 0;
  189|       |
  190|  1.66k|  } else {
  191|       |
  192|       |    /* Interleaved (multi-component) scan */
  193|  1.66k|    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  1.66k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (193:9): [True: 0, False: 1.66k]
  |  Branch (193:38): [True: 0, False: 1.66k]
  ------------------
  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|  1.66k|               MAX_COMPS_IN_SCAN);
  196|       |
  197|       |    /* Overall image size in MCUs */
  198|  1.66k|    cinfo->MCUs_per_row = (JDIMENSION)
  199|  1.66k|      jdiv_round_up((long)cinfo->image_width,
  200|  1.66k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  201|  1.66k|    cinfo->MCU_rows_in_scan = (JDIMENSION)
  202|  1.66k|      jdiv_round_up((long)cinfo->image_height,
  203|  1.66k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  204|       |
  205|  1.66k|    cinfo->blocks_in_MCU = 0;
  206|       |
  207|  7.08k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (207:18): [True: 5.41k, False: 1.66k]
  ------------------
  208|  5.41k|      compptr = cinfo->cur_comp_info[ci];
  209|       |      /* Sampling factors give # of data units of component in each MCU */
  210|  5.41k|      compptr->MCU_width = compptr->h_samp_factor;
  211|  5.41k|      compptr->MCU_height = compptr->v_samp_factor;
  212|  5.41k|      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
  213|  5.41k|      compptr->MCU_sample_width = compptr->MCU_width *
  214|  5.41k|                                  compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  5.41k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  215|       |      /* Figure number of non-dummy data units in last MCU column & row */
  216|  5.41k|      tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
  217|  5.41k|      if (tmp == 0) tmp = compptr->MCU_width;
  ------------------
  |  Branch (217:11): [True: 5.12k, False: 292]
  ------------------
  218|  5.41k|      compptr->last_col_width = tmp;
  219|  5.41k|      tmp = (int)(compptr->height_in_blocks % compptr->MCU_height);
  220|  5.41k|      if (tmp == 0) tmp = compptr->MCU_height;
  ------------------
  |  Branch (220:11): [True: 5.40k, False: 14]
  ------------------
  221|  5.41k|      compptr->last_row_height = tmp;
  222|       |      /* Prepare array describing MCU composition */
  223|  5.41k|      mcublks = compptr->MCU_blocks;
  224|  5.41k|      if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
  ------------------
  |  |   82|  5.41k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (224:11): [True: 0, False: 5.41k]
  ------------------
  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|  11.7k|      while (mcublks-- > 0) {
  ------------------
  |  Branch (226:14): [True: 6.37k, False: 5.41k]
  ------------------
  227|  6.37k|        cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
  228|  6.37k|      }
  229|  5.41k|    }
  230|       |
  231|  1.66k|  }
  232|  2.36k|}
jdinput.c:latch_quant_tables:
  258|  2.36k|{
  259|  2.36k|  int ci, qtblno;
  260|  2.36k|  jpeg_component_info *compptr;
  261|  2.36k|  JQUANT_TBL *qtbl;
  262|       |
  263|  8.43k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (263:16): [True: 6.06k, False: 2.36k]
  ------------------
  264|  6.06k|    compptr = cinfo->cur_comp_info[ci];
  265|       |    /* No work if we already saved Q-table for this component */
  266|  6.06k|    if (compptr->quant_table != NULL)
  ------------------
  |  Branch (266:9): [True: 674, False: 5.39k]
  ------------------
  267|    674|      continue;
  268|       |    /* Make sure specified quantization table is present */
  269|  5.39k|    qtblno = compptr->quant_tbl_no;
  270|  5.39k|    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
  ------------------
  |  |   68|  10.7k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (270:9): [True: 0, False: 5.39k]
  |  Branch (270:23): [True: 11, False: 5.38k]
  ------------------
  271|  5.39k|        cinfo->quant_tbl_ptrs[qtblno] == NULL)
  ------------------
  |  Branch (271:9): [True: 3, False: 5.37k]
  ------------------
  272|     14|      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
  ------------------
  |  |  243|     14|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     14|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     14|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  273|       |    /* OK, save away the quantization table */
  274|  5.39k|    qtbl = (JQUANT_TBL *)
  275|  5.39k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  5.39k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  276|  5.39k|                                  sizeof(JQUANT_TBL));
  277|  5.39k|    memcpy(qtbl, cinfo->quant_tbl_ptrs[qtblno], sizeof(JQUANT_TBL));
  278|  5.39k|    compptr->quant_table = qtbl;
  279|  5.39k|  }
  280|  2.36k|}
jdinput.c:finish_input_pass:
  310|  1.42k|{
  311|  1.42k|  cinfo->inputctl->consume_input = consume_markers;
  312|  1.42k|}

jinit_lhuff_decoder:
  284|      5|{
  285|      5|  lhuff_entropy_ptr entropy;
  286|      5|  int i;
  287|       |
  288|      5|  entropy = (lhuff_entropy_ptr)
  289|      5|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      5|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  290|      5|                                sizeof(lhuff_entropy_decoder));
  291|      5|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  292|      5|  entropy->pub.start_pass = start_pass_lhuff_decoder;
  293|      5|  entropy->pub.decode_mcus = decode_mcus;
  294|      5|  entropy->pub.process_restart = process_restart;
  295|       |
  296|       |  /* Mark tables unallocated */
  297|     25|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|     25|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (297:15): [True: 20, False: 5]
  ------------------
  298|     20|    entropy->derived_tbls[i] = NULL;
  299|     20|  }
  300|      5|}
jdlhuff.c:start_pass_lhuff_decoder:
   84|      5|{
   85|      5|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
   86|      5|  int ci, dctbl, sampn, ptrn, yoffset, xoffset;
   87|      5|  jpeg_component_info *compptr;
   88|       |
   89|     19|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (89:16): [True: 14, False: 5]
  ------------------
   90|     14|    compptr = cinfo->cur_comp_info[ci];
   91|     14|    dctbl = compptr->dc_tbl_no;
   92|       |    /* Make sure requested tables are present */
   93|     14|    if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS ||
  ------------------
  |  |   69|     28|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (93:9): [True: 0, False: 14]
  |  Branch (93:22): [True: 2, False: 12]
  ------------------
   94|     14|        cinfo->dc_huff_tbl_ptrs[dctbl] == NULL)
  ------------------
  |  Branch (94:9): [True: 0, False: 12]
  ------------------
   95|      2|      ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
  ------------------
  |  |  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)))
  ------------------
   96|       |    /* Compute derived values for Huffman tables */
   97|       |    /* We may do this more than once for a table, but it's not expensive */
   98|     14|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl,
  ------------------
  |  |  209|     14|#define TRUE    1
  ------------------
   99|     14|                            &entropy->derived_tbls[dctbl]);
  100|     14|  }
  101|       |
  102|       |  /* Precalculate decoding info for each sample in an MCU of this scan */
  103|     17|  for (sampn = 0, ptrn = 0; sampn < cinfo->blocks_in_MCU;) {
  ------------------
  |  Branch (103:29): [True: 12, False: 5]
  ------------------
  104|     12|    compptr = cinfo->cur_comp_info[cinfo->MCU_membership[sampn]];
  105|     12|    ci = compptr->component_index;
  106|     24|    for (yoffset = 0; yoffset < compptr->MCU_height; yoffset++, ptrn++) {
  ------------------
  |  Branch (106:23): [True: 12, False: 12]
  ------------------
  107|       |      /* Precalculate the setup info for each output pointer */
  108|     12|      entropy->output_ptr_info[ptrn].ci = ci;
  109|     12|      entropy->output_ptr_info[ptrn].yoffset = yoffset;
  110|     12|      entropy->output_ptr_info[ptrn].MCU_width = compptr->MCU_width;
  111|     24|      for (xoffset = 0; xoffset < compptr->MCU_width; xoffset++, sampn++) {
  ------------------
  |  Branch (111:25): [True: 12, False: 12]
  ------------------
  112|       |        /* Precalculate the output pointer index for each sample */
  113|     12|        entropy->output_ptr_index[sampn] = ptrn;
  114|       |        /* Precalculate which table to use for each sample */
  115|     12|        entropy->cur_tbls[sampn] = entropy->derived_tbls[compptr->dc_tbl_no];
  116|     12|      }
  117|     12|    }
  118|     12|  }
  119|      5|  entropy->num_output_ptrs = ptrn;
  120|       |
  121|       |  /* Initialize bitread state variables */
  122|      5|  entropy->bitstate.bits_left = 0;
  123|      5|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  124|      5|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|      5|#define FALSE   0               /* values of boolean */
  ------------------
  125|      5|}

jdlossls.c:start_pass_lossless:
  240|      3|{
  241|      3|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  242|      3|  int ci;
  243|       |
  244|       |  /* Check that the scan parameters Ss, Se, Ah, Al are OK for lossless JPEG.
  245|       |   *
  246|       |   * Ss is the predictor selection value (psv).  Legal values for sequential
  247|       |   * lossless JPEG are: 1 <= psv <= 7.
  248|       |   *
  249|       |   * Se and Ah are not used and should be zero.
  250|       |   *
  251|       |   * Al specifies the point transform (Pt).
  252|       |   * Legal values are: 0 <= Pt <= (data precision - 1).
  253|       |   */
  254|      3|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (254:7): [True: 3, False: 0]
  |  Branch (254:24): [True: 0, False: 0]
  ------------------
  255|      3|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (255:7): [True: 0, False: 0]
  |  Branch (255:25): [True: 0, False: 0]
  ------------------
  256|      3|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (256:7): [True: 0, False: 0]
  |  Branch (256:24): [True: 0, False: 0]
  ------------------
  257|      3|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      3|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      3|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      3|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      3|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      3|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  258|      3|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  259|       |
  260|       |  /* Set undifference functions to first row function */
  261|      3|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (261:16): [True: 0, False: 3]
  ------------------
  262|      0|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  263|       |
  264|       |  /* Set scaler function based on Pt */
  265|      3|  if (cinfo->Al)
  ------------------
  |  Branch (265:7): [True: 0, False: 3]
  ------------------
  266|      0|    losslessd->scaler_scale = simple_upscale;
  267|      3|  else
  268|      3|    losslessd->scaler_scale = noscale;
  269|      3|}
jinit_lossless_decompressor:
  278|      5|{
  279|      5|  lossless_decomp_ptr losslessd;
  280|       |
  281|       |  /* Create subobject in permanent pool */
  282|      5|  losslessd = (lossless_decomp_ptr)
  283|      5|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  883|      5|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  284|      5|                                sizeof(jpeg_lossless_decompressor));
  285|      5|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  286|      5|  losslessd->pub.start_pass = start_pass_lossless;
  287|      5|}

j12init_d_main_controller:
  429|      2|{
  430|      2|  my_main_ptr main_ptr;
  431|      2|  int ci, rgroup, ngroups;
  432|      2|  jpeg_component_info *compptr;
  433|       |
  434|      2|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  Branch (434:7): [True: 0, False: 2]
  ------------------
  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|      2|  main_ptr = (my_main_ptr)
  438|      2|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  439|      2|                                sizeof(my_main_controller));
  440|      2|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  441|      2|  main_ptr->pub.start_pass = start_pass_main;
  442|       |
  443|      2|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (443:7): [True: 0, False: 2]
  ------------------
  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|      2|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (449:7): [True: 2, False: 0]
  ------------------
  450|      2|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|      2|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (450:9): [True: 0, False: 2]
  ------------------
  451|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  452|      2|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  453|      2|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|      2|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  454|      2|  } else {
  455|      0|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  456|      0|  }
  457|       |
  458|      8|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (458:44): [True: 6, False: 2]
  ------------------
  459|      6|       ci++, compptr++) {
  460|      6|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|      6|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  461|      6|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|      6|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  462|      6|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  463|      6|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      6|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|      6|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|      6|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  465|      6|                         (JDIMENSION)(rgroup * ngroups));
  466|      6|  }
  467|      2|}
jdmainct.c:start_pass_main:
  259|  1.45k|{
  260|  1.45k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|  1.45k|  switch (pass_mode) {
  263|  1.45k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 1.45k, False: 0]
  ------------------
  264|  1.45k|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 209, False: 1.24k]
  ------------------
  265|    209|      main_ptr->pub._process_data = process_data_context_main;
  ------------------
  |  |  139|    209|#define _process_data  process_data_12
  ------------------
  266|    209|      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
  267|    209|      main_ptr->whichptr = 0;   /* Read first iMCU row into xbuffer[0] */
  268|    209|      main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|    209|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  269|    209|      main_ptr->iMCU_row_ctr = 0;
  270|  1.24k|    } else {
  271|       |      /* Simple case with no context needed */
  272|  1.24k|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  139|  1.24k|#define _process_data  process_data_12
  ------------------
  273|  1.24k|    }
  274|  1.45k|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  206|  1.45k|#define FALSE   0               /* values of boolean */
  ------------------
  275|  1.45k|    main_ptr->rowgroup_ctr = 0;
  276|  1.45k|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 1.45k]
  ------------------
  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: 1.45k]
  ------------------
  284|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  285|      0|    break;
  286|  1.45k|  }
  287|  1.45k|}
jdmainct.c:process_data_context_main:
  337|  5.98k|{
  338|  5.98k|  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.98k|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (341:7): [True: 539, False: 5.44k]
  ------------------
  342|    539|    if (!(*cinfo->coef->_decompress_data) (cinfo,
  ------------------
  |  |  141|    539|#define _decompress_data  decompress_data_12
  ------------------
  |  Branch (342:9): [True: 0, False: 539]
  ------------------
  343|    539|                                           main_ptr->xbuffer[main_ptr->whichptr]))
  344|      0|      return;                   /* suspension forced, can do nothing more */
  345|    539|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  209|    539|#define TRUE    1
  ------------------
  346|    539|    main_ptr->iMCU_row_ctr++;   /* count rows received */
  347|    539|  }
  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.98k|  switch (main_ptr->context_state) {
  ------------------
  |  Branch (354:11): [True: 156, False: 5.83k]
  ------------------
  355|    426|  case CTX_POSTPONED_ROW:
  ------------------
  |  |   48|    426|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  |  Branch (355:3): [True: 426, False: 5.56k]
  ------------------
  356|       |    /* Call postprocessor using previously set pointers for postponed row */
  357|    426|    (*cinfo->post->_post_process_data) (cinfo,
  ------------------
  |  |  143|    426|#define _post_process_data  post_process_data_12
  ------------------
  358|    426|                                        main_ptr->xbuffer[main_ptr->whichptr],
  359|    426|                                        &main_ptr->rowgroup_ctr,
  360|    426|                                        main_ptr->rowgroups_avail, output_buf,
  361|    426|                                        out_row_ctr, out_rows_avail);
  362|    426|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (362:9): [True: 213, False: 213]
  ------------------
  363|    213|      return;                   /* Need to suspend */
  364|    213|    main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|    213|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  365|    213|    if (*out_row_ctr >= out_rows_avail)
  ------------------
  |  Branch (365:9): [True: 213, False: 0]
  ------------------
  366|    213|      return;                   /* Postprocessor exactly filled output buf */
  367|       |    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|      0|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  368|    383|  case CTX_PREPARE_FOR_IMCU:
  ------------------
  |  |   46|    383|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  |  Branch (368:3): [True: 383, False: 5.60k]
  ------------------
  369|       |    /* Prepare to process first M-1 row groups of this iMCU row */
  370|    383|    main_ptr->rowgroup_ctr = 0;
  371|    383|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size - 1);
  ------------------
  |  |   27|    383|#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|    383|    if (main_ptr->iMCU_row_ctr == cinfo->total_iMCU_rows)
  ------------------
  |  Branch (375:9): [True: 51, False: 332]
  ------------------
  376|     51|      set_bottom_pointers(cinfo);
  377|    383|    main_ptr->context_state = CTX_PROCESS_IMCU;
  ------------------
  |  |   47|    383|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  378|       |    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|    383|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  379|  5.40k|  case CTX_PROCESS_IMCU:
  ------------------
  |  |   47|  5.40k|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  |  Branch (379:3): [True: 5.02k, False: 965]
  ------------------
  380|       |    /* Call postprocessor using previously set pointers */
  381|  5.40k|    (*cinfo->post->_post_process_data) (cinfo,
  ------------------
  |  |  143|  5.40k|#define _post_process_data  post_process_data_12
  ------------------
  382|  5.40k|                                        main_ptr->xbuffer[main_ptr->whichptr],
  383|  5.40k|                                        &main_ptr->rowgroup_ctr,
  384|  5.40k|                                        main_ptr->rowgroups_avail, output_buf,
  385|  5.40k|                                        out_row_ctr, out_rows_avail);
  386|  5.40k|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (386:9): [True: 5.02k, False: 379]
  ------------------
  387|  5.02k|      return;                   /* Need to suspend */
  388|       |    /* After the first iMCU, change wraparound pointers to normal state */
  389|    379|    if (main_ptr->iMCU_row_ctr == 1)
  ------------------
  |  Branch (389:9): [True: 170, False: 209]
  ------------------
  390|    170|      set_wraparound_pointers(cinfo);
  391|       |    /* Prepare to load new iMCU row using other xbuffer list */
  392|    379|    main_ptr->whichptr ^= 1;    /* 0=>1 or 1=>0 */
  393|    379|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  206|    379|#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|    379|    main_ptr->rowgroup_ctr = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 1);
  ------------------
  |  |   27|    379|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  397|    379|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 2);
  ------------------
  |  |   27|    379|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  398|    379|    main_ptr->context_state = CTX_POSTPONED_ROW;
  ------------------
  |  |   48|    379|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  399|  5.98k|  }
  400|  5.98k|}
jdmainct.c:set_bottom_pointers:
  222|     51|{
  223|     51|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  224|     51|  int ci, i, rgroup, iMCUheight, rows_left;
  225|     51|  jpeg_component_info *compptr;
  226|     51|  _JSAMPARRAY xbuf;
  ------------------
  |  |  113|     51|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  227|       |
  228|    204|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (228:44): [True: 153, False: 51]
  ------------------
  229|    153|       ci++, compptr++) {
  230|       |    /* Count sample rows in one iMCU row and in one row group */
  231|    153|    iMCUheight = compptr->v_samp_factor * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|    153|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  232|    153|    rgroup = iMCUheight / cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    153|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  233|       |    /* Count nondummy sample rows remaining for this component */
  234|    153|    rows_left = (int)(compptr->downsampled_height % (JDIMENSION)iMCUheight);
  235|    153|    if (rows_left == 0) rows_left = iMCUheight;
  ------------------
  |  Branch (235:9): [True: 141, False: 12]
  ------------------
  236|       |    /* Count nondummy row groups.  Should get same answer for each component,
  237|       |     * so we need only do it once.
  238|       |     */
  239|    153|    if (ci == 0) {
  ------------------
  |  Branch (239:9): [True: 51, False: 102]
  ------------------
  240|     51|      main_ptr->rowgroups_avail = (JDIMENSION)((rows_left - 1) / rgroup + 1);
  241|     51|    }
  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|    153|    xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci];
  246|    561|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (246:17): [True: 408, False: 153]
  ------------------
  247|    408|      xbuf[rows_left + i] = xbuf[rows_left - 1];
  248|    408|    }
  249|    153|  }
  250|     51|}
jdmainct.c:make_funny_pointers:
  181|    209|{
  182|    209|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  183|    209|  int ci, i, rgroup;
  184|    209|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    209|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  185|    209|  jpeg_component_info *compptr;
  186|    209|  _JSAMPARRAY buf, xbuf0, xbuf1;
  ------------------
  |  |  113|    209|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  187|       |
  188|    836|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (188:44): [True: 627, False: 209]
  ------------------
  189|    627|       ci++, compptr++) {
  190|    627|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    627|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  191|    627|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|    627|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  192|    627|    xbuf0 = main_ptr->xbuffer[0][ci];
  193|    627|    xbuf1 = main_ptr->xbuffer[1][ci];
  194|       |    /* First copy the workspace pointers as-is */
  195|    627|    buf = main_ptr->buffer[ci];
  196|  8.98k|    for (i = 0; i < rgroup * (M + 2); i++) {
  ------------------
  |  Branch (196:17): [True: 8.36k, False: 627]
  ------------------
  197|  8.36k|      xbuf0[i] = xbuf1[i] = buf[i];
  198|  8.36k|    }
  199|       |    /* In the second list, put the last four row groups in swapped order */
  200|  2.29k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (200:17): [True: 1.67k, False: 627]
  ------------------
  201|  1.67k|      xbuf1[rgroup * (M - 2) + i] = buf[rgroup * M + i];
  202|  1.67k|      xbuf1[rgroup * M + i] = buf[rgroup * (M - 2) + i];
  203|  1.67k|    }
  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.46k|    for (i = 0; i < rgroup; i++) {
  ------------------
  |  Branch (209:17): [True: 836, False: 627]
  ------------------
  210|    836|      xbuf0[i - rgroup] = xbuf0[0];
  211|    836|    }
  212|    627|  }
  213|    209|}
jdmainct.c:process_data_simple_main:
  298|   153k|{
  299|   153k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  300|   153k|  JDIMENSION rowgroups_avail;
  301|       |
  302|       |  /* Read input data if we haven't filled the main buffer yet */
  303|   153k|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (303:7): [True: 19.7k, False: 133k]
  ------------------
  304|  19.7k|    if (!(*cinfo->coef->_decompress_data) (cinfo, main_ptr->buffer))
  ------------------
  |  |  141|  19.7k|#define _decompress_data  decompress_data_12
  ------------------
  |  Branch (304:9): [True: 0, False: 19.7k]
  ------------------
  305|      0|      return;                   /* suspension forced, can do nothing more */
  306|  19.7k|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  209|  19.7k|#define TRUE    1
  ------------------
  307|  19.7k|  }
  308|       |
  309|       |  /* There are always min_DCT_scaled_size row groups in an iMCU row. */
  310|   153k|  rowgroups_avail = (JDIMENSION)cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|   153k|#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|   153k|  (*cinfo->post->_post_process_data) (cinfo, main_ptr->buffer,
  ------------------
  |  |  143|   153k|#define _post_process_data  post_process_data_12
  ------------------
  318|   153k|                                      &main_ptr->rowgroup_ctr, rowgroups_avail,
  319|   153k|                                      output_buf, out_row_ctr, out_rows_avail);
  320|       |
  321|       |  /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
  322|   153k|  if (main_ptr->rowgroup_ctr >= rowgroups_avail) {
  ------------------
  |  Branch (322:7): [True: 18.9k, False: 134k]
  ------------------
  323|  18.9k|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  206|  18.9k|#define FALSE   0               /* values of boolean */
  ------------------
  324|  18.9k|    main_ptr->rowgroup_ctr = 0;
  325|  18.9k|  }
  326|   153k|}
jdmainct.c:alloc_funny_pointers:
  139|    298|{
  140|    298|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  141|    298|  int ci, rgroup;
  142|    298|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    298|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  143|    298|  jpeg_component_info *compptr;
  144|    298|  _JSAMPARRAY xbuf;
  ------------------
  |  |  113|    298|#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|    298|  main_ptr->xbuffer[0] = (_JSAMPIMAGE)
  150|    298|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    298|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  151|    298|                                cinfo->num_components * 2 *
  152|    298|                                sizeof(_JSAMPARRAY));
  153|    298|  main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
  154|       |
  155|  1.19k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (155:44): [True: 894, False: 298]
  ------------------
  156|    894|       ci++, compptr++) {
  157|    894|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    894|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  158|    894|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|    894|#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|    894|    xbuf = (_JSAMPARRAY)
  163|    894|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    894|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  164|    894|                                  2 * (rgroup * (M + 4)) * sizeof(_JSAMPROW));
  165|    894|    xbuf += rgroup;             /* want one row group at negative offsets */
  166|    894|    main_ptr->xbuffer[0][ci] = xbuf;
  167|    894|    xbuf += rgroup * (M + 4);
  168|    894|    main_ptr->xbuffer[1][ci] = xbuf;
  169|    894|  }
  170|    298|}
jinit_d_main_controller:
  429|  1.69k|{
  430|  1.69k|  my_main_ptr main_ptr;
  431|  1.69k|  int ci, rgroup, ngroups;
  432|  1.69k|  jpeg_component_info *compptr;
  433|       |
  434|  1.69k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   34|  1.69k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (434:7): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|  main_ptr = (my_main_ptr)
  438|  1.69k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.69k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  439|  1.69k|                                sizeof(my_main_controller));
  440|  1.69k|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  441|  1.69k|  main_ptr->pub.start_pass = start_pass_main;
  442|       |
  443|  1.69k|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (443:7): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (449:7): [True: 296, False: 1.39k]
  ------------------
  450|    296|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|    296|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (450:9): [True: 0, False: 296]
  ------------------
  451|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  452|    296|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  453|    296|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|    296|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  454|  1.39k|  } else {
  455|  1.39k|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.39k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  456|  1.39k|  }
  457|       |
  458|  7.13k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (458:44): [True: 5.43k, False: 1.69k]
  ------------------
  459|  5.43k|       ci++, compptr++) {
  460|  5.43k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  5.43k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  461|  5.43k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  5.43k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  462|  5.43k|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  463|  5.43k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  5.43k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|  5.43k|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|  5.43k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  465|  5.43k|                         (JDIMENSION)(rgroup * ngroups));
  466|  5.43k|  }
  467|  1.69k|}

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

jpeg_resync_to_restart:
 1217|      3|{
 1218|      3|  int marker = cinfo->unread_marker;
 1219|      3|  int action = 1;
 1220|       |
 1221|       |  /* Always put up a warning. */
 1222|      3|  WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
  ------------------
  |  |  290|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      3|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      3|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      3|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
 1223|       |
 1224|       |  /* Outer loop handles repeated decision after scanning forward. */
 1225|      3|  for (;;) {
 1226|      0|    if (marker < (int)M_SOF0)
  ------------------
  |  Branch (1226:9): [True: 0, False: 0]
  ------------------
 1227|      0|      action = 2;               /* invalid marker */
 1228|      0|    else if (marker < (int)M_RST0 || marker > (int)M_RST7)
  ------------------
  |  Branch (1228:14): [True: 0, False: 0]
  |  Branch (1228:38): [True: 0, False: 0]
  ------------------
 1229|      0|      action = 3;               /* valid non-restart marker */
 1230|      0|    else {
 1231|      0|      if (marker == ((int)M_RST0 + ((desired + 1) & 7)) ||
  ------------------
  |  Branch (1231:11): [True: 0, False: 0]
  ------------------
 1232|      0|          marker == ((int)M_RST0 + ((desired + 2) & 7)))
  ------------------
  |  Branch (1232:11): [True: 0, False: 0]
  ------------------
 1233|      0|        action = 3;             /* one of the next two expected restarts */
 1234|      0|      else if (marker == ((int)M_RST0 + ((desired - 1) & 7)) ||
  ------------------
  |  Branch (1234:16): [True: 0, False: 0]
  ------------------
 1235|      0|               marker == ((int)M_RST0 + ((desired - 2) & 7)))
  ------------------
  |  Branch (1235:16): [True: 0, False: 0]
  ------------------
 1236|      0|        action = 2;             /* a prior restart, so advance */
 1237|      0|      else
 1238|      0|        action = 1;             /* desired restart or too far away */
 1239|      0|    }
 1240|      0|    TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action);
  ------------------
  |  |  304|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  305|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1241|      0|    switch (action) {
  ------------------
  |  Branch (1241:13): [True: 0, False: 0]
  ------------------
 1242|      0|    case 1:
  ------------------
  |  Branch (1242:5): [True: 0, False: 0]
  ------------------
 1243|       |      /* Discard marker and let entropy decoder resume processing. */
 1244|      0|      cinfo->unread_marker = 0;
 1245|      0|      return TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
 1246|      0|    case 2:
  ------------------
  |  Branch (1246:5): [True: 0, False: 0]
  ------------------
 1247|       |      /* Scan to the next marker, and repeat the decision loop. */
 1248|      0|      if (!next_marker(cinfo))
  ------------------
  |  Branch (1248:11): [True: 0, False: 0]
  ------------------
 1249|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1250|      0|      marker = cinfo->unread_marker;
 1251|      0|      break;
 1252|      0|    case 3:
  ------------------
  |  Branch (1252:5): [True: 0, False: 0]
  ------------------
 1253|       |      /* Return without advancing past this marker. */
 1254|       |      /* Entropy decoder will be forced to process an empty segment. */
 1255|      0|      return TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
 1256|      0|    }
 1257|      0|  } /* end loop */
 1258|      3|}
jinit_marker_reader:
 1287|  2.58k|{
 1288|  2.58k|  my_marker_ptr marker;
 1289|  2.58k|  int i;
 1290|       |
 1291|       |  /* Create subobject in permanent pool */
 1292|  2.58k|  marker = (my_marker_ptr)
 1293|  2.58k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  883|  2.58k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
 1294|  2.58k|                                sizeof(my_marker_reader));
 1295|  2.58k|  cinfo->marker = (struct jpeg_marker_reader *)marker;
 1296|       |  /* Initialize public method pointers */
 1297|  2.58k|  marker->pub.reset_marker_reader = reset_marker_reader;
 1298|  2.58k|  marker->pub.read_markers = read_markers;
 1299|  2.58k|  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|  2.58k|  marker->process_COM = skip_variable;
 1305|  2.58k|  marker->length_limit_COM = 0;
 1306|  44.0k|  for (i = 0; i < 16; i++) {
  ------------------
  |  Branch (1306:15): [True: 41.4k, False: 2.58k]
  ------------------
 1307|  41.4k|    marker->process_APPn[i] = skip_variable;
 1308|  41.4k|    marker->length_limit_APPn[i] = 0;
 1309|  41.4k|  }
 1310|  2.58k|  marker->process_APPn[0] = get_interesting_appn;
 1311|  2.58k|  marker->process_APPn[14] = get_interesting_appn;
 1312|       |  /* Reset marker processing state */
 1313|  2.58k|  reset_marker_reader(cinfo);
 1314|  2.58k|}
jdmarker.c:next_marker:
  891|  18.7k|{
  892|  18.7k|  int c;
  893|  18.7k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  18.7k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  18.7k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  18.7k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  894|       |
  895|  49.2k|  for (;;) {
  896|  49.2k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  49.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  49.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 119]
  |  |  |  |  |  Branch (279:38): [True: 119, False: 49.1k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  49.2k|            bytes_in_buffer--; \
  |  |  156|  49.2k|            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|  3.66M|    while (c != 0xFF) {
  ------------------
  |  Branch (902:12): [True: 3.61M, False: 49.2k]
  ------------------
  903|  3.61M|      cinfo->marker->discarded_bytes++;
  904|  3.61M|      INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  3.61M|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  3.61M|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  905|  3.61M|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  3.61M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.61M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 69]
  |  |  |  |  |  Branch (279:38): [True: 69, False: 3.61M]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  3.61M|            bytes_in_buffer--; \
  |  |  156|  3.61M|            V = *next_input_byte++; )
  ------------------
  906|  3.61M|    }
  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|  58.1k|    do {
  913|  58.1k|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  58.1k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  58.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 58.1k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  58.1k|            bytes_in_buffer--; \
  |  |  156|  58.1k|            V = *next_input_byte++; )
  ------------------
  914|  58.1k|    } while (c == 0xFF);
  ------------------
  |  Branch (914:14): [True: 8.94k, False: 49.2k]
  ------------------
  915|  49.2k|    if (c != 0)
  ------------------
  |  Branch (915:9): [True: 18.5k, False: 30.6k]
  ------------------
  916|  18.5k|      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|  30.6k|    cinfo->marker->discarded_bytes += 2;
  921|  30.6k|    INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  30.6k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  30.6k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  922|  30.6k|  }
  923|       |
  924|  18.7k|  if (cinfo->marker->discarded_bytes != 0) {
  ------------------
  |  Branch (924:7): [True: 510, False: 18.2k]
  ------------------
  925|    510|    WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
  ------------------
  |  |  290|    510|  ((cinfo)->err->msg_code = (code), \
  |  |  291|    510|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|    510|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|    510|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  926|    510|    cinfo->marker->discarded_bytes = 0;
  927|    510|  }
  928|       |
  929|  18.7k|  cinfo->unread_marker = c;
  930|       |
  931|  18.7k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  18.7k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  18.7k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  932|  18.7k|  return TRUE;
  ------------------
  |  |  209|  18.7k|#define TRUE    1
  ------------------
  933|  18.7k|}
jdmarker.c:reset_marker_reader:
 1267|  5.17k|{
 1268|  5.17k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1269|       |
 1270|  5.17k|  cinfo->comp_info = NULL;              /* until allocated by get_sof */
 1271|  5.17k|  cinfo->input_scan_number = 0;         /* no SOS seen yet */
 1272|  5.17k|  cinfo->unread_marker = 0;             /* no pending marker */
 1273|  5.17k|  marker->pub.saw_SOI = FALSE;          /* set internal state too */
  ------------------
  |  |  206|  5.17k|#define FALSE   0               /* values of boolean */
  ------------------
 1274|  5.17k|  marker->pub.saw_SOF = FALSE;
  ------------------
  |  |  206|  5.17k|#define FALSE   0               /* values of boolean */
  ------------------
 1275|  5.17k|  marker->pub.discarded_bytes = 0;
 1276|  5.17k|  marker->cur_marker = NULL;
 1277|  5.17k|}
jdmarker.c:read_markers:
  969|  4.01k|{
  970|       |  /* Outer loop repeats once for each marker. */
  971|  22.4k|  for (;;) {
  972|       |    /* Collect the marker proper, unless we already did. */
  973|       |    /* NB: first_marker() enforces the requirement that SOI appear first. */
  974|  22.4k|    if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (974:9): [True: 21.1k, False: 1.22k]
  ------------------
  975|  21.1k|      if (!cinfo->marker->saw_SOI) {
  ------------------
  |  Branch (975:11): [True: 2.58k, False: 18.5k]
  ------------------
  976|  2.58k|        if (!first_marker(cinfo))
  ------------------
  |  Branch (976:13): [True: 0, False: 2.58k]
  ------------------
  977|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  978|  18.5k|      } else {
  979|  18.5k|        if (!next_marker(cinfo))
  ------------------
  |  Branch (979:13): [True: 0, False: 18.5k]
  ------------------
  980|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  981|  18.5k|      }
  982|  21.1k|    }
  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|  22.4k|    switch (cinfo->unread_marker) {
  988|  2.55k|    case M_SOI:
  ------------------
  |  Branch (988:5): [True: 2.55k, False: 19.8k]
  ------------------
  989|  2.55k|      if (!get_soi(cinfo))
  ------------------
  |  Branch (989:11): [True: 0, False: 2.55k]
  ------------------
  990|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  991|  2.55k|      break;
  992|       |
  993|  2.55k|    case M_SOF0:                /* Baseline */
  ------------------
  |  Branch (993:5): [True: 1.94k, False: 20.4k]
  ------------------
  994|  1.95k|    case M_SOF1:                /* Extended sequential, Huffman */
  ------------------
  |  Branch (994:5): [True: 10, False: 22.3k]
  ------------------
  995|  1.95k|      if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  206|  1.95k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  206|  1.95k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  206|  1.95k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (995:11): [True: 0, False: 1.95k]
  ------------------
  996|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  997|  1.95k|      break;
  998|       |
  999|  1.95k|    case M_SOF2:                /* Progressive, Huffman */
  ------------------
  |  Branch (999:5): [True: 172, False: 22.2k]
  ------------------
 1000|    172|      if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  209|    172|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  206|    172|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  206|    172|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1000:11): [True: 0, False: 172]
  ------------------
 1001|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1002|    172|      break;
 1003|       |
 1004|    172|    case M_SOF3:                /* Lossless, Huffman */
  ------------------
  |  Branch (1004:5): [True: 7, False: 22.3k]
  ------------------
 1005|      7|      if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  206|      7|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  209|      7|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  206|      7|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1005:11): [True: 0, False: 7]
  ------------------
 1006|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1007|      7|      break;
 1008|       |
 1009|      7|    case M_SOF9:                /* Extended sequential, arithmetic */
  ------------------
  |  Branch (1009:5): [True: 2, False: 22.3k]
  ------------------
 1010|      2|      if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  206|      2|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  206|      2|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  209|      2|#define TRUE    1
  ------------------
  |  Branch (1010:11): [True: 0, False: 2]
  ------------------
 1011|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1012|      2|      break;
 1013|       |
 1014|      2|    case M_SOF10:               /* Progressive, arithmetic */
  ------------------
  |  Branch (1014:5): [True: 0, False: 22.4k]
  ------------------
 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|      0|    case M_SOF11:               /* Lossless, arithmetic */
  ------------------
  |  Branch (1019:5): [True: 0, False: 22.4k]
  ------------------
 1020|      0|      if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  |  Branch (1020:11): [True: 0, False: 0]
  ------------------
 1021|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1022|      0|      break;
 1023|       |
 1024|       |    /* Currently unsupported SOFn types */
 1025|      2|    case M_SOF5:                /* Differential sequential, Huffman */
  ------------------
  |  Branch (1025:5): [True: 2, False: 22.3k]
  ------------------
 1026|      8|    case M_SOF6:                /* Differential progressive, Huffman */
  ------------------
  |  Branch (1026:5): [True: 6, False: 22.3k]
  ------------------
 1027|     11|    case M_SOF7:                /* Differential lossless, Huffman */
  ------------------
  |  Branch (1027:5): [True: 3, False: 22.3k]
  ------------------
 1028|     16|    case M_JPG:                 /* Reserved for JPEG extensions */
  ------------------
  |  Branch (1028:5): [True: 5, False: 22.3k]
  ------------------
 1029|     19|    case M_SOF13:               /* Differential sequential, arithmetic */
  ------------------
  |  Branch (1029:5): [True: 3, False: 22.3k]
  ------------------
 1030|     27|    case M_SOF14:               /* Differential progressive, arithmetic */
  ------------------
  |  Branch (1030:5): [True: 8, False: 22.3k]
  ------------------
 1031|     29|    case M_SOF15:               /* Differential lossless, arithmetic */
  ------------------
  |  Branch (1031:5): [True: 2, False: 22.3k]
  ------------------
 1032|     29|      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
  ------------------
  |  |  243|     29|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     29|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     29|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1033|     29|      break;
 1034|       |
 1035|  2.45k|    case M_SOS:
  ------------------
  |  Branch (1035:5): [True: 2.45k, False: 19.9k]
  ------------------
 1036|  2.45k|      if (!get_sos(cinfo))
  ------------------
  |  Branch (1036:11): [True: 0, False: 2.45k]
  ------------------
 1037|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1038|  2.45k|      cinfo->unread_marker = 0; /* processed the marker */
 1039|  2.45k|      return JPEG_REACHED_SOS;
  ------------------
  |  | 1106|  2.45k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
 1040|       |
 1041|    626|    case M_EOI:
  ------------------
  |  Branch (1041:5): [True: 626, False: 21.7k]
  ------------------
 1042|    626|      TRACEMS(cinfo, 1, JTRC_EOI);
  ------------------
  |  |  297|    626|  ((cinfo)->err->msg_code = (code), \
  |  |  298|    626|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1043|    626|      cinfo->unread_marker = 0; /* processed the marker */
 1044|    626|      return JPEG_REACHED_EOI;
  ------------------
  |  | 1107|    626|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
 1045|       |
 1046|      8|    case M_DAC:
  ------------------
  |  Branch (1046:5): [True: 8, False: 22.3k]
  ------------------
 1047|      8|      if (!get_dac(cinfo))
  ------------------
  |  Branch (1047:11): [True: 0, False: 8]
  ------------------
 1048|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1049|      8|      break;
 1050|       |
 1051|  5.93k|    case M_DHT:
  ------------------
  |  Branch (1051:5): [True: 5.93k, False: 16.4k]
  ------------------
 1052|  5.93k|      if (!get_dht(cinfo))
  ------------------
  |  Branch (1052:11): [True: 0, False: 5.93k]
  ------------------
 1053|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1054|  5.93k|      break;
 1055|       |
 1056|  5.93k|    case M_DQT:
  ------------------
  |  Branch (1056:5): [True: 3.37k, False: 19.0k]
  ------------------
 1057|  3.37k|      if (!get_dqt(cinfo))
  ------------------
  |  Branch (1057:11): [True: 0, False: 3.37k]
  ------------------
 1058|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1059|  3.37k|      break;
 1060|       |
 1061|  3.37k|    case M_DRI:
  ------------------
  |  Branch (1061:5): [True: 108, False: 22.2k]
  ------------------
 1062|    108|      if (!get_dri(cinfo))
  ------------------
  |  Branch (1062:11): [True: 0, False: 108]
  ------------------
 1063|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1064|    108|      break;
 1065|       |
 1066|  1.06k|    case M_APP0:
  ------------------
  |  Branch (1066:5): [True: 1.06k, False: 21.3k]
  ------------------
 1067|  1.82k|    case M_APP1:
  ------------------
  |  Branch (1067:5): [True: 759, False: 21.6k]
  ------------------
 1068|  1.96k|    case M_APP2:
  ------------------
  |  Branch (1068:5): [True: 135, False: 22.2k]
  ------------------
 1069|  1.96k|    case M_APP3:
  ------------------
  |  Branch (1069:5): [True: 3, False: 22.3k]
  ------------------
 1070|  1.97k|    case M_APP4:
  ------------------
  |  Branch (1070:5): [True: 9, False: 22.3k]
  ------------------
 1071|  1.97k|    case M_APP5:
  ------------------
  |  Branch (1071:5): [True: 3, False: 22.3k]
  ------------------
 1072|  1.98k|    case M_APP6:
  ------------------
  |  Branch (1072:5): [True: 4, False: 22.3k]
  ------------------
 1073|  1.98k|    case M_APP7:
  ------------------
  |  Branch (1073:5): [True: 8, False: 22.3k]
  ------------------
 1074|  1.99k|    case M_APP8:
  ------------------
  |  Branch (1074:5): [True: 3, False: 22.3k]
  ------------------
 1075|  1.99k|    case M_APP9:
  ------------------
  |  Branch (1075:5): [True: 2, False: 22.3k]
  ------------------
 1076|  1.99k|    case M_APP10:
  ------------------
  |  Branch (1076:5): [True: 0, False: 22.4k]
  ------------------
 1077|  1.99k|    case M_APP11:
  ------------------
  |  Branch (1077:5): [True: 2, False: 22.3k]
  ------------------
 1078|  2.02k|    case M_APP12:
  ------------------
  |  Branch (1078:5): [True: 25, False: 22.3k]
  ------------------
 1079|  2.37k|    case M_APP13:
  ------------------
  |  Branch (1079:5): [True: 354, False: 22.0k]
  ------------------
 1080|  4.10k|    case M_APP14:
  ------------------
  |  Branch (1080:5): [True: 1.73k, False: 20.6k]
  ------------------
 1081|  4.10k|    case M_APP15:
  ------------------
  |  Branch (1081:5): [True: 3, False: 22.3k]
  ------------------
 1082|  4.10k|      if (!(*((my_marker_ptr)cinfo->marker)->process_APPn[
  ------------------
  |  Branch (1082:11): [True: 0, False: 4.10k]
  ------------------
 1083|  4.10k|               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|  4.10k|      break;
 1086|       |
 1087|  4.10k|    case M_COM:
  ------------------
  |  Branch (1087:5): [True: 326, False: 22.0k]
  ------------------
 1088|    326|      if (!(*((my_marker_ptr)cinfo->marker)->process_COM) (cinfo))
  ------------------
  |  Branch (1088:11): [True: 0, False: 326]
  ------------------
 1089|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1090|    326|      break;
 1091|       |
 1092|    326|    case M_RST0:                /* these are all parameterless */
  ------------------
  |  Branch (1092:5): [True: 3, False: 22.3k]
  ------------------
 1093|      8|    case M_RST1:
  ------------------
  |  Branch (1093:5): [True: 5, False: 22.3k]
  ------------------
 1094|     18|    case M_RST2:
  ------------------
  |  Branch (1094:5): [True: 10, False: 22.3k]
  ------------------
 1095|     20|    case M_RST3:
  ------------------
  |  Branch (1095:5): [True: 2, False: 22.3k]
  ------------------
 1096|     23|    case M_RST4:
  ------------------
  |  Branch (1096:5): [True: 3, False: 22.3k]
  ------------------
 1097|     26|    case M_RST5:
  ------------------
  |  Branch (1097:5): [True: 3, False: 22.3k]
  ------------------
 1098|     42|    case M_RST6:
  ------------------
  |  Branch (1098:5): [True: 16, False: 22.3k]
  ------------------
 1099|     42|    case M_RST7:
  ------------------
  |  Branch (1099:5): [True: 0, False: 22.4k]
  ------------------
 1100|     45|    case M_TEM:
  ------------------
  |  Branch (1100:5): [True: 3, False: 22.3k]
  ------------------
 1101|     45|      TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
  ------------------
  |  |  300|     45|  ((cinfo)->err->msg_code = (code), \
  |  |  301|     45|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|     45|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1102|     45|      break;
 1103|       |
 1104|      8|    case M_DNL:                 /* Ignore DNL ... perhaps the wrong thing */
  ------------------
  |  Branch (1104:5): [True: 8, False: 22.3k]
  ------------------
 1105|      8|      if (!skip_variable(cinfo))
  ------------------
  |  Branch (1105:11): [True: 0, False: 8]
  ------------------
 1106|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1060|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1107|      8|      break;
 1108|       |
 1109|      8|    default:                    /* must be DHP, EXP, JPGn, or RESn */
  ------------------
  |  Branch (1109:5): [True: 5, False: 22.3k]
  ------------------
 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|      5|      ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  243|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1116|      5|      break;
 1117|  22.4k|    }
 1118|       |    /* Successfully processed marker, so reset state variable */
 1119|  18.3k|    cinfo->unread_marker = 0;
 1120|  18.3k|  } /* end loop */
 1121|  4.01k|}
jdmarker.c:first_marker:
  944|  2.58k|{
  945|  2.58k|  int c, c2;
  946|  2.58k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  2.58k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  2.58k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  2.58k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  947|       |
  948|  2.58k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  2.58k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.58k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.58k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.58k|            bytes_in_buffer--; \
  |  |  156|  2.58k|            V = *next_input_byte++; )
  ------------------
  949|  2.58k|  INPUT_BYTE(cinfo, c2, return FALSE);
  ------------------
  |  |  154|  2.58k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.58k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.58k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.58k|            bytes_in_buffer--; \
  |  |  156|  2.58k|            V = *next_input_byte++; )
  ------------------
  950|  2.58k|  if (c != 0xFF || c2 != (int)M_SOI)
  ------------------
  |  Branch (950:7): [True: 26, False: 2.56k]
  |  Branch (950:20): [True: 6, False: 2.55k]
  ------------------
  951|     32|    ERREXIT2(cinfo, JERR_NO_SOI, c, c2);
  ------------------
  |  |  247|     32|  ((cinfo)->err->msg_code = (code), \
  |  |  248|     32|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|     32|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|     32|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  952|       |
  953|  2.58k|  cinfo->unread_marker = c2;
  954|       |
  955|  2.58k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  2.58k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  2.58k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  956|  2.58k|  return TRUE;
  ------------------
  |  |  209|  2.58k|#define TRUE    1
  ------------------
  957|  2.58k|}
jdmarker.c:get_soi:
  204|  2.55k|{
  205|  2.55k|  int i;
  206|       |
  207|  2.55k|  TRACEMS(cinfo, 1, JTRC_SOI);
  ------------------
  |  |  297|  2.55k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|  2.55k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  208|       |
  209|  2.55k|  if (cinfo->marker->saw_SOI)
  ------------------
  |  Branch (209:7): [True: 2, False: 2.55k]
  ------------------
  210|      2|    ERREXIT(cinfo, JERR_SOI_DUPLICATE);
  ------------------
  |  |  240|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  211|       |
  212|       |  /* Reset all parameters that are defined to be reset by SOI */
  213|       |
  214|  43.4k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|  43.4k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (214:15): [True: 40.9k, False: 2.55k]
  ------------------
  215|  40.9k|    cinfo->arith_dc_L[i] = 0;
  216|  40.9k|    cinfo->arith_dc_U[i] = 1;
  217|  40.9k|    cinfo->arith_ac_K[i] = 5;
  218|  40.9k|  }
  219|  2.55k|  cinfo->restart_interval = 0;
  220|       |
  221|       |  /* Set initial assumptions for colorspace etc */
  222|       |
  223|  2.55k|  cinfo->jpeg_color_space = JCS_UNKNOWN;
  224|  2.55k|  cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
  ------------------
  |  |  206|  2.55k|#define FALSE   0               /* values of boolean */
  ------------------
  225|       |
  226|  2.55k|  cinfo->saw_JFIF_marker = FALSE;
  ------------------
  |  |  206|  2.55k|#define FALSE   0               /* values of boolean */
  ------------------
  227|  2.55k|  cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */
  228|  2.55k|  cinfo->JFIF_minor_version = 1;
  229|  2.55k|  cinfo->density_unit = 0;
  230|  2.55k|  cinfo->X_density = 1;
  231|  2.55k|  cinfo->Y_density = 1;
  232|  2.55k|  cinfo->saw_Adobe_marker = FALSE;
  ------------------
  |  |  206|  2.55k|#define FALSE   0               /* values of boolean */
  ------------------
  233|  2.55k|  cinfo->Adobe_transform = 0;
  234|       |
  235|  2.55k|  cinfo->marker->saw_SOI = TRUE;
  ------------------
  |  |  209|  2.55k|#define TRUE    1
  ------------------
  236|       |
  237|  2.55k|  return TRUE;
  ------------------
  |  |  209|  2.55k|#define TRUE    1
  ------------------
  238|  2.55k|}
jdmarker.c:get_sof:
  245|  2.13k|{
  246|  2.13k|  JLONG length;
  247|  2.13k|  int c, ci;
  248|  2.13k|  jpeg_component_info *compptr;
  249|  2.13k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  2.13k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  2.13k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  2.13k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  250|       |
  251|  2.13k|  if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (251:7): [True: 2, False: 2.12k]
  ------------------
  252|      2|    ERREXIT(cinfo, JERR_SOF_DUPLICATE);
  ------------------
  |  |  240|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  253|       |
  254|  2.13k|  cinfo->progressive_mode = is_prog;
  255|  2.13k|  cinfo->master->lossless = is_lossless;
  256|  2.13k|  cinfo->arith_code = is_arith;
  257|       |
  258|  2.13k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  2.13k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.26k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.13k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.13k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  2.13k|            bytes_in_buffer--; \
  |  |  164|  2.13k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  2.13k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  2.13k|            bytes_in_buffer--; \
  |  |  167|  2.13k|            V += *next_input_byte++; )
  ------------------
  259|       |
  260|  2.13k|  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
  ------------------
  |  |  154|  2.13k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.13k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.13k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.13k|            bytes_in_buffer--; \
  |  |  156|  2.13k|            V = *next_input_byte++; )
  ------------------
  261|  2.13k|  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);
  ------------------
  |  |  162|  2.13k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.26k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.13k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.13k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  2.13k|            bytes_in_buffer--; \
  |  |  164|  2.13k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  2.13k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  2.13k|            bytes_in_buffer--; \
  |  |  167|  2.13k|            V += *next_input_byte++; )
  ------------------
  262|  2.13k|  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);
  ------------------
  |  |  162|  2.13k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.26k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.13k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.13k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  2.13k|            bytes_in_buffer--; \
  |  |  164|  2.13k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  2.13k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  2.13k|            bytes_in_buffer--; \
  |  |  167|  2.13k|            V += *next_input_byte++; )
  ------------------
  263|  2.13k|  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);
  ------------------
  |  |  154|  2.13k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.13k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.13k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.13k|            bytes_in_buffer--; \
  |  |  156|  2.13k|            V = *next_input_byte++; )
  ------------------
  264|       |
  265|  2.13k|  length -= 8;
  266|       |
  267|  2.13k|  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
  ------------------
  |  |  314|  2.13k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  2.13k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  2.13k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  2.13k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  2.13k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  268|  2.13k|           (int)cinfo->image_width, (int)cinfo->image_height,
  269|  2.13k|           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|  2.13k|  if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
  ------------------
  |  Branch (274:7): [True: 6, False: 2.12k]
  |  Branch (274:35): [True: 3, False: 2.12k]
  ------------------
  275|  2.13k|      cinfo->num_components <= 0)
  ------------------
  |  Branch (275:7): [True: 5, False: 2.11k]
  ------------------
  276|     12|    ERREXIT(cinfo, JERR_EMPTY_IMAGE);
  ------------------
  |  |  240|     12|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     12|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  277|       |
  278|  2.13k|  if (length != (cinfo->num_components * 3))
  ------------------
  |  Branch (278:7): [True: 11, False: 2.12k]
  ------------------
  279|     11|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     11|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     11|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  280|       |
  281|  2.13k|  if (cinfo->comp_info == NULL) /* do only once, even if suspend */
  ------------------
  |  Branch (281:7): [True: 2.10k, False: 25]
  ------------------
  282|  2.10k|    cinfo->comp_info = (jpeg_component_info *)(*cinfo->mem->alloc_small)
  283|  2.10k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  2.10k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  284|  2.10k|                         cinfo->num_components * sizeof(jpeg_component_info));
  285|       |
  286|  8.85k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (286:44): [True: 6.71k, False: 2.13k]
  ------------------
  287|  6.71k|       ci++, compptr++) {
  288|  6.71k|    compptr->component_index = ci;
  289|  6.71k|    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
  ------------------
  |  |  154|  6.71k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  6.71k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6.71k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  6.71k|            bytes_in_buffer--; \
  |  |  156|  6.71k|            V = *next_input_byte++; )
  ------------------
  290|  6.71k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  6.71k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  6.71k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6.71k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  6.71k|            bytes_in_buffer--; \
  |  |  156|  6.71k|            V = *next_input_byte++; )
  ------------------
  291|  6.71k|    compptr->h_samp_factor = (c >> 4) & 15;
  292|  6.71k|    compptr->v_samp_factor = (c     ) & 15;
  293|  6.71k|    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);
  ------------------
  |  |  154|  6.71k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  6.71k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6.71k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  6.71k|            bytes_in_buffer--; \
  |  |  156|  6.71k|            V = *next_input_byte++; )
  ------------------
  294|       |
  295|  6.71k|    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
  ------------------
  |  |  314|  6.71k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  6.71k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  6.71k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  6.71k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  6.71k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  296|  6.71k|             compptr->component_id, compptr->h_samp_factor,
  297|  6.71k|             compptr->v_samp_factor, compptr->quant_tbl_no);
  298|  6.71k|  }
  299|       |
  300|  2.13k|  cinfo->marker->saw_SOF = TRUE;
  ------------------
  |  |  209|  2.13k|#define TRUE    1
  ------------------
  301|       |
  302|  2.13k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  2.13k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  2.13k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  303|  2.13k|  return TRUE;
  ------------------
  |  |  209|  2.13k|#define TRUE    1
  ------------------
  304|  2.13k|}
jdmarker.c:get_sos:
  310|  2.45k|{
  311|  2.45k|  JLONG length;
  312|  2.45k|  int i, ci, n, c, cc, pi;
  313|  2.45k|  jpeg_component_info *compptr;
  314|  2.45k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  2.45k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  2.45k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  2.45k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  315|       |
  316|  2.45k|  if (!cinfo->marker->saw_SOF)
  ------------------
  |  Branch (316:7): [True: 5, False: 2.45k]
  ------------------
  317|      5|    ERREXIT(cinfo, JERR_SOS_NO_SOF);
  ------------------
  |  |  240|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  318|       |
  319|  2.45k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  2.45k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.91k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.45k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.45k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  2.45k|            bytes_in_buffer--; \
  |  |  164|  2.45k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  2.45k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  2.45k|            bytes_in_buffer--; \
  |  |  167|  2.45k|            V += *next_input_byte++; )
  ------------------
  320|       |
  321|  2.45k|  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
  ------------------
  |  |  154|  2.45k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.45k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.45k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.45k|            bytes_in_buffer--; \
  |  |  156|  2.45k|            V = *next_input_byte++; )
  ------------------
  322|       |
  323|  2.45k|  TRACEMS1(cinfo, 1, JTRC_SOS, n);
  ------------------
  |  |  300|  2.45k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  2.45k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  2.45k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  324|       |
  325|  2.45k|  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  2.44k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (325:7): [True: 13, False: 2.44k]
  |  Branch (325:32): [True: 0, False: 2.44k]
  |  Branch (325:41): [True: 0, False: 2.44k]
  ------------------
  326|      8|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      8|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      8|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  327|       |
  328|  2.45k|  cinfo->comps_in_scan = n;
  329|       |
  330|       |  /* Collect the component-spec parameters */
  331|       |
  332|  12.2k|  for (i = 0; i < MAX_COMPS_IN_SCAN; i++)
  ------------------
  |  |   71|  12.2k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (332:15): [True: 9.77k, False: 2.45k]
  ------------------
  333|  9.77k|    cinfo->cur_comp_info[i] = NULL;
  334|       |
  335|  8.76k|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (335:15): [True: 6.34k, False: 2.42k]
  ------------------
  336|  6.34k|    INPUT_BYTE(cinfo, cc, return FALSE);
  ------------------
  |  |  154|  6.34k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  6.34k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6.34k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  6.34k|            bytes_in_buffer--; \
  |  |  156|  6.34k|            V = *next_input_byte++; )
  ------------------
  337|  6.34k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  6.34k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  6.34k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6.34k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  6.34k|            bytes_in_buffer--; \
  |  |  156|  6.34k|            V = *next_input_byte++; )
  ------------------
  338|       |
  339|  6.34k|    for (ci = 0, compptr = cinfo->comp_info;
  340|  13.5k|         ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN;
  ------------------
  |  |   71|  13.5k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (340:10): [True: 13.5k, False: 34]
  |  Branch (340:40): [True: 13.5k, False: 0]
  ------------------
  341|  13.5k|         ci++, compptr++) {
  342|  13.5k|      if (cc == compptr->component_id && !cinfo->cur_comp_info[ci])
  ------------------
  |  Branch (342:11): [True: 6.31k, False: 7.24k]
  |  Branch (342:42): [True: 6.31k, False: 5]
  ------------------
  343|  6.31k|        goto id_found;
  344|  13.5k|    }
  345|       |
  346|     34|    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|     34|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     34|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     34|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  347|       |
  348|  6.31k|id_found:
  349|       |
  350|  6.31k|    cinfo->cur_comp_info[i] = compptr;
  351|  6.31k|    compptr->dc_tbl_no = (c >> 4) & 15;
  352|  6.31k|    compptr->ac_tbl_no = (c     ) & 15;
  353|       |
  354|  6.31k|    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
  ------------------
  |  |  309|  6.31k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  6.31k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  6.31k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  6.31k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  6.31k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  355|  6.31k|             compptr->dc_tbl_no, compptr->ac_tbl_no);
  356|       |
  357|       |    /* This CSi (cc) should differ from the previous CSi */
  358|  12.7k|    for (pi = 0; pi < i; pi++) {
  ------------------
  |  Branch (358:18): [True: 6.46k, False: 6.31k]
  ------------------
  359|  6.46k|      if (cinfo->cur_comp_info[pi] == compptr) {
  ------------------
  |  Branch (359:11): [True: 0, False: 6.46k]
  ------------------
  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|  6.46k|    }
  363|  6.31k|  }
  364|       |
  365|       |  /* Collect the additional scan parameters Ss, Se, Ah/Al. */
  366|  2.42k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  2.42k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.42k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.42k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.42k|            bytes_in_buffer--; \
  |  |  156|  2.42k|            V = *next_input_byte++; )
  ------------------
  367|  2.42k|  cinfo->Ss = c;
  368|  2.42k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  2.42k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.42k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.42k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.42k|            bytes_in_buffer--; \
  |  |  156|  2.42k|            V = *next_input_byte++; )
  ------------------
  369|  2.42k|  cinfo->Se = c;
  370|  2.42k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  2.42k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.42k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.42k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.42k|            bytes_in_buffer--; \
  |  |  156|  2.42k|            V = *next_input_byte++; )
  ------------------
  371|  2.42k|  cinfo->Ah = (c >> 4) & 15;
  372|  2.42k|  cinfo->Al = (c     ) & 15;
  373|       |
  374|  2.42k|  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
  ------------------
  |  |  314|  2.42k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  2.42k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  2.42k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  2.42k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  2.42k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  375|  2.42k|           cinfo->Ah, cinfo->Al);
  376|       |
  377|       |  /* Prepare to scan data & restart markers */
  378|  2.42k|  cinfo->marker->next_restart_num = 0;
  379|       |
  380|       |  /* Count another SOS marker */
  381|  2.42k|  cinfo->input_scan_number++;
  382|       |
  383|  2.42k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  2.42k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  2.42k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  384|  2.42k|  return TRUE;
  ------------------
  |  |  209|  2.42k|#define TRUE    1
  ------------------
  385|  2.42k|}
jdmarker.c:get_dac:
  393|      8|{
  394|      8|  JLONG length;
  395|      8|  int index, val;
  396|      8|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|      8|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|      8|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|      8|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  397|       |
  398|      8|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|      8|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|     16|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 8]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 8]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|      8|            bytes_in_buffer--; \
  |  |  164|      8|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|      8|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|      8|            bytes_in_buffer--; \
  |  |  167|      8|            V += *next_input_byte++; )
  ------------------
  399|      8|  length -= 2;
  400|       |
  401|     21|  while (length > 0) {
  ------------------
  |  Branch (401:10): [True: 13, False: 8]
  ------------------
  402|     13|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|     13|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|     13|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 13]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|     13|            bytes_in_buffer--; \
  |  |  156|     13|            V = *next_input_byte++; )
  ------------------
  403|     13|    INPUT_BYTE(cinfo, val, return FALSE);
  ------------------
  |  |  154|     13|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|     13|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 13]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|     13|            bytes_in_buffer--; \
  |  |  156|     13|            V = *next_input_byte++; )
  ------------------
  404|       |
  405|     13|    length -= 2;
  406|       |
  407|     13|    TRACEMS2(cinfo, 1, JTRC_DAC, index, val);
  ------------------
  |  |  304|     13|  ((cinfo)->err->msg_code = (code), \
  |  |  305|     13|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|     13|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|     13|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  408|       |
  409|     13|    if (index < 0 || index >= (2 * NUM_ARITH_TBLS))
  ------------------
  |  |   70|     13|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (409:9): [True: 0, False: 13]
  |  Branch (409:22): [True: 4, False: 9]
  ------------------
  410|      4|      ERREXIT1(cinfo, JERR_DAC_INDEX, index);
  ------------------
  |  |  243|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      4|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      4|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  411|       |
  412|     13|    if (index >= NUM_ARITH_TBLS) { /* define AC table */
  ------------------
  |  |   70|     13|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (412:9): [True: 0, False: 13]
  ------------------
  413|      0|      cinfo->arith_ac_K[index - NUM_ARITH_TBLS] = (UINT8)val;
  ------------------
  |  |   70|      0|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  414|     13|    } else {                    /* define DC table */
  415|     13|      cinfo->arith_dc_L[index] = (UINT8)(val & 0x0F);
  416|     13|      cinfo->arith_dc_U[index] = (UINT8)(val >> 4);
  417|     13|      if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
  ------------------
  |  Branch (417:11): [True: 4, False: 9]
  ------------------
  418|      4|        ERREXIT1(cinfo, JERR_DAC_VALUE, val);
  ------------------
  |  |  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)))
  ------------------
  419|     13|    }
  420|     13|  }
  421|       |
  422|      8|  if (length != 0)
  ------------------
  |  Branch (422:7): [True: 0, False: 8]
  ------------------
  423|      0|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  424|       |
  425|      8|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|      8|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|      8|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  426|      8|  return TRUE;
  ------------------
  |  |  209|      8|#define TRUE    1
  ------------------
  427|      8|}
jdmarker.c:get_dht:
  439|  5.93k|{
  440|  5.93k|  JLONG length;
  441|  5.93k|  UINT8 bits[17];
  442|  5.93k|  UINT8 huffval[256];
  443|  5.93k|  int i, index, count;
  444|  5.93k|  JHUFF_TBL **htblptr;
  445|  5.93k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  5.93k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  5.93k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  5.93k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  446|       |
  447|  5.93k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  5.93k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  11.8k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 5.93k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 5.93k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  5.93k|            bytes_in_buffer--; \
  |  |  164|  5.93k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  5.93k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  5.93k|            bytes_in_buffer--; \
  |  |  167|  5.93k|            V += *next_input_byte++; )
  ------------------
  448|  5.93k|  length -= 2;
  449|       |
  450|  12.9k|  while (length > 16) {
  ------------------
  |  Branch (450:10): [True: 7.02k, False: 5.93k]
  ------------------
  451|  7.02k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|  7.02k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  7.02k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 7.02k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  7.02k|            bytes_in_buffer--; \
  |  |  156|  7.02k|            V = *next_input_byte++; )
  ------------------
  452|       |
  453|  7.02k|    TRACEMS1(cinfo, 1, JTRC_DHT, index);
  ------------------
  |  |  300|  7.02k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  7.02k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  7.02k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  454|       |
  455|  7.02k|    bits[0] = 0;
  456|  7.02k|    count = 0;
  457|   119k|    for (i = 1; i <= 16; i++) {
  ------------------
  |  Branch (457:17): [True: 112k, False: 7.02k]
  ------------------
  458|   112k|      INPUT_BYTE(cinfo, bits[i], return FALSE);
  ------------------
  |  |  154|   112k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   112k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 10]
  |  |  |  |  |  Branch (279:38): [True: 10, False: 112k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   112k|            bytes_in_buffer--; \
  |  |  156|   112k|            V = *next_input_byte++; )
  ------------------
  459|   112k|      count += bits[i];
  460|   112k|    }
  461|       |
  462|  7.02k|    length -= 1 + 16;
  463|       |
  464|  7.02k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|  7.02k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  7.02k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  7.02k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|  7.02k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|  7.02k|           (cinfo)->err->msg_code = (code); \
  |  |  329|  7.02k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  465|  7.02k|             bits[1], bits[2], bits[3], bits[4],
  466|  7.02k|             bits[5], bits[6], bits[7], bits[8]);
  467|  7.02k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|  7.02k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  7.02k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  7.02k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|  7.02k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|  7.02k|           (cinfo)->err->msg_code = (code); \
  |  |  329|  7.02k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  468|  7.02k|             bits[9], bits[10], bits[11], bits[12],
  469|  7.02k|             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|  7.02k|    if (count > 256 || ((JLONG)count) > length)
  ------------------
  |  Branch (474:9): [True: 89, False: 6.93k]
  |  Branch (474:24): [True: 19, False: 6.92k]
  ------------------
  475|     98|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|     98|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     98|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  476|       |
  477|   541k|    for (i = 0; i < count; i++)
  ------------------
  |  Branch (477:17): [True: 534k, False: 7.02k]
  ------------------
  478|   534k|      INPUT_BYTE(cinfo, huffval[i], return FALSE);
  ------------------
  |  |  154|   534k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   541k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6]
  |  |  |  |  |  Branch (279:38): [True: 6, False: 534k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  7.02k|            bytes_in_buffer--; \
  |  |  156|  7.02k|            V = *next_input_byte++; )
  ------------------
  479|       |
  480|  7.02k|    memset(&huffval[count], 0, (256 - count) * sizeof(UINT8));
  481|       |
  482|  7.02k|    length -= count;
  483|       |
  484|  7.02k|    if (index & 0x10) {         /* AC table definition */
  ------------------
  |  Branch (484:9): [True: 3.45k, False: 3.57k]
  ------------------
  485|  3.45k|      index -= 0x10;
  486|  3.45k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  3.45k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (486:11): [True: 0, False: 3.45k]
  |  Branch (486:24): [True: 7, False: 3.44k]
  ------------------
  487|      7|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      7|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  488|  3.45k|      htblptr = &cinfo->ac_huff_tbl_ptrs[index];
  489|  3.57k|    } else {                    /* DC table definition */
  490|  3.57k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  3.46k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (490:11): [True: 114, False: 3.46k]
  |  Branch (490:24): [True: 4, False: 3.45k]
  ------------------
  491|      4|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      4|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      4|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  492|  3.57k|      htblptr = &cinfo->dc_huff_tbl_ptrs[index];
  493|  3.57k|    }
  494|       |
  495|  7.02k|    if (*htblptr == NULL)
  ------------------
  |  Branch (495:9): [True: 6.80k, False: 225]
  ------------------
  496|  6.80k|      *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
  497|       |
  498|  7.02k|    memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
  499|  7.02k|    memcpy((*htblptr)->huffval, huffval, sizeof((*htblptr)->huffval));
  500|  7.02k|  }
  501|       |
  502|  5.93k|  if (length != 0)
  ------------------
  |  Branch (502:7): [True: 9, False: 5.92k]
  ------------------
  503|      9|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  504|       |
  505|  5.93k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  5.93k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  5.93k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  506|  5.93k|  return TRUE;
  ------------------
  |  |  209|  5.93k|#define TRUE    1
  ------------------
  507|  5.93k|}
jdmarker.c:get_dqt:
  513|  3.37k|{
  514|  3.37k|  JLONG length;
  515|  3.37k|  int n, i, prec;
  516|  3.37k|  unsigned int tmp;
  517|  3.37k|  JQUANT_TBL *quant_ptr;
  518|  3.37k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  3.37k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  3.37k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  3.37k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  519|       |
  520|  3.37k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  3.37k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  6.74k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3.37k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3.37k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  3.37k|            bytes_in_buffer--; \
  |  |  164|  3.37k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  3.37k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  3.37k|            bytes_in_buffer--; \
  |  |  167|  3.37k|            V += *next_input_byte++; )
  ------------------
  521|  3.37k|  length -= 2;
  522|       |
  523|  7.10k|  while (length > 0) {
  ------------------
  |  Branch (523:10): [True: 3.73k, False: 3.37k]
  ------------------
  524|  3.73k|    INPUT_BYTE(cinfo, n, return FALSE);
  ------------------
  |  |  154|  3.73k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.73k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 3.72k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  3.73k|            bytes_in_buffer--; \
  |  |  156|  3.73k|            V = *next_input_byte++; )
  ------------------
  525|  3.73k|    prec = n >> 4;
  526|  3.73k|    n &= 0x0F;
  527|       |
  528|  3.73k|    TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);
  ------------------
  |  |  304|  3.73k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  3.73k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  3.73k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  3.73k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  529|       |
  530|  3.73k|    if (n >= NUM_QUANT_TBLS)
  ------------------
  |  |   68|  3.73k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (530:9): [True: 17, False: 3.71k]
  ------------------
  531|     17|      ERREXIT1(cinfo, JERR_DQT_INDEX, n);
  ------------------
  |  |  243|     17|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     17|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     17|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  532|       |
  533|  3.73k|    if (cinfo->quant_tbl_ptrs[n] == NULL)
  ------------------
  |  Branch (533:9): [True: 3.64k, False: 82]
  ------------------
  534|  3.64k|      cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr)cinfo);
  535|  3.73k|    quant_ptr = cinfo->quant_tbl_ptrs[n];
  536|       |
  537|   240k|    for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|   240k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (537:17): [True: 237k, False: 3.73k]
  ------------------
  538|   237k|      if (prec)
  ------------------
  |  Branch (538:11): [True: 2.08k, False: 234k]
  ------------------
  539|   237k|        INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  2.08k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.19k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 2.08k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6]
  |  |  |  |  |  Branch (279:38): [True: 6, False: 2.07k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   237k|            bytes_in_buffer--; \
  |  |  164|   237k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   237k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   237k|            bytes_in_buffer--; \
  |  |  167|   237k|            V += *next_input_byte++; )
  ------------------
  540|   234k|      else
  541|   237k|        INPUT_BYTE(cinfo, tmp, return FALSE);
  ------------------
  |  |  154|   234k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   234k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6]
  |  |  |  |  |  Branch (279:38): [True: 6, False: 234k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   237k|            bytes_in_buffer--; \
  |  |  156|   237k|            V = *next_input_byte++; )
  ------------------
  542|       |      /* We convert the zigzag-order table to natural array order. */
  543|   237k|      quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16)tmp;
  544|   237k|    }
  545|       |
  546|  3.73k|    if (cinfo->err->trace_level >= 2) {
  ------------------
  |  Branch (546:9): [True: 0, False: 3.73k]
  ------------------
  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|  3.73k|    length -= DCTSIZE2 + 1;
  ------------------
  |  |   67|  3.73k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  557|  3.73k|    if (prec) length -= DCTSIZE2;
  ------------------
  |  |   67|     29|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (557:9): [True: 29, False: 3.70k]
  ------------------
  558|  3.73k|  }
  559|       |
  560|  3.37k|  if (length != 0)
  ------------------
  |  Branch (560:7): [True: 6, False: 3.36k]
  ------------------
  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|  3.37k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  3.37k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  3.37k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  564|  3.37k|  return TRUE;
  ------------------
  |  |  209|  3.37k|#define TRUE    1
  ------------------
  565|  3.37k|}
jdmarker.c:get_dri:
  571|    108|{
  572|    108|  JLONG length;
  573|    108|  unsigned int tmp;
  574|    108|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    108|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    108|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    108|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  575|       |
  576|    108|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|    108|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    216|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 108]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 108]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    108|            bytes_in_buffer--; \
  |  |  164|    108|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    108|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    108|            bytes_in_buffer--; \
  |  |  167|    108|            V += *next_input_byte++; )
  ------------------
  577|       |
  578|    108|  if (length != 4)
  ------------------
  |  Branch (578:7): [True: 3, False: 105]
  ------------------
  579|      3|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      3|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  580|       |
  581|    108|  INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|    108|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    216|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 108]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 108]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    108|            bytes_in_buffer--; \
  |  |  164|    108|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    108|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    108|            bytes_in_buffer--; \
  |  |  167|    108|            V += *next_input_byte++; )
  ------------------
  582|       |
  583|    108|  TRACEMS1(cinfo, 1, JTRC_DRI, tmp);
  ------------------
  |  |  300|    108|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    108|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    108|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  584|       |
  585|    108|  cinfo->restart_interval = tmp;
  586|       |
  587|    108|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    108|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    108|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  588|    108|  return TRUE;
  ------------------
  |  |  209|    108|#define TRUE    1
  ------------------
  589|    108|}
jdmarker.c:read_restart_marker:
 1138|  1.56k|{
 1139|       |  /* Obtain a marker unless we already did. */
 1140|       |  /* Note that next_marker will complain if it skips any data. */
 1141|  1.56k|  if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (1141:7): [True: 150, False: 1.41k]
  ------------------
 1142|    150|    if (!next_marker(cinfo))
  ------------------
  |  Branch (1142:9): [True: 0, False: 150]
  ------------------
 1143|      0|      return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1144|    150|  }
 1145|       |
 1146|  1.56k|  if (cinfo->unread_marker ==
  ------------------
  |  Branch (1146:7): [True: 1.51k, False: 52]
  ------------------
 1147|  1.56k|      ((int)M_RST0 + cinfo->marker->next_restart_num)) {
 1148|       |    /* Normal case --- swallow the marker and let entropy decoder continue */
 1149|  1.51k|    TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
  ------------------
  |  |  300|  1.51k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  1.51k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  1.51k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1150|  1.51k|    cinfo->unread_marker = 0;
 1151|  1.51k|  } else {
 1152|       |    /* Uh-oh, the restart markers have been messed up. */
 1153|       |    /* Let the data source manager determine how to resync. */
 1154|     52|    if (!(*cinfo->src->resync_to_restart) (cinfo,
  ------------------
  |  Branch (1154:9): [True: 0, False: 52]
  ------------------
 1155|     52|                                           cinfo->marker->next_restart_num))
 1156|      0|      return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1157|     52|  }
 1158|       |
 1159|       |  /* Update next-restart state */
 1160|  1.56k|  cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
 1161|       |
 1162|  1.56k|  return TRUE;
  ------------------
  |  |  209|  1.56k|#define TRUE    1
  ------------------
 1163|  1.56k|}
jdmarker.c:skip_variable:
  863|  1.64k|{
  864|  1.64k|  JLONG length;
  865|  1.64k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  1.64k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  1.64k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  1.64k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  866|       |
  867|  1.64k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  1.64k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.28k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.64k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.64k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  1.64k|            bytes_in_buffer--; \
  |  |  164|  1.64k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  1.64k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  1.64k|            bytes_in_buffer--; \
  |  |  167|  1.64k|            V += *next_input_byte++; )
  ------------------
  868|  1.64k|  length -= 2;
  869|       |
  870|  1.64k|  TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int)length);
  ------------------
  |  |  304|  1.64k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  1.64k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  1.64k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  1.64k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  871|       |
  872|  1.64k|  INPUT_SYNC(cinfo);            /* do before skip_input_data */
  ------------------
  |  |  131|  1.64k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  1.64k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  873|  1.64k|  if (length > 0)
  ------------------
  |  Branch (873:7): [True: 1.32k, False: 316]
  ------------------
  874|  1.32k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  875|       |
  876|  1.64k|  return TRUE;
  ------------------
  |  |  209|  1.64k|#define TRUE    1
  ------------------
  877|  1.64k|}
jdmarker.c:get_interesting_appn:
  711|  2.79k|{
  712|  2.79k|  JLONG length;
  713|  2.79k|  JOCTET b[APPN_DATA_LEN];
  714|  2.79k|  unsigned int i, numtoread;
  715|  2.79k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  2.79k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  2.79k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  2.79k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  716|       |
  717|  2.79k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  2.79k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  5.59k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.79k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.79k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  2.79k|            bytes_in_buffer--; \
  |  |  164|  2.79k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  2.79k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  2.79k|            bytes_in_buffer--; \
  |  |  167|  2.79k|            V += *next_input_byte++; )
  ------------------
  718|  2.79k|  length -= 2;
  719|       |
  720|       |  /* get the interesting part of the marker data */
  721|  2.79k|  if (length >= APPN_DATA_LEN)
  ------------------
  |  |  601|  2.79k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  |  Branch (721:7): [True: 1.22k, False: 1.57k]
  ------------------
  722|  1.22k|    numtoread = APPN_DATA_LEN;
  ------------------
  |  |  601|  1.22k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  723|  1.57k|  else if (length > 0)
  ------------------
  |  Branch (723:12): [True: 1.56k, False: 9]
  ------------------
  724|  1.56k|    numtoread = (unsigned int)length;
  725|      9|  else
  726|      9|    numtoread = 0;
  727|  38.6k|  for (i = 0; i < numtoread; i++)
  ------------------
  |  Branch (727:15): [True: 35.8k, False: 2.79k]
  ------------------
  728|  35.8k|    INPUT_BYTE(cinfo, b[i], return FALSE);
  ------------------
  |  |  154|  35.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  38.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3]
  |  |  |  |  |  Branch (279:38): [True: 3, False: 35.8k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.79k|            bytes_in_buffer--; \
  |  |  156|  2.79k|            V = *next_input_byte++; )
  ------------------
  729|  2.79k|  length -= numtoread;
  730|       |
  731|       |  /* process it */
  732|  2.79k|  switch (cinfo->unread_marker) {
  733|  1.06k|  case M_APP0:
  ------------------
  |  Branch (733:3): [True: 1.06k, False: 1.73k]
  ------------------
  734|  1.06k|    examine_app0(cinfo, (JOCTET *)b, numtoread, length);
  735|  1.06k|    break;
  736|  1.72k|  case M_APP14:
  ------------------
  |  Branch (736:3): [True: 1.72k, False: 1.07k]
  ------------------
  737|  1.72k|    examine_app14(cinfo, (JOCTET *)b, numtoread, length);
  738|  1.72k|    break;
  739|      0|  default:
  ------------------
  |  Branch (739:3): [True: 0, False: 2.79k]
  ------------------
  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|  2.79k|  }
  744|       |
  745|       |  /* skip any remaining data -- could be lots */
  746|  2.79k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  2.79k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  2.79k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  747|  2.79k|  if (length > 0)
  ------------------
  |  Branch (747:7): [True: 189, False: 2.60k]
  ------------------
  748|    189|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  749|       |
  750|  2.79k|  return TRUE;
  ------------------
  |  |  209|  2.79k|#define TRUE    1
  ------------------
  751|  2.79k|}
jdmarker.c:examine_app0:
  611|  1.06k|{
  612|  1.06k|  JLONG totallen = (JLONG)datalen + remaining;
  613|       |
  614|  1.06k|  if (datalen >= APP0_DATA_LEN &&
  ------------------
  |  |  599|  2.13k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  |  Branch (614:7): [True: 1.05k, False: 16]
  ------------------
  615|  1.06k|      data[0] == 0x4A &&
  ------------------
  |  Branch (615:7): [True: 1.03k, False: 13]
  ------------------
  616|  1.06k|      data[1] == 0x46 &&
  ------------------
  |  Branch (616:7): [True: 1.02k, False: 12]
  ------------------
  617|  1.06k|      data[2] == 0x49 &&
  ------------------
  |  Branch (617:7): [True: 1.00k, False: 18]
  ------------------
  618|  1.06k|      data[3] == 0x46 &&
  ------------------
  |  Branch (618:7): [True: 986, False: 22]
  ------------------
  619|  1.06k|      data[4] == 0) {
  ------------------
  |  Branch (619:7): [True: 982, False: 4]
  ------------------
  620|       |    /* Found JFIF APP0 marker: save info */
  621|    982|    cinfo->saw_JFIF_marker = TRUE;
  ------------------
  |  |  209|    982|#define TRUE    1
  ------------------
  622|    982|    cinfo->JFIF_major_version = data[5];
  623|    982|    cinfo->JFIF_minor_version = data[6];
  624|    982|    cinfo->density_unit = data[7];
  625|    982|    cinfo->X_density = (data[8] << 8) + data[9];
  626|    982|    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|    982|    if (cinfo->JFIF_major_version != 1)
  ------------------
  |  Branch (633:9): [True: 3, False: 979]
  ------------------
  634|      3|      WARNMS2(cinfo, JWRN_JFIF_MAJOR,
  ------------------
  |  |  290|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      3|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      3|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      3|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  635|    982|              cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
  636|       |    /* Generate trace messages */
  637|    982|    TRACEMS5(cinfo, 1, JTRC_JFIF,
  ------------------
  |  |  319|    982|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    982|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  320|    982|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  321|    982|           _mp[4] = (p5); \
  |  |  322|    982|           (cinfo)->err->msg_code = (code); \
  |  |  323|    982|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  638|    982|             cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
  639|    982|             cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
  640|       |    /* Validate thumbnail dimensions and issue appropriate messages */
  641|    982|    if (data[12] | data[13])
  ------------------
  |  Branch (641:9): [True: 28, False: 954]
  ------------------
  642|     28|      TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, data[12], data[13]);
  ------------------
  |  |  304|     28|  ((cinfo)->err->msg_code = (code), \
  |  |  305|     28|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|     28|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|     28|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  643|    982|    totallen -= APP0_DATA_LEN;
  ------------------
  |  |  599|    982|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  644|    982|    if (totallen != ((JLONG)data[12] * (JLONG)data[13] * (JLONG)3))
  ------------------
  |  Branch (644:9): [True: 28, False: 954]
  ------------------
  645|     28|      TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)totallen);
  ------------------
  |  |  300|     28|  ((cinfo)->err->msg_code = (code), \
  |  |  301|     28|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|     28|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  646|    982|  } else if (datalen >= 6 &&
  ------------------
  |  Branch (646:14): [True: 75, False: 10]
  ------------------
  647|     85|             data[0] == 0x4A &&
  ------------------
  |  Branch (647:14): [True: 59, False: 16]
  ------------------
  648|     85|             data[1] == 0x46 &&
  ------------------
  |  Branch (648:14): [True: 47, False: 12]
  ------------------
  649|     85|             data[2] == 0x58 &&
  ------------------
  |  Branch (649:14): [True: 0, False: 47]
  ------------------
  650|     85|             data[3] == 0x58 &&
  ------------------
  |  Branch (650:14): [True: 0, False: 0]
  ------------------
  651|     85|             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|     85|  } else {
  671|       |    /* Start of APP0 does not match "JFIF" or "JFXX", or too short */
  672|     85|    TRACEMS1(cinfo, 1, JTRC_APP0, (int)totallen);
  ------------------
  |  |  300|     85|  ((cinfo)->err->msg_code = (code), \
  |  |  301|     85|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|     85|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  673|     85|  }
  674|  1.06k|}
jdmarker.c:examine_app14:
  684|  1.72k|{
  685|  1.72k|  unsigned int version, flags0, flags1, transform;
  686|       |
  687|  1.72k|  if (datalen >= APP14_DATA_LEN &&
  ------------------
  |  |  600|  3.45k|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
  |  Branch (687:7): [True: 1.72k, False: 3]
  ------------------
  688|  1.72k|      data[0] == 0x41 &&
  ------------------
  |  Branch (688:7): [True: 1.70k, False: 16]
  ------------------
  689|  1.72k|      data[1] == 0x64 &&
  ------------------
  |  Branch (689:7): [True: 1.62k, False: 83]
  ------------------
  690|  1.72k|      data[2] == 0x6F &&
  ------------------
  |  Branch (690:7): [True: 1.61k, False: 13]
  ------------------
  691|  1.72k|      data[3] == 0x62 &&
  ------------------
  |  Branch (691:7): [True: 1.58k, False: 32]
  ------------------
  692|  1.72k|      data[4] == 0x65) {
  ------------------
  |  Branch (692:7): [True: 1.55k, False: 27]
  ------------------
  693|       |    /* Found Adobe APP14 marker */
  694|  1.55k|    version = (data[5] << 8) + data[6];
  695|  1.55k|    flags0 = (data[7] << 8) + data[8];
  696|  1.55k|    flags1 = (data[9] << 8) + data[10];
  697|  1.55k|    transform = data[11];
  698|  1.55k|    TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
  ------------------
  |  |  314|  1.55k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  1.55k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  1.55k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  1.55k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  1.55k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  699|  1.55k|    cinfo->saw_Adobe_marker = TRUE;
  ------------------
  |  |  209|  1.55k|#define TRUE    1
  ------------------
  700|  1.55k|    cinfo->Adobe_transform = (UINT8)transform;
  701|  1.55k|  } else {
  702|       |    /* Start of APP14 does not match "Adobe", or too short */
  703|    174|    TRACEMS1(cinfo, 1, JTRC_APP14, (int)(datalen + remaining));
  ------------------
  |  |  300|    174|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    174|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    174|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  704|    174|  }
  705|  1.72k|}

jpeg_calc_output_dimensions:
  266|  3.39k|{
  267|  3.39k|#ifdef IDCT_SCALING_SUPPORTED
  268|  3.39k|  int ci;
  269|  3.39k|  jpeg_component_info *compptr;
  270|  3.39k|#endif
  271|       |
  272|       |  /* Prevent application from calling me at wrong times */
  273|  3.39k|  if (cinfo->global_state != DSTATE_READY)
  ------------------
  |  |   50|  3.39k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (273:7): [True: 0, False: 3.39k]
  ------------------
  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|  3.39k|  jpeg_core_output_dimensions(cinfo);
  278|       |
  279|  3.39k|#ifdef IDCT_SCALING_SUPPORTED
  280|       |
  281|  3.39k|  if (!cinfo->master->lossless) {
  ------------------
  |  Branch (281:7): [True: 3.38k, False: 10]
  ------------------
  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|  14.2k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (287:46): [True: 10.8k, False: 3.38k]
  ------------------
  288|  10.8k|         ci++, compptr++) {
  289|  10.8k|      int ssize = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  10.8k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  290|  10.8k|      while (ssize < DCTSIZE &&
  ------------------
  |  |   66|  21.7k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (290:14): [True: 0, False: 10.8k]
  ------------------
  291|  10.8k|             ((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|  10.8k|             ((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|  10.8k|      compptr->DCT_scaled_size = ssize;
  301|  10.8k|#endif
  302|  10.8k|    }
  303|       |
  304|       |    /* Recompute downsampled dimensions of components;
  305|       |     * application needs to know these if using raw downsampled data.
  306|       |     */
  307|  14.2k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (307:46): [True: 10.8k, False: 3.38k]
  ------------------
  308|  10.8k|         ci++, compptr++) {
  309|       |      /* Size in samples, after IDCT scaling */
  310|  10.8k|      compptr->downsampled_width = (JDIMENSION)
  311|  10.8k|        jdiv_round_up((long)cinfo->image_width *
  312|  10.8k|                      (long)(compptr->h_samp_factor *
  313|  10.8k|                             compptr->_DCT_scaled_size),
  ------------------
  |  |   24|  10.8k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  314|  10.8k|                      (long)(cinfo->max_h_samp_factor * DCTSIZE));
  ------------------
  |  |   66|  10.8k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  315|  10.8k|      compptr->downsampled_height = (JDIMENSION)
  316|  10.8k|        jdiv_round_up((long)cinfo->image_height *
  317|  10.8k|                      (long)(compptr->v_samp_factor *
  318|  10.8k|                             compptr->_DCT_scaled_size),
  ------------------
  |  |   24|  10.8k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  319|  10.8k|                      (long)(cinfo->max_v_samp_factor * DCTSIZE));
  ------------------
  |  |   66|  10.8k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  320|  10.8k|    }
  321|  3.38k|  } else
  322|     10|#endif /* IDCT_SCALING_SUPPORTED */
  323|     10|  {
  324|       |    /* Hardwire it to "no scaling" */
  325|     10|    cinfo->output_width = cinfo->image_width;
  326|     10|    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|     10|  }
  331|       |
  332|       |  /* Report number of components in selected colorspace. */
  333|       |  /* Probably this should be in the color conversion module... */
  334|  3.39k|  switch (cinfo->out_color_space) {
  335|     58|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (335:3): [True: 58, False: 3.34k]
  ------------------
  336|     58|    cinfo->out_color_components = 1;
  337|     58|    break;
  338|  2.50k|  case JCS_RGB:
  ------------------
  |  Branch (338:3): [True: 2.50k, False: 896]
  ------------------
  339|  2.50k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (339:3): [True: 0, False: 3.39k]
  ------------------
  340|  2.50k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (340:3): [True: 0, False: 3.39k]
  ------------------
  341|  2.50k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (341:3): [True: 0, False: 3.39k]
  ------------------
  342|  2.50k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (342:3): [True: 0, False: 3.39k]
  ------------------
  343|  2.50k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (343:3): [True: 0, False: 3.39k]
  ------------------
  344|  2.50k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (344:3): [True: 0, False: 3.39k]
  ------------------
  345|  2.50k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (345:3): [True: 0, False: 3.39k]
  ------------------
  346|  2.50k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (346:3): [True: 0, False: 3.39k]
  ------------------
  347|  2.50k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (347:3): [True: 0, False: 3.39k]
  ------------------
  348|  2.50k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (348:3): [True: 0, False: 3.39k]
  ------------------
  349|  2.50k|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  350|  2.50k|    break;
  351|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (351:3): [True: 0, False: 3.39k]
  ------------------
  352|      0|  case JCS_RGB565:
  ------------------
  |  Branch (352:3): [True: 0, False: 3.39k]
  ------------------
  353|      0|    cinfo->out_color_components = 3;
  354|      0|    break;
  355|    838|  case JCS_CMYK:
  ------------------
  |  Branch (355:3): [True: 838, False: 2.56k]
  ------------------
  356|    838|  case JCS_YCCK:
  ------------------
  |  Branch (356:3): [True: 0, False: 3.39k]
  ------------------
  357|    838|    cinfo->out_color_components = 4;
  358|    838|    break;
  359|      0|  default:                      /* else must be same colorspace as in file */
  ------------------
  |  Branch (359:3): [True: 0, False: 3.39k]
  ------------------
  360|      0|    cinfo->out_color_components = cinfo->num_components;
  361|      0|    break;
  362|  3.39k|  }
  363|  3.39k|  cinfo->output_components = (cinfo->quantize_colors ? 1 :
  ------------------
  |  Branch (363:31): [True: 0, False: 3.39k]
  ------------------
  364|  3.39k|                              cinfo->out_color_components);
  365|       |
  366|       |  /* See if upsampler will want to emit more than one row at a time */
  367|  3.39k|  if (use_merged_upsample(cinfo))
  ------------------
  |  Branch (367:7): [True: 0, False: 3.39k]
  ------------------
  368|      0|    cinfo->rec_outbuf_height = cinfo->max_v_samp_factor;
  369|  3.39k|  else
  370|  3.39k|    cinfo->rec_outbuf_height = 1;
  371|  3.39k|}
jinit_master_decompress:
  881|  1.69k|{
  882|  1.69k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  883|       |
  884|  1.69k|  master->pub.prepare_for_output_pass = prepare_for_output_pass;
  885|  1.69k|  master->pub.finish_output_pass = finish_output_pass;
  886|       |
  887|  1.69k|  master->pub.is_dummy_pass = FALSE;
  ------------------
  |  |  206|  1.69k|#define FALSE   0               /* values of boolean */
  ------------------
  888|  1.69k|  master->pub.jinit_upsampler_no_alloc = FALSE;
  ------------------
  |  |  206|  1.69k|#define FALSE   0               /* values of boolean */
  ------------------
  889|       |
  890|  1.69k|  master_selection(cinfo);
  891|  1.69k|}
jdmaster.c:jpeg_core_output_dimensions:
  100|  3.39k|{
  101|  3.39k|#ifdef IDCT_SCALING_SUPPORTED
  102|  3.39k|  int ci;
  103|  3.39k|  jpeg_component_info *compptr;
  104|       |
  105|  3.39k|  if (!cinfo->master->lossless) {
  ------------------
  |  Branch (105:7): [True: 3.38k, False: 10]
  ------------------
  106|       |    /* Compute actual output image dimensions and DCT scaling choices. */
  107|  3.38k|    if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom) {
  ------------------
  |  |   66|  3.38k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (107:9): [True: 0, False: 3.38k]
  ------------------
  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|  3.38k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 2) {
  ------------------
  |  |   66|  3.38k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (115:16): [True: 0, False: 3.38k]
  ------------------
  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|  3.38k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 3) {
  ------------------
  |  |   66|  3.38k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (123:16): [True: 0, False: 3.38k]
  ------------------
  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|  3.38k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 4) {
  ------------------
  |  |   66|  3.38k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (131:16): [True: 0, False: 3.38k]
  ------------------
  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|  3.38k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 5) {
  ------------------
  |  |   66|  3.38k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (139:16): [True: 0, False: 3.38k]
  ------------------
  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|  3.38k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 6) {
  ------------------
  |  |   66|  3.38k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (147:16): [True: 0, False: 3.38k]
  ------------------
  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|  3.38k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 7) {
  ------------------
  |  |   66|  3.38k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (155:16): [True: 0, False: 3.38k]
  ------------------
  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|  3.38k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 8) {
  ------------------
  |  |   66|  3.38k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (163:16): [True: 3.38k, False: 0]
  ------------------
  164|       |      /* Provide 8/block_size scaling */
  165|  3.38k|      cinfo->output_width = (JDIMENSION)
  166|  3.38k|        jdiv_round_up((long)cinfo->image_width * 8L, (long)DCTSIZE);
  ------------------
  |  |   66|  3.38k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  167|  3.38k|      cinfo->output_height = (JDIMENSION)
  168|  3.38k|        jdiv_round_up((long)cinfo->image_height * 8L, (long)DCTSIZE);
  ------------------
  |  |   66|  3.38k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  169|  3.38k|      cinfo->_min_DCT_h_scaled_size = 8;
  ------------------
  |  |   28|  3.38k|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  170|  3.38k|      cinfo->_min_DCT_v_scaled_size = 8;
  ------------------
  |  |   29|  3.38k|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  171|  3.38k|    } 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|  14.2k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (238:46): [True: 10.8k, False: 3.38k]
  ------------------
  239|  10.8k|         ci++, compptr++) {
  240|  10.8k|      compptr->_DCT_h_scaled_size = cinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   25|  10.8k|#define _DCT_h_scaled_size  DCT_scaled_size
  ------------------
                    compptr->_DCT_h_scaled_size = cinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   28|  10.8k|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  241|  10.8k|      compptr->_DCT_v_scaled_size = cinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   26|  10.8k|#define _DCT_v_scaled_size  DCT_scaled_size
  ------------------
                    compptr->_DCT_v_scaled_size = cinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   29|  10.8k|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  242|  10.8k|    }
  243|  3.38k|  } else
  244|     10|#endif /* !IDCT_SCALING_SUPPORTED */
  245|     10|  {
  246|       |    /* Hardwire it to "no scaling" */
  247|     10|    cinfo->output_width = cinfo->image_width;
  248|     10|    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|     10|  }
  253|  3.39k|}
jdmaster.c:use_merged_upsample:
   36|  5.09k|{
   37|  5.09k|#ifdef UPSAMPLE_MERGING_SUPPORTED
   38|       |  /* Colorspace conversion is not supported with lossless JPEG images */
   39|  5.09k|  if (cinfo->master->lossless)
  ------------------
  |  Branch (39:7): [True: 15, False: 5.08k]
  ------------------
   40|     15|    return FALSE;
  ------------------
  |  |  206|     15|#define FALSE   0               /* values of boolean */
  ------------------
   41|       |  /* Merging is the equivalent of plain box-filter upsampling */
   42|  5.08k|  if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling)
  ------------------
  |  Branch (42:7): [True: 5.08k, False: 0]
  |  Branch (42:37): [True: 0, False: 0]
  ------------------
   43|  5.08k|    return FALSE;
  ------------------
  |  |  206|  5.08k|#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|  1.45k|{
  777|  1.45k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  778|       |
  779|  1.45k|  if (master->pub.is_dummy_pass) {
  ------------------
  |  Branch (779:7): [True: 0, False: 1.45k]
  ------------------
  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|  1.45k|  } else {
  790|  1.45k|    if (cinfo->quantize_colors && cinfo->colormap == NULL) {
  ------------------
  |  Branch (790:9): [True: 0, False: 1.45k]
  |  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|  1.45k|    (*cinfo->idct->start_pass) (cinfo);
  802|  1.45k|    (*cinfo->coef->start_output_pass) (cinfo);
  803|  1.45k|    if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (803:9): [True: 1.45k, False: 0]
  ------------------
  804|  1.45k|      if (!master->using_merged_upsample)
  ------------------
  |  Branch (804:11): [True: 1.45k, False: 0]
  ------------------
  805|  1.45k|        (*cinfo->cconvert->start_pass) (cinfo);
  806|  1.45k|      (*cinfo->upsample->start_pass) (cinfo);
  807|  1.45k|      if (cinfo->quantize_colors)
  ------------------
  |  Branch (807:11): [True: 0, False: 1.45k]
  ------------------
  808|      0|        (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass);
  809|  1.45k|      (*cinfo->post->start_pass) (cinfo,
  810|  1.45k|            (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
  ------------------
  |  Branch (810:14): [True: 0, False: 1.45k]
  ------------------
  811|  1.45k|      (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
  812|  1.45k|    }
  813|  1.45k|  }
  814|       |
  815|       |  /* Set up progress monitor's pass info if present */
  816|  1.45k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (816:7): [True: 1.45k, False: 0]
  ------------------
  817|  1.45k|    cinfo->progress->completed_passes = master->pass_number;
  818|  1.45k|    cinfo->progress->total_passes = master->pass_number +
  819|  1.45k|                                    (master->pub.is_dummy_pass ? 2 : 1);
  ------------------
  |  Branch (819:38): [True: 0, False: 1.45k]
  ------------------
  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|  1.45k|    if (cinfo->buffered_image && !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (823:9): [True: 0, False: 1.45k]
  |  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|  1.45k|  }
  827|  1.45k|}
jdmaster.c:finish_output_pass:
  836|    734|{
  837|    734|  my_master_ptr master = (my_master_ptr)cinfo->master;
  838|       |
  839|    734|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (839:7): [True: 0, False: 734]
  ------------------
  840|      0|    (*cinfo->cquantize->finish_pass) (cinfo);
  841|    734|  master->pass_number++;
  842|    734|}
jdmaster.c:master_selection:
  512|  1.69k|{
  513|  1.69k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  514|  1.69k|  boolean use_c_buffer;
  515|  1.69k|  long samplesperrow;
  516|  1.69k|  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|  1.69k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (524:7): [True: 5, False: 1.69k]
  ------------------
  525|      5|    cinfo->raw_data_out = FALSE;
  ------------------
  |  |  206|      5|#define FALSE   0               /* values of boolean */
  ------------------
  526|      5|    cinfo->scale_num = cinfo->scale_denom = 1;
  527|      5|  }
  528|       |
  529|       |  /* Initialize dimensions and other stuff */
  530|  1.69k|  jpeg_calc_output_dimensions(cinfo);
  531|  1.69k|  prepare_range_limit_table(cinfo);
  532|       |
  533|       |  /* Width of an output scanline must be representable as JDIMENSION. */
  534|  1.69k|  samplesperrow = (long)cinfo->output_width *
  535|  1.69k|                  (long)cinfo->out_color_components;
  536|  1.69k|  jd_samplesperrow = (JDIMENSION)samplesperrow;
  537|  1.69k|  if ((long)jd_samplesperrow != samplesperrow)
  ------------------
  |  Branch (537:7): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|  master->pass_number = 0;
  542|  1.69k|  master->using_merged_upsample = use_merged_upsample(cinfo);
  543|       |
  544|       |  /* Color quantizer selection */
  545|  1.69k|  master->quantizer_1pass = NULL;
  546|  1.69k|  master->quantizer_2pass = NULL;
  547|       |  /* No mode changes if not using buffered-image mode. */
  548|  1.69k|  if (!cinfo->quantize_colors || !cinfo->buffered_image) {
  ------------------
  |  Branch (548:7): [True: 1.69k, False: 0]
  |  Branch (548:34): [True: 0, False: 0]
  ------------------
  549|  1.69k|    cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  206|  1.69k|#define FALSE   0               /* values of boolean */
  ------------------
  550|  1.69k|    cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  206|  1.69k|#define FALSE   0               /* values of boolean */
  ------------------
  551|  1.69k|    cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  206|  1.69k|#define FALSE   0               /* values of boolean */
  ------------------
  552|  1.69k|  }
  553|  1.69k|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (553:7): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|  if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (605:7): [True: 1.69k, False: 0]
  ------------------
  606|  1.69k|    if (master->using_merged_upsample) {
  ------------------
  |  Branch (606:9): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|    } else {
  618|  1.69k|      if (cinfo->data_precision == 16) {
  ------------------
  |  Branch (618:11): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|      } else if (cinfo->data_precision == 12) {
  ------------------
  |  Branch (625:18): [True: 2, False: 1.69k]
  ------------------
  626|      2|        j12init_color_deconverter(cinfo);
  627|      2|        j12init_upsampler(cinfo);
  628|  1.69k|      } else {
  629|  1.69k|        jinit_color_deconverter(cinfo);
  630|  1.69k|        jinit_upsampler(cinfo);
  631|  1.69k|      }
  632|  1.69k|    }
  633|  1.69k|    if (cinfo->data_precision == 16)
  ------------------
  |  Branch (633:9): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|    else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (639:14): [True: 2, False: 1.69k]
  ------------------
  640|      2|      j12init_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  641|  1.69k|    else
  642|  1.69k|      jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  643|  1.69k|  }
  644|       |
  645|  1.69k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (645:7): [True: 5, False: 1.69k]
  ------------------
  646|      5|#ifdef D_LOSSLESS_SUPPORTED
  647|       |    /* Prediction, sample undifferencing, point transform, and sample size
  648|       |     * scaling
  649|       |     */
  650|      5|    if (cinfo->data_precision == 16)
  ------------------
  |  Branch (650:9): [True: 0, False: 5]
  ------------------
  651|      0|      j16init_lossless_decompressor(cinfo);
  652|      5|    else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (652:14): [True: 0, False: 5]
  ------------------
  653|      0|      j12init_lossless_decompressor(cinfo);
  654|      5|    else
  655|      5|      jinit_lossless_decompressor(cinfo);
  656|       |    /* Entropy decoding: either Huffman or arithmetic coding. */
  657|      5|    if (cinfo->arith_code) {
  ------------------
  |  Branch (657:9): [True: 0, False: 5]
  ------------------
  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|      5|    } else {
  660|      5|      jinit_lhuff_decoder(cinfo);
  661|      5|    }
  662|       |
  663|       |    /* Initialize principal buffer controllers. */
  664|      5|    use_c_buffer = cinfo->inputctl->has_multiple_scans ||
  ------------------
  |  Branch (664:20): [True: 0, False: 5]
  ------------------
  665|      5|                   cinfo->buffered_image;
  ------------------
  |  Branch (665:20): [True: 0, False: 5]
  ------------------
  666|      5|    if (cinfo->data_precision == 16)
  ------------------
  |  Branch (666:9): [True: 0, False: 5]
  ------------------
  667|      0|      j16init_d_diff_controller(cinfo, use_c_buffer);
  668|      5|    else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (668:14): [True: 0, False: 5]
  ------------------
  669|      0|      j12init_d_diff_controller(cinfo, use_c_buffer);
  670|      5|    else
  671|      5|      jinit_d_diff_controller(cinfo, use_c_buffer);
  672|       |#else
  673|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  674|       |#endif
  675|  1.69k|  } else {
  676|  1.69k|    if (cinfo->data_precision == 16)
  ------------------
  |  Branch (676:9): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|    if (cinfo->data_precision == 12)
  ------------------
  |  Branch (679:9): [True: 2, False: 1.69k]
  ------------------
  680|      2|      j12init_inverse_dct(cinfo);
  681|  1.69k|    else
  682|  1.69k|      jinit_inverse_dct(cinfo);
  683|       |    /* Entropy decoding: either Huffman or arithmetic coding. */
  684|  1.69k|    if (cinfo->arith_code) {
  ------------------
  |  Branch (684:9): [True: 0, False: 1.69k]
  ------------------
  685|      0|#ifdef D_ARITH_CODING_SUPPORTED
  686|      0|      jinit_arith_decoder(cinfo);
  687|       |#else
  688|       |      ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  689|       |#endif
  690|  1.69k|    } else {
  691|  1.69k|      if (cinfo->progressive_mode) {
  ------------------
  |  Branch (691:11): [True: 168, False: 1.52k]
  ------------------
  692|    168|#ifdef D_PROGRESSIVE_SUPPORTED
  693|    168|        jinit_phuff_decoder(cinfo);
  694|       |#else
  695|       |        ERREXIT(cinfo, JERR_NOT_COMPILED);
  696|       |#endif
  697|    168|      } else
  698|  1.52k|        jinit_huff_decoder(cinfo);
  699|  1.69k|    }
  700|       |
  701|       |    /* Initialize principal buffer controllers. */
  702|  1.69k|    use_c_buffer = cinfo->inputctl->has_multiple_scans ||
  ------------------
  |  Branch (702:20): [True: 170, False: 1.52k]
  ------------------
  703|  1.69k|                   cinfo->buffered_image;
  ------------------
  |  Branch (703:20): [True: 0, False: 1.52k]
  ------------------
  704|  1.69k|    if (cinfo->data_precision == 12)
  ------------------
  |  Branch (704:9): [True: 2, False: 1.69k]
  ------------------
  705|      2|      j12init_d_coef_controller(cinfo, use_c_buffer);
  706|  1.69k|    else
  707|  1.69k|      jinit_d_coef_controller(cinfo, use_c_buffer);
  708|  1.69k|  }
  709|       |
  710|  1.69k|  if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (710:7): [True: 1.69k, False: 2]
  ------------------
  711|  1.69k|    if (cinfo->data_precision == 16)
  ------------------
  |  Branch (711:9): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|    else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (718:14): [True: 2, False: 1.69k]
  ------------------
  719|      2|      j12init_d_main_controller(cinfo,
  720|      2|                                FALSE /* never need full buffer here */);
  ------------------
  |  |  206|      2|#define FALSE   0               /* values of boolean */
  ------------------
  721|  1.69k|    else
  722|  1.69k|      jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */);
  ------------------
  |  |  206|  1.69k|#define FALSE   0               /* values of boolean */
  ------------------
  723|  1.69k|  }
  724|       |
  725|       |  /* We can now tell the memory manager to allocate virtual arrays. */
  726|  1.69k|  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
  727|       |
  728|       |  /* Initialize input side of decompressor to consume first scan. */
  729|  1.69k|  (*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|  1.69k|  cinfo->master->first_iMCU_col = 0;
  735|  1.69k|  cinfo->master->last_iMCU_col = cinfo->MCUs_per_row - 1;
  736|  1.69k|  cinfo->master->last_good_iMCU_row = 0;
  737|       |
  738|  1.69k|#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|  1.69k|  if (cinfo->progress != NULL && !cinfo->buffered_image &&
  ------------------
  |  Branch (743:7): [True: 1.55k, False: 145]
  |  Branch (743:34): [True: 1.55k, False: 0]
  ------------------
  744|  1.69k|      cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (744:7): [True: 168, False: 1.38k]
  ------------------
  745|    168|    int nscans;
  746|       |    /* Estimate number of scans to set pass_limit. */
  747|    168|    if (cinfo->progressive_mode) {
  ------------------
  |  Branch (747:9): [True: 168, False: 0]
  ------------------
  748|       |      /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
  749|    168|      nscans = 2 + 3 * cinfo->num_components;
  750|    168|    } else {
  751|       |      /* For a nonprogressive multiscan file, estimate 1 scan per component. */
  752|      0|      nscans = cinfo->num_components;
  753|      0|    }
  754|    168|    cinfo->progress->pass_counter = 0L;
  755|    168|    cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows * nscans;
  756|    168|    cinfo->progress->completed_passes = 0;
  757|    168|    cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2);
  ------------------
  |  Branch (757:38): [True: 0, False: 168]
  ------------------
  758|       |    /* Count the input pass as done */
  759|    168|    master->pass_number++;
  760|    168|  }
  761|  1.69k|#endif /* D_MULTISCAN_FILES_SUPPORTED */
  762|  1.69k|}
jdmaster.c:prepare_range_limit_table:
  417|  1.69k|{
  418|  1.69k|  JSAMPLE *table;
  419|  1.69k|  J12SAMPLE *table12;
  420|  1.69k|#ifdef D_LOSSLESS_SUPPORTED
  421|  1.69k|  J16SAMPLE *table16;
  422|  1.69k|#endif
  423|  1.69k|  int i;
  424|       |
  425|  1.69k|  if (cinfo->data_precision == 16) {
  ------------------
  |  Branch (425:7): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|  } else if (cinfo->data_precision == 12) {
  ------------------
  |  Branch (452:14): [True: 2, False: 1.69k]
  ------------------
  453|      2|    table12 = (J12SAMPLE *)
  454|      2|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  455|      2|                  (5 * (MAXJ12SAMPLE + 1) + CENTERJ12SAMPLE) *
  ------------------
  |  |   59|      2|#define MAXJ12SAMPLE     4095
  ------------------
                                (5 * (MAXJ12SAMPLE + 1) + CENTERJ12SAMPLE) *
  ------------------
  |  |   60|      2|#define CENTERJ12SAMPLE  2048
  ------------------
  456|      2|                  sizeof(J12SAMPLE));
  457|      2|    table12 += (MAXJ12SAMPLE + 1);  /* allow negative subscripts of simple
  ------------------
  |  |   59|      2|#define MAXJ12SAMPLE     4095
  ------------------
  458|       |                                       table */
  459|      2|    cinfo->sample_range_limit = (JSAMPLE *)table12;
  460|       |    /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  461|      2|    memset(table12 - (MAXJ12SAMPLE + 1), 0,
  ------------------
  |  |   59|      2|#define MAXJ12SAMPLE     4095
  ------------------
  462|      2|           (MAXJ12SAMPLE + 1) * sizeof(J12SAMPLE));
  ------------------
  |  |   59|      2|#define MAXJ12SAMPLE     4095
  ------------------
  463|       |    /* Main part of "simple" table: limit[x] = x */
  464|  8.19k|    for (i = 0; i <= MAXJ12SAMPLE; i++)
  ------------------
  |  |   59|  8.19k|#define MAXJ12SAMPLE     4095
  ------------------
  |  Branch (464:17): [True: 8.19k, False: 2]
  ------------------
  465|  8.19k|      table12[i] = (J12SAMPLE)i;
  466|      2|    table12 += CENTERJ12SAMPLE; /* Point to where post-IDCT table starts */
  ------------------
  |  |   60|      2|#define CENTERJ12SAMPLE  2048
  ------------------
  467|       |    /* End of simple table, rest of first half of post-IDCT table */
  468|  12.2k|    for (i = CENTERJ12SAMPLE; i < 2 * (MAXJ12SAMPLE + 1); i++)
  ------------------
  |  |   60|      2|#define CENTERJ12SAMPLE  2048
  ------------------
                  for (i = CENTERJ12SAMPLE; i < 2 * (MAXJ12SAMPLE + 1); i++)
  ------------------
  |  |   59|  12.2k|#define MAXJ12SAMPLE     4095
  ------------------
  |  Branch (468:31): [True: 12.2k, False: 2]
  ------------------
  469|  12.2k|      table12[i] = MAXJ12SAMPLE;
  ------------------
  |  |   59|  12.2k|#define MAXJ12SAMPLE     4095
  ------------------
  470|       |    /* Second half of post-IDCT table */
  471|      2|    memset(table12 + (2 * (MAXJ12SAMPLE + 1)), 0,
  ------------------
  |  |   59|      2|#define MAXJ12SAMPLE     4095
  ------------------
  472|      2|           (2 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE) * sizeof(J12SAMPLE));
  ------------------
  |  |   59|      2|#define MAXJ12SAMPLE     4095
  ------------------
                         (2 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE) * sizeof(J12SAMPLE));
  ------------------
  |  |   60|      2|#define CENTERJ12SAMPLE  2048
  ------------------
  473|      2|    memcpy(table12 + (4 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE),
  ------------------
  |  |   59|      2|#define MAXJ12SAMPLE     4095
  ------------------
                  memcpy(table12 + (4 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE),
  ------------------
  |  |   60|      2|#define CENTERJ12SAMPLE  2048
  ------------------
  474|      2|           cinfo->sample_range_limit, CENTERJ12SAMPLE * sizeof(J12SAMPLE));
  ------------------
  |  |   60|      2|#define CENTERJ12SAMPLE  2048
  ------------------
  475|  1.69k|  } else {
  476|  1.69k|    table = (JSAMPLE *)
  477|  1.69k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.69k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|  1.69k|                  (5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   51|  1.69k|#define MAXJSAMPLE       255
  ------------------
                                (5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  1.69k|#define CENTERJSAMPLE    128
  ------------------
  479|  1.69k|    table += (MAXJSAMPLE + 1);  /* allow negative subscripts of simple table */
  ------------------
  |  |   51|  1.69k|#define MAXJSAMPLE       255
  ------------------
  480|  1.69k|    cinfo->sample_range_limit = table;
  481|       |    /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  482|  1.69k|    memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
  ------------------
  |  |   51|  1.69k|#define MAXJSAMPLE       255
  ------------------
                  memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
  ------------------
  |  |   51|  1.69k|#define MAXJSAMPLE       255
  ------------------
  483|       |    /* Main part of "simple" table: limit[x] = x */
  484|   435k|    for (i = 0; i <= MAXJSAMPLE; i++)
  ------------------
  |  |   51|   435k|#define MAXJSAMPLE       255
  ------------------
  |  Branch (484:17): [True: 433k, False: 1.69k]
  ------------------
  485|   433k|      table[i] = (JSAMPLE)i;
  486|  1.69k|    table += CENTERJSAMPLE;     /* Point to where post-IDCT table starts */
  ------------------
  |  |   52|  1.69k|#define CENTERJSAMPLE    128
  ------------------
  487|       |    /* End of simple table, rest of first half of post-IDCT table */
  488|   652k|    for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
  ------------------
  |  |   52|  1.69k|#define CENTERJSAMPLE    128
  ------------------
                  for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
  ------------------
  |  |   51|   652k|#define MAXJSAMPLE       255
  ------------------
  |  Branch (488:29): [True: 650k, False: 1.69k]
  ------------------
  489|   650k|      table[i] = MAXJSAMPLE;
  ------------------
  |  |   51|   650k|#define MAXJSAMPLE       255
  ------------------
  490|       |    /* Second half of post-IDCT table */
  491|  1.69k|    memset(table + (2 * (MAXJSAMPLE + 1)), 0,
  ------------------
  |  |   51|  1.69k|#define MAXJSAMPLE       255
  ------------------
  492|  1.69k|           (2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   51|  1.69k|#define MAXJSAMPLE       255
  ------------------
                         (2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  1.69k|#define CENTERJSAMPLE    128
  ------------------
  493|  1.69k|    memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
  ------------------
  |  |   51|  1.69k|#define MAXJSAMPLE       255
  ------------------
                  memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
  ------------------
  |  |   52|  1.69k|#define CENTERJSAMPLE    128
  ------------------
  494|  1.69k|           cinfo->sample_range_limit, CENTERJSAMPLE * sizeof(JSAMPLE));
  ------------------
  |  |   52|  1.69k|#define CENTERJSAMPLE    128
  ------------------
  495|  1.69k|  }
  496|  1.69k|}

jinit_phuff_decoder:
  654|    168|{
  655|    168|  phuff_entropy_ptr entropy;
  656|    168|  int *coef_bit_ptr;
  657|    168|  int ci, i;
  658|       |
  659|    168|  entropy = (phuff_entropy_ptr)
  660|    168|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    168|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  661|    168|                                sizeof(phuff_entropy_decoder));
  662|    168|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  663|    168|  entropy->pub.start_pass = start_pass_phuff_decoder;
  664|       |
  665|       |  /* Mark derived tables unallocated */
  666|    840|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|    840|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (666:15): [True: 672, False: 168]
  ------------------
  667|    672|    entropy->derived_tbls[i] = NULL;
  668|    672|  }
  669|       |
  670|       |  /* Create progression status table */
  671|    168|  cinfo->coef_bits = (int (*)[DCTSIZE2])
  672|    168|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    168|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  673|    168|                                cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|    168|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  674|    168|                                sizeof(int));
  675|    168|  coef_bit_ptr = &cinfo->coef_bits[0][0];
  676|    672|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (676:16): [True: 504, False: 168]
  ------------------
  677|  32.7k|    for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|  32.7k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (677:17): [True: 32.2k, False: 504]
  ------------------
  678|  32.2k|      *coef_bit_ptr++ = -1;
  679|    168|}
jdphuff.c:start_pass_phuff_decoder:
   83|    842|{
   84|    842|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
   85|    842|  boolean is_DC_band, bad;
   86|    842|  int ci, coefi, tbl;
   87|    842|  d_derived_tbl **pdtbl;
   88|    842|  int *coef_bit_ptr, *prev_coef_bit_ptr;
   89|    842|  jpeg_component_info *compptr;
   90|       |
   91|    842|  is_DC_band = (cinfo->Ss == 0);
   92|       |
   93|       |  /* Validate scan parameters */
   94|    842|  bad = FALSE;
  ------------------
  |  |  206|    842|#define FALSE   0               /* values of boolean */
  ------------------
   95|    842|  if (is_DC_band) {
  ------------------
  |  Branch (95:7): [True: 168, False: 674]
  ------------------
   96|    168|    if (cinfo->Se != 0)
  ------------------
  |  Branch (96:9): [True: 0, False: 168]
  ------------------
   97|      0|      bad = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
   98|    674|  } else {
   99|       |    /* need not check Ss/Se < 0 since they came from unsigned bytes */
  100|    674|    if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2)
  ------------------
  |  |   67|    674|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (100:9): [True: 0, False: 674]
  |  Branch (100:34): [True: 0, False: 674]
  ------------------
  101|      0|      bad = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  102|       |    /* AC scans may have only one component */
  103|    674|    if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (103:9): [True: 0, False: 674]
  ------------------
  104|      0|      bad = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  105|    674|  }
  106|    842|  if (cinfo->Ah != 0) {
  ------------------
  |  Branch (106:7): [True: 2, False: 840]
  ------------------
  107|       |    /* Successive approximation refinement scan: must have Al = Ah-1. */
  108|      2|    if (cinfo->Al != cinfo->Ah - 1)
  ------------------
  |  Branch (108:9): [True: 2, False: 0]
  ------------------
  109|      2|      bad = TRUE;
  ------------------
  |  |  209|      2|#define TRUE    1
  ------------------
  110|      2|  }
  111|    842|  if (cinfo->Al > 13)           /* need not check for < 0 */
  ------------------
  |  Branch (111:7): [True: 0, False: 842]
  ------------------
  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|    842|  if (bad)
  ------------------
  |  Branch (119:7): [True: 2, False: 840]
  ------------------
  120|      2|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      2|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      2|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      2|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  121|    842|             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|  2.01k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (126:16): [True: 1.17k, False: 842]
  ------------------
  127|  1.17k|    int cindex = cinfo->cur_comp_info[ci]->component_index;
  128|  1.17k|    coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  129|  1.17k|    prev_coef_bit_ptr = &cinfo->coef_bits[cindex + cinfo->num_components][0];
  130|  1.17k|    if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (130:9): [True: 672, False: 504]
  |  Branch (130:24): [True: 0, False: 672]
  ------------------
  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|  28.7k|    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  447|  1.17k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (447:26): [True: 504, False: 672]
  |  |  ------------------
  ------------------
                  for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  445|  28.7k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (445:26): [True: 19.5k, False: 9.20k]
  |  |  ------------------
  ------------------
  |  Branch (132:37): [True: 27.6k, False: 1.17k]
  ------------------
  133|  27.6k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (133:11): [True: 22.5k, False: 5.04k]
  ------------------
  134|  22.5k|        prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  135|  5.04k|      else
  136|  5.04k|        prev_coef_bit_ptr[coefi] = 0;
  137|  27.6k|    }
  138|  21.2k|    for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (138:29): [True: 20.0k, False: 1.17k]
  ------------------
  139|  20.0k|      int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (139:22): [True: 20.0k, False: 0]
  ------------------
  140|  20.0k|      if (cinfo->Ah != expected)
  ------------------
  |  Branch (140:11): [True: 0, False: 20.0k]
  ------------------
  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|  20.0k|      coef_bit_ptr[coefi] = cinfo->Al;
  143|  20.0k|    }
  144|  1.17k|  }
  145|       |
  146|       |  /* Select MCU decoding routine */
  147|    842|  if (cinfo->Ah == 0) {
  ------------------
  |  Branch (147:7): [True: 840, False: 2]
  ------------------
  148|    840|    if (is_DC_band)
  ------------------
  |  Branch (148:9): [True: 168, False: 672]
  ------------------
  149|    168|      entropy->pub.decode_mcu = decode_mcu_DC_first;
  150|    672|    else
  151|    672|      entropy->pub.decode_mcu = decode_mcu_AC_first;
  152|    840|  } else {
  153|      2|    if (is_DC_band)
  ------------------
  |  Branch (153:9): [True: 0, False: 2]
  ------------------
  154|      0|      entropy->pub.decode_mcu = decode_mcu_DC_refine;
  155|      2|    else
  156|      2|      entropy->pub.decode_mcu = decode_mcu_AC_refine;
  157|      2|  }
  158|       |
  159|  2.01k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (159:16): [True: 1.17k, False: 842]
  ------------------
  160|  1.17k|    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|  1.17k|    if (is_DC_band) {
  ------------------
  |  Branch (164:9): [True: 504, False: 672]
  ------------------
  165|    504|      if (cinfo->Ah == 0) {     /* DC refinement needs no table */
  ------------------
  |  Branch (165:11): [True: 504, False: 0]
  ------------------
  166|    504|        tbl = compptr->dc_tbl_no;
  167|    504|        pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  168|    504|        jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, pdtbl);
  ------------------
  |  |  209|    504|#define TRUE    1
  ------------------
  169|    504|      }
  170|    672|    } else {
  171|    672|      tbl = compptr->ac_tbl_no;
  172|    672|      pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  173|    672|      jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, pdtbl);
  ------------------
  |  |  206|    672|#define FALSE   0               /* values of boolean */
  ------------------
  174|       |      /* remember the single active table */
  175|    672|      entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
  176|    672|    }
  177|       |    /* Initialize DC predictions to 0 */
  178|  1.17k|    entropy->saved.last_dc_val[ci] = 0;
  179|  1.17k|  }
  180|       |
  181|       |  /* Initialize bitread state variables */
  182|    842|  entropy->bitstate.bits_left = 0;
  183|    842|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  184|    842|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|    842|#define FALSE   0               /* values of boolean */
  ------------------
  185|       |
  186|       |  /* Initialize private state variables */
  187|    842|  entropy->saved.EOBRUN = 0;
  188|       |
  189|       |  /* Initialize restart counter */
  190|    842|  entropy->restarts_to_go = cinfo->restart_interval;
  191|    842|}
jdphuff.c:decode_mcu_DC_first:
  291|  87.8k|{
  292|  87.8k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  293|  87.8k|  int Al = cinfo->Al;
  294|  87.8k|  register int s, r;
  295|  87.8k|  int blkn, ci;
  296|  87.8k|  JBLOCKROW block;
  297|  87.8k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  87.8k|  register bit_buf_type get_buffer; \
  |  |  126|  87.8k|  register int bits_left; \
  |  |  127|  87.8k|  bitread_working_state br_state
  ------------------
  298|  87.8k|  savable_state state;
  299|  87.8k|  d_derived_tbl *tbl;
  300|  87.8k|  jpeg_component_info *compptr;
  301|       |
  302|       |  /* Process restart marker if needed; may have to suspend */
  303|  87.8k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (303:7): [True: 0, False: 87.8k]
  ------------------
  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|  87.8k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (312:7): [True: 87.8k, False: 0]
  ------------------
  313|       |
  314|       |    /* Load up working state */
  315|  87.8k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  87.8k|  br_state.cinfo = cinfop; \
  |  |  131|  87.8k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  87.8k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  87.8k|  get_buffer = permstate.get_buffer; \
  |  |  134|  87.8k|  bits_left = permstate.bits_left;
  ------------------
  316|  87.8k|    state = entropy->saved;
  317|       |
  318|       |    /* Outer loop handles each block in the MCU */
  319|       |
  320|   351k|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (320:20): [True: 263k, False: 87.8k]
  ------------------
  321|   263k|      block = MCU_data[blkn];
  322|   263k|      ci = cinfo->MCU_membership[blkn];
  323|   263k|      compptr = cinfo->cur_comp_info[ci];
  324|   263k|      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|   263k|      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
  ------------------
  |  |  200|   263k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   263k|  register int nb, look; \
  |  |  202|   263k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   263k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 22.7k, False: 240k]
  |  |  ------------------
  |  |  203|  22.7k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 22.7k]
  |  |  ------------------
  |  |  204|  22.7k|      { failaction; } \
  |  |  205|  22.7k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  22.7k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  22.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 435, False: 22.3k]
  |  |  ------------------
  |  |  207|    435|      nb = 1;  goto slowlabel; \
  |  |  208|    435|    } \
  |  |  209|  22.7k|  } \
  |  |  210|   263k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   263k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   263k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   263k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   263k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 263k, False: 20]
  |  |  ------------------
  |  |  212|   263k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   263k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   263k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   263k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   263k|  } else { \
  |  |  215|    455|slowlabel: \
  |  |  216|    455|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 455]
  |  |  ------------------
  |  |  217|    455|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|    455|      { failaction; } \
  |  |  219|    455|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|    455|  } \
  |  |  221|   263k|}
  ------------------
  330|   263k|      if (s) {
  ------------------
  |  Branch (330:11): [True: 174k, False: 89.4k]
  ------------------
  331|   174k|        CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|   174k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   174k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 1.76k, False: 172k]
  |  |  ------------------
  |  |  162|  1.76k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 1.76k]
  |  |  ------------------
  |  |  163|  1.76k|      { action; } \
  |  |  164|  1.76k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  1.76k|  } \
  |  |  166|   174k|}
  ------------------
  332|   174k|        r = GET_BITS(s);
  ------------------
  |  |  169|   174k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  333|   174k|        s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|   174k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|  85.9k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 85.9k, False: 88.2k]
  |  |  ------------------
  ------------------
  334|   174k|      }
  335|       |
  336|       |      /* Convert DC difference to actual value, update last_dc_val */
  337|   263k|      if ((state.last_dc_val[ci] >= 0 &&
  ------------------
  |  Branch (337:12): [True: 127k, False: 136k]
  ------------------
  338|   263k|           s > INT_MAX - state.last_dc_val[ci]) ||
  ------------------
  |  Branch (338:12): [True: 0, False: 127k]
  ------------------
  339|   263k|          (state.last_dc_val[ci] < 0 && s < INT_MIN - state.last_dc_val[ci]))
  ------------------
  |  Branch (339:12): [True: 136k, False: 127k]
  |  Branch (339:41): [True: 0, False: 136k]
  ------------------
  340|      0|        ERREXIT(cinfo, JERR_BAD_DCT_COEF);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  341|   263k|      s += state.last_dc_val[ci];
  342|   263k|      state.last_dc_val[ci] = s;
  343|       |      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
  344|   263k|      (*block)[0] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|   263k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  345|   263k|    }
  346|       |
  347|       |    /* Completed MCU, so update state */
  348|  87.8k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  87.8k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  87.8k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  87.8k|  permstate.get_buffer = get_buffer; \
  |  |  140|  87.8k|  permstate.bits_left = bits_left
  ------------------
  349|  87.8k|    entropy->saved = state;
  350|  87.8k|  }
  351|       |
  352|       |  /* Account for restart interval (no-op if not using restarts) */
  353|  87.8k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (353:7): [True: 0, False: 87.8k]
  ------------------
  354|      0|    entropy->restarts_to_go--;
  355|       |
  356|  87.8k|  return TRUE;
  ------------------
  |  |  209|  87.8k|#define TRUE    1
  ------------------
  357|  87.8k|}
jdphuff.c:decode_mcu_AC_first:
  367|   407k|{
  368|   407k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  369|   407k|  int Se = cinfo->Se;
  370|   407k|  int Al = cinfo->Al;
  371|   407k|  register int s, k, r;
  372|   407k|  unsigned int EOBRUN;
  373|   407k|  JBLOCKROW block;
  374|   407k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   407k|  register bit_buf_type get_buffer; \
  |  |  126|   407k|  register int bits_left; \
  |  |  127|   407k|  bitread_working_state br_state
  ------------------
  375|   407k|  d_derived_tbl *tbl;
  376|       |
  377|       |  /* Process restart marker if needed; may have to suspend */
  378|   407k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (378:7): [True: 0, False: 407k]
  ------------------
  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|   407k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (387:7): [True: 407k, False: 0]
  ------------------
  388|       |
  389|       |    /* Load up working state.
  390|       |     * We can avoid loading/saving bitread state if in an EOB run.
  391|       |     */
  392|   407k|    EOBRUN = entropy->saved.EOBRUN;     /* only part of saved state we need */
  393|       |
  394|       |    /* There is always only one block per MCU */
  395|       |
  396|   407k|    if (EOBRUN > 0)             /* if it's a band of zeroes... */
  ------------------
  |  Branch (396:9): [True: 144k, False: 262k]
  ------------------
  397|   144k|      EOBRUN--;                 /* ...process it now (we do nothing) */
  398|   262k|    else {
  399|   262k|      BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   262k|  br_state.cinfo = cinfop; \
  |  |  131|   262k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   262k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   262k|  get_buffer = permstate.get_buffer; \
  |  |  134|   262k|  bits_left = permstate.bits_left;
  ------------------
  400|   262k|      block = MCU_data[0];
  401|   262k|      tbl = entropy->ac_derived_tbl;
  402|       |
  403|  2.11M|      for (k = cinfo->Ss; k <= Se; k++) {
  ------------------
  |  Branch (403:27): [True: 2.02M, False: 96.9k]
  ------------------
  404|  2.02M|        HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
  ------------------
  |  |  200|  2.02M|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  2.02M|  register int nb, look; \
  |  |  202|  2.02M|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.02M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 181k, False: 1.83M]
  |  |  ------------------
  |  |  203|   181k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 181k]
  |  |  ------------------
  |  |  204|   181k|      { failaction; } \
  |  |  205|   181k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|   181k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   181k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 227, False: 181k]
  |  |  ------------------
  |  |  207|    227|      nb = 1;  goto slowlabel; \
  |  |  208|    227|    } \
  |  |  209|   181k|  } \
  |  |  210|  2.02M|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  2.02M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  2.02M|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.02M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.02M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 1.98M, False: 34.8k]
  |  |  ------------------
  |  |  212|  1.98M|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  1.98M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  1.98M|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  1.98M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  1.98M|  } else { \
  |  |  215|  35.0k|slowlabel: \
  |  |  216|  35.0k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 35.0k]
  |  |  ------------------
  |  |  217|  35.0k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  35.0k|      { failaction; } \
  |  |  219|  35.0k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  35.0k|  } \
  |  |  221|  2.02M|}
  ------------------
  405|  2.02M|        r = s >> 4;
  406|  2.02M|        s &= 15;
  407|  2.02M|        if (s) {
  ------------------
  |  Branch (407:13): [True: 1.85M, False: 169k]
  ------------------
  408|  1.85M|          k += r;
  409|  1.85M|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  1.85M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  1.85M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 10.8k, False: 1.84M]
  |  |  ------------------
  |  |  162|  10.8k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 10.8k]
  |  |  ------------------
  |  |  163|  10.8k|      { action; } \
  |  |  164|  10.8k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  10.8k|  } \
  |  |  166|  1.85M|}
  ------------------
  410|  1.85M|          r = GET_BITS(s);
  ------------------
  |  |  169|  1.85M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  411|  1.85M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|  1.85M|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|   927k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 927k, False: 924k]
  |  |  ------------------
  ------------------
  412|       |          /* Scale and output coefficient in natural (dezigzagged) order */
  413|  1.85M|          (*block)[jpeg_natural_order[k]] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|  1.85M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  414|  1.85M|        } else {
  415|   169k|          if (r == 15) {        /* ZRL */
  ------------------
  |  Branch (415:15): [True: 3.14k, False: 165k]
  ------------------
  416|  3.14k|            k += 15;            /* skip 15 zeroes in band */
  417|   165k|          } else {              /* EOBr, run length is 2^r + appended bits */
  418|   165k|            EOBRUN = 1 << r;
  419|   165k|            if (r) {            /* EOBr, r > 0 */
  ------------------
  |  Branch (419:17): [True: 18.2k, False: 147k]
  ------------------
  420|  18.2k|              CHECK_BIT_BUFFER(br_state, r, return FALSE);
  ------------------
  |  |  160|  18.2k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  18.2k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 319, False: 17.8k]
  |  |  ------------------
  |  |  162|    319|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 319]
  |  |  ------------------
  |  |  163|    319|      { action; } \
  |  |  164|    319|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    319|  } \
  |  |  166|  18.2k|}
  ------------------
  421|  18.2k|              r = GET_BITS(r);
  ------------------
  |  |  169|  18.2k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  422|  18.2k|              EOBRUN += r;
  423|  18.2k|            }
  424|   165k|            EOBRUN--;           /* this band is processed at this moment */
  425|   165k|            break;              /* force end-of-band */
  426|   165k|          }
  427|   169k|        }
  428|  2.02M|      }
  429|       |
  430|   262k|      BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   262k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   262k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   262k|  permstate.get_buffer = get_buffer; \
  |  |  140|   262k|  permstate.bits_left = bits_left
  ------------------
  431|   262k|    }
  432|       |
  433|       |    /* Completed MCU, so update state */
  434|   407k|    entropy->saved.EOBRUN = EOBRUN;     /* only part of saved state we need */
  435|   407k|  }
  436|       |
  437|       |  /* Account for restart interval (no-op if not using restarts) */
  438|   407k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (438:7): [True: 0, False: 407k]
  ------------------
  439|      0|    entropy->restarts_to_go--;
  440|       |
  441|   407k|  return TRUE;
  ------------------
  |  |  209|   407k|#define TRUE    1
  ------------------
  442|   407k|}

j12init_d_post_controller:
  267|      2|{
  268|      2|  my_post_ptr post;
  269|       |
  270|      2|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  Branch (270:7): [True: 0, False: 2]
  ------------------
  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|      2|  post = (my_post_ptr)
  274|      2|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  275|      2|                                sizeof(my_post_controller));
  276|      2|  cinfo->post = (struct jpeg_d_post_controller *)post;
  277|      2|  post->pub.start_pass = start_pass_dpost;
  278|      2|  post->whole_image = NULL;     /* flag for no virtual arrays */
  279|      2|  post->buffer = NULL;          /* flag for no strip buffer */
  280|       |
  281|       |  /* Create the quantization buffer, if needed */
  282|      2|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (282:7): [True: 0, False: 2]
  ------------------
  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|      2|}
jdpostct.c:start_pass_dpost:
   85|  1.45k|{
   86|  1.45k|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|  1.45k|  switch (pass_mode) {
   89|  1.45k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 1.45k, False: 0]
  ------------------
   90|  1.45k|#if BITS_IN_JSAMPLE != 16
   91|  1.45k|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (91:9): [True: 0, False: 1.45k]
  ------------------
   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|  1.45k|#endif
  105|  1.45k|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|  1.45k|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  143|  1.45k|#define _post_process_data  post_process_data_12
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  148|  1.45k|#define _upsample  upsample_12
  ------------------
  110|  1.45k|    }
  111|  1.45k|    break;
  112|      0|#if defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16
  113|      0|  case JBUF_SAVE_AND_PASS:
  ------------------
  |  Branch (113:3): [True: 0, False: 1.45k]
  ------------------
  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: 1.45k]
  ------------------
  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: 1.45k]
  ------------------
  127|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  128|      0|    break;
  129|  1.45k|  }
  130|  1.45k|  post->starting_row = post->next_row = 0;
  131|  1.45k|}
jinit_d_post_controller:
  267|  1.69k|{
  268|  1.69k|  my_post_ptr post;
  269|       |
  270|  1.69k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   34|  1.69k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (270:7): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|  post = (my_post_ptr)
  274|  1.69k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.69k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  275|  1.69k|                                sizeof(my_post_controller));
  276|  1.69k|  cinfo->post = (struct jpeg_d_post_controller *)post;
  277|  1.69k|  post->pub.start_pass = start_pass_dpost;
  278|  1.69k|  post->whole_image = NULL;     /* flag for no virtual arrays */
  279|  1.69k|  post->buffer = NULL;          /* flag for no strip buffer */
  280|       |
  281|       |  /* Create the quantization buffer, if needed */
  282|  1.69k|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (282:7): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|}

jinit_upsampler:
  417|  1.69k|{
  418|  1.69k|  my_upsample_ptr upsample;
  419|  1.69k|  int ci;
  420|  1.69k|  jpeg_component_info *compptr;
  421|  1.69k|  boolean need_buffer, do_fancy;
  422|  1.69k|  int h_in_group, v_in_group, h_out_group, v_out_group;
  423|       |
  424|  1.69k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   34|  1.69k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (424:7): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (427:7): [True: 1.69k, False: 0]
  ------------------
  428|  1.69k|    upsample = (my_upsample_ptr)
  429|  1.69k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|  1.69k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  430|  1.69k|                                  sizeof(my_upsampler));
  431|  1.69k|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  432|  1.69k|    upsample->pub.start_pass = start_pass_upsample;
  433|  1.69k|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  263|  1.69k|#define _upsample  upsample
  ------------------
  434|  1.69k|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  206|  1.69k|#define FALSE   0               /* values of boolean */
  ------------------
  435|  1.69k|  } else
  436|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  437|       |
  438|  1.69k|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (438:7): [True: 0, False: 1.69k]
  ------------------
  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|  1.69k|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|  1.69k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (444:14): [True: 1.69k, False: 0]
  |  Branch (444:44): [True: 1.69k, False: 5]
  ------------------
  445|       |
  446|       |  /* Verify we can handle the sampling factors, select per-component methods,
  447|       |   * and create storage as needed.
  448|       |   */
  449|  7.13k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (449:44): [True: 5.44k, False: 1.69k]
  ------------------
  450|  5.44k|       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|  5.44k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  5.44k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  455|  5.44k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  5.44k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  456|  5.44k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  5.44k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  457|  5.44k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  5.44k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  458|  5.44k|    h_out_group = cinfo->max_h_samp_factor;
  459|  5.44k|    v_out_group = cinfo->max_v_samp_factor;
  460|  5.44k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  461|  5.44k|    need_buffer = TRUE;
  ------------------
  |  |  209|  5.44k|#define TRUE    1
  ------------------
  462|  5.44k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (462:9): [True: 0, False: 5.44k]
  ------------------
  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|  5.44k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (466:16): [True: 4.86k, False: 580]
  |  Branch (466:45): [True: 4.73k, False: 124]
  ------------------
  467|       |      /* Fullsize components can be processed without any work. */
  468|  4.73k|      upsample->methods[ci] = fullsize_upsample;
  469|  4.73k|      need_buffer = FALSE;
  ------------------
  |  |  206|  4.73k|#define FALSE   0               /* values of boolean */
  ------------------
  470|  4.73k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (470:16): [True: 580, False: 124]
  |  Branch (470:49): [True: 0, False: 580]
  ------------------
  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|    704|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (487:16): [True: 124, False: 580]
  ------------------
  488|    704|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (488:16): [True: 12, False: 112]
  |  Branch (488:49): [True: 12, 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|     12|        upsample->methods[ci] = h1v2_fancy_upsample;
  497|     12|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  209|     12|#define TRUE    1
  ------------------
  498|    692|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (498:16): [True: 580, False: 112]
  ------------------
  499|    692|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (499:16): [True: 580, False: 0]
  ------------------
  500|       |      /* Special cases for 2h2v upsampling */
  501|    580|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (501:11): [True: 580, False: 0]
  |  Branch (501:23): [True: 580, False: 0]
  ------------------
  502|    580|#ifdef WITH_SIMD
  503|    580|        if (jsimd_can_h2v2_fancy_upsample())
  ------------------
  |  Branch (503:13): [True: 0, False: 580]
  ------------------
  504|      0|          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  505|    580|        else
  506|    580|#endif
  507|    580|          upsample->methods[ci] = h2v2_fancy_upsample;
  508|    580|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  209|    580|#define TRUE    1
  ------------------
  509|    580|      } 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|    580|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (517:16): [True: 112, False: 0]
  ------------------
  518|    112|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (518:16): [True: 110, False: 2]
  ------------------
  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|    110|        upsample->methods[ci] = int_upsample;
  526|    110|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  527|    110|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  528|    110|    } else
  529|      2|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  530|  5.44k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (530:9): [True: 702, False: 4.73k]
  |  Branch (530:24): [True: 702, False: 0]
  ------------------
  531|    702|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  532|    702|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    702|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  533|    702|         (JDIMENSION)jround_up((long)cinfo->output_width,
  534|    702|                               (long)cinfo->max_h_samp_factor),
  535|    702|         (JDIMENSION)cinfo->max_v_samp_factor);
  536|    702|    }
  537|  5.44k|  }
  538|  1.69k|}
jdsample.c:start_pass_upsample:
   43|  1.45k|{
   44|  1.45k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   45|       |
   46|       |  /* Mark the conversion buffer empty */
   47|  1.45k|  upsample->next_row_out = cinfo->max_v_samp_factor;
   48|       |  /* Initialize total-height counter for detecting bottom of image */
   49|  1.45k|  upsample->rows_to_go = cinfo->output_height;
   50|  1.45k|}
jdsample.c:sep_upsample:
   66|   158k|{
   67|   158k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   68|   158k|  int ci;
   69|   158k|  jpeg_component_info *compptr;
   70|   158k|  JDIMENSION num_rows;
   71|       |
   72|       |  /* Fill the conversion buffer, if it's empty */
   73|   158k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (73:7): [True: 154k, False: 3.88k]
  ------------------
   74|   627k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (74:46): [True: 472k, False: 154k]
  ------------------
   75|   472k|         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|   472k|      (*upsample->methods[ci]) (cinfo, compptr,
   80|   472k|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   81|   472k|        upsample->color_buf + ci);
   82|   472k|    }
   83|   154k|    upsample->next_row_out = 0;
   84|   154k|  }
   85|       |
   86|       |  /* Color-convert and emit rows */
   87|       |
   88|       |  /* How many we have in the buffer: */
   89|   158k|  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|   158k|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (93:7): [True: 4, False: 158k]
  ------------------
   94|      4|    num_rows = upsample->rows_to_go;
   95|       |  /* And not more than what the client can accept: */
   96|   158k|  out_rows_avail -= *out_row_ctr;
   97|   158k|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (97:7): [True: 3.88k, False: 154k]
  ------------------
   98|  3.88k|    num_rows = out_rows_avail;
   99|       |
  100|   158k|  (*cinfo->cconvert->_color_convert) (cinfo, upsample->color_buf,
  ------------------
  |  |  265|   158k|#define _color_convert  color_convert
  ------------------
  101|   158k|                                      (JDIMENSION)upsample->next_row_out,
  102|   158k|                                      output_buf + *out_row_ctr,
  103|   158k|                                      (int)num_rows);
  104|       |
  105|       |  /* Adjust counts */
  106|   158k|  *out_row_ctr += num_rows;
  107|   158k|  upsample->rows_to_go -= num_rows;
  108|   158k|  upsample->next_row_out += num_rows;
  109|       |  /* When the buffer is emptied, declare this input row group consumed */
  110|   158k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (110:7): [True: 154k, False: 3.89k]
  ------------------
  111|   154k|    (*in_row_group_ctr)++;
  112|   158k|}
jdsample.c:fullsize_upsample:
  131|   465k|{
  132|   465k|  *output_data_ptr = input_data;
  133|   465k|}
jdsample.c:h1v2_fancy_upsample:
  318|  1.04k|{
  319|  1.04k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  228|  1.04k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  320|  1.04k|  _JSAMPROW inptr0, inptr1, outptr;
  ------------------
  |  |  227|  1.04k|#define _JSAMPROW  JSAMPROW
  ------------------
  321|  1.04k|#if BITS_IN_JSAMPLE == 8
  322|  1.04k|  int thiscolsum, bias;
  323|       |#else
  324|       |  JLONG thiscolsum, bias;
  325|       |#endif
  326|  1.04k|  JDIMENSION colctr;
  327|  1.04k|  int inrow, outrow, v;
  328|       |
  329|  1.04k|  inrow = outrow = 0;
  330|  2.08k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (330:10): [True: 1.04k, False: 1.04k]
  ------------------
  331|  3.13k|    for (v = 0; v < 2; v++) {
  ------------------
  |  Branch (331:17): [True: 2.08k, False: 1.04k]
  ------------------
  332|       |      /* inptr0 points to nearest input row, inptr1 points to next nearest */
  333|  2.08k|      inptr0 = input_data[inrow];
  334|  2.08k|      if (v == 0) {             /* next nearest is row above */
  ------------------
  |  Branch (334:11): [True: 1.04k, False: 1.04k]
  ------------------
  335|  1.04k|        inptr1 = input_data[inrow - 1];
  336|  1.04k|        bias = 1;
  337|  1.04k|      } else {                  /* next nearest is row below */
  338|  1.04k|        inptr1 = input_data[inrow + 1];
  339|  1.04k|        bias = 2;
  340|  1.04k|      }
  341|  2.08k|      outptr = output_data[outrow++];
  342|       |
  343|   421k|      for (colctr = 0; colctr < compptr->downsampled_width; colctr++) {
  ------------------
  |  Branch (343:24): [True: 419k, False: 2.08k]
  ------------------
  344|   419k|        thiscolsum = (*inptr0++) * 3 + (*inptr1++);
  345|   419k|        *outptr++ = (_JSAMPLE)((thiscolsum + bias) >> 2);
  346|   419k|      }
  347|  2.08k|    }
  348|  1.04k|    inrow++;
  349|  1.04k|  }
  350|  1.04k|}
jdsample.c:h2v2_fancy_upsample:
  364|  4.79k|{
  365|  4.79k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  228|  4.79k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  366|  4.79k|  register _JSAMPROW inptr0, inptr1, outptr;
  367|  4.79k|#if BITS_IN_JSAMPLE == 8
  368|  4.79k|  register int thiscolsum, lastcolsum, nextcolsum;
  369|       |#else
  370|       |  register JLONG thiscolsum, lastcolsum, nextcolsum;
  371|       |#endif
  372|  4.79k|  register JDIMENSION colctr;
  373|  4.79k|  int inrow, outrow, v;
  374|       |
  375|  4.79k|  inrow = outrow = 0;
  376|  9.58k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (376:10): [True: 4.79k, False: 4.79k]
  ------------------
  377|  14.3k|    for (v = 0; v < 2; v++) {
  ------------------
  |  Branch (377:17): [True: 9.58k, False: 4.79k]
  ------------------
  378|       |      /* inptr0 points to nearest input row, inptr1 points to next nearest */
  379|  9.58k|      inptr0 = input_data[inrow];
  380|  9.58k|      if (v == 0)               /* next nearest is row above */
  ------------------
  |  Branch (380:11): [True: 4.79k, False: 4.79k]
  ------------------
  381|  4.79k|        inptr1 = input_data[inrow - 1];
  382|  4.79k|      else                      /* next nearest is row below */
  383|  4.79k|        inptr1 = input_data[inrow + 1];
  384|  9.58k|      outptr = output_data[outrow++];
  385|       |
  386|       |      /* Special case for first column */
  387|  9.58k|      thiscolsum = (*inptr0++) * 3 + (*inptr1++);
  388|  9.58k|      nextcolsum = (*inptr0++) * 3 + (*inptr1++);
  389|  9.58k|      *outptr++ = (_JSAMPLE)((thiscolsum * 4 + 8) >> 4);
  390|  9.58k|      *outptr++ = (_JSAMPLE)((thiscolsum * 3 + nextcolsum + 7) >> 4);
  391|  9.58k|      lastcolsum = thiscolsum;  thiscolsum = nextcolsum;
  392|       |
  393|   180k|      for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
  ------------------
  |  Branch (393:53): [True: 171k, False: 9.58k]
  ------------------
  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|   171k|        nextcolsum = (*inptr0++) * 3 + (*inptr1++);
  397|   171k|        *outptr++ = (_JSAMPLE)((thiscolsum * 3 + lastcolsum + 8) >> 4);
  398|   171k|        *outptr++ = (_JSAMPLE)((thiscolsum * 3 + nextcolsum + 7) >> 4);
  399|   171k|        lastcolsum = thiscolsum;  thiscolsum = nextcolsum;
  400|   171k|      }
  401|       |
  402|       |      /* Special case for last column */
  403|  9.58k|      *outptr++ = (_JSAMPLE)((thiscolsum * 3 + lastcolsum + 8) >> 4);
  404|  9.58k|      *outptr++ = (_JSAMPLE)((thiscolsum * 4 + 7) >> 4);
  405|  9.58k|    }
  406|  4.79k|    inrow++;
  407|  4.79k|  }
  408|  4.79k|}
jdsample.c:int_upsample:
  163|  1.45k|{
  164|  1.45k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
  165|  1.45k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  228|  1.45k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  166|  1.45k|  register _JSAMPROW inptr, outptr;
  167|  1.45k|  register _JSAMPLE invalue;
  168|  1.45k|  register int h;
  169|  1.45k|  _JSAMPROW outend;
  ------------------
  |  |  227|  1.45k|#define _JSAMPROW  JSAMPROW
  ------------------
  170|  1.45k|  int h_expand, v_expand;
  171|  1.45k|  int inrow, outrow;
  172|       |
  173|  1.45k|  h_expand = upsample->h_expand[compptr->component_index];
  174|  1.45k|  v_expand = upsample->v_expand[compptr->component_index];
  175|       |
  176|  1.45k|  inrow = outrow = 0;
  177|  2.91k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (177:10): [True: 1.45k, False: 1.45k]
  ------------------
  178|       |    /* Generate one output row with proper horizontal expansion */
  179|  1.45k|    inptr = input_data[inrow];
  180|  1.45k|    outptr = output_data[outrow];
  181|  1.45k|    outend = outptr + cinfo->output_width;
  182|  62.2k|    while (outptr < outend) {
  ------------------
  |  Branch (182:12): [True: 60.8k, False: 1.45k]
  ------------------
  183|  60.8k|      invalue = *inptr++;
  184|   121k|      for (h = h_expand; h > 0; h--) {
  ------------------
  |  Branch (184:26): [True: 60.8k, False: 60.8k]
  ------------------
  185|  60.8k|        *outptr++ = invalue;
  186|  60.8k|      }
  187|  60.8k|    }
  188|       |    /* Generate any additional output rows by duplicating the first one */
  189|  1.45k|    if (v_expand > 1) {
  ------------------
  |  Branch (189:9): [True: 1.45k, False: 0]
  ------------------
  190|  1.45k|      _jcopy_sample_rows(output_data, outrow, output_data, outrow + 1,
  ------------------
  |  |  295|  1.45k|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  191|  1.45k|                         v_expand - 1, cinfo->output_width);
  192|  1.45k|    }
  193|  1.45k|    inrow++;
  194|  1.45k|    outrow += v_expand;
  195|  1.45k|  }
  196|  1.45k|}
j12init_upsampler:
  417|      2|{
  418|      2|  my_upsample_ptr upsample;
  419|      2|  int ci;
  420|      2|  jpeg_component_info *compptr;
  421|      2|  boolean need_buffer, do_fancy;
  422|      2|  int h_in_group, v_in_group, h_out_group, v_out_group;
  423|       |
  424|      2|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  Branch (424:7): [True: 0, False: 2]
  ------------------
  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|      2|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (427:7): [True: 2, False: 0]
  ------------------
  428|      2|    upsample = (my_upsample_ptr)
  429|      2|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  430|      2|                                  sizeof(my_upsampler));
  431|      2|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  432|      2|    upsample->pub.start_pass = start_pass_upsample;
  433|      2|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  148|      2|#define _upsample  upsample_12
  ------------------
  434|      2|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  206|      2|#define FALSE   0               /* values of boolean */
  ------------------
  435|      2|  } else
  436|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  437|       |
  438|      2|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (438:7): [True: 0, False: 2]
  ------------------
  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|      2|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|      2|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (444:14): [True: 2, False: 0]
  |  Branch (444:44): [True: 2, False: 0]
  ------------------
  445|       |
  446|       |  /* Verify we can handle the sampling factors, select per-component methods,
  447|       |   * and create storage as needed.
  448|       |   */
  449|      8|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (449:44): [True: 6, False: 2]
  ------------------
  450|      6|       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|      6|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|      6|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  455|      6|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|      6|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  456|      6|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|      6|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  457|      6|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|      6|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  458|      6|    h_out_group = cinfo->max_h_samp_factor;
  459|      6|    v_out_group = cinfo->max_v_samp_factor;
  460|      6|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  461|      6|    need_buffer = TRUE;
  ------------------
  |  |  209|      6|#define TRUE    1
  ------------------
  462|      6|    if (!compptr->component_needed) {
  ------------------
  |  Branch (462:9): [True: 0, False: 6]
  ------------------
  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|      6|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (466:16): [True: 2, False: 4]
  |  Branch (466:45): [True: 2, False: 0]
  ------------------
  467|       |      /* Fullsize components can be processed without any work. */
  468|      2|      upsample->methods[ci] = fullsize_upsample;
  469|      2|      need_buffer = FALSE;
  ------------------
  |  |  206|      2|#define FALSE   0               /* values of boolean */
  ------------------
  470|      4|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (470:16): [True: 4, False: 0]
  |  Branch (470:49): [True: 0, False: 4]
  ------------------
  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|       |#ifdef WITH_SIMD
  474|       |        if (jsimd_can_h2v1_fancy_upsample())
  475|       |          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  476|       |        else
  477|       |#endif
  478|      0|          upsample->methods[ci] = h2v1_fancy_upsample;
  479|      0|      } else {
  480|       |#ifdef WITH_SIMD
  481|       |        if (jsimd_can_h2v1_upsample())
  482|       |          upsample->methods[ci] = jsimd_h2v1_upsample;
  483|       |        else
  484|       |#endif
  485|      0|          upsample->methods[ci] = h2v1_upsample;
  486|      0|      }
  487|      4|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (487:16): [True: 0, False: 4]
  ------------------
  488|      4|               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|      4|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (498:16): [True: 4, False: 0]
  ------------------
  499|      4|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (499:16): [True: 4, False: 0]
  ------------------
  500|       |      /* Special cases for 2h2v upsampling */
  501|      4|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (501:11): [True: 4, False: 0]
  |  Branch (501:23): [True: 4, False: 0]
  ------------------
  502|       |#ifdef WITH_SIMD
  503|       |        if (jsimd_can_h2v2_fancy_upsample())
  504|       |          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  505|       |        else
  506|       |#endif
  507|      4|          upsample->methods[ci] = h2v2_fancy_upsample;
  508|      4|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  209|      4|#define TRUE    1
  ------------------
  509|      4|      } else {
  510|       |#ifdef WITH_SIMD
  511|       |        if (jsimd_can_h2v2_upsample())
  512|       |          upsample->methods[ci] = jsimd_h2v2_upsample;
  513|       |        else
  514|       |#endif
  515|      0|          upsample->methods[ci] = h2v2_upsample;
  516|      0|      }
  517|      4|    } 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|      6|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (530:9): [True: 4, False: 2]
  |  Branch (530:24): [True: 4, False: 0]
  ------------------
  531|      4|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  532|      4|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|      4|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  533|      4|         (JDIMENSION)jround_up((long)cinfo->output_width,
  534|      4|                               (long)cinfo->max_h_samp_factor),
  535|      4|         (JDIMENSION)cinfo->max_v_samp_factor);
  536|      4|    }
  537|      6|  }
  538|      2|}

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

jpeg_idct_islow:
  176|  1.41M|{
  177|  1.41M|  JLONG tmp0, tmp1, tmp2, tmp3;
  178|  1.41M|  JLONG tmp10, tmp11, tmp12, tmp13;
  179|  1.41M|  JLONG z1, z2, z3, z4, z5;
  180|  1.41M|  JCOEFPTR inptr;
  181|  1.41M|  ISLOW_MULT_TYPE *quantptr;
  182|  1.41M|  int *wsptr;
  183|  1.41M|  _JSAMPROW outptr;
  ------------------
  |  |  227|  1.41M|#define _JSAMPROW  JSAMPROW
  ------------------
  184|  1.41M|  _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |  222|  1.41M|#define _JSAMPLE  JSAMPLE
  ------------------
                _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |   89|  1.41M|  ((_JSAMPLE *)((cinfo)->sample_range_limit) + _CENTERJSAMPLE)
  |  |  ------------------
  |  |  |  |  225|  1.41M|#define _CENTERJSAMPLE   CENTERJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  1.41M|#define CENTERJSAMPLE    128
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  185|  1.41M|  int ctr;
  186|  1.41M|  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|  1.41M|  inptr = coef_block;
  194|  1.41M|  quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
  195|  1.41M|  wsptr = workspace;
  196|  12.7M|  for (ctr = DCTSIZE; ctr > 0; ctr--) {
  ------------------
  |  |   66|  1.41M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (196:23): [True: 11.3M, False: 1.41M]
  ------------------
  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|  11.3M|    if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|  11.3M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|  10.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (206:9): [True: 10.1M, False: 1.16M]
  |  Branch (206:36): [True: 10.0M, False: 131k]
  ------------------
  207|  11.3M|        inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|  10.0M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|  10.0M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (207:9): [True: 10.0M, False: 44.2k]
  |  Branch (207:36): [True: 9.98M, False: 28.9k]
  ------------------
  208|  11.3M|        inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|  9.98M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|  9.96M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (208:9): [True: 9.96M, False: 22.2k]
  |  Branch (208:36): [True: 9.94M, False: 16.3k]
  ------------------
  209|  11.3M|        inptr[DCTSIZE * 7] == 0) {
  ------------------
  |  |   66|  9.94M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (209:9): [True: 9.93M, False: 11.9k]
  ------------------
  210|       |      /* AC terms all zero */
  211|  9.93M|      int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
  ------------------
  |  |   85|  9.93M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  212|  9.93M|                             quantptr[DCTSIZE * 0]), PASS1_BITS);
  213|       |
  214|  9.93M|      wsptr[DCTSIZE * 0] = dcval;
  ------------------
  |  |   66|  9.93M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  215|  9.93M|      wsptr[DCTSIZE * 1] = dcval;
  ------------------
  |  |   66|  9.93M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  216|  9.93M|      wsptr[DCTSIZE * 2] = dcval;
  ------------------
  |  |   66|  9.93M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  217|  9.93M|      wsptr[DCTSIZE * 3] = dcval;
  ------------------
  |  |   66|  9.93M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  218|  9.93M|      wsptr[DCTSIZE * 4] = dcval;
  ------------------
  |  |   66|  9.93M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  219|  9.93M|      wsptr[DCTSIZE * 5] = dcval;
  ------------------
  |  |   66|  9.93M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  220|  9.93M|      wsptr[DCTSIZE * 6] = dcval;
  ------------------
  |  |   66|  9.93M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  221|  9.93M|      wsptr[DCTSIZE * 7] = dcval;
  ------------------
  |  |   66|  9.93M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  222|       |
  223|  9.93M|      inptr++;                  /* advance pointers to next column */
  224|  9.93M|      quantptr++;
  225|  9.93M|      wsptr++;
  226|  9.93M|      continue;
  227|  9.93M|    }
  228|       |
  229|       |    /* Even part: reverse the even part of the forward DCT. */
  230|       |    /* The rotator is sqrt(2)*c(-6). */
  231|       |
  232|  1.42M|    z2 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
  ------------------
  |  |  165|  1.42M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  233|  1.42M|    z3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
  ------------------
  |  |  165|  1.42M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  234|       |
  235|  1.42M|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  154|  1.42M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  1.42M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  236|  1.42M|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  154|  1.42M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  1.42M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  237|  1.42M|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  154|  1.42M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  1.42M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  238|       |
  239|  1.42M|    z2 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
  ------------------
  |  |  165|  1.42M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  240|  1.42M|    z3 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
  ------------------
  |  |  165|  1.42M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  241|       |
  242|  1.42M|    tmp0 = LEFT_SHIFT(z2 + z3, CONST_BITS);
  ------------------
  |  |   85|  1.42M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  243|  1.42M|    tmp1 = LEFT_SHIFT(z2 - z3, CONST_BITS);
  ------------------
  |  |   85|  1.42M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  244|       |
  245|  1.42M|    tmp10 = tmp0 + tmp3;
  246|  1.42M|    tmp13 = tmp0 - tmp3;
  247|  1.42M|    tmp11 = tmp1 + tmp2;
  248|  1.42M|    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|  1.42M|    tmp0 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
  ------------------
  |  |  165|  1.42M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  255|  1.42M|    tmp1 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
  ------------------
  |  |  165|  1.42M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  256|  1.42M|    tmp2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
  ------------------
  |  |  165|  1.42M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  257|  1.42M|    tmp3 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
  ------------------
  |  |  165|  1.42M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  258|       |
  259|  1.42M|    z1 = tmp0 + tmp3;
  260|  1.42M|    z2 = tmp1 + tmp2;
  261|  1.42M|    z3 = tmp0 + tmp2;
  262|  1.42M|    z4 = tmp1 + tmp3;
  263|  1.42M|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  154|  1.42M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  1.42M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  264|       |
  265|  1.42M|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  154|  1.42M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  1.42M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  266|  1.42M|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  154|  1.42M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  1.42M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  267|  1.42M|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  154|  1.42M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  1.42M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  268|  1.42M|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  154|  1.42M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  1.42M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  269|  1.42M|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  154|  1.42M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  1.42M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  270|  1.42M|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  154|  1.42M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  1.42M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  271|  1.42M|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  154|  1.42M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  1.42M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  272|  1.42M|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  154|  1.42M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  1.42M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  273|       |
  274|  1.42M|    z3 += z5;
  275|  1.42M|    z4 += z5;
  276|       |
  277|  1.42M|    tmp0 += z1 + z3;
  278|  1.42M|    tmp1 += z2 + z4;
  279|  1.42M|    tmp2 += z2 + z3;
  280|  1.42M|    tmp3 += z1 + z4;
  281|       |
  282|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  283|       |
  284|  1.42M|    wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.42M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  1.42M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  1.42M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  285|  1.42M|    wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.42M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  1.42M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  1.42M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  286|  1.42M|    wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.42M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  1.42M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  1.42M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  287|  1.42M|    wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.42M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  1.42M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  1.42M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  288|  1.42M|    wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.42M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  1.42M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  1.42M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  289|  1.42M|    wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.42M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  1.42M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  1.42M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  290|  1.42M|    wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.42M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  1.42M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  1.42M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  291|  1.42M|    wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.42M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  191|  1.42M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  1.42M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  292|       |
  293|  1.42M|    inptr++;                    /* advance pointers to next column */
  294|  1.42M|    quantptr++;
  295|  1.42M|    wsptr++;
  296|  1.42M|  }
  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|  1.41M|  wsptr = workspace;
  303|  12.7M|  for (ctr = 0; ctr < DCTSIZE; ctr++) {
  ------------------
  |  |   66|  12.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (303:17): [True: 11.3M, False: 1.41M]
  ------------------
  304|  11.3M|    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|  11.3M|#ifndef NO_ZERO_ROW_TEST
  314|  11.3M|    if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
  ------------------
  |  Branch (314:9): [True: 9.05M, False: 2.29M]
  |  Branch (314:26): [True: 9.00M, False: 52.4k]
  |  Branch (314:43): [True: 8.99M, False: 12.0k]
  |  Branch (314:60): [True: 8.98M, False: 5.14k]
  ------------------
  315|  11.3M|        wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
  ------------------
  |  Branch (315:9): [True: 8.98M, False: 7.86k]
  |  Branch (315:26): [True: 8.97M, False: 8.21k]
  |  Branch (315:43): [True: 8.97M, False: 840]
  ------------------
  316|       |      /* AC terms all zero */
  317|  8.97M|      _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  222|  8.97M|#define _JSAMPLE  JSAMPLE
  ------------------
                    _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  191|  8.97M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  8.97M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  318|  8.97M|                                                PASS1_BITS + 3) & RANGE_MASK];
  ------------------
  |  |   91|  8.97M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  8.97M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  8.97M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  319|       |
  320|  8.97M|      outptr[0] = dcval;
  321|  8.97M|      outptr[1] = dcval;
  322|  8.97M|      outptr[2] = dcval;
  323|  8.97M|      outptr[3] = dcval;
  324|  8.97M|      outptr[4] = dcval;
  325|  8.97M|      outptr[5] = dcval;
  326|  8.97M|      outptr[6] = dcval;
  327|  8.97M|      outptr[7] = dcval;
  328|       |
  329|  8.97M|      wsptr += DCTSIZE;         /* advance pointer to next row */
  ------------------
  |  |   66|  8.97M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  330|  8.97M|      continue;
  331|  8.97M|    }
  332|  2.38M|#endif
  333|       |
  334|       |    /* Even part: reverse the even part of the forward DCT. */
  335|       |    /* The rotator is sqrt(2)*c(-6). */
  336|       |
  337|  2.38M|    z2 = (JLONG)wsptr[2];
  338|  2.38M|    z3 = (JLONG)wsptr[6];
  339|       |
  340|  2.38M|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  154|  2.38M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  2.38M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  341|  2.38M|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  154|  2.38M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  2.38M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  342|  2.38M|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  154|  2.38M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  2.38M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  343|       |
  344|  2.38M|    tmp0 = LEFT_SHIFT((JLONG)wsptr[0] + (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|  2.38M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  345|  2.38M|    tmp1 = LEFT_SHIFT((JLONG)wsptr[0] - (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|  2.38M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  346|       |
  347|  2.38M|    tmp10 = tmp0 + tmp3;
  348|  2.38M|    tmp13 = tmp0 - tmp3;
  349|  2.38M|    tmp11 = tmp1 + tmp2;
  350|  2.38M|    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|  2.38M|    tmp0 = (JLONG)wsptr[7];
  357|  2.38M|    tmp1 = (JLONG)wsptr[5];
  358|  2.38M|    tmp2 = (JLONG)wsptr[3];
  359|  2.38M|    tmp3 = (JLONG)wsptr[1];
  360|       |
  361|  2.38M|    z1 = tmp0 + tmp3;
  362|  2.38M|    z2 = tmp1 + tmp2;
  363|  2.38M|    z3 = tmp0 + tmp2;
  364|  2.38M|    z4 = tmp1 + tmp3;
  365|  2.38M|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  154|  2.38M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  2.38M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  366|       |
  367|  2.38M|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  154|  2.38M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  2.38M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  368|  2.38M|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  154|  2.38M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  2.38M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  369|  2.38M|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  154|  2.38M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  2.38M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  370|  2.38M|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  154|  2.38M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  2.38M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  371|  2.38M|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  154|  2.38M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  2.38M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  372|  2.38M|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  154|  2.38M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  2.38M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  373|  2.38M|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  154|  2.38M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  2.38M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  374|  2.38M|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  154|  2.38M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  210|  2.38M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  375|       |
  376|  2.38M|    z3 += z5;
  377|  2.38M|    z4 += z5;
  378|       |
  379|  2.38M|    tmp0 += z1 + z3;
  380|  2.38M|    tmp1 += z2 + z4;
  381|  2.38M|    tmp2 += z2 + z3;
  382|  2.38M|    tmp3 += z1 + z4;
  383|       |
  384|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  385|       |
  386|  2.38M|    outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp3,
  ------------------
  |  |  191|  2.38M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  2.38M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  387|  2.38M|                                         CONST_BITS + PASS1_BITS + 3) &
  388|  2.38M|                            RANGE_MASK];
  ------------------
  |  |   91|  2.38M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  2.38M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  2.38M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  389|  2.38M|    outptr[7] = range_limit[(int)DESCALE(tmp10 - tmp3,
  ------------------
  |  |  191|  2.38M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  2.38M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  390|  2.38M|                                         CONST_BITS + PASS1_BITS + 3) &
  391|  2.38M|                            RANGE_MASK];
  ------------------
  |  |   91|  2.38M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  2.38M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  2.38M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  392|  2.38M|    outptr[1] = range_limit[(int)DESCALE(tmp11 + tmp2,
  ------------------
  |  |  191|  2.38M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  2.38M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  393|  2.38M|                                         CONST_BITS + PASS1_BITS + 3) &
  394|  2.38M|                            RANGE_MASK];
  ------------------
  |  |   91|  2.38M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  2.38M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  2.38M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  395|  2.38M|    outptr[6] = range_limit[(int)DESCALE(tmp11 - tmp2,
  ------------------
  |  |  191|  2.38M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  2.38M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  396|  2.38M|                                         CONST_BITS + PASS1_BITS + 3) &
  397|  2.38M|                            RANGE_MASK];
  ------------------
  |  |   91|  2.38M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  2.38M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  2.38M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  398|  2.38M|    outptr[2] = range_limit[(int)DESCALE(tmp12 + tmp1,
  ------------------
  |  |  191|  2.38M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  2.38M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  399|  2.38M|                                         CONST_BITS + PASS1_BITS + 3) &
  400|  2.38M|                            RANGE_MASK];
  ------------------
  |  |   91|  2.38M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  2.38M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  2.38M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  401|  2.38M|    outptr[5] = range_limit[(int)DESCALE(tmp12 - tmp1,
  ------------------
  |  |  191|  2.38M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  2.38M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  402|  2.38M|                                         CONST_BITS + PASS1_BITS + 3) &
  403|  2.38M|                            RANGE_MASK];
  ------------------
  |  |   91|  2.38M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  2.38M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  2.38M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  404|  2.38M|    outptr[3] = range_limit[(int)DESCALE(tmp13 + tmp0,
  ------------------
  |  |  191|  2.38M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  2.38M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  405|  2.38M|                                         CONST_BITS + PASS1_BITS + 3) &
  406|  2.38M|                            RANGE_MASK];
  ------------------
  |  |   91|  2.38M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  2.38M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  2.38M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  407|  2.38M|    outptr[4] = range_limit[(int)DESCALE(tmp13 - tmp0,
  ------------------
  |  |  191|  2.38M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  474|  2.38M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  408|  2.38M|                                         CONST_BITS + PASS1_BITS + 3) &
  409|  2.38M|                            RANGE_MASK];
  ------------------
  |  |   91|  2.38M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  224|  2.38M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   51|  2.38M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  410|       |
  411|  2.38M|    wsptr += DCTSIZE;           /* advance pointer to next row */
  ------------------
  |  |   66|  2.38M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  412|  2.38M|  }
  413|  1.41M|}

jmemmgr.c:GETENV_S:
   80|  2.58k|{
   81|  2.58k|  char *env;
   82|       |
   83|  2.58k|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 2.58k]
  ------------------
   84|      0|    if (buffer_size == 0)
  ------------------
  |  Branch (84:9): [True: 0, False: 0]
  ------------------
   85|      0|      return 0;
   86|      0|    else
   87|      0|      return (errno = EINVAL);
   88|      0|  }
   89|  2.58k|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 2.58k]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|  2.58k|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 2.58k]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|  2.58k|  env = getenv(name);
   97|  2.58k|  if (!env)
  ------------------
  |  Branch (97:7): [True: 2.58k, False: 0]
  ------------------
   98|  2.58k|  {
   99|  2.58k|    *buffer = 0;
  100|  2.58k|    return 0;
  101|  2.58k|  }
  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|  2.58k|{
 1196|  2.58k|  my_mem_ptr mem;
 1197|  2.58k|  long max_to_use;
 1198|  2.58k|  int pool;
 1199|  2.58k|  size_t test_mac;
 1200|       |
 1201|  2.58k|  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|  2.58k|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  2.58k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  2.58k|#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|  2.58k|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  2.58k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1218|  2.58k|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|  5.17k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1218:7): [True: 0, False: 2.58k]
  ------------------
 1219|  2.58k|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|  2.58k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  2.58k|#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|  2.58k|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1223|       |
 1224|       |  /* Attempt to allocate memory manager's control block */
 1225|  2.58k|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1226|       |
 1227|  2.58k|  if (mem == NULL) {
  ------------------
  |  Branch (1227:7): [True: 0, False: 2.58k]
  ------------------
 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|  2.58k|  mem->pub.alloc_small = alloc_small;
 1234|  2.58k|  mem->pub.alloc_large = alloc_large;
 1235|  2.58k|  mem->pub.alloc_sarray = alloc_sarray;
 1236|  2.58k|  mem->pub.alloc_barray = alloc_barray;
 1237|  2.58k|  mem->pub.request_virt_sarray = request_virt_sarray;
 1238|  2.58k|  mem->pub.request_virt_barray = request_virt_barray;
 1239|  2.58k|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1240|  2.58k|  mem->pub.access_virt_sarray = access_virt_sarray;
 1241|  2.58k|  mem->pub.access_virt_barray = access_virt_barray;
 1242|  2.58k|  mem->pub.free_pool = free_pool;
 1243|  2.58k|  mem->pub.self_destruct = self_destruct;
 1244|       |
 1245|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1246|  2.58k|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  2.58k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1247|       |
 1248|       |  /* Initialize working state */
 1249|  2.58k|  mem->pub.max_memory_to_use = max_to_use;
 1250|       |
 1251|  7.76k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  885|  2.58k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  883|  7.76k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1251:35): [True: 5.17k, False: 2.58k]
  ------------------
 1252|  5.17k|    mem->small_list[pool] = NULL;
 1253|  5.17k|    mem->large_list[pool] = NULL;
 1254|  5.17k|  }
 1255|  2.58k|  mem->virt_sarray_list = NULL;
 1256|  2.58k|  mem->virt_barray_list = NULL;
 1257|       |
 1258|  2.58k|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1259|       |
 1260|       |  /* Declare ourselves open for business */
 1261|  2.58k|  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|  2.58k|#ifndef NO_GETENV
 1270|  2.58k|  {
 1271|  2.58k|    char memenv[30] = { 0 };
 1272|       |
 1273|  2.58k|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1273:9): [True: 2.58k, False: 0]
  |  Branch (1273:45): [True: 0, False: 2.58k]
  ------------------
 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|  2.58k|  }
 1287|  2.58k|#endif
 1288|       |
 1289|  2.58k|}
jmemmgr.c:alloc_small:
  268|  70.3k|{
  269|  70.3k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  270|  70.3k|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  271|  70.3k|  char *data_ptr;
  272|  70.3k|  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|  70.3k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  70.3k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (280:7): [True: 0, False: 70.3k]
  ------------------
  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|  70.3k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  70.3k|#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|  70.3k|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  70.3k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (288:7): [True: 0, False: 70.3k]
  ------------------
  289|  70.3k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  70.3k|#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|  70.3k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  885|  70.3k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (293:7): [True: 0, False: 70.3k]
  |  Branch (293:22): [True: 0, False: 70.3k]
  ------------------
  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|  70.3k|  prev_hdr_ptr = NULL;
  296|  70.3k|  hdr_ptr = mem->small_list[pool_id];
  297|  73.1k|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (297:10): [True: 65.8k, False: 7.23k]
  ------------------
  298|  65.8k|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (298:9): [True: 63.0k, False: 2.79k]
  ------------------
  299|  63.0k|      break;                    /* found pool with enough space */
  300|  2.79k|    prev_hdr_ptr = hdr_ptr;
  301|  2.79k|    hdr_ptr = hdr_ptr->next;
  302|  2.79k|  }
  303|       |
  304|       |  /* Time to make a new pool? */
  305|  70.3k|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (305:7): [True: 7.23k, False: 63.0k]
  ------------------
  306|       |    /* min_request is what we need now, slop is what will be leftover */
  307|  7.23k|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  7.23k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  308|  7.23k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (308:9): [True: 4.69k, False: 2.53k]
  ------------------
  309|  4.69k|      slop = first_pool_slop[pool_id];
  310|  2.53k|    else
  311|  2.53k|      slop = extra_pool_slop[pool_id];
  312|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  313|  7.23k|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|  7.23k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (313:9): [True: 0, False: 7.23k]
  ------------------
  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|  7.23k|    for (;;) {
  317|  7.23k|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  318|  7.23k|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (318:11): [True: 7.23k, False: 0]
  ------------------
  319|  7.23k|        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|  7.23k|    mem->total_space_allocated += min_request + slop;
  325|       |    /* Success, initialize the new pool header and add to end of list */
  326|  7.23k|    hdr_ptr->next = NULL;
  327|  7.23k|    hdr_ptr->bytes_used = 0;
  328|  7.23k|    hdr_ptr->bytes_left = sizeofobject + slop;
  329|  7.23k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (329:9): [True: 4.69k, False: 2.53k]
  ------------------
  330|  4.69k|      mem->small_list[pool_id] = hdr_ptr;
  331|  2.53k|    else
  332|  2.53k|      prev_hdr_ptr->next = hdr_ptr;
  333|  7.23k|  }
  334|       |
  335|       |  /* OK, allocate the object from the current pool */
  336|  70.3k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  337|  70.3k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  338|  70.3k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  70.3k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (338:7): [True: 70.3k, False: 0]
  ------------------
  339|  70.3k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  70.3k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  70.3k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  340|  70.3k|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  341|  70.3k|  hdr_ptr->bytes_used += sizeofobject;
  342|  70.3k|  hdr_ptr->bytes_left -= sizeofobject;
  343|       |
  344|  70.3k|  return (void *)data_ptr;
  345|  70.3k|}
jmemmgr.c:round_up_pow2:
   45|  88.1k|{
   46|  88.1k|  return ((a + b - 1) & (~(b - 1)));
   47|  88.1k|}
jmemmgr.c:alloc_large:
  365|  9.91k|{
  366|  9.91k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  367|  9.91k|  large_pool_ptr hdr_ptr;
  368|  9.91k|  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|  9.91k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  9.91k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (375:7): [True: 0, False: 9.91k]
  ------------------
  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|  9.91k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  9.91k|#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|  9.91k|  if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  9.91k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (383:7): [True: 0, False: 9.91k]
  ------------------
  384|  9.91k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  9.91k|#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|  9.91k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  885|  9.91k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (388:7): [True: 0, False: 9.91k]
  |  Branch (388:22): [True: 0, False: 9.91k]
  ------------------
  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|  9.91k|  hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
  392|  9.91k|                                           sizeof(large_pool_hdr) +
  393|  9.91k|                                           ALIGN_SIZE - 1);
  ------------------
  |  |   89|  9.91k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  394|  9.91k|  if (hdr_ptr == NULL)
  ------------------
  |  Branch (394:7): [True: 0, False: 9.91k]
  ------------------
  395|      0|    out_of_memory(cinfo, 4);    /* jpeg_get_large failed */
  396|  9.91k|  mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
  397|  9.91k|                                ALIGN_SIZE - 1;
  ------------------
  |  |   89|  9.91k|#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|  9.91k|  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|  9.91k|  hdr_ptr->bytes_used = sizeofobject;
  405|  9.91k|  hdr_ptr->bytes_left = 0;
  406|  9.91k|  mem->large_list[pool_id] = hdr_ptr;
  407|       |
  408|  9.91k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  409|  9.91k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  410|  9.91k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  9.91k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (410:7): [True: 9.91k, False: 0]
  ------------------
  411|  9.91k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  9.91k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  9.91k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  412|       |
  413|  9.91k|  return (void *)data_ptr;
  414|  9.91k|}
jmemmgr.c:alloc_sarray:
  437|  7.88k|{
  438|  7.88k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  439|  7.88k|  JSAMPARRAY result;
  440|  7.88k|  JSAMPROW workspace;
  441|  7.88k|  JDIMENSION rowsperchunk, currow, i;
  442|  7.88k|  long ltemp;
  443|  7.88k|  J12SAMPARRAY result12;
  444|  7.88k|  J12SAMPROW workspace12;
  445|  7.88k|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  446|  7.88k|  J16SAMPARRAY result16;
  447|  7.88k|  J16SAMPROW workspace16;
  448|  7.88k|#endif
  449|  7.88k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (449:24): [True: 7.88k, False: 0]
  ------------------
  450|  7.88k|                        ((j_decompress_ptr)cinfo)->data_precision :
  451|  7.88k|                        ((j_compress_ptr)cinfo)->data_precision;
  452|  7.88k|  size_t sample_size = data_precision == 16 ?
  ------------------
  |  Branch (452:24): [True: 0, False: 7.88k]
  ------------------
  453|  7.88k|                       sizeof(J16SAMPLE) : (data_precision == 12 ?
  ------------------
  |  Branch (453:45): [True: 12, False: 7.87k]
  ------------------
  454|     12|                                            sizeof(J12SAMPLE) :
  455|  7.88k|                                            sizeof(JSAMPLE));
  456|       |
  457|       |  /* Make sure each row is properly aligned */
  458|  7.88k|  if ((ALIGN_SIZE % sample_size) != 0)
  ------------------
  |  |   89|  7.88k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (458:7): [True: 0, False: 7.88k]
  ------------------
  459|      0|    out_of_memory(cinfo, 5);    /* safety check */
  460|       |
  461|  7.88k|  if (samplesperrow > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  7.88k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (461:7): [True: 0, False: 7.88k]
  ------------------
  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|  7.88k|  samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) /
  ------------------
  |  |   89|  7.88k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  467|  7.88k|                                                           sample_size);
  468|       |
  469|       |  /* Calculate max # of rows allowed in one allocation chunk */
  470|  7.88k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  7.88k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  471|  7.88k|          ((long)samplesperrow * (long)sample_size);
  472|  7.88k|  if (ltemp <= 0)
  ------------------
  |  Branch (472:7): [True: 0, False: 7.88k]
  ------------------
  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|  7.88k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (474:7): [True: 0, False: 7.88k]
  ------------------
  475|      0|    rowsperchunk = (JDIMENSION)ltemp;
  476|  7.88k|  else
  477|  7.88k|    rowsperchunk = numrows;
  478|  7.88k|  mem->last_rowsperchunk = rowsperchunk;
  479|       |
  480|  7.88k|  if (data_precision == 16) {
  ------------------
  |  Branch (480:7): [True: 0, False: 7.88k]
  ------------------
  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|  7.88k|  } else if (data_precision == 12) {
  ------------------
  |  Branch (504:14): [True: 12, False: 7.87k]
  ------------------
  505|       |    /* Get space for row pointers (small object) */
  506|     12|    result12 = (J12SAMPARRAY)alloc_small(cinfo, pool_id,
  507|     12|                                         (size_t)(numrows *
  508|     12|                                                  sizeof(J12SAMPROW)));
  509|       |
  510|       |    /* Get the rows themselves (large objects) */
  511|     12|    currow = 0;
  512|     24|    while (currow < numrows) {
  ------------------
  |  Branch (512:12): [True: 12, False: 12]
  ------------------
  513|     12|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  447|     12|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (447:26): [True: 0, False: 12]
  |  |  ------------------
  ------------------
  514|     12|      workspace12 = (J12SAMPROW)alloc_large(cinfo, pool_id,
  515|     12|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  516|    102|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (516:30): [True: 90, False: 12]
  ------------------
  517|     90|        result12[currow++] = workspace12;
  518|     90|        workspace12 += samplesperrow;
  519|     90|      }
  520|     12|    }
  521|       |
  522|     12|    return (JSAMPARRAY)result12;
  523|  7.87k|  } else {
  524|       |    /* Get space for row pointers (small object) */
  525|  7.87k|    result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
  526|  7.87k|                                     (size_t)(numrows * sizeof(JSAMPROW)));
  527|       |
  528|       |    /* Get the rows themselves (large objects) */
  529|  7.87k|    currow = 0;
  530|  15.7k|    while (currow < numrows) {
  ------------------
  |  Branch (530:12): [True: 7.87k, False: 7.87k]
  ------------------
  531|  7.87k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  447|  7.87k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (447:26): [True: 0, False: 7.87k]
  |  |  ------------------
  ------------------
  532|  7.87k|      workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
  533|  7.87k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  534|  59.8k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (534:30): [True: 51.9k, False: 7.87k]
  ------------------
  535|  51.9k|        result[currow++] = workspace;
  536|  51.9k|        workspace += samplesperrow;
  537|  51.9k|      }
  538|  7.87k|    }
  539|       |
  540|  7.87k|    return result;
  541|  7.87k|  }
  542|  7.88k|}
jmemmgr.c:alloc_barray:
  554|    504|{
  555|    504|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  556|    504|  JBLOCKARRAY result;
  557|    504|  JBLOCKROW workspace;
  558|    504|  JDIMENSION rowsperchunk, currow, i;
  559|    504|  long ltemp;
  560|       |
  561|       |  /* Make sure each row is properly aligned */
  562|    504|  if ((sizeof(JBLOCK) % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|    504|#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|    504|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|    504|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  567|    504|          ((long)blocksperrow * sizeof(JBLOCK));
  568|    504|  if (ltemp <= 0)
  ------------------
  |  Branch (568:7): [True: 0, False: 504]
  ------------------
  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|    504|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (570:7): [True: 0, False: 504]
  ------------------
  571|      0|    rowsperchunk = (JDIMENSION)ltemp;
  572|    504|  else
  573|    504|    rowsperchunk = numrows;
  574|    504|  mem->last_rowsperchunk = rowsperchunk;
  575|       |
  576|       |  /* Get space for row pointers (small object) */
  577|    504|  result = (JBLOCKARRAY)alloc_small(cinfo, pool_id,
  578|    504|                                    (size_t)(numrows * sizeof(JBLOCKROW)));
  579|       |
  580|       |  /* Get the rows themselves (large objects) */
  581|    504|  currow = 0;
  582|  1.00k|  while (currow < numrows) {
  ------------------
  |  Branch (582:10): [True: 504, False: 504]
  ------------------
  583|    504|    rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  447|    504|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (447:26): [True: 0, False: 504]
  |  |  ------------------
  ------------------
  584|    504|    workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
  585|    504|        (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
  586|    504|                  sizeof(JBLOCK)));
  587|  13.1k|    for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (587:28): [True: 12.6k, False: 504]
  ------------------
  588|  12.6k|      result[currow++] = workspace;
  589|  12.6k|      workspace += blocksperrow;
  590|  12.6k|    }
  591|    504|  }
  592|       |
  593|    504|  return result;
  594|    504|}
jmemmgr.c:request_virt_barray:
  669|    504|{
  670|    504|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  671|    504|  jvirt_barray_ptr result;
  672|       |
  673|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  674|    504|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  884|    504|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (674:7): [True: 0, False: 504]
  ------------------
  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|    504|  result = (jvirt_barray_ptr)alloc_small(cinfo, pool_id,
  679|    504|                                         sizeof(struct jvirt_barray_control));
  680|       |
  681|    504|  result->mem_buffer = NULL;    /* marks array not yet realized */
  682|    504|  result->rows_in_array = numrows;
  683|    504|  result->blocksperrow = blocksperrow;
  684|    504|  result->maxaccess = maxaccess;
  685|    504|  result->pre_zero = pre_zero;
  686|    504|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  206|    504|#define FALSE   0               /* values of boolean */
  ------------------
  687|    504|  result->next = mem->virt_barray_list; /* add to list of virtual arrays */
  688|    504|  mem->virt_barray_list = result;
  689|       |
  690|    504|  return result;
  691|    504|}
jmemmgr.c:realize_virt_arrays:
  697|  1.69k|{
  698|  1.69k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  699|  1.69k|  size_t space_per_minheight, maximum_space, avail_mem;
  700|  1.69k|  size_t minheights, max_minheights;
  701|  1.69k|  jvirt_sarray_ptr sptr;
  702|  1.69k|  jvirt_barray_ptr bptr;
  703|  1.69k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (703:24): [True: 1.69k, False: 0]
  ------------------
  704|  1.69k|                        ((j_decompress_ptr)cinfo)->data_precision :
  705|  1.69k|                        ((j_compress_ptr)cinfo)->data_precision;
  706|  1.69k|  size_t sample_size = data_precision == 16 ?
  ------------------
  |  Branch (706:24): [True: 0, False: 1.69k]
  ------------------
  707|  1.69k|                       sizeof(J16SAMPLE) : (data_precision == 12 ?
  ------------------
  |  Branch (707:45): [True: 2, False: 1.69k]
  ------------------
  708|      2|                                            sizeof(J12SAMPLE) :
  709|  1.69k|                                            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|  1.69k|  space_per_minheight = 0;
  716|  1.69k|  maximum_space = 0;
  717|  1.69k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (717:38): [True: 0, False: 1.69k]
  ------------------
  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|  2.19k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (729:38): [True: 504, False: 1.69k]
  ------------------
  730|    504|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (730:9): [True: 504, False: 0]
  ------------------
  731|    504|      size_t new_space = (long)bptr->rows_in_array *
  732|    504|                         (long)bptr->blocksperrow * sizeof(JBLOCK);
  733|       |
  734|    504|      space_per_minheight += (long)bptr->maxaccess *
  735|    504|                             (long)bptr->blocksperrow * sizeof(JBLOCK);
  736|    504|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (736:11): [True: 0, False: 504]
  ------------------
  737|      0|        out_of_memory(cinfo, 11);
  738|    504|      maximum_space += new_space;
  739|    504|    }
  740|    504|  }
  741|       |
  742|  1.69k|  if (space_per_minheight <= 0)
  ------------------
  |  Branch (742:7): [True: 1.52k, False: 168]
  ------------------
  743|  1.52k|    return;                     /* no unrealized arrays, no work */
  744|       |
  745|       |  /* Determine amount of memory to actually use; this is system-dependent. */
  746|    168|  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
  747|    168|                                 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|    168|  if (avail_mem >= maximum_space)
  ------------------
  |  Branch (753:7): [True: 168, False: 0]
  ------------------
  754|    168|    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|    168|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (766:38): [True: 0, False: 168]
  ------------------
  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|    672|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (790:38): [True: 504, False: 168]
  ------------------
  791|    504|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (791:9): [True: 504, False: 0]
  ------------------
  792|    504|      minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
  793|    504|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (793:11): [True: 504, False: 0]
  ------------------
  794|       |        /* This buffer fits in memory */
  795|    504|        bptr->rows_in_mem = bptr->rows_in_array;
  796|    504|      } 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|    504|      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  884|    504|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  806|    504|                                      bptr->blocksperrow, bptr->rows_in_mem);
  807|    504|      bptr->rowsperchunk = mem->last_rowsperchunk;
  808|    504|      bptr->cur_start_row = 0;
  809|    504|      bptr->first_undef_row = 0;
  810|    504|      bptr->dirty = FALSE;
  ------------------
  |  |  206|    504|#define FALSE   0               /* values of boolean */
  ------------------
  811|    504|    }
  812|    504|  }
  813|    168|}
jmemmgr.c:access_virt_barray:
 1014|  32.3k|{
 1015|  32.3k|  JDIMENSION end_row = start_row + num_rows;
 1016|  32.3k|  JDIMENSION undef_row;
 1017|       |
 1018|       |  /* debugging check */
 1019|  32.3k|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (1019:7): [True: 0, False: 32.3k]
  |  Branch (1019:39): [True: 0, False: 32.3k]
  ------------------
 1020|  32.3k|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (1020:7): [True: 0, False: 32.3k]
  ------------------
 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|  32.3k|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (1024:7): [True: 0, False: 32.3k]
  ------------------
 1025|  32.3k|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (1025:7): [True: 0, False: 32.3k]
  ------------------
 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|  32.3k|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (1061:7): [True: 10.5k, False: 21.7k]
  ------------------
 1062|  10.5k|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (1062:9): [True: 0, False: 10.5k]
  ------------------
 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|  10.5k|    } else {
 1067|  10.5k|      undef_row = ptr->first_undef_row;
 1068|  10.5k|    }
 1069|  10.5k|    if (writable)
  ------------------
  |  Branch (1069:9): [True: 10.5k, False: 0]
  ------------------
 1070|  10.5k|      ptr->first_undef_row = end_row;
 1071|  10.5k|    if (ptr->pre_zero) {
  ------------------
  |  Branch (1071:9): [True: 10.5k, False: 0]
  ------------------
 1072|  10.5k|      size_t bytesperrow = (size_t)ptr->blocksperrow * sizeof(JBLOCK);
 1073|  10.5k|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
 1074|  10.5k|      end_row -= ptr->cur_start_row;
 1075|  21.1k|      while (undef_row < end_row) {
  ------------------
  |  Branch (1075:14): [True: 10.5k, False: 10.5k]
  ------------------
 1076|  10.5k|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
 1077|  10.5k|        undef_row++;
 1078|  10.5k|      }
 1079|  10.5k|    } 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|  10.5k|  }
 1084|       |  /* Flag the buffer dirty if caller will write in it */
 1085|  32.3k|  if (writable)
  ------------------
  |  Branch (1085:7): [True: 26.9k, False: 5.40k]
  ------------------
 1086|  26.9k|    ptr->dirty = TRUE;
  ------------------
  |  |  209|  26.9k|#define TRUE    1
  ------------------
 1087|       |  /* Return address of proper part of the buffer */
 1088|  32.3k|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1089|  32.3k|}
jmemmgr.c:free_pool:
 1098|  5.79k|{
 1099|  5.79k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
 1100|  5.79k|  small_pool_ptr shdr_ptr;
 1101|  5.79k|  large_pool_ptr lhdr_ptr;
 1102|  5.79k|  size_t space_freed;
 1103|       |
 1104|  5.79k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  885|  5.79k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (1104:7): [True: 0, False: 5.79k]
  |  Branch (1104:22): [True: 0, False: 5.79k]
  ------------------
 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|  5.79k|  if (pool_id == JPOOL_IMAGE) {
  ------------------
  |  |  884|  5.79k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (1113:7): [True: 3.20k, False: 2.58k]
  ------------------
 1114|  3.20k|    jvirt_sarray_ptr sptr;
 1115|  3.20k|    jvirt_barray_ptr bptr;
 1116|       |
 1117|  3.20k|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1117:40): [True: 0, False: 3.20k]
  ------------------
 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|  3.20k|    mem->virt_sarray_list = NULL;
 1124|  3.71k|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1124:40): [True: 504, False: 3.20k]
  ------------------
 1125|    504|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1125:11): [True: 0, False: 504]
  ------------------
 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|    504|    }
 1130|  3.20k|    mem->virt_barray_list = NULL;
 1131|  3.20k|  }
 1132|       |
 1133|       |  /* Release large objects */
 1134|  5.79k|  lhdr_ptr = mem->large_list[pool_id];
 1135|  5.79k|  mem->large_list[pool_id] = NULL;
 1136|       |
 1137|  15.7k|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1137:10): [True: 9.91k, False: 5.79k]
  ------------------
 1138|  9.91k|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1139|  9.91k|    space_freed = lhdr_ptr->bytes_used +
 1140|  9.91k|                  lhdr_ptr->bytes_left +
 1141|  9.91k|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  9.91k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1142|  9.91k|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1143|  9.91k|    mem->total_space_allocated -= space_freed;
 1144|  9.91k|    lhdr_ptr = next_lhdr_ptr;
 1145|  9.91k|  }
 1146|       |
 1147|       |  /* Release small objects */
 1148|  5.79k|  shdr_ptr = mem->small_list[pool_id];
 1149|  5.79k|  mem->small_list[pool_id] = NULL;
 1150|       |
 1151|  13.0k|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1151:10): [True: 7.23k, False: 5.79k]
  ------------------
 1152|  7.23k|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1153|  7.23k|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1154|  7.23k|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  7.23k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1155|  7.23k|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1156|  7.23k|    mem->total_space_allocated -= space_freed;
 1157|  7.23k|    shdr_ptr = next_shdr_ptr;
 1158|  7.23k|  }
 1159|  5.79k|}
jmemmgr.c:self_destruct:
 1169|  2.58k|{
 1170|  2.58k|  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|  7.76k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  885|  2.58k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  883|  7.76k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1176:35): [True: 5.17k, False: 2.58k]
  ------------------
 1177|  5.17k|    free_pool(cinfo, pool);
 1178|  5.17k|  }
 1179|       |
 1180|       |  /* Release the memory manager control block too. */
 1181|  2.58k|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1182|  2.58k|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1183|       |
 1184|  2.58k|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1185|  2.58k|}

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

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

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

jsimd_can_ycc_rgb:
  113|  1.19k|{
  114|  1.19k|  init_simd();
  115|       |
  116|       |  /* The code is optimised for these values only */
  117|  1.19k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  1.19k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (117:7): [Folded - Ignored]
  ------------------
  118|      0|    return 0;
  119|  1.19k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (119:7): [Folded - Ignored]
  ------------------
  120|      0|    return 0;
  121|  1.19k|  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
  ------------------
  |  |  298|  1.19k|#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|  1.19k|  if ((simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   28|  1.19k|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (124:7): [True: 0, False: 1.19k]
  ------------------
  125|  1.19k|      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|  1.19k|  if ((simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   24|  1.19k|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (127:7): [True: 0, False: 1.19k]
  ------------------
  128|  1.19k|      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|  1.19k|  return 0;
  132|  1.19k|}
jsimd_can_h2v2_fancy_upsample:
  449|    580|{
  450|    580|  init_simd();
  451|       |
  452|       |  /* The code is optimised for these values only */
  453|    580|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|    580|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (453:7): [Folded - Ignored]
  ------------------
  454|      0|    return 0;
  455|    580|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (455:7): [Folded - Ignored]
  ------------------
  456|      0|    return 0;
  457|       |
  458|    580|  if ((simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   28|    580|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (458:7): [True: 0, False: 580]
  ------------------
  459|    580|      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|    580|  if ((simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   24|    580|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (461:7): [True: 0, False: 580]
  ------------------
  462|    580|      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|    580|  return 0;
  466|    580|}
jsimd_can_idct_islow:
  931|  4.67k|{
  932|  4.67k|  init_simd();
  933|       |
  934|       |  /* The code is optimised for these values only */
  935|  4.67k|  if (DCTSIZE != 8)
  ------------------
  |  |   66|  4.67k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (935:7): [Folded - Ignored]
  ------------------
  936|      0|    return 0;
  937|  4.67k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (937:7): [Folded - Ignored]
  ------------------
  938|      0|    return 0;
  939|  4.67k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  4.67k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (939:7): [Folded - Ignored]
  ------------------
  940|      0|    return 0;
  941|  4.67k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (941:7): [Folded - Ignored]
  ------------------
  942|      0|    return 0;
  943|  4.67k|  if (sizeof(ISLOW_MULT_TYPE) != 2)
  ------------------
  |  Branch (943:7): [Folded - Ignored]
  ------------------
  944|      0|    return 0;
  945|       |
  946|  4.67k|  if ((simd_support & JSIMD_AVX2) && IS_ALIGNED_AVX(jconst_idct_islow_avx2))
  ------------------
  |  |   28|  4.67k|#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: 4.67k]
  ------------------
  947|      0|    return 1;
  948|  4.67k|  if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2))
  ------------------
  |  |   24|  4.67k|#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: 4.67k]
  ------------------
  949|      0|    return 1;
  950|       |
  951|  4.67k|  return 0;
  952|  4.67k|}
jsimd.c:init_simd:
   42|  6.44k|{
   43|  6.44k|#ifndef NO_GETENV
   44|  6.44k|  char env[2] = { 0 };
   45|  6.44k|#endif
   46|       |
   47|  6.44k|  if (simd_support != ~0U)
  ------------------
  |  Branch (47:7): [True: 6.44k, False: 1]
  ------------------
   48|  6.44k|    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|  8.04k|{
   49|  8.04k|}
_ZN10FuzzHelper7getQpdfEv:
   53|  12.4k|{
   54|  12.4k|    auto is =
   55|  12.4k|        std::shared_ptr<InputSource>(new BufferInputSource("fuzz input", &this->input_buffer));
   56|  12.4k|    auto qpdf = QPDF::create();
   57|  12.4k|    qpdf->setMaxWarnings(200);
   58|  12.4k|    qpdf->processInputSource(is);
   59|  12.4k|    return qpdf;
   60|  12.4k|}
_ZN10FuzzHelper9getWriterENSt3__110shared_ptrI4QPDFEE:
   64|  8.78k|{
   65|  8.78k|    auto w = std::make_shared<QPDFWriter>(*qpdf);
   66|  8.78k|    w->setOutputPipeline(&this->discard);
   67|  8.78k|    w->setDecodeLevel(qpdf_dl_all);
   68|  8.78k|    return w;
   69|  8.78k|}
_ZN10FuzzHelper7doWriteENSt3__110shared_ptrI10QPDFWriterEE:
   73|  8.32k|{
   74|  8.32k|    try {
   75|  8.32k|        w->write();
   76|  8.32k|    } catch (QPDFExc const& e) {
   77|  1.12k|        std::cerr << e.what() << std::endl;
   78|  1.12k|    } catch (std::runtime_error const& e) {
   79|    613|        std::cerr << e.what() << std::endl;
   80|    613|    }
   81|  8.32k|}
_ZN10FuzzHelper9testWriteEv:
   85|  8.04k|{
   86|       |    // Write in various ways to exercise QPDFWriter
   87|       |
   88|  8.04k|    std::shared_ptr<QPDF> q;
   89|  8.04k|    std::shared_ptr<QPDFWriter> w;
   90|       |
   91|  8.04k|    q = getQpdf();
   92|  8.04k|    w = getWriter(q);
   93|  8.04k|    w->setDeterministicID(true);
   94|  8.04k|    w->setQDFMode(true);
   95|  8.04k|    doWrite(w);
   96|       |
   97|  8.04k|    q = getQpdf();
   98|  8.04k|    w = getWriter(q);
   99|  8.04k|    w->setStaticID(true);
  100|  8.04k|    w->setLinearization(true);
  101|  8.04k|    w->setR6EncryptionParameters("u", "o", true, true, true, true, true, true, qpdf_r3p_full, true);
  102|  8.04k|    doWrite(w);
  103|  8.04k|}
_ZN10FuzzHelper8doChecksEv:
  107|  8.04k|{
  108|       |    // Limit the memory used to decompress JPEG files during fuzzing. Excessive memory use during
  109|       |    // fuzzing is due to corrupt JPEG data which sometimes cannot be detected before
  110|       |    // jpeg_start_decompress is called. During normal use of qpdf very large JPEGs can occasionally
  111|       |    // occur legitimately and therefore must be allowed during normal operations.
  112|  8.04k|    Pl_DCT::setMemoryLimit(100'000'000);
  113|  8.04k|    Pl_DCT::setScanLimit(50);
  114|       |
  115|  8.04k|    Pl_PNGFilter::setMemoryLimit(1'000'000);
  116|  8.04k|    Pl_TIFFPredictor::setMemoryLimit(1'000'000);
  117|  8.04k|    Pl_Flate::setMemoryLimit(1'000'000);
  118|       |
  119|       |    // Do not decompress corrupt data. This may cause extended runtime within jpeglib without
  120|       |    // exercising additional code paths in qpdf, and potentially causing counterproductive timeouts.
  121|  8.04k|    Pl_DCT::setThrowOnCorruptData(true);
  122|       |
  123|       |    // Get as much coverage as possible in parts of the library that
  124|       |    // might benefit from fuzzing.
  125|  8.04k|    std::cerr << "\ninfo: starting testWrite\n";
  126|  8.04k|    testWrite();
  127|  8.04k|}
_ZN10FuzzHelper3runEv:
  131|  8.04k|{
  132|       |    // The goal here is that you should be able to throw anything at
  133|       |    // libqpdf and it will respond without any memory errors and never
  134|       |    // do anything worse than throwing a QPDFExc or
  135|       |    // std::runtime_error. Throwing any other kind of exception,
  136|       |    // segfaulting, or having a memory error (when built with
  137|       |    // appropriate sanitizers) will all cause abnormal exit.
  138|  8.04k|    try {
  139|  8.04k|        doChecks();
  140|  8.04k|    } catch (QPDFExc const& e) {
  141|  4.02k|        std::cerr << "QPDFExc: " << e.what() << std::endl;
  142|  4.02k|    } catch (std::runtime_error const& e) {
  143|     67|        std::cerr << "runtime_error: " << e.what() << std::endl;
  144|     67|    }
  145|  8.04k|}
LLVMFuzzerTestOneInput:
  149|  8.04k|{
  150|  8.04k|#ifndef _WIN32
  151|       |    // Used by jpeg library to work around false positives in memory
  152|       |    // sanitizer.
  153|  8.04k|    setenv("JSIMD_FORCENONE", "1", 1);
  154|  8.04k|#endif
  155|  8.04k|    FuzzHelper f(data, size);
  156|  8.04k|    f.run();
  157|  8.04k|    return 0;
  158|  8.04k|}

_ZN11InputSourceC2Ev:
   37|  57.1k|    {
   38|  57.1k|    }
_ZN11InputSource10loadBufferEv:
  116|  6.14M|{
  117|  6.14M|    this->buf_idx = 0;
  118|  6.14M|    this->buf_len = qpdf_offset_t(read(this->buffer, this->buf_size));
  119|       |    // NB read sets last_offset
  120|  6.14M|    this->buf_start = this->last_offset;
  121|  6.14M|}
_ZN11InputSource8fastTellEv:
  125|  33.6M|{
  126|  33.6M|    if (this->buf_len == 0) {
  ------------------
  |  Branch (126:9): [True: 82.0k, False: 33.5M]
  ------------------
  127|  82.0k|        loadBuffer();
  128|  33.5M|    } else {
  129|  33.5M|        auto curr = tell();
  130|  33.5M|        if (curr < this->buf_start || curr >= (this->buf_start + this->buf_len)) {
  ------------------
  |  Branch (130:13): [True: 123k, False: 33.4M]
  |  Branch (130:39): [True: 5.93M, False: 27.5M]
  ------------------
  131|  6.06M|            loadBuffer();
  132|  27.5M|        } else {
  133|  27.5M|            this->last_offset = curr;
  134|  27.5M|            this->buf_idx = curr - this->buf_start;
  135|  27.5M|        }
  136|  33.5M|    }
  137|  33.6M|    return this->last_offset;
  138|  33.6M|}
_ZN11InputSource8fastReadERc:
  142|   670M|{
  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|   670M|    if (this->buf_idx < this->buf_len) {
  ------------------
  |  Branch (145:9): [True: 665M, False: 4.88M]
  ------------------
  146|   665M|        ch = this->buffer[this->buf_idx];
  147|   665M|        ++(this->buf_idx);
  148|   665M|        ++(this->last_offset);
  149|   665M|        return true;
  150|       |
  151|   665M|    } else if (this->buf_len == 0) {
  ------------------
  |  Branch (151:16): [True: 64.4k, False: 4.81M]
  ------------------
  152|  64.4k|        return false;
  153|  4.81M|    } else {
  154|  4.81M|        seek(this->buf_start + this->buf_len, SEEK_SET);
  155|  4.81M|        fastTell();
  156|  4.81M|        return fastRead(ch);
  157|  4.81M|    }
  158|   670M|}
_ZN11InputSource10fastUnreadEb:
  162|  28.8M|{
  163|  28.8M|    this->last_offset -= back ? 1 : 0;
  ------------------
  |  Branch (163:26): [True: 23.7M, False: 5.07M]
  ------------------
  164|  28.8M|    seek(this->last_offset, SEEK_SET);
  165|  28.8M|}
_ZN11InputSourceD2Ev:
   40|  57.1k|    virtual ~InputSource() = default;
_ZN11InputSource6FinderC2Ev:
   46|  55.4k|        Finder() = default;
_ZN11InputSource6FinderD2Ev:
   48|  55.4k|        virtual ~Finder() = default;

_ZN8PipelineD2Ev:
   53|  4.31M|    virtual ~Pipeline() = default;

_ZN9Pl_Buffer7MembersC2Ev:
   81|  1.45M|        Members() = default;
_ZN9Pl_Buffer7MembersD2Ev:
   78|  1.45M|        ~Members() = default;

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

_ZN16Pl_QPDFTokenizer7MembersD2Ev:
   61|  7.78k|        ~Members() = default;

_ZN12Pl_RunLength7MembersD2Ev:
   55|    788|        ~Members() = default;

_ZN5QIntC9to_offsetImEExRKT_:
  221|  60.9M|    {
  222|  60.9M|        return IntConverter<T, qpdf_offset_t>::convert(i);
  223|  60.9M|    }
_ZN5QIntC12IntConverterImxLb0ELb1EE7convertERKm:
  146|  60.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|  60.9M|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  150|  60.9M|            if (i > maxval) {
  ------------------
  |  Branch (150:17): [True: 0, False: 60.9M]
  ------------------
  151|      0|                error(i);
  152|      0|            }
  153|  60.9M|            return static_cast<To>(i);
  154|  60.9M|        }
_ZN5QIntC11range_checkIxEEvRKT_S3_:
  273|   423k|    {
  274|   423k|        if ((delta > 0) != (cur > 0)) {
  ------------------
  |  Branch (274:13): [True: 341k, False: 82.1k]
  ------------------
  275|   341k|            return;
  276|   341k|        }
  277|  82.1k|        QIntC::range_check_error<T>(cur, delta);
  278|  82.1k|    }
_ZN5QIntC17range_check_errorIxEEvRKT_S3_:
  256|  82.1k|    {
  257|  82.1k|        if ((delta > 0) && ((std::numeric_limits<T>::max() - cur) < delta)) {
  ------------------
  |  Branch (257:13): [True: 82.1k, False: 0]
  |  Branch (257:28): [True: 11, False: 82.1k]
  ------------------
  258|     11|            std::ostringstream msg;
  259|     11|            msg.imbue(std::locale::classic());
  260|     11|            msg << "adding " << delta << " to " << cur << " would cause an integer overflow";
  261|     11|            throw std::range_error(msg.str());
  262|  82.1k|        } else if ((delta < 0) && ((std::numeric_limits<T>::min() - cur) > delta)) {
  ------------------
  |  Branch (262:20): [True: 0, False: 82.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|  82.1k|    }
_ZN5QIntC7to_sizeIxEEmRKT_:
  214|  8.35M|    {
  215|  8.35M|        return IntConverter<T, size_t>::convert(i);
  216|  8.35M|    }
_ZN5QIntC12IntConverterIxmLb1ELb0EE7convertERKx:
  118|  8.35M|        {
  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|  8.35M|            auto ii = static_cast<typename to_u<From>::type>(i);
  123|  8.35M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (123:17): [True: 0, False: 8.35M]
  |  Branch (123:28): [True: 0, False: 8.35M]
  ------------------
  124|      0|                error(i);
  125|      0|            }
  126|  8.35M|            return static_cast<To>(i);
  127|  8.35M|        }
_ZN5QIntC7to_sizeIlEEmRKT_:
  214|  1.20M|    {
  215|  1.20M|        return IntConverter<T, size_t>::convert(i);
  216|  1.20M|    }
_ZN5QIntC12IntConverterIlmLb1ELb0EE7convertERKl:
  118|  1.20M|        {
  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.20M|            auto ii = static_cast<typename to_u<From>::type>(i);
  123|  1.20M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (123:17): [True: 0, False: 1.20M]
  |  Branch (123:28): [True: 0, False: 1.20M]
  ------------------
  124|      0|                error(i);
  125|      0|            }
  126|  1.20M|            return static_cast<To>(i);
  127|  1.20M|        }
_ZN5QIntC7to_uintIiEEjRKT_:
  207|   117k|    {
  208|   117k|        return IntConverter<T, unsigned int>::convert(i);
  209|   117k|    }
_ZN5QIntC12IntConverterIijLb1ELb0EE7convertERKi:
  118|   117k|        {
  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|   117k|            auto ii = static_cast<typename to_u<From>::type>(i);
  123|   117k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (123:17): [True: 3, False: 117k]
  |  Branch (123:28): [True: 0, False: 117k]
  ------------------
  124|      3|                error(i);
  125|      3|            }
  126|   117k|            return static_cast<To>(i);
  127|   117k|        }
_ZN5QIntC12IntConverterIijLb1ELb0EE5errorEi:
  131|      3|        {
  132|      3|            std::ostringstream msg;
  133|      3|            msg.imbue(std::locale::classic());
  134|      3|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  135|      3|                << "-byte signed type to a " << sizeof(To) << "-byte unsigned type";
  136|      3|            throw std::range_error(msg.str());
  137|      3|        }
_ZN5QIntC7to_sizeIjEEmRKT_:
  214|  73.5k|    {
  215|  73.5k|        return IntConverter<T, size_t>::convert(i);
  216|  73.5k|    }
_ZN5QIntC12IntConverterIjmLb0ELb0EE7convertERKj:
   68|  73.5k|        {
   69|       |            // From and To are both unsigned.
   70|  73.5k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (70:17): [True: 0, False: 73.5k]
  ------------------
   71|      0|                error(i);
   72|      0|            }
   73|  73.5k|            return static_cast<To>(i);
   74|  73.5k|        }
_ZN5QIntC7to_sizeIiEEmRKT_:
  214|  1.41M|    {
  215|  1.41M|        return IntConverter<T, size_t>::convert(i);
  216|  1.41M|    }
_ZN5QIntC12IntConverterIimLb1ELb0EE7convertERKi:
  118|  1.41M|        {
  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.41M|            auto ii = static_cast<typename to_u<From>::type>(i);
  123|  1.41M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (123:17): [True: 0, False: 1.41M]
  |  Branch (123:28): [True: 0, False: 1.41M]
  ------------------
  124|      0|                error(i);
  125|      0|            }
  126|  1.41M|            return static_cast<To>(i);
  127|  1.41M|        }
_ZN5QIntC7to_uintImEEjRKT_:
  207|  4.11M|    {
  208|  4.11M|        return IntConverter<T, unsigned int>::convert(i);
  209|  4.11M|    }
_ZN5QIntC12IntConverterImjLb0ELb0EE7convertERKm:
   68|  4.11M|        {
   69|       |            // From and To are both unsigned.
   70|  4.11M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (70:17): [True: 0, False: 4.11M]
  ------------------
   71|      0|                error(i);
   72|      0|            }
   73|  4.11M|            return static_cast<To>(i);
   74|  4.11M|        }
_ZN5QIntC8to_ulongImEEmRKT_:
  235|  1.86M|    {
  236|  1.86M|        return IntConverter<T, unsigned long>::convert(i);
  237|  1.86M|    }
_ZN5QIntC12IntConverterImmLb0ELb0EE7convertERKm:
   68|  1.87M|        {
   69|       |            // From and To are both unsigned.
   70|  1.87M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (70:17): [True: 0, False: 1.87M]
  ------------------
   71|      0|                error(i);
   72|      0|            }
   73|  1.87M|            return static_cast<To>(i);
   74|  1.87M|        }
_ZN5QIntC6to_intIlEEiRKT_:
  200|  1.67k|    {
  201|  1.67k|        return IntConverter<T, int>::convert(i);
  202|  1.67k|    }
_ZN5QIntC12IntConverterIliLb1ELb1EE7convertERKl:
   93|  1.67k|        {
   94|       |            // From and To are both signed.
   95|  1.67k|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (95:17): [True: 0, False: 1.67k]
  |  Branch (95:57): [True: 0, False: 1.67k]
  ------------------
   96|      0|                error(i);
   97|      0|            }
   98|  1.67k|            return static_cast<To>(i);
   99|  1.67k|        }
_ZN5QIntC6to_intIxEEiRKT_:
  200|  4.99M|    {
  201|  4.99M|        return IntConverter<T, int>::convert(i);
  202|  4.99M|    }
_ZN5QIntC12IntConverterIxiLb1ELb1EE7convertERKx:
   93|  4.99M|        {
   94|       |            // From and To are both signed.
   95|  4.99M|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (95:17): [True: 139, False: 4.99M]
  |  Branch (95:57): [True: 183, False: 4.99M]
  ------------------
   96|    322|                error(i);
   97|    322|            }
   98|  4.99M|            return static_cast<To>(i);
   99|  4.99M|        }
_ZN5QIntC12IntConverterIxiLb1ELb1EE5errorEx:
  103|    322|        {
  104|    322|            std::ostringstream msg;
  105|    322|            msg.imbue(std::locale::classic());
  106|    322|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  107|    322|                << "-byte signed type to a " << sizeof(To) << "-byte signed type";
  108|    322|            throw std::range_error(msg.str());
  109|    322|        }
_ZN5QIntC7to_sizeIyEEmRKT_:
  214|  82.2k|    {
  215|  82.2k|        return IntConverter<T, size_t>::convert(i);
  216|  82.2k|    }
_ZN5QIntC12IntConverterIymLb0ELb0EE7convertERKy:
   68|  82.2k|        {
   69|       |            // From and To are both unsigned.
   70|  82.2k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (70:17): [True: 0, False: 82.2k]
  ------------------
   71|      0|                error(i);
   72|      0|            }
   73|  82.2k|            return static_cast<To>(i);
   74|  82.2k|        }
_ZN5QIntC6to_intImEEiRKT_:
  200|   430k|    {
  201|   430k|        return IntConverter<T, int>::convert(i);
  202|   430k|    }
_ZN5QIntC12IntConverterImiLb0ELb1EE7convertERKm:
  146|   430k|        {
  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|   430k|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  150|   430k|            if (i > maxval) {
  ------------------
  |  Branch (150:17): [True: 22, False: 430k]
  ------------------
  151|     22|                error(i);
  152|     22|            }
  153|   430k|            return static_cast<To>(i);
  154|   430k|        }
_ZN5QIntC12IntConverterImiLb0ELb1EE5errorEm:
  158|     22|        {
  159|     22|            std::ostringstream msg;
  160|     22|            msg.imbue(std::locale::classic());
  161|     22|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  162|     22|                << "-byte unsigned type to a " << sizeof(To) << "-byte signed type";
  163|     22|            throw std::range_error(msg.str());
  164|     22|        }
_ZN5QIntC11to_longlongImEExRKT_:
  242|  1.09k|    {
  243|  1.09k|        return IntConverter<T, long long>::convert(i);
  244|  1.09k|    }
_ZN5QIntC7to_sizeImEEmRKT_:
  214|  8.26k|    {
  215|  8.26k|        return IntConverter<T, size_t>::convert(i);
  216|  8.26k|    }
_ZN5QIntC12to_ulonglongIxEEyRKT_:
  249|  60.3k|    {
  250|  60.3k|        return IntConverter<T, unsigned long long>::convert(i);
  251|  60.3k|    }
_ZN5QIntC12IntConverterIxyLb1ELb0EE7convertERKx:
  118|  60.3k|        {
  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|  60.3k|            auto ii = static_cast<typename to_u<From>::type>(i);
  123|  60.3k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (123:17): [True: 0, False: 60.3k]
  |  Branch (123:28): [True: 0, False: 60.3k]
  ------------------
  124|      0|                error(i);
  125|      0|            }
  126|  60.3k|            return static_cast<To>(i);
  127|  60.3k|        }
_ZN5QIntC12to_ulonglongIiEEyRKT_:
  249|   261k|    {
  250|   261k|        return IntConverter<T, unsigned long long>::convert(i);
  251|   261k|    }
_ZN5QIntC12IntConverterIiyLb1ELb0EE7convertERKi:
  118|   261k|        {
  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|   261k|            auto ii = static_cast<typename to_u<From>::type>(i);
  123|   261k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (123:17): [True: 0, False: 261k]
  |  Branch (123:28): [True: 0, False: 261k]
  ------------------
  124|      0|                error(i);
  125|      0|            }
  126|   261k|            return static_cast<To>(i);
  127|   261k|        }
_ZN5QIntC6to_intIiEEiRKT_:
  200|  13.5k|    {
  201|  13.5k|        return IntConverter<T, int>::convert(i);
  202|  13.5k|    }
_ZN5QIntC12IntConverterIiiLb1ELb1EE7convertERKi:
   93|  13.5k|        {
   94|       |            // From and To are both signed.
   95|  13.5k|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (95:17): [True: 0, False: 13.5k]
  |  Branch (95:57): [True: 0, False: 13.5k]
  ------------------
   96|      0|                error(i);
   97|      0|            }
   98|  13.5k|            return static_cast<To>(i);
   99|  13.5k|        }
_ZN5QIntC8to_ucharImEEhRKT_:
  179|   211k|    {
  180|   211k|        return IntConverter<T, unsigned char>::convert(i);
  181|   211k|    }
_ZN5QIntC12IntConverterImhLb0ELb0EE7convertERKm:
   68|   211k|        {
   69|       |            // From and To are both unsigned.
   70|   211k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (70:17): [True: 0, False: 211k]
  ------------------
   71|      0|                error(i);
   72|      0|            }
   73|   211k|            return static_cast<To>(i);
   74|   211k|        }

_ZN4QPDF14EncryptionDataC2EiiiiRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_S9_S9_S9_S9_b:
  469|  8.27k|        {
  470|  8.27k|        }
_ZN4QPDF6Writer8optimizeERS_RKN10QPDFWriter8ObjTableENSt3__18functionIFiR16QPDFObjectHandleEEE:
  739|  3.66k|        {
  740|  3.66k|            return qpdf.optimize(obj, skip_stream_parameters);
  741|  3.66k|        }
_ZN4QPDF6Writer18getLinearizedPartsERS_RKN10QPDFWriter8ObjTableERNSt3__16vectorI16QPDFObjectHandleNS6_9allocatorIS8_EEEESC_SC_SC_SC_:
  752|  3.62k|        {
  753|  3.62k|            qpdf.getLinearizedParts(obj, part4, part6, part7, part8, part9);
  754|  3.62k|        }
_ZN4QPDF6Writer18generateHintStreamERS_RKN10QPDFWriter11NewObjTableERKNS2_8ObjTableERNSt3__110shared_ptrI6BufferEERiSE_b:
  765|  2.92k|        {
  766|  2.92k|            return qpdf.generateHintStream(new_obj, obj, hint_stream, S, O, compressed);
  767|  2.92k|        }
_ZN4QPDF6Writer21getCompressibleObjSetERS_:
  777|    805|        {
  778|    805|            return qpdf.getCompressibleObjSet();
  779|    805|        }
_ZN4QPDF6Writer12getXRefTableERS_:
  783|  8.26k|        {
  784|  8.26k|            return qpdf.getXRefTableInternal();
  785|  8.26k|        }
_ZN4QPDF6Writer9tableSizeERS_:
  789|  8.26k|        {
  790|  8.26k|            return qpdf.tableSize();
  791|  8.26k|        }
_ZN4QPDF8Resolver8resolvedEPS_10QPDFObjGen:
  804|   147k|        {
  805|   147k|            return qpdf->resolve(og);
  806|   147k|        }
_ZN4QPDF10ParseGuardC2EPS_:
  831|   392k|        {
  832|   392k|            if (qpdf) {
  ------------------
  |  Branch (832:17): [True: 371k, False: 20.9k]
  ------------------
  833|   371k|                qpdf->inParse(true);
  834|   371k|            }
  835|   392k|        }
_ZN4QPDF10ParseGuard9getObjectEPS_iib:
  839|  1.41M|        {
  840|  1.41M|            return qpdf->getObjectForParser(id, gen, parse_pdf);
  841|  1.41M|        }
_ZN4QPDF10ParseGuardD2Ev:
  844|   392k|        {
  845|   392k|            if (qpdf) {
  ------------------
  |  Branch (845:17): [True: 371k, False: 20.9k]
  ------------------
  846|   371k|                qpdf->inParse(false);
  847|   371k|            }
  848|   392k|        }
_ZN4QPDF4Pipe14pipeStreamDataEPS_RK10QPDFObjGenxm16QPDFObjectHandleP8Pipelinebb:
  868|   103k|        {
  869|   103k|            return qpdf->pipeStreamData(
  870|   103k|                og, offset, length, dict, pipeline, suppress_warnings, will_retry);
  871|   103k|        }
_ZN4QPDF8ObjCacheC2Ev:
  907|   105k|        {
  908|   105k|        }
_ZN4QPDF8ObjCacheC2ENSt3__110shared_ptrI10QPDFObjectEExx:
  916|   416k|        {
  917|   416k|        }
_ZN4QPDF15ResolveRecorderC2EPS_RK10QPDFObjGen:
 1019|   367k|        {
 1020|   367k|        }
_ZN4QPDF15ResolveRecorderD2Ev:
 1022|   367k|        {
 1023|   367k|            this->qpdf->m->resolving.erase(iter);
 1024|   367k|        }
_ZN4QPDF19CHSharedObjectEntryC2Ei:
 1325|  32.0k|        {
 1326|  32.0k|        }
_ZN4QPDF13PatternFinderC2ERS_MS_FbvE:
 1384|  45.9k|        {
 1385|  45.9k|        }
_ZN4QPDF13PatternFinder5checkEv:
 1389|  42.2k|        {
 1390|  42.2k|            return (this->qpdf.*checker)();
 1391|  42.2k|        }
_ZN4QPDF7MembersD2Ev:
 1500|  12.4k|        ~Members() = default;
_ZN4QPDF3toOImEExRKT_:
 1471|  6.43M|    {
 1472|  6.43M|        return QIntC::to_offset(i);
 1473|  6.43M|    }
_ZN4QPDF3toIIlEEiRKT_:
 1483|  1.67k|    {
 1484|  1.67k|        return QIntC::to_int(i);
 1485|  1.67k|    }
_ZN4QPDF3toIIxEEiRKT_:
 1483|   394k|    {
 1484|   394k|        return QIntC::to_int(i);
 1485|   394k|    }
_ZN4QPDF3toSIiEEmRKT_:
 1477|   440k|    {
 1478|   440k|        return QIntC::to_size(i);
 1479|   440k|    }
_ZN4QPDF3toSIyEEmRKT_:
 1477|  82.2k|    {
 1478|  82.2k|        return QIntC::to_size(i);
 1479|  82.2k|    }
_ZN4QPDF3toSIxEEmRKT_:
 1477|  19.8k|    {
 1478|  19.8k|        return QIntC::to_size(i);
 1479|  19.8k|    }
_ZN4QPDF3toIImEEiRKT_:
 1483|   120k|    {
 1484|   120k|        return QIntC::to_int(i);
 1485|   120k|    }
_ZN4QPDF5toULLIxEEyRKT_:
 1489|  6.31k|    {
 1490|  6.31k|        return QIntC::to_ulonglong(i);
 1491|  6.31k|    }
_ZN4QPDF5toULLIiEEyRKT_:
 1489|  2.92k|    {
 1490|  2.92k|        return QIntC::to_ulonglong(i);
 1491|  2.92k|    }

_ZN14QPDFCryptoImplC2Ev:
   39|  2.95M|    QPDFCryptoImpl() = default;
_ZN14QPDFCryptoImplD2Ev:
   42|  2.95M|    virtual ~QPDFCryptoImpl() = default;

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

_ZN7QPDFExcD2Ev:
   40|  2.95M|    ~QPDFExc() noexcept override = default;

_ZN10QPDFObjGenC2Ev:
   38|  11.9M|    {
   39|  11.9M|    }
_ZN10QPDFObjGenC2Eii:
   44|  2.89M|    {
   45|  2.89M|    }
_ZNK10QPDFObjGenltERKS_:
   49|   107M|    {
   50|   107M|        return (obj < rhs.obj) || ((obj == rhs.obj) && (gen < rhs.gen));
  ------------------
  |  Branch (50:16): [True: 58.2M, False: 48.9M]
  |  Branch (50:36): [True: 13.5M, False: 35.4M]
  |  Branch (50:56): [True: 35.1k, False: 13.5M]
  ------------------
   51|   107M|    }
_ZNK10QPDFObjGeneqERKS_:
   55|   585k|    {
   56|   585k|        return (obj == rhs.obj) && (gen == rhs.gen);
  ------------------
  |  Branch (56:16): [True: 10.0k, False: 575k]
  |  Branch (56:36): [True: 9.97k, False: 28]
  ------------------
   57|   585k|    }
_ZNK10QPDFObjGenneERKS_:
   61|   331k|    {
   62|   331k|        return (obj != rhs.obj) || (gen != rhs.gen);
  ------------------
  |  Branch (62:16): [True: 4.00k, False: 327k]
  |  Branch (62:36): [True: 10, False: 327k]
  ------------------
   63|   331k|    }
_ZNK10QPDFObjGen6getObjEv:
   67|  27.6M|    {
   68|  27.6M|        return obj;
   69|  27.6M|    }
_ZNK10QPDFObjGen6getGenEv:
   73|   567k|    {
   74|   567k|        return gen;
   75|   567k|    }
_ZNK10QPDFObjGen10isIndirectEv:
   79|  4.93M|    {
   80|  4.93M|        return obj != 0;
   81|  4.93M|    }
_ZN10QPDFObjGen3set3addES_:
  113|  1.24M|        {
  114|  1.24M|            if (og.isIndirect()) {
  ------------------
  |  Branch (114:17): [True: 1.24M, False: 6.82k]
  ------------------
  115|  1.24M|                if (count(og) > 0) {
  ------------------
  |  Branch (115:21): [True: 806k, False: 435k]
  ------------------
  116|   806k|                    return false;
  117|   806k|                }
  118|   435k|                emplace(og);
  119|   435k|            }
  120|   442k|            return true;
  121|  1.24M|        }
_ZN10QPDFObjGen3set5eraseES_:
  132|  5.92k|        {
  133|  5.92k|            if (og.isIndirect()) {
  ------------------
  |  Branch (133:17): [True: 218, False: 5.70k]
  ------------------
  134|    218|                std::set<QPDFObjGen>::erase(og);
  135|    218|            }
  136|  5.92k|        }

_ZN16QPDFObjectHandle11TokenFilter16PipelineAccessor11setPipelineEPS0_P8Pipeline:
  171|  15.4k|            {
  172|  15.4k|                f->setPipeline(p);
  173|  15.4k|            }
_ZN16QPDFObjectHandle9RectangleC2Edddd:
  244|  10.9k|        {
  245|  10.9k|        }
_ZN16QPDFObjectHandle16DisconnectAccess10disconnectES_:
 1271|  2.39M|        {
 1272|  2.39M|            o.disconnect();
 1273|  2.39M|        }
_ZN16QPDFObjectHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
 1337|  12.9M|    {
 1338|  12.9M|    }
_ZN16QPDFObjectHandle6getObjEv:
 1341|   350k|    {
 1342|   350k|        return obj;
 1343|   350k|    }
_ZNK16QPDFObjectHandle6getObjEv:
 1346|  77.1k|    {
 1347|  77.1k|        return obj;
 1348|  77.1k|    }
_ZNK16QPDFObjectHandle12getObjectPtrEv:
 1356|   126k|    {
 1357|   126k|        return obj.get();
 1358|   126k|    }
_ZNK16QPDFObjectHandle14QPDFArrayItems8iteratorneERKS1_:
 1575|   106k|        {
 1576|   106k|            return !operator==(other);
 1577|   106k|        }
_ZNK16QPDFObjectHandle11getObjectIDEv:
 1615|  24.3M|{
 1616|  24.3M|    return getObjGen().getObj();
 1617|  24.3M|}
_ZNK16QPDFObjectHandle10isIndirectEv:
 1627|  22.2M|{
 1628|  22.2M|    return (obj != nullptr) && (getObjectID() != 0);
  ------------------
  |  Branch (1628:12): [True: 22.2M, False: 0]
  |  Branch (1628:32): [True: 3.93M, False: 18.2M]
  ------------------
 1629|  22.2M|}
_ZNK16QPDFObjectHandle13isInitializedEv:
 1633|  39.5M|{
 1634|  39.5M|    return obj != nullptr;
 1635|  39.5M|}
_ZN16QPDFObjectHandleC2ERKS_:
  289|  54.5M|    QPDFObjectHandle(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandleaSERKS_:
  291|  84.7k|    QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle15StringDecrypterD2Ev:
  197|   325k|        virtual ~StringDecrypter() = default;
_ZN16QPDFObjectHandleC2Ev:
  287|   878k|    QPDFObjectHandle() = default;
_ZN16QPDFObjectHandleaSEOS_:
  296|  1.22M|    QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleC2EOS_:
  294|  9.33M|    QPDFObjectHandle(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorD2Ev:
 1545|  14.9k|        virtual ~iterator() = default;
_ZN16QPDFObjectHandle11TokenFilterD2Ev:
  159|  7.78k|        virtual ~TokenFilter() = default;
_ZN16QPDFObjectHandle11TokenFilterC2Ev:
  157|  7.78k|        TokenFilter() = default;

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

_ZN13QPDFTokenizer5TokenC2Ev:
   63|  15.7M|        {
   64|  15.7M|        }
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES8_S8_:
   76|  15.7M|        {
   77|  15.7M|        }
_ZNK13QPDFTokenizer5Token7getTypeEv:
   80|  26.4M|        {
   81|  26.4M|            return this->type;
   82|  26.4M|        }
_ZNK13QPDFTokenizer5Token8getValueEv:
   85|  8.53M|        {
   86|  8.53M|            return this->value;
   87|  8.53M|        }
_ZNK13QPDFTokenizer5Token11getRawValueEv:
   90|  5.34M|        {
   91|  5.34M|            return this->raw_value;
   92|  5.34M|        }
_ZNK13QPDFTokenizer5TokeneqERKS0_:
  100|  10.4k|        {
  101|       |            // Ignore fields other than type and value
  102|  10.4k|            return (
  103|  10.4k|                (this->type != tt_bad) && (this->type == rhs.type) && (this->value == rhs.value));
  ------------------
  |  Branch (103:17): [True: 10.4k, False: 0]
  |  Branch (103:43): [True: 10.4k, False: 0]
  |  Branch (103:71): [True: 8.65k, False: 1.83k]
  ------------------
  104|  10.4k|        }
_ZNK13QPDFTokenizer5Token9isIntegerEv:
  107|  8.38M|        {
  108|  8.38M|            return this->type == tt_integer;
  109|  8.38M|        }
_ZNK13QPDFTokenizer5Token6isWordEv:
  112|  10.4k|        {
  113|  10.4k|            return this->type == tt_word;
  114|  10.4k|        }
_ZNK13QPDFTokenizer5Token6isWordERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  117|  10.2M|        {
  118|  10.2M|            return this->type == tt_word && this->value == value;
  ------------------
  |  Branch (118:20): [True: 3.69M, False: 6.56M]
  |  Branch (118:45): [True: 1.27M, False: 2.42M]
  ------------------
  119|  10.2M|        }
_ZNK13QPDFTokenizer7getTypeEv:
  300|  16.4M|{
  301|  16.4M|    return this->type;
  302|  16.4M|}
_ZNK13QPDFTokenizer8getValueEv:
  305|  10.4M|{
  306|  10.4M|    return (this->type == tt_name || this->type == tt_string) ? this->val : this->raw_val;
  ------------------
  |  Branch (306:13): [True: 3.67M, False: 6.75M]
  |  Branch (306:38): [True: 200k, False: 6.55M]
  ------------------
  307|  10.4M|}
_ZNK13QPDFTokenizer15getErrorMessageEv:
  315|  51.0k|{
  316|  51.0k|    return this->error_message;
  317|  51.0k|}

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

_ZN13QPDFXRefEntryC2Ex:
   43|   800k|    {
   44|   800k|    }
_ZN13QPDFXRefEntryC2Eii:
   51|   116k|    {
   52|   116k|    }

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

_ZN5QUtil10FileCloserC2EP8_IO_FILE:
  114|      1|        {
  115|      1|        }
_ZN5QUtil10FileCloserD2Ev:
  118|      1|        {
  119|      1|            if (f) {
  ------------------
  |  Branch (119:17): [True: 1, False: 0]
  ------------------
  120|      1|                fclose(f);
  121|      1|                f = nullptr;
  122|      1|            }
  123|      1|        }
_ZN5QUtil8is_spaceEc:
  499|  65.4M|{
  500|  65.4M|    return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v';
  ------------------
  |  Branch (500:12): [True: 30.4M, False: 35.0M]
  |  Branch (500:25): [True: 3.46M, False: 31.5M]
  |  Branch (500:39): [True: 830k, False: 30.7M]
  |  Branch (500:53): [True: 43.9k, False: 30.6M]
  |  Branch (500:67): [True: 124k, False: 30.5M]
  |  Branch (500:81): [True: 1.46M, False: 29.0M]
  ------------------
  501|  65.4M|}
_ZN5QUtil8is_digitEc:
  505|  29.6M|{
  506|  29.6M|    return ((ch >= '0') && (ch <= '9'));
  ------------------
  |  Branch (506:13): [True: 19.0M, False: 10.5M]
  |  Branch (506:28): [True: 18.7M, False: 245k]
  ------------------
  507|  29.6M|}
_ZN5QUtil15hex_encode_charEc:
  539|  21.9M|{
  540|  21.9M|    static auto constexpr hexchars = "0123456789abcdef";
  541|  21.9M|    return {'#', hexchars[static_cast<unsigned char>(c) >> 4], hexchars[c & 0x0f]};
  542|  21.9M|}
_ZN5QUtil15hex_decode_charEc:
  546|  2.88M|{
  547|  2.88M|    return digit <= '9' && digit >= '0'
  ------------------
  |  Branch (547:12): [True: 1.98M, False: 902k]
  |  Branch (547:28): [True: 1.65M, False: 329k]
  ------------------
  548|  2.88M|        ? char(digit - '0')
  549|  2.88M|        : (digit >= 'a' ? char(digit - 'a' + 10) : (digit >= 'A' ? char(digit - 'A' + 10) : '\20'));
  ------------------
  |  Branch (549:12): [True: 455k, False: 775k]
  |  Branch (549:53): [True: 346k, False: 429k]
  ------------------
  550|  2.88M|}
_ZN5QUtil17make_shared_arrayIhEENSt3__110shared_ptrIT_EEm:
  181|  77.6k|    {
  182|  77.6k|        return std::shared_ptr<T>(new T[n], std::default_delete<T[]>());
  183|  77.6k|    }

_ZN18RandomDataProviderD2Ev:
   31|      2|    virtual ~RandomDataProvider() = default;

_ZN14AES_PDF_nativeC2EbPKhmbPh:
   22|  1.38M|{
   23|  1.38M|    size_t keybits = 8 * key_bytes;
   24|  1.38M|    this->key = std::make_unique<unsigned char[]>(key_bytes);
   25|  1.38M|    this->rk = std::make_unique<uint32_t[]>(RKLENGTH(keybits));
  ------------------
  |  |   27|  1.38M|#define RKLENGTH(keybits) ((keybits) / 8 + 28)
  ------------------
   26|  1.38M|    size_t rk_bytes = RKLENGTH(keybits) * sizeof(uint32_t);
  ------------------
  |  |   27|  1.38M|#define RKLENGTH(keybits) ((keybits) / 8 + 28)
  ------------------
   27|  1.38M|    std::memcpy(this->key.get(), key, key_bytes);
   28|  1.38M|    std::memset(this->rk.get(), 0, rk_bytes);
   29|  1.38M|    if (encrypt) {
  ------------------
  |  Branch (29:9): [True: 1.37M, False: 6.47k]
  ------------------
   30|  1.37M|        this->nrounds = rijndaelSetupEncrypt(this->rk.get(), this->key.get(), keybits);
   31|  1.37M|    } else {
   32|  6.47k|        this->nrounds = rijndaelSetupDecrypt(this->rk.get(), this->key.get(), keybits);
   33|  6.47k|    }
   34|  1.38M|}
_ZN14AES_PDF_native6updateEPhS0_:
   38|   345M|{
   39|   345M|    if (this->encrypt) {
  ------------------
  |  Branch (39:9): [True: 343M, False: 1.99M]
  ------------------
   40|   343M|        if (this->cbc_mode) {
  ------------------
  |  Branch (40:13): [True: 343M, False: 0]
  ------------------
   41|  5.84G|            for (size_t i = 0; i < QPDFCryptoImpl::rijndael_buf_size; ++i) {
  ------------------
  |  Branch (41:32): [True: 5.49G, False: 343M]
  ------------------
   42|  5.49G|                in_data[i] ^= this->cbc_block[i];
   43|  5.49G|            }
   44|   343M|        }
   45|   343M|        rijndaelEncrypt(this->rk.get(), this->nrounds, in_data, out_data);
   46|   343M|        if (this->cbc_mode) {
  ------------------
  |  Branch (46:13): [True: 343M, False: 0]
  ------------------
   47|   343M|            memcpy(this->cbc_block, out_data, QPDFCryptoImpl::rijndael_buf_size);
   48|   343M|        }
   49|   343M|    } else {
   50|  1.99M|        rijndaelDecrypt(this->rk.get(), this->nrounds, in_data, out_data);
   51|  1.99M|        if (this->cbc_mode) {
  ------------------
  |  Branch (51:13): [True: 1.99M, False: 0]
  ------------------
   52|  33.9M|            for (size_t i = 0; i < QPDFCryptoImpl::rijndael_buf_size; ++i) {
  ------------------
  |  Branch (52:32): [True: 31.9M, False: 1.99M]
  ------------------
   53|  31.9M|                out_data[i] ^= this->cbc_block[i];
   54|  31.9M|            }
   55|  1.99M|            memcpy(this->cbc_block, in_data, QPDFCryptoImpl::rijndael_buf_size);
   56|  1.99M|        }
   57|  1.99M|    }
   58|   345M|}

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

_ZN6Buffer7MembersC2EmPhb:
   22|   257k|{
   23|   257k|    if (own_memory) {
  ------------------
  |  Branch (23:9): [True: 249k, False: 8.04k]
  ------------------
   24|   249k|        this->buf = (size ? new unsigned char[size] : nullptr);
  ------------------
  |  Branch (24:22): [True: 249k, False: 0]
  ------------------
   25|   249k|    } else {
   26|  8.04k|        this->buf = buf;
   27|  8.04k|    }
   28|   257k|}
_ZN6Buffer7MembersC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   35|  95.5k|{
   36|  95.5k|}
_ZN6Buffer7MembersD2Ev:
   39|   352k|{
   40|   352k|    if (this->own_memory) {
  ------------------
  |  Branch (40:9): [True: 249k, False: 103k]
  ------------------
   41|   249k|        delete[] this->buf;
   42|   249k|    }
   43|   352k|}
_ZN6BufferC2Em:
   52|   249k|{
   53|   249k|}
_ZN6BufferC2EONSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   57|  95.5k|{
   58|  95.5k|}
_ZN6BufferC2EPhm:
   62|  8.04k|{
   63|  8.04k|}
_ZN6BufferC2EOS_:
   86|   492k|{
   87|   492k|}
_ZNK6Buffer7getSizeEv:
  109|   376k|{
  110|   376k|    return m->size;
  111|   376k|}
_ZN6Buffer9getBufferEv:
  121|  15.2M|{
  122|  15.2M|    return m->buf;
  123|  15.2M|}

_ZN17BufferInputSourceC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEP6Bufferb:
   14|  22.0k|{
   15|  22.0k|}
_ZN17BufferInputSourceC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
   23|  20.9k|{
   24|  20.9k|    memcpy(buf->getBuffer(), contents.c_str(), contents.length());
   25|  20.9k|}
_ZN17BufferInputSourceD2Ev:
   28|  42.9k|{
   29|  42.9k|    if (this->own_memory) {
  ------------------
  |  Branch (29:9): [True: 28.5k, False: 14.4k]
  ------------------
   30|  28.5k|        delete this->buf;
   31|  28.5k|    }
   32|  42.9k|}
_ZN17BufferInputSource18findAndSkipNextEOLEv:
   36|  6.36M|{
   37|  6.36M|    if (this->cur_offset < 0) {
  ------------------
  |  Branch (37:9): [True: 0, False: 6.36M]
  ------------------
   38|      0|        throw std::logic_error("INTERNAL ERROR: BufferInputSource offset < 0");
   39|      0|    }
   40|  6.36M|    qpdf_offset_t end_pos = this->max_offset;
   41|  6.36M|    if (this->cur_offset >= end_pos) {
  ------------------
  |  Branch (41:9): [True: 5.99k, False: 6.36M]
  ------------------
   42|  5.99k|        this->last_offset = end_pos;
   43|  5.99k|        this->cur_offset = end_pos;
   44|  5.99k|        return end_pos;
   45|  5.99k|    }
   46|       |
   47|  6.36M|    qpdf_offset_t result = 0;
   48|  6.36M|    unsigned char const* buffer = this->buf->getBuffer();
   49|  6.36M|    unsigned char const* end = buffer + end_pos;
   50|  6.36M|    unsigned char const* p = buffer + this->cur_offset;
   51|       |
   52|   439M|    while ((p < end) && !((*p == '\r') || (*p == '\n'))) {
  ------------------
  |  Branch (52:12): [True: 439M, False: 6.62k]
  |  Branch (52:27): [True: 1.92M, False: 437M]
  |  Branch (52:43): [True: 4.42M, False: 433M]
  ------------------
   53|   433M|        ++p;
   54|   433M|    }
   55|  6.36M|    if (p < end) {
  ------------------
  |  Branch (55:9): [True: 6.35M, False: 6.62k]
  ------------------
   56|  6.35M|        result = p - buffer;
   57|  6.35M|        this->cur_offset = result + 1;
   58|  6.35M|        ++p;
   59|  7.89M|        while ((this->cur_offset < end_pos) && ((*p == '\r') || (*p == '\n'))) {
  ------------------
  |  Branch (59:16): [True: 7.89M, False: 689]
  |  Branch (59:49): [True: 178k, False: 7.71M]
  |  Branch (59:65): [True: 1.36M, False: 6.35M]
  ------------------
   60|  1.54M|            ++p;
   61|  1.54M|            ++this->cur_offset;
   62|  1.54M|        }
   63|  6.35M|    } else {
   64|  6.62k|        this->cur_offset = end_pos;
   65|  6.62k|        result = end_pos;
   66|  6.62k|    }
   67|  6.36M|    return result;
   68|  6.36M|}
_ZNK17BufferInputSource7getNameEv:
   72|  1.28M|{
   73|  1.28M|    return this->description;
   74|  1.28M|}
_ZN17BufferInputSource4tellEv:
   78|  53.6M|{
   79|  53.6M|    return this->cur_offset;
   80|  53.6M|}
_ZN17BufferInputSource4seekExi:
   84|  36.3M|{
   85|  36.3M|    switch (whence) {
   86|  35.9M|    case SEEK_SET:
  ------------------
  |  Branch (86:5): [True: 35.9M, False: 423k]
  ------------------
   87|  35.9M|        this->cur_offset = offset;
   88|  35.9M|        break;
   89|       |
   90|  24.7k|    case SEEK_END:
  ------------------
  |  Branch (90:5): [True: 24.7k, False: 36.3M]
  ------------------
   91|  24.7k|        QIntC::range_check(this->max_offset, offset);
   92|  24.7k|        this->cur_offset = this->max_offset + offset;
   93|  24.7k|        break;
   94|       |
   95|   398k|    case SEEK_CUR:
  ------------------
  |  Branch (95:5): [True: 398k, False: 35.9M]
  ------------------
   96|   398k|        QIntC::range_check(this->cur_offset, offset);
   97|   398k|        this->cur_offset += offset;
   98|   398k|        break;
   99|       |
  100|      0|    default:
  ------------------
  |  Branch (100:5): [True: 0, False: 36.3M]
  ------------------
  101|      0|        throw std::logic_error("INTERNAL ERROR: invalid argument to BufferInputSource::seek");
  102|      0|        break;
  103|  36.3M|    }
  104|       |
  105|  36.3M|    if (this->cur_offset < 0) {
  ------------------
  |  Branch (105:9): [True: 50, False: 36.3M]
  ------------------
  106|     50|        throw std::runtime_error(this->description + ": seek before beginning of buffer");
  107|     50|    }
  108|  36.3M|}
_ZN17BufferInputSource4readEPcm:
  118|  8.34M|{
  119|  8.34M|    if (this->cur_offset < 0) {
  ------------------
  |  Branch (119:9): [True: 0, False: 8.34M]
  ------------------
  120|      0|        throw std::logic_error("INTERNAL ERROR: BufferInputSource offset < 0");
  121|      0|    }
  122|  8.34M|    qpdf_offset_t end_pos = this->max_offset;
  123|  8.34M|    if (this->cur_offset >= end_pos) {
  ------------------
  |  Branch (123:9): [True: 88.7k, False: 8.25M]
  ------------------
  124|  88.7k|        this->last_offset = end_pos;
  125|  88.7k|        return 0;
  126|  88.7k|    }
  127|       |
  128|  8.25M|    this->last_offset = this->cur_offset;
  129|  8.25M|    size_t len = std::min(QIntC::to_size(end_pos - this->cur_offset), length);
  130|  8.25M|    memcpy(buffer, this->buf->getBuffer() + this->cur_offset, len);
  131|  8.25M|    this->cur_offset += QIntC::to_offset(len);
  132|  8.25M|    return len;
  133|  8.34M|}
_ZN17BufferInputSource8unreadChEc:
  137|  6.81k|{
  138|  6.81k|    if (this->cur_offset > 0) {
  ------------------
  |  Branch (138:9): [True: 6.81k, False: 0]
  ------------------
  139|  6.81k|        --this->cur_offset;
  140|  6.81k|    }
  141|  6.81k|}

_ZN17ContentNormalizerC2Ev:
    9|  7.78k|{
   10|  7.78k|}
_ZN17ContentNormalizer11handleTokenERKN13QPDFTokenizer5TokenE:
   14|  5.34M|{
   15|  5.34M|    QPDFTokenizer::token_type_e token_type = token.getType();
   16|       |
   17|  5.34M|    if (token_type == QPDFTokenizer::tt_bad) {
  ------------------
  |  Branch (17:9): [True: 165k, False: 5.17M]
  ------------------
   18|   165k|        this->any_bad_tokens = true;
   19|   165k|        this->last_token_was_bad = true;
   20|  5.17M|    } else if (token_type != QPDFTokenizer::tt_eof) {
  ------------------
  |  Branch (20:16): [True: 5.17M, False: 7.63k]
  ------------------
   21|  5.17M|        this->last_token_was_bad = false;
   22|  5.17M|    }
   23|       |
   24|  5.34M|    switch (token_type) {
   25|  2.25M|    case QPDFTokenizer::tt_space:
  ------------------
  |  Branch (25:5): [True: 2.25M, False: 3.09M]
  ------------------
   26|  2.25M|        {
   27|  2.25M|            std::string const& value = token.getRawValue();
   28|  2.25M|            auto size = value.size();
   29|  2.25M|            size_t pos = 0;
   30|  2.25M|            auto r_pos = value.find('\r');
   31|  2.26M|            while (r_pos != std::string::npos) {
  ------------------
  |  Branch (31:20): [True: 18.8k, False: 2.24M]
  ------------------
   32|  18.8k|                if (pos != r_pos) {
  ------------------
  |  Branch (32:21): [True: 1.39k, False: 17.4k]
  ------------------
   33|  1.39k|                    write(&value[pos], r_pos - pos);
   34|  1.39k|                }
   35|  18.8k|                if (++r_pos >= size) {
  ------------------
  |  Branch (35:21): [True: 6.35k, False: 12.5k]
  ------------------
   36|  6.35k|                    write("\n");
   37|  6.35k|                    return;
   38|  6.35k|                }
   39|  12.5k|                if (value[r_pos] != '\n') {
  ------------------
  |  Branch (39:21): [True: 10.8k, False: 1.67k]
  ------------------
   40|  10.8k|                    write("\n");
   41|  10.8k|                }
   42|  12.5k|                pos = r_pos;
   43|  12.5k|                r_pos = value.find('\r', pos);
   44|  12.5k|            }
   45|  2.24M|            if (pos < size) {
  ------------------
  |  Branch (45:17): [True: 2.24M, False: 0]
  ------------------
   46|  2.24M|                write(&value[pos], size - pos);
   47|  2.24M|            }
   48|  2.24M|        }
   49|      0|        return;
   50|       |
   51|   180k|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (51:5): [True: 180k, False: 5.16M]
  ------------------
   52|       |        // Replacing string and name tokens in this way normalizes their representation as this will
   53|       |        // automatically handle quoting of unprintable characters, etc.
   54|   180k|        write(QPDFObjectHandle::newString(token.getValue()).unparse());
   55|   180k|        break;
   56|       |
   57|   310k|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (57:5): [True: 310k, False: 5.03M]
  ------------------
   58|   310k|        write(QPDF_Name::normalizeName(token.getValue()));
   59|   310k|        break;
   60|       |
   61|  2.60M|    default:
  ------------------
  |  Branch (61:5): [True: 2.60M, False: 2.74M]
  ------------------
   62|  2.60M|        writeToken(token);
   63|  2.60M|        return;
   64|  5.34M|    }
   65|       |
   66|       |    // tt_string or tt_name
   67|   491k|    std::string const& value = token.getRawValue();
   68|   491k|    if (value.find('\r') != std::string::npos || value.find('\n') != std::string::npos) {
  ------------------
  |  Branch (68:9): [True: 937, False: 490k]
  |  Branch (68:50): [True: 1.54k, False: 488k]
  ------------------
   69|  2.47k|        write("\n");
   70|  2.47k|    }
   71|   491k|}
_ZNK17ContentNormalizer12anyBadTokensEv:
   75|  7.24k|{
   76|  7.24k|    return this->any_bad_tokens;
   77|  7.24k|}
_ZNK17ContentNormalizer15lastTokenWasBadEv:
   81|    654|{
   82|    654|    return this->last_token_was_bad;
   83|    654|}

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

_ZN11InputSource13setLastOffsetEx:
   10|  29.4M|{
   11|  29.4M|    this->last_offset = offset;
   12|  29.4M|}
_ZNK11InputSource13getLastOffsetEv:
   16|  7.43M|{
   17|  7.43M|    return this->last_offset;
   18|  7.43M|}
_ZN11InputSource8readLineEm:
   22|  11.1k|{
   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|  11.1k|    qpdf_offset_t offset = this->tell();
   29|  11.1k|    auto bp = std::make_unique<char[]>(max_line_length + 1);
   30|  11.1k|    char* buf = bp.get();
   31|  11.1k|    memset(buf, '\0', max_line_length + 1);
   32|  11.1k|    this->read(buf, max_line_length);
   33|  11.1k|    this->seek(offset, SEEK_SET);
   34|  11.1k|    qpdf_offset_t eol = this->findAndSkipNextEOL();
   35|  11.1k|    this->last_offset = offset;
   36|  11.1k|    size_t line_length = QIntC::to_size(eol - offset);
   37|  11.1k|    if (line_length < max_line_length) {
  ------------------
  |  Branch (37:9): [True: 10.3k, False: 775]
  ------------------
   38|  10.3k|        buf[line_length] = '\0';
   39|  10.3k|    }
   40|  11.1k|    return {buf};
   41|  11.1k|}
_ZN11InputSource9findFirstEPKcxmRNS_6FinderE:
   45|  61.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|  61.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|  61.5k|    size_t size = sizeof(buf) - 1;
   59|  61.5k|    if ((strlen(start_chars) < 1) || (strlen(start_chars) > size)) {
  ------------------
  |  Branch (59:9): [True: 0, False: 61.5k]
  |  Branch (59:38): [True: 0, False: 61.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|  61.5k|    char* p = nullptr;
   65|  61.5k|    qpdf_offset_t buf_offset = offset;
   66|  61.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|  1.22M|    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|  1.22M|        if ((p == nullptr) || ((p + strlen(start_chars)) > (buf + bytes_read))) {
  ------------------
  |  Branch (77:13): [True: 61.5k, False: 1.16M]
  |  Branch (77:31): [True: 243k, False: 918k]
  ------------------
   78|   304k|            if (p) {
  ------------------
  |  Branch (78:17): [True: 243k, False: 61.5k]
  ------------------
   79|   243k|                QTC::TC(
   80|   243k|                    "libtests", "InputSource read next block", ((p == buf + bytes_read) ? 0 : 1));
  ------------------
  |  Branch (80:65): [True: 239k, False: 4.26k]
  ------------------
   81|   243k|                buf_offset += (p - buf);
   82|   243k|            }
   83|   304k|            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|   304k|            bytes_read = this->read(buf, size);
   88|   304k|            if (bytes_read < strlen(start_chars)) {
  ------------------
  |  Branch (88:17): [True: 18.0k, False: 286k]
  ------------------
   89|  18.0k|                QTC::TC("libtests", "InputSource find EOF", bytes_read == 0 ? 0 : 1);
  ------------------
  |  Branch (89:61): [True: 15.7k, False: 2.29k]
  ------------------
   90|  18.0k|                return false;
   91|  18.0k|            }
   92|   286k|            memset(buf + bytes_read, '\0', 1 + (size - bytes_read));
   93|   286k|            p = buf;
   94|   286k|        }
   95|       |
   96|       |        // Search for the first character.
   97|  1.20M|        if ((p = static_cast<char*>(
  ------------------
  |  Branch (97:13): [True: 966k, False: 239k]
  ------------------
   98|       |                 // line-break
   99|  1.20M|                 memchr(p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) != nullptr) {
  100|   966k|            if (p == buf) {
  ------------------
  |  Branch (100:17): [True: 10.1k, False: 956k]
  ------------------
  101|  10.1k|                QTC::TC("libtests", "InputSource found match at buf[0]");
  102|  10.1k|            }
  103|       |            // Found first letter.
  104|   966k|            if (len != 0) {
  ------------------
  |  Branch (104:17): [True: 25.7k, False: 940k]
  ------------------
  105|       |                // Make sure it's in range.
  106|  25.7k|                size_t p_relative_offset = QIntC::to_size((p - buf) + (buf_offset - offset));
  107|  25.7k|                if (p_relative_offset >= len) {
  ------------------
  |  Branch (107:21): [True: 1.28k, False: 24.4k]
  ------------------
  108|       |                    // out of range
  109|  1.28k|                    QTC::TC("libtests", "InputSource out of range");
  110|  1.28k|                    return false;
  111|  1.28k|                }
  112|  25.7k|            }
  113|   965k|            if ((p + strlen(start_chars)) > (buf + bytes_read)) {
  ------------------
  |  Branch (113:17): [True: 3.22k, False: 962k]
  ------------------
  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|  3.22k|                QTC::TC("libtests", "InputSource not enough bytes");
  117|  3.22k|                continue;
  118|  3.22k|            }
  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|   962k|            if (strncmp(p, start_chars, strlen(start_chars)) == 0) {
  ------------------
  |  Branch (122:17): [True: 52.7k, False: 909k]
  ------------------
  123|       |                // Call finder.check() with the input source positioned to the point of the match.
  124|  52.7k|                this->seek(buf_offset + (p - buf), SEEK_SET);
  125|  52.7k|                if (finder.check()) {
  ------------------
  |  Branch (125:21): [True: 42.2k, False: 10.5k]
  ------------------
  126|  42.2k|                    return true;
  127|  42.2k|                } else {
  128|  10.5k|                    QTC::TC("libtests", "InputSource start_chars matched but not check");
  129|  10.5k|                }
  130|   909k|            } else {
  131|   909k|                QTC::TC("libtests", "InputSource first char matched but not string");
  132|   909k|            }
  133|       |            // This occurrence of the first character wasn't a match. Skip over it and keep
  134|       |            // searching.
  135|   919k|            ++p;
  136|   919k|        } else {
  137|       |            // Trigger reading the next block
  138|   239k|            p = buf + bytes_read;
  139|   239k|        }
  140|  1.20M|    }
  141|      0|    throw std::logic_error("InputSource after while (true)");
  142|  61.5k|}
_ZN11InputSource8findLastEPKcxmRNS_6FinderE:
  146|  12.4k|{
  147|  12.4k|    bool found = false;
  148|  12.4k|    qpdf_offset_t after_found_offset = 0;
  149|  12.4k|    qpdf_offset_t cur_offset = offset;
  150|  12.4k|    size_t cur_len = len;
  151|  18.5k|    while (this->findFirst(start_chars, cur_offset, cur_len, finder)) {
  ------------------
  |  Branch (151:12): [True: 6.08k, False: 12.4k]
  ------------------
  152|  6.08k|        if (found) {
  ------------------
  |  Branch (152:13): [True: 424, False: 5.65k]
  ------------------
  153|    424|            QTC::TC("libtests", "InputSource findLast found more than one");
  154|  5.65k|        } else {
  155|  5.65k|            found = true;
  156|  5.65k|        }
  157|  6.08k|        after_found_offset = this->tell();
  158|  6.08k|        cur_offset = after_found_offset;
  159|  6.08k|        cur_len = len - QIntC::to_size((cur_offset - offset));
  160|  6.08k|    }
  161|  12.4k|    if (found) {
  ------------------
  |  Branch (161:9): [True: 5.65k, False: 6.76k]
  ------------------
  162|  5.65k|        this->seek(after_found_offset, SEEK_SET);
  163|  5.65k|    }
  164|  12.4k|    return found;
  165|  12.4k|}

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

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

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

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

_ZN10Pl_AES_PDFC2EPKcP8PipelinebPKhm:
   28|  1.38M|{
   29|  1.38M|    this->key = std::make_unique<unsigned char[]>(key_bytes);
   30|  1.38M|    std::memcpy(this->key.get(), key, key_bytes);
   31|  1.38M|    std::memset(this->inbuf, 0, this->buf_size);
   32|  1.38M|    std::memset(this->outbuf, 0, this->buf_size);
   33|  1.38M|    std::memset(this->cbc_block, 0, this->buf_size);
   34|  1.38M|}
_ZN10Pl_AES_PDF9useZeroIVEv:
   38|  12.1k|{
   39|  12.1k|    this->use_zero_iv = true;
   40|  12.1k|}
_ZN10Pl_AES_PDF14disablePaddingEv:
   44|  1.16M|{
   45|  1.16M|    this->disable_padding = true;
   46|  1.16M|}
_ZN10Pl_AES_PDF5setIVEPKhm:
   50|  1.15M|{
   51|  1.15M|    if (bytes != this->buf_size) {
  ------------------
  |  Branch (51:9): [True: 0, False: 1.15M]
  ------------------
   52|      0|        throw std::logic_error(
   53|      0|            "Pl_AES_PDF: specified initialization vector"
   54|      0|            " size in bytes must be " +
   55|      0|            std::to_string(bytes));
   56|      0|    }
   57|  1.15M|    this->use_specified_iv = true;
   58|  1.15M|    memcpy(this->specified_iv, iv, bytes);
   59|  1.15M|}
_ZN10Pl_AES_PDF5writeEPKhm:
   75|  73.8M|{
   76|  73.8M|    size_t bytes_left = len;
   77|  73.8M|    unsigned char const* p = data;
   78|       |
   79|   485M|    while (bytes_left > 0) {
  ------------------
  |  Branch (79:12): [True: 411M, False: 73.8M]
  ------------------
   80|   411M|        if (this->offset == this->buf_size) {
  ------------------
  |  Branch (80:13): [True: 344M, False: 67.4M]
  ------------------
   81|   344M|            flush(false);
   82|   344M|        }
   83|       |
   84|   411M|        size_t available = this->buf_size - this->offset;
   85|   411M|        size_t bytes = (bytes_left < available ? bytes_left : available);
  ------------------
  |  Branch (85:25): [True: 66.2M, False: 345M]
  ------------------
   86|   411M|        bytes_left -= bytes;
   87|   411M|        std::memcpy(this->inbuf + this->offset, p, bytes);
   88|   411M|        this->offset += bytes;
   89|   411M|        p += bytes;
   90|   411M|    }
   91|  73.8M|}
_ZN10Pl_AES_PDF6finishEv:
   95|  1.38M|{
   96|  1.38M|    if (this->encrypt) {
  ------------------
  |  Branch (96:9): [True: 1.37M, False: 6.47k]
  ------------------
   97|  1.37M|        if (this->offset == this->buf_size) {
  ------------------
  |  Branch (97:13): [True: 1.17M, False: 195k]
  ------------------
   98|  1.17M|            flush(false);
   99|  1.17M|        }
  100|  1.37M|        if (!this->disable_padding) {
  ------------------
  |  Branch (100:13): [True: 211k, False: 1.16M]
  ------------------
  101|       |            // Pad as described in section 3.5.1 of version 1.7 of the PDF specification, including
  102|       |            // providing an entire block of padding if the input was a multiple of 16 bytes.
  103|   211k|            unsigned char pad = QIntC::to_uchar(this->buf_size - this->offset);
  104|   211k|            memset(this->inbuf + this->offset, pad, pad);
  105|   211k|            this->offset = this->buf_size;
  106|   211k|            flush(false);
  107|   211k|        }
  108|  1.37M|    } else {
  109|  6.47k|        if (this->offset != this->buf_size) {
  ------------------
  |  Branch (109:13): [True: 5.62k, False: 848]
  ------------------
  110|       |            // This is never supposed to happen as the output is always supposed to be padded.
  111|       |            // However, we have encountered files for which the output is not a multiple of the
  112|       |            // block size.  In this case, pad with zeroes and hope for the best.
  113|  5.62k|            if (this->offset >= this->buf_size) {
  ------------------
  |  Branch (113:17): [True: 0, False: 5.62k]
  ------------------
  114|      0|                throw std::logic_error("buffer overflow in AES encryption"
  115|      0|                                       " pipeline");
  116|      0|            }
  117|  5.62k|            std::memset(this->inbuf + this->offset, 0, this->buf_size - this->offset);
  118|  5.62k|            this->offset = this->buf_size;
  119|  5.62k|        }
  120|  6.47k|        flush(!this->disable_padding);
  121|  6.47k|    }
  122|  1.38M|    this->crypto->rijndael_finalize();
  123|  1.38M|    getNext()->finish();
  124|  1.38M|}
_ZN10Pl_AES_PDF16initializeVectorEv:
  128|  1.37M|{
  129|  1.37M|    if (use_zero_iv) {
  ------------------
  |  Branch (129:9): [True: 12.1k, False: 1.36M]
  ------------------
  130|   206k|        for (unsigned int i = 0; i < this->buf_size; ++i) {
  ------------------
  |  Branch (130:34): [True: 194k, False: 12.1k]
  ------------------
  131|   194k|            this->cbc_block[i] = 0;
  132|   194k|        }
  133|  1.36M|    } else if (use_specified_iv) {
  ------------------
  |  Branch (133:16): [True: 1.15M, False: 211k]
  ------------------
  134|  1.15M|        std::memcpy(this->cbc_block, this->specified_iv, this->buf_size);
  135|  1.15M|    } else if (use_static_iv) {
  ------------------
  |  Branch (135:16): [True: 0, False: 211k]
  ------------------
  136|      0|        for (unsigned int i = 0; i < this->buf_size; ++i) {
  ------------------
  |  Branch (136:34): [True: 0, False: 0]
  ------------------
  137|      0|            this->cbc_block[i] = static_cast<unsigned char>(14U * (1U + i));
  138|      0|        }
  139|   211k|    } else {
  140|   211k|        QUtil::initializeWithRandomBytes(this->cbc_block, this->buf_size);
  141|   211k|    }
  142|  1.37M|}
_ZN10Pl_AES_PDF5flushEb:
  146|   345M|{
  147|   345M|    if (this->offset != this->buf_size) {
  ------------------
  |  Branch (147:9): [True: 0, False: 345M]
  ------------------
  148|      0|        throw std::logic_error("AES pipeline: flush called when buffer was not full");
  149|      0|    }
  150|       |
  151|   345M|    if (first) {
  ------------------
  |  Branch (151:9): [True: 1.38M, False: 344M]
  ------------------
  152|  1.38M|        first = false;
  153|  1.38M|        bool return_after_init = false;
  154|  1.38M|        if (this->cbc_mode) {
  ------------------
  |  Branch (154:13): [True: 1.38M, False: 0]
  ------------------
  155|  1.38M|            if (encrypt) {
  ------------------
  |  Branch (155:17): [True: 1.37M, False: 6.47k]
  ------------------
  156|       |                // Set cbc_block to the initialization vector, and if not zero, write it to the
  157|       |                // output stream.
  158|  1.37M|                initializeVector();
  159|  1.37M|                if (!(this->use_zero_iv || this->use_specified_iv)) {
  ------------------
  |  Branch (159:23): [True: 11.8k, False: 1.36M]
  |  Branch (159:44): [True: 1.15M, False: 211k]
  ------------------
  160|   211k|                    getNext()->write(this->cbc_block, this->buf_size);
  161|   211k|                }
  162|  1.37M|            } else if (this->use_zero_iv || this->use_specified_iv) {
  ------------------
  |  Branch (162:24): [True: 286, False: 6.19k]
  |  Branch (162:45): [True: 0, False: 6.19k]
  ------------------
  163|       |                // Initialize vector with zeroes; zero vector was not written to the beginning of
  164|       |                // the input file.
  165|    286|                initializeVector();
  166|  6.19k|            } else {
  167|       |                // Take the first block of input as the initialization vector.  There's nothing to
  168|       |                // write at this time.
  169|  6.19k|                memcpy(this->cbc_block, this->inbuf, this->buf_size);
  170|  6.19k|                this->offset = 0;
  171|  6.19k|                return_after_init = true;
  172|  6.19k|            }
  173|  1.38M|        }
  174|  1.38M|        this->crypto->rijndael_init(
  175|  1.38M|            encrypt, this->key.get(), key_bytes, this->cbc_mode, this->cbc_block);
  176|  1.38M|        if (return_after_init) {
  ------------------
  |  Branch (176:13): [True: 6.19k, False: 1.37M]
  ------------------
  177|  6.19k|            return;
  178|  6.19k|        }
  179|  1.38M|    }
  180|       |
  181|   345M|    this->crypto->rijndael_process(this->inbuf, this->outbuf);
  182|   345M|    unsigned int bytes = this->buf_size;
  183|   345M|    if (strip_padding) {
  ------------------
  |  Branch (183:9): [True: 4.55k, False: 345M]
  ------------------
  184|  4.55k|        unsigned char last = this->outbuf[this->buf_size - 1];
  185|  4.55k|        if (last <= this->buf_size) {
  ------------------
  |  Branch (185:13): [True: 387, False: 4.16k]
  ------------------
  186|    387|            bool strip = true;
  187|  1.08k|            for (unsigned int i = 1; i <= last; ++i) {
  ------------------
  |  Branch (187:38): [True: 936, False: 144]
  ------------------
  188|    936|                if (this->outbuf[this->buf_size - i] != last) {
  ------------------
  |  Branch (188:21): [True: 243, False: 693]
  ------------------
  189|    243|                    strip = false;
  190|    243|                    break;
  191|    243|                }
  192|    936|            }
  193|    387|            if (strip) {
  ------------------
  |  Branch (193:17): [True: 144, False: 243]
  ------------------
  194|    144|                bytes -= last;
  195|    144|            }
  196|    387|        }
  197|  4.55k|    }
  198|   345M|    this->offset = 0;
  199|   345M|    getNext()->write(this->outbuf, bytes);
  200|   345M|}

_ZN17Pl_ASCII85DecoderC2EPKcP8Pipeline:
   11|  8.39k|{
   12|  8.39k|    memset(this->inbuf, 117, 5);
   13|  8.39k|}
_ZN17Pl_ASCII85Decoder5writeEPKhm:
   17|  8.50k|{
   18|  8.50k|    if (eod > 1) {
  ------------------
  |  Branch (18:9): [True: 0, False: 8.50k]
  ------------------
   19|      0|        return;
   20|      0|    }
   21|   930k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (21:24): [True: 923k, False: 6.86k]
  ------------------
   22|   923k|        switch (buf[i]) {
  ------------------
  |  Branch (22:17): [True: 905k, False: 18.4k]
  ------------------
   23|  1.97k|        case ' ':
  ------------------
  |  Branch (23:9): [True: 1.97k, False: 921k]
  ------------------
   24|  2.06k|        case '\f':
  ------------------
  |  Branch (24:9): [True: 92, False: 923k]
  ------------------
   25|  6.52k|        case '\v':
  ------------------
  |  Branch (25:9): [True: 4.45k, False: 919k]
  ------------------
   26|  6.79k|        case '\t':
  ------------------
  |  Branch (26:9): [True: 275, False: 923k]
  ------------------
   27|  7.74k|        case '\r':
  ------------------
  |  Branch (27:9): [True: 945, False: 922k]
  ------------------
   28|  18.4k|        case '\n':
  ------------------
  |  Branch (28:9): [True: 10.6k, False: 913k]
  ------------------
   29|  18.4k|            QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
   30|       |            // ignore whitespace
   31|  18.4k|            continue;
   32|   923k|        }
   33|   905k|        if (eod > 1) {
  ------------------
  |  Branch (33:13): [True: 227, False: 905k]
  ------------------
   34|    227|            break;
   35|   905k|        } else if (eod == 1) {
  ------------------
  |  Branch (35:20): [True: 7.08k, False: 898k]
  ------------------
   36|  7.08k|            if (buf[i] == '>') {
  ------------------
  |  Branch (36:17): [True: 7.04k, False: 37]
  ------------------
   37|  7.04k|                flush();
   38|  7.04k|                eod = 2;
   39|  7.04k|            } else {
   40|     37|                throw std::runtime_error("broken end-of-data sequence in base 85 data");
   41|     37|            }
   42|   898k|        } else {
   43|   898k|            switch (buf[i]) {
   44|  7.08k|            case '~':
  ------------------
  |  Branch (44:13): [True: 7.08k, False: 891k]
  ------------------
   45|  7.08k|                eod = 1;
   46|  7.08k|                break;
   47|       |
   48|  5.74k|            case 'z':
  ------------------
  |  Branch (48:13): [True: 5.74k, False: 892k]
  ------------------
   49|  5.74k|                if (pos != 0) {
  ------------------
  |  Branch (49:21): [True: 82, False: 5.66k]
  ------------------
   50|     82|                    throw std::runtime_error("unexpected z during base 85 decode");
   51|  5.66k|                } else {
   52|  5.66k|                    QTC::TC("libtests", "Pl_ASCII85Decoder read z");
   53|  5.66k|                    unsigned char zeroes[4];
   54|  5.66k|                    memset(zeroes, '\0', 4);
   55|  5.66k|                    getNext()->write(zeroes, 4);
   56|  5.66k|                }
   57|  5.66k|                break;
   58|       |
   59|   885k|            default:
  ------------------
  |  Branch (59:13): [True: 885k, False: 12.8k]
  ------------------
   60|   885k|                if ((buf[i] < 33) || (buf[i] > 117)) {
  ------------------
  |  Branch (60:21): [True: 257, False: 885k]
  |  Branch (60:38): [True: 608, False: 884k]
  ------------------
   61|    865|                    throw std::runtime_error("character out of range during base 85 decode");
   62|   884k|                } else {
   63|   884k|                    this->inbuf[this->pos++] = buf[i];
   64|   884k|                    if (pos == 5) {
  ------------------
  |  Branch (64:25): [True: 172k, False: 711k]
  ------------------
   65|   172k|                        flush();
   66|   172k|                    }
   67|   884k|                }
   68|   884k|                break;
   69|   898k|            }
   70|   898k|        }
   71|   905k|    }
   72|  8.50k|}
_ZN17Pl_ASCII85Decoder5flushEv:
   76|   188k|{
   77|   188k|    if (this->pos == 0) {
  ------------------
  |  Branch (77:9): [True: 9.07k, False: 179k]
  ------------------
   78|  9.07k|        QTC::TC("libtests", "Pl_ASCII85Decoder no-op flush");
   79|  9.07k|        return;
   80|  9.07k|    }
   81|   179k|    unsigned long lval = 0;
   82|  1.07M|    for (int i = 0; i < 5; ++i) {
  ------------------
  |  Branch (82:21): [True: 895k, False: 179k]
  ------------------
   83|   895k|        lval *= 85;
   84|   895k|        lval += (this->inbuf[i] - 33U);
   85|   895k|    }
   86|       |
   87|   179k|    unsigned char outbuf[4];
   88|   179k|    memset(outbuf, 0, 4);
   89|   895k|    for (int i = 3; i >= 0; --i) {
  ------------------
  |  Branch (89:21): [True: 716k, False: 179k]
  ------------------
   90|   716k|        outbuf[i] = lval & 0xff;
   91|   716k|        lval >>= 8;
   92|   716k|    }
   93|       |
   94|   179k|    QTC::TC("libtests", "Pl_ASCII85Decoder partial flush", (this->pos == 5) ? 0 : 1);
  ------------------
  |  Branch (94:60): [True: 172k, False: 6.22k]
  ------------------
   95|       |    // Reset before calling getNext()->write in case that throws an exception.
   96|   179k|    auto t = this->pos - 1;
   97|   179k|    this->pos = 0;
   98|   179k|    memset(this->inbuf, 117, 5);
   99|       |
  100|   179k|    getNext()->write(outbuf, t);
  101|   179k|}
_ZN17Pl_ASCII85Decoder6finishEv:
  105|  8.24k|{
  106|  8.24k|    flush();
  107|  8.24k|    getNext()->finish();
  108|  8.24k|}

_ZN18Pl_ASCIIHexDecoderC2EPKcP8Pipeline:
   11|    203|{
   12|    203|    this->inbuf[0] = '0';
   13|    203|    this->inbuf[1] = '0';
   14|    203|    this->inbuf[2] = '\0';
   15|    203|}
_ZN18Pl_ASCIIHexDecoder5writeEPKhm:
   19|    203|{
   20|    203|    if (this->eod) {
  ------------------
  |  Branch (20:9): [True: 0, False: 203]
  ------------------
   21|      0|        return;
   22|      0|    }
   23|  4.20k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (23:24): [True: 4.14k, False: 59]
  ------------------
   24|  4.14k|        char ch = static_cast<char>(toupper(buf[i]));
   25|  4.14k|        switch (ch) {
   26|    284|        case ' ':
  ------------------
  |  Branch (26:9): [True: 284, False: 3.85k]
  ------------------
   27|    321|        case '\f':
  ------------------
  |  Branch (27:9): [True: 37, False: 4.10k]
  ------------------
   28|    365|        case '\v':
  ------------------
  |  Branch (28:9): [True: 44, False: 4.09k]
  ------------------
   29|    402|        case '\t':
  ------------------
  |  Branch (29:9): [True: 37, False: 4.10k]
  ------------------
   30|    859|        case '\r':
  ------------------
  |  Branch (30:9): [True: 457, False: 3.68k]
  ------------------
   31|    966|        case '\n':
  ------------------
  |  Branch (31:9): [True: 107, False: 4.03k]
  ------------------
   32|    966|            QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space");
   33|       |            // ignore whitespace
   34|    966|            break;
   35|       |
   36|     40|        case '>':
  ------------------
  |  Branch (36:9): [True: 40, False: 4.10k]
  ------------------
   37|     40|            this->eod = true;
   38|     40|            flush();
   39|     40|            break;
   40|       |
   41|  3.13k|        default:
  ------------------
  |  Branch (41:9): [True: 3.13k, False: 1.00k]
  ------------------
   42|  3.13k|            if (((ch >= '0') && (ch <= '9')) || ((ch >= 'A') && (ch <= 'F'))) {
  ------------------
  |  Branch (42:18): [True: 3.10k, False: 32]
  |  Branch (42:33): [True: 2.34k, False: 760]
  |  Branch (42:50): [True: 754, False: 38]
  |  Branch (42:65): [True: 688, False: 66]
  ------------------
   43|  3.03k|                this->inbuf[this->pos++] = ch;
   44|  3.03k|                if (this->pos == 2) {
  ------------------
  |  Branch (44:21): [True: 1.46k, False: 1.56k]
  ------------------
   45|  1.46k|                    flush();
   46|  1.46k|                }
   47|  3.03k|            } else {
   48|    104|                char t[2];
   49|    104|                t[0] = ch;
   50|    104|                t[1] = 0;
   51|    104|                throw std::runtime_error(
   52|    104|                    std::string("character out of range"
   53|    104|                                " during base Hex decode: ") +
   54|    104|                    t);
   55|    104|            }
   56|  3.03k|            break;
   57|  4.14k|        }
   58|  4.03k|        if (this->eod) {
  ------------------
  |  Branch (58:13): [True: 40, False: 3.99k]
  ------------------
   59|     40|            break;
   60|     40|        }
   61|  4.03k|    }
   62|    203|}
_ZN18Pl_ASCIIHexDecoder5flushEv:
   66|  1.70k|{
   67|  1.70k|    if (this->pos == 0) {
  ------------------
  |  Branch (67:9): [True: 144, False: 1.56k]
  ------------------
   68|    144|        QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush");
   69|    144|        return;
   70|    144|    }
   71|  1.56k|    int b[2];
   72|  4.68k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (72:21): [True: 3.12k, False: 1.56k]
  ------------------
   73|  3.12k|        if (this->inbuf[i] >= 'A') {
  ------------------
  |  Branch (73:13): [True: 688, False: 2.43k]
  ------------------
   74|    688|            b[i] = this->inbuf[i] - 'A' + 10;
   75|  2.43k|        } else {
   76|  2.43k|            b[i] = this->inbuf[i] - '0';
   77|  2.43k|        }
   78|  3.12k|    }
   79|  1.56k|    auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
   80|       |
   81|  1.56k|    QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", (this->pos == 2) ? 0 : 1);
  ------------------
  |  Branch (81:61): [True: 1.46k, False: 94]
  ------------------
   82|       |    // Reset before calling getNext()->write in case that throws an exception.
   83|  1.56k|    this->pos = 0;
   84|  1.56k|    this->inbuf[0] = '0';
   85|  1.56k|    this->inbuf[1] = '0';
   86|  1.56k|    this->inbuf[2] = '\0';
   87|       |
   88|  1.56k|    getNext()->write(&ch, 1);
   89|  1.56k|}
_ZN18Pl_ASCIIHexDecoder6finishEv:
   93|    198|{
   94|    198|    flush();
   95|    198|    getNext()->finish();
   96|    198|}

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

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

_ZN6Pl_DCT7MembersC2Ev:
   63|  2.59k|{
   64|  2.59k|}
_ZN6Pl_DCTC2EPKcP8Pipeline:
   80|  2.59k|{
   81|  2.59k|}
_ZN6Pl_DCT14setMemoryLimitEl:
   85|  8.04k|{
   86|  8.04k|    memory_limit = limit;
   87|  8.04k|}
_ZN6Pl_DCT12setScanLimitEi:
   91|  8.04k|{
   92|  8.04k|    scan_limit = limit;
   93|  8.04k|}
_ZN6Pl_DCT21setThrowOnCorruptDataEb:
   97|  8.04k|{
   98|  8.04k|    throw_on_corrupt_data = treat_as_error;
   99|  8.04k|}
_ZN6Pl_DCTD2Ev:
  114|  2.59k|{
  115|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
  116|  2.59k|}
_ZN6Pl_DCT5writeEPKhm:
  120|  4.30k|{
  121|  4.30k|    m->buf.write(data, len);
  122|  4.30k|}
_ZN6Pl_DCT6finishEv:
  126|  2.59k|{
  127|  2.59k|    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|  2.59k|    Buffer* b = m->buf.getBuffer();
  132|  2.59k|    if (b->getSize() == 0) {
  ------------------
  |  Branch (132:9): [True: 3, False: 2.58k]
  ------------------
  133|       |        // Special case: empty data will never succeed and probably means we're calling finish a
  134|       |        // second time from an exception handler.
  135|      3|        delete b;
  136|      3|        this->getNext()->finish();
  137|      3|        return;
  138|      3|    }
  139|       |
  140|  2.58k|    struct jpeg_compress_struct cinfo_compress;
  141|  2.58k|    struct jpeg_decompress_struct cinfo_decompress;
  142|  2.58k|    struct qpdf_jpeg_error_mgr jerr;
  143|       |
  144|  2.58k|    cinfo_compress.err = jpeg_std_error(&(jerr.pub));
  145|  2.58k|    cinfo_decompress.err = jpeg_std_error(&(jerr.pub));
  146|  2.58k|    jerr.pub.error_exit = error_handler;
  147|  2.58k|    if (m->action == a_decompress && throw_on_corrupt_data) {
  ------------------
  |  Branch (147:9): [True: 2.58k, False: 0]
  |  Branch (147:38): [True: 2.58k, False: 0]
  ------------------
  148|  2.58k|        jerr.pub.emit_message = emit_message;
  149|  2.58k|    }
  150|       |
  151|  2.58k|    bool error = false;
  152|       |    // The jpeg library is a "C" library, so we use setjmp and longjmp for exception handling.
  153|  2.58k|    if (setjmp(jerr.jmpbuf) == 0) {
  ------------------
  |  Branch (153:9): [True: 2.58k, False: 0]
  ------------------
  154|  2.58k|        try {
  155|  2.58k|            if (m->action == a_compress) {
  ------------------
  |  Branch (155:17): [True: 0, False: 2.58k]
  ------------------
  156|      0|                compress(reinterpret_cast<void*>(&cinfo_compress), b);
  157|  2.58k|            } else {
  158|  2.58k|                decompress(reinterpret_cast<void*>(&cinfo_decompress), b);
  159|  2.58k|            }
  160|  2.58k|        } 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|    352|            jerr.msg = e.what();
  164|    352|            longjmp(jerr.jmpbuf, 1);
  165|    352|        }
  166|  2.58k|    } else {
  167|      0|        error = true;
  168|      0|    }
  169|    620|    delete b;
  170|       |
  171|    620|    if (m->action == a_compress) {
  ------------------
  |  Branch (171:9): [True: 0, False: 620]
  ------------------
  172|      0|        jpeg_destroy_compress(&cinfo_compress);
  173|      0|    }
  174|  2.58k|    if (m->action == a_decompress) {
  ------------------
  |  Branch (174:9): [True: 2.58k, False: 18.4E]
  ------------------
  175|  2.58k|        jpeg_destroy_decompress(&cinfo_decompress);
  176|  2.58k|    }
  177|  1.96k|    if (error) {
  ------------------
  |  Branch (177:9): [True: 1.96k, False: 18.4E]
  ------------------
  178|  1.96k|        throw std::runtime_error(jerr.msg);
  179|  1.96k|    }
  180|    620|}
_ZN6Pl_DCT10decompressEPvP6Buffer:
  334|  2.58k|{
  335|  2.58k|    auto* cinfo = reinterpret_cast<jpeg_decompress_struct*>(cinfo_p);
  336|       |
  337|  2.58k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  338|  2.58k|# pragma GCC diagnostic push
  339|  2.58k|# pragma GCC diagnostic ignored "-Wold-style-cast"
  340|  2.58k|#endif
  341|  2.58k|    jpeg_create_decompress(cinfo);
  342|  2.58k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  343|  2.58k|# pragma GCC diagnostic pop
  344|  2.58k|#endif
  345|       |
  346|  2.58k|    if (memory_limit > 0) {
  ------------------
  |  Branch (346:9): [True: 2.58k, False: 0]
  ------------------
  347|  2.58k|        cinfo->mem->max_memory_to_use = memory_limit;
  348|  2.58k|    }
  349|       |
  350|  2.58k|    jpeg_buffer_src(cinfo, b);
  351|       |
  352|  2.58k|    (void)jpeg_read_header(cinfo, TRUE);
  353|  2.58k|    (void)jpeg_calc_output_dimensions(cinfo);
  354|  2.58k|    unsigned int width = cinfo->output_width * QIntC::to_uint(cinfo->output_components);
  355|  2.58k|    if (memory_limit > 0 &&
  ------------------
  |  Branch (355:9): [True: 1.70k, False: 887]
  ------------------
  356|  2.58k|        width > (static_cast<unsigned long>(memory_limit) / (20U * cinfo->output_height))) {
  ------------------
  |  Branch (356:9): [True: 5, False: 1.69k]
  ------------------
  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|      5|        throw std::runtime_error("Pl_DCT::decompress: JPEG data large - may be too slow");
  361|      5|    }
  362|  2.58k|    jpeg_progress_mgr progress_mgr;
  363|  2.58k|    if (scan_limit > 0) {
  ------------------
  |  Branch (363:9): [True: 1.69k, False: 887]
  ------------------
  364|  1.69k|        progress_mgr.progress_monitor = &progress_monitor;
  365|  1.69k|        cinfo->progress = &progress_mgr;
  366|  1.69k|    }
  367|  2.58k|    JSAMPARRAY buffer =
  368|  2.58k|        (*cinfo->mem->alloc_sarray)(reinterpret_cast<j_common_ptr>(cinfo), JPOOL_IMAGE, width, 1);
  369|       |
  370|  2.58k|    (void)jpeg_start_decompress(cinfo);
  371|   161k|    while (cinfo->output_scanline < cinfo->output_height) {
  ------------------
  |  Branch (371:12): [True: 159k, False: 2.58k]
  ------------------
  372|   159k|        (void)jpeg_read_scanlines(cinfo, buffer, 1);
  373|   159k|        getNext()->write(buffer[0], width * sizeof(buffer[0][0]));
  374|   159k|    }
  375|  2.58k|    (void)jpeg_finish_decompress(cinfo);
  376|  2.58k|    getNext()->finish();
  377|  2.58k|}
Pl_DCT.cc:_ZL13error_handlerP18jpeg_common_struct:
   31|    398|{
   32|    398|    auto* jerr = reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
   33|    398|    char buf[JMSG_LENGTH_MAX];
   34|    398|    (*cinfo->err->format_message)(cinfo, buf);
   35|    398|    jerr->msg = buf;
   36|    398|    longjmp(jerr->jmpbuf, 1);
   37|    398|}
Pl_DCT.cc:_ZL12emit_messageP18jpeg_common_structi:
   41|  55.3k|{
   42|  55.3k|    if (msg_level == -1) {
  ------------------
  |  Branch (42:9): [True: 1.21k, False: 54.1k]
  ------------------
   43|  1.21k|        auto* jerr = reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
   44|  1.21k|        jerr->msg = "Pl_DCT::decompress: JPEG data is corrupt";
   45|  1.21k|        longjmp(jerr->jmpbuf, 1);
   46|  1.21k|    }
   47|  55.3k|}
Pl_DCT.cc:_ZL15jpeg_buffer_srcP22jpeg_decompress_structP6Buffer:
  271|  2.58k|{
  272|  2.58k|    cinfo->src = reinterpret_cast<jpeg_source_mgr*>(
  273|       |        // line-break
  274|  2.58k|        (*cinfo->mem->alloc_small)(
  275|  2.58k|            reinterpret_cast<j_common_ptr>(cinfo), JPOOL_PERMANENT, sizeof(jpeg_source_mgr)));
  276|       |
  277|  2.58k|    jpeg_source_mgr* src = cinfo->src;
  278|  2.58k|    src->init_source = init_buffer_source;
  279|  2.58k|    src->fill_input_buffer = fill_buffer_input_buffer;
  280|  2.58k|    src->skip_input_data = skip_buffer_input_data;
  281|  2.58k|    src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
  282|  2.58k|    src->term_source = term_buffer_source;
  283|  2.58k|    src->bytes_in_buffer = buffer->getSize();
  284|  2.58k|    src->next_input_byte = buffer->getBuffer();
  285|  2.58k|}
Pl_DCT.cc:_ZL18init_buffer_sourceP22jpeg_decompress_struct:
  235|  2.58k|{
  236|  2.58k|}
Pl_DCT.cc:_ZL24fill_buffer_input_bufferP22jpeg_decompress_struct:
  240|    347|{
  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|    347|    throw std::runtime_error("invalid jpeg data reading from buffer");
  244|      0|    return TRUE;
  245|    347|}
Pl_DCT.cc:_ZL22skip_buffer_input_dataP22jpeg_decompress_structl:
  249|  1.51k|{
  250|  1.51k|    if (num_bytes < 0) {
  ------------------
  |  Branch (250:9): [True: 0, False: 1.51k]
  ------------------
  251|      0|        throw std::runtime_error(
  252|      0|            "reading jpeg: jpeg library requested skipping a negative number of bytes");
  253|      0|    }
  254|  1.51k|    size_t to_skip = QIntC::to_size(num_bytes);
  255|  1.51k|    if ((to_skip > 0) && (to_skip <= cinfo->src->bytes_in_buffer)) {
  ------------------
  |  Branch (255:9): [True: 1.51k, False: 0]
  |  Branch (255:26): [True: 1.40k, False: 117]
  ------------------
  256|  1.40k|        cinfo->src->next_input_byte += to_skip;
  257|  1.40k|        cinfo->src->bytes_in_buffer -= to_skip;
  258|  1.40k|    } else if (to_skip != 0) {
  ------------------
  |  Branch (258:16): [True: 117, False: 0]
  ------------------
  259|    117|        cinfo->src->next_input_byte += cinfo->src->bytes_in_buffer;
  260|    117|        cinfo->src->bytes_in_buffer = 0;
  261|    117|    }
  262|  1.51k|}
Pl_DCT.cc:_ZL18term_buffer_sourceP22jpeg_decompress_struct:
  266|    620|{
  267|    620|}
Pl_DCT.cc:_ZL16progress_monitorP18jpeg_common_struct:
   51|   179k|{
   52|   179k|    if (cinfo->is_decompressor &&
  ------------------
  |  Branch (52:9): [True: 179k, False: 0]
  ------------------
   53|   179k|        reinterpret_cast<jpeg_decompress_struct*>(cinfo)->input_scan_number > scan_limit) {
  ------------------
  |  Branch (53:9): [True: 0, False: 179k]
  ------------------
   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|   179k|}

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

_ZN8Pl_Flate7MembersC2EmNS_8action_eE:
   22|  72.2k|{
   23|  72.2k|    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|  72.2k|    this->zdata = new z_stream;
   28|       |
   29|  72.2k|    if (out_bufsize > UINT_MAX) {
  ------------------
  |  Branch (29:9): [True: 0, False: 72.2k]
  ------------------
   30|      0|        throw std::runtime_error(
   31|      0|            "Pl_Flate: zlib doesn't support buffer sizes larger than unsigned int");
   32|      0|    }
   33|       |
   34|  72.2k|    z_stream& zstream = *(static_cast<z_stream*>(this->zdata));
   35|  72.2k|    zstream.zalloc = nullptr;
   36|  72.2k|    zstream.zfree = nullptr;
   37|  72.2k|    zstream.opaque = nullptr;
   38|  72.2k|    zstream.next_in = nullptr;
   39|  72.2k|    zstream.avail_in = 0;
   40|  72.2k|    zstream.next_out = this->outbuf.get();
   41|  72.2k|    zstream.avail_out = QIntC::to_uint(out_bufsize);
   42|  72.2k|}
_ZN8Pl_Flate7MembersD2Ev:
   45|  72.2k|{
   46|  72.2k|    if (this->initialized) {
  ------------------
  |  Branch (46:9): [True: 2.44k, False: 69.7k]
  ------------------
   47|  2.44k|        z_stream& zstream = *(static_cast<z_stream*>(this->zdata));
   48|  2.44k|        if (action == a_deflate) {
  ------------------
  |  Branch (48:13): [True: 320, False: 2.12k]
  ------------------
   49|    320|            deflateEnd(&zstream);
   50|  2.12k|        } else {
   51|  2.12k|            inflateEnd(&zstream);
   52|  2.12k|        }
   53|  2.44k|    }
   54|       |
   55|  72.2k|    delete static_cast<z_stream*>(this->zdata);
   56|  72.2k|    this->zdata = nullptr;
   57|  72.2k|}
_ZN8Pl_FlateC2EPKcP8PipelineNS_8action_eEj:
   63|  72.2k|{
   64|  72.2k|}
_ZN8Pl_FlateD2Ev:
   67|  72.2k|{
   68|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   69|  72.2k|}
_ZN8Pl_Flate14setMemoryLimitEy:
   73|  8.04k|{
   74|  8.04k|    memory_limit = limit;
   75|  8.04k|}
_ZN8Pl_Flate15setWarnCallbackENSt3__18functionIFvPKciEEE:
   79|  30.0k|{
   80|  30.0k|    m->callback = callback;
   81|  30.0k|}
_ZN8Pl_Flate4warnEPKci:
   85|  1.38k|{
   86|  1.38k|    if (m->callback != nullptr) {
  ------------------
  |  Branch (86:9): [True: 1.38k, False: 0]
  ------------------
   87|  1.38k|        m->callback(msg, code);
   88|  1.38k|    }
   89|  1.38k|}
_ZN8Pl_Flate5writeEPKhm:
   93|  1.79M|{
   94|  1.79M|    if (m->outbuf == nullptr) {
  ------------------
  |  Branch (94:9): [True: 0, False: 1.79M]
  ------------------
   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|  1.79M|    static size_t const max_bytes = 1 << 30;
  101|  1.79M|    size_t bytes_left = len;
  102|  1.79M|    unsigned char const* buf = data;
  103|  3.59M|    while (bytes_left > 0) {
  ------------------
  |  Branch (103:12): [True: 1.79M, False: 1.79M]
  ------------------
  104|  1.79M|        size_t bytes = (bytes_left >= max_bytes ? max_bytes : bytes_left);
  ------------------
  |  Branch (104:25): [True: 0, False: 1.79M]
  ------------------
  105|  1.79M|        handleData(buf, bytes, (m->action == a_inflate ? Z_SYNC_FLUSH : Z_NO_FLUSH));
  ------------------
  |  Branch (105:33): [True: 680k, False: 1.11M]
  ------------------
  106|  1.79M|        bytes_left -= bytes;
  107|  1.79M|        buf += bytes;
  108|  1.79M|    }
  109|  1.79M|}
_ZN8Pl_Flate10handleDataEPKhmi:
  113|  1.86M|{
  114|  1.86M|    if (len > UINT_MAX) {
  ------------------
  |  Branch (114:9): [True: 0, False: 1.86M]
  ------------------
  115|      0|        throw std::runtime_error("Pl_Flate: zlib doesn't support data blocks larger than int");
  116|      0|    }
  117|  1.86M|    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|  1.86M|    zstream.next_in = const_cast<unsigned char*>(data);
  121|  1.86M|    zstream.avail_in = QIntC::to_uint(len);
  122|       |
  123|  1.86M|    if (!m->initialized) {
  ------------------
  |  Branch (123:9): [True: 71.1k, False: 1.79M]
  ------------------
  124|  71.1k|        int err = Z_OK;
  125|       |
  126|       |        // deflateInit and inflateInit are macros that use old-style casts.
  127|  71.1k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  128|  71.1k|# pragma GCC diagnostic push
  129|  71.1k|# pragma GCC diagnostic ignored "-Wold-style-cast"
  130|  71.1k|#endif
  131|  71.1k|        if (m->action == a_deflate) {
  ------------------
  |  Branch (131:13): [True: 41.2k, False: 29.8k]
  ------------------
  132|  41.2k|            err = deflateInit(&zstream, compression_level);
  133|  41.2k|        } else {
  134|  29.8k|            err = inflateInit(&zstream);
  135|  29.8k|        }
  136|  71.1k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  137|  71.1k|# pragma GCC diagnostic pop
  138|  71.1k|#endif
  139|       |
  140|  71.1k|        checkError("Init", err);
  141|  71.1k|        m->initialized = true;
  142|  71.1k|    }
  143|       |
  144|  1.86M|    int err = Z_OK;
  145|       |
  146|  1.86M|    bool done = false;
  147|  3.73M|    while (!done) {
  ------------------
  |  Branch (147:12): [True: 1.87M, False: 1.86M]
  ------------------
  148|  1.87M|        if (m->action == a_deflate) {
  ------------------
  |  Branch (148:13): [True: 1.15M, False: 710k]
  ------------------
  149|  1.15M|            err = deflate(&zstream, flush);
  150|  1.15M|        } else {
  151|   710k|            err = inflate(&zstream, flush);
  152|   710k|        }
  153|  1.87M|        if ((m->action == a_inflate) && (err != Z_OK) && zstream.msg &&
  ------------------
  |  Branch (153:13): [True: 710k, False: 1.15M]
  |  Branch (153:41): [True: 59.1k, False: 651k]
  |  Branch (153:58): [True: 8.12k, False: 51.0k]
  ------------------
  154|  1.87M|            (strcmp(zstream.msg, "incorrect data check") == 0)) {
  ------------------
  |  Branch (154:13): [True: 4.10k, False: 4.02k]
  ------------------
  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|  4.10k|            err = Z_STREAM_END;
  158|  4.10k|        }
  159|  1.87M|        switch (err) {
  160|  1.38k|        case Z_BUF_ERROR:
  ------------------
  |  Branch (160:9): [True: 1.38k, False: 1.86M]
  ------------------
  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|  1.38k|            this->warn("input stream is complete but output may still be valid", err);
  168|  1.38k|            done = true;
  169|  1.38k|            break;
  170|       |
  171|  94.6k|        case Z_STREAM_END:
  ------------------
  |  Branch (171:9): [True: 94.6k, False: 1.77M]
  ------------------
  172|  94.6k|            done = true;
  173|       |            // fall through
  174|       |
  175|  1.86M|        case Z_OK:
  ------------------
  |  Branch (175:9): [True: 1.77M, False: 100k]
  ------------------
  176|  1.86M|            {
  177|  1.86M|                if ((zstream.avail_in == 0) && (zstream.avail_out > 0)) {
  ------------------
  |  Branch (177:21): [True: 1.85M, False: 5.52k]
  |  Branch (177:48): [True: 1.85M, False: 38]
  ------------------
  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|  1.85M|                    done = true;
  181|  1.85M|                }
  182|  1.86M|                uLong ready = QIntC::to_ulong(m->out_bufsize - zstream.avail_out);
  183|  1.86M|                if (ready > 0) {
  ------------------
  |  Branch (183:21): [True: 696k, False: 1.16M]
  ------------------
  184|   696k|                    if (memory_limit) {
  ------------------
  |  Branch (184:25): [True: 696k, False: 0]
  ------------------
  185|   696k|                        m->written += ready;
  186|   696k|                        if (m->written > memory_limit) {
  ------------------
  |  Branch (186:29): [True: 35, False: 696k]
  ------------------
  187|     35|                            throw std::runtime_error("PL_Flate memory limit exceeded");
  188|     35|                        }
  189|   696k|                    }
  190|   696k|                    this->getNext()->write(m->outbuf.get(), ready);
  191|   696k|                    zstream.next_out = m->outbuf.get();
  192|   696k|                    zstream.avail_out = QIntC::to_uint(m->out_bufsize);
  193|   696k|                }
  194|  1.86M|            }
  195|  1.86M|            break;
  196|       |
  197|  1.86M|        default:
  ------------------
  |  Branch (197:9): [True: 4.05k, False: 1.86M]
  ------------------
  198|  4.05k|            this->checkError("data", err);
  199|  4.05k|            break;
  200|  1.87M|        }
  201|  1.87M|    }
  202|  1.86M|}
_ZN8Pl_Flate6finishEv:
  206|  70.8k|{
  207|  70.8k|    if (m->written > memory_limit) {
  ------------------
  |  Branch (207:9): [True: 15, False: 70.8k]
  ------------------
  208|     15|        return;
  209|     15|    }
  210|  70.8k|    try {
  211|  70.8k|        if (m->outbuf.get()) {
  ------------------
  |  Branch (211:13): [True: 70.8k, False: 0]
  ------------------
  212|  70.8k|            if (m->initialized) {
  ------------------
  |  Branch (212:17): [True: 70.4k, False: 399]
  ------------------
  213|  70.4k|                z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  214|  70.4k|                unsigned char buf[1];
  215|  70.4k|                buf[0] = '\0';
  216|  70.4k|                handleData(buf, 0, Z_FINISH);
  217|  70.4k|                int err = Z_OK;
  218|  70.4k|                if (m->action == a_deflate) {
  ------------------
  |  Branch (218:21): [True: 40.9k, False: 29.4k]
  ------------------
  219|  40.9k|                    err = deflateEnd(&zstream);
  220|  40.9k|                } else {
  221|  29.4k|                    err = inflateEnd(&zstream);
  222|  29.4k|                }
  223|  70.4k|                m->initialized = false;
  224|  70.4k|                checkError("End", err);
  225|  70.4k|            }
  226|       |
  227|  70.8k|            m->outbuf = nullptr;
  228|  70.8k|        }
  229|  70.8k|    } catch (std::exception& e) {
  230|  1.73k|        try {
  231|  1.73k|            this->getNext()->finish();
  232|  1.73k|        } catch (...) {
  233|       |            // ignore secondary exception
  234|      3|        }
  235|  1.73k|        throw std::runtime_error(e.what());
  236|  1.73k|    }
  237|  69.1k|    this->getNext()->finish();
  238|  69.1k|}
_ZN8Pl_Flate10checkErrorEPKci:
  248|   143k|{
  249|   143k|    z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  250|   143k|    if (error_code != Z_OK) {
  ------------------
  |  Branch (250:9): [True: 4.05k, False: 139k]
  ------------------
  251|  4.05k|        char const* action_str = (m->action == a_deflate ? "deflate" : "inflate");
  ------------------
  |  Branch (251:35): [True: 0, False: 4.05k]
  ------------------
  252|  4.05k|        std::string msg = this->identifier + ": " + action_str + ": " + prefix + ": ";
  253|       |
  254|  4.05k|        if (zstream.msg) {
  ------------------
  |  Branch (254:13): [True: 4.02k, False: 33]
  ------------------
  255|  4.02k|            msg += zstream.msg;
  256|  4.02k|        } else {
  257|     33|            switch (error_code) {
  258|      0|            case Z_ERRNO:
  ------------------
  |  Branch (258:13): [True: 0, False: 33]
  ------------------
  259|      0|                msg += "zlib system error";
  260|      0|                break;
  261|       |
  262|      0|            case Z_STREAM_ERROR:
  ------------------
  |  Branch (262:13): [True: 0, False: 33]
  ------------------
  263|      0|                msg += "zlib stream error";
  264|      0|                break;
  265|       |
  266|      0|            case Z_DATA_ERROR:
  ------------------
  |  Branch (266:13): [True: 0, False: 33]
  ------------------
  267|      0|                msg += "zlib data error";
  268|      0|                break;
  269|       |
  270|      0|            case Z_MEM_ERROR:
  ------------------
  |  Branch (270:13): [True: 0, False: 33]
  ------------------
  271|      0|                msg += "zlib memory error";
  272|      0|                break;
  273|       |
  274|      0|            case Z_BUF_ERROR:
  ------------------
  |  Branch (274:13): [True: 0, False: 33]
  ------------------
  275|      0|                msg += "zlib buffer error";
  276|      0|                break;
  277|       |
  278|      0|            case Z_VERSION_ERROR:
  ------------------
  |  Branch (278:13): [True: 0, False: 33]
  ------------------
  279|      0|                msg += "zlib version error";
  280|      0|                break;
  281|       |
  282|     33|            default:
  ------------------
  |  Branch (282:13): [True: 33, False: 0]
  ------------------
  283|     33|                msg += std::string("zlib unknown error (") + std::to_string(error_code) + ")";
  284|     33|                break;
  285|     33|            }
  286|     33|        }
  287|       |
  288|  4.05k|        throw std::runtime_error(msg);
  289|  4.05k|    }
  290|   143k|}

_ZN13Pl_LZWDecoderC2EPKcP8Pipelineb:
   19|    604|{
   20|    604|    memset(buf, 0, 3);
   21|    604|}
_ZN13Pl_LZWDecoder5writeEPKhm:
   25|  30.0k|{
   26|   326k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (26:24): [True: 296k, False: 30.0k]
  ------------------
   27|   296k|        this->buf[next++] = bytes[i];
   28|   296k|        if (this->next == 3) {
  ------------------
  |  Branch (28:13): [True: 98.4k, False: 197k]
  ------------------
   29|  98.4k|            this->next = 0;
   30|  98.4k|        }
   31|   296k|        this->bits_available += 8;
   32|   296k|        if (this->bits_available >= this->code_size) {
  ------------------
  |  Branch (32:13): [True: 236k, False: 60.2k]
  ------------------
   33|   236k|            sendNextCode();
   34|   236k|        }
   35|   296k|    }
   36|  30.0k|}
_ZN13Pl_LZWDecoder6finishEv:
   40|    587|{
   41|    587|    getNext()->finish();
   42|    587|}
_ZN13Pl_LZWDecoder12sendNextCodeEv:
   46|   236k|{
   47|   236k|    unsigned int high = this->byte_pos;
   48|   236k|    unsigned int med = (this->byte_pos + 1) % 3;
   49|   236k|    unsigned int low = (this->byte_pos + 2) % 3;
   50|       |
   51|   236k|    unsigned int bits_from_high = 8 - this->bit_pos;
   52|   236k|    unsigned int bits_from_med = this->code_size - bits_from_high;
   53|   236k|    unsigned int bits_from_low = 0;
   54|   236k|    if (bits_from_med > 8) {
  ------------------
  |  Branch (54:9): [True: 31.7k, False: 204k]
  ------------------
   55|  31.7k|        bits_from_low = bits_from_med - 8;
   56|  31.7k|        bits_from_med = 8;
   57|  31.7k|    }
   58|   236k|    unsigned int high_mask = (1U << bits_from_high) - 1U;
   59|   236k|    unsigned int med_mask = 0xff - ((1U << (8 - bits_from_med)) - 1U);
   60|   236k|    unsigned int low_mask = 0xff - ((1U << (8 - bits_from_low)) - 1U);
   61|   236k|    unsigned int code = 0;
   62|   236k|    code += (this->buf[high] & high_mask) << bits_from_med;
   63|   236k|    code += ((this->buf[med] & med_mask) >> (8 - bits_from_med));
   64|   236k|    if (bits_from_low) {
  ------------------
  |  Branch (64:9): [True: 31.7k, False: 204k]
  ------------------
   65|  31.7k|        code <<= bits_from_low;
   66|  31.7k|        code += ((this->buf[low] & low_mask) >> (8 - bits_from_low));
   67|  31.7k|        this->byte_pos = low;
   68|  31.7k|        this->bit_pos = bits_from_low;
   69|   204k|    } else {
   70|   204k|        this->byte_pos = med;
   71|   204k|        this->bit_pos = bits_from_med;
   72|   204k|    }
   73|   236k|    if (this->bit_pos == 8) {
  ------------------
  |  Branch (73:9): [True: 27.8k, False: 208k]
  ------------------
   74|  27.8k|        this->bit_pos = 0;
   75|  27.8k|        ++this->byte_pos;
   76|  27.8k|        this->byte_pos %= 3;
   77|  27.8k|    }
   78|   236k|    this->bits_available -= this->code_size;
   79|       |
   80|   236k|    handleCode(code);
   81|   236k|}
_ZN13Pl_LZWDecoder12getFirstCharEj:
   85|  85.5k|{
   86|  85.5k|    unsigned char result = '\0';
   87|  85.5k|    if (code < 256) {
  ------------------
  |  Branch (87:9): [True: 2.69k, False: 82.8k]
  ------------------
   88|  2.69k|        result = static_cast<unsigned char>(code);
   89|  82.8k|    } else if (code > 257) {
  ------------------
  |  Branch (89:16): [True: 82.8k, False: 0]
  ------------------
   90|  82.8k|        unsigned int idx = code - 258;
   91|  82.8k|        if (idx >= table.size()) {
  ------------------
  |  Branch (91:13): [True: 0, False: 82.8k]
  ------------------
   92|      0|            throw std::runtime_error("Pl_LZWDecoder::getFirstChar: table overflow");
   93|      0|        }
   94|  82.8k|        Buffer& b = table.at(idx);
   95|  82.8k|        result = b.getBuffer()[0];
   96|  82.8k|    } else {
   97|      0|        throw std::runtime_error(
   98|      0|            "Pl_LZWDecoder::getFirstChar called with invalid code (" + std::to_string(code) + ")");
   99|      0|    }
  100|  85.5k|    return result;
  101|  85.5k|}
_ZN13Pl_LZWDecoder10addToTableEh:
  105|   228k|{
  106|   228k|    unsigned int last_size = 0;
  107|   228k|    unsigned char const* last_data = nullptr;
  108|   228k|    unsigned char tmp[1];
  109|       |
  110|   228k|    if (this->last_code < 256) {
  ------------------
  |  Branch (110:9): [True: 142k, False: 85.1k]
  ------------------
  111|   142k|        tmp[0] = static_cast<unsigned char>(this->last_code);
  112|   142k|        last_data = tmp;
  113|   142k|        last_size = 1;
  114|   142k|    } else if (this->last_code > 257) {
  ------------------
  |  Branch (114:16): [True: 85.1k, False: 0]
  ------------------
  115|  85.1k|        unsigned int idx = this->last_code - 258;
  116|  85.1k|        if (idx >= table.size()) {
  ------------------
  |  Branch (116:13): [True: 0, False: 85.1k]
  ------------------
  117|      0|            throw std::runtime_error("Pl_LZWDecoder::addToTable: table overflow");
  118|      0|        }
  119|  85.1k|        Buffer& b = table.at(idx);
  120|  85.1k|        last_data = b.getBuffer();
  121|  85.1k|        last_size = QIntC::to_uint(b.getSize());
  122|  85.1k|    } 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|   228k|    Buffer entry(1 + last_size);
  129|   228k|    unsigned char* new_data = entry.getBuffer();
  130|   228k|    memcpy(new_data, last_data, last_size);
  131|   228k|    new_data[last_size] = next;
  132|   228k|    this->table.push_back(std::move(entry));
  133|   228k|}
_ZN13Pl_LZWDecoder10handleCodeEj:
  137|   236k|{
  138|   236k|    if (this->eod) {
  ------------------
  |  Branch (138:9): [True: 6.34k, False: 229k]
  ------------------
  139|  6.34k|        return;
  140|  6.34k|    }
  141|       |
  142|   229k|    if (code == 256) {
  ------------------
  |  Branch (142:9): [True: 519, False: 229k]
  ------------------
  143|    519|        if (!this->table.empty()) {
  ------------------
  |  Branch (143:13): [True: 45, False: 474]
  ------------------
  144|     45|            QTC::TC("libtests", "Pl_LZWDecoder intermediate reset");
  145|     45|        }
  146|    519|        this->table.clear();
  147|    519|        this->code_size = 9;
  148|   229k|    } else if (code == 257) {
  ------------------
  |  Branch (148:16): [True: 251, False: 228k]
  ------------------
  149|    251|        this->eod = true;
  150|   228k|    } else {
  151|   228k|        if (this->last_code != 256) {
  ------------------
  |  Branch (151:13): [True: 228k, False: 641]
  ------------------
  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|   228k|            unsigned char next = '\0';
  155|   228k|            unsigned int table_size = QIntC::to_uint(table.size());
  156|   228k|            if (code < 256) {
  ------------------
  |  Branch (156:17): [True: 142k, False: 85.6k]
  ------------------
  157|       |                // just read < 256; last time's next was code
  158|   142k|                next = static_cast<unsigned char>(code);
  159|   142k|            } else if (code > 257) {
  ------------------
  |  Branch (159:24): [True: 85.6k, False: 0]
  ------------------
  160|  85.6k|                size_t idx = code - 258;
  161|  85.6k|                if (idx > table_size) {
  ------------------
  |  Branch (161:21): [True: 148, False: 85.5k]
  ------------------
  162|    148|                    throw std::runtime_error("LZWDecoder: bad code received");
  163|  85.5k|                } else if (idx == table_size) {
  ------------------
  |  Branch (163:28): [True: 5.50k, False: 80.0k]
  ------------------
  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|  5.50k|                    QTC::TC("libtests", "Pl_LZWDecoder last was table size");
  167|  5.50k|                    next = getFirstChar(this->last_code);
  168|  80.0k|                } else {
  169|  80.0k|                    next = getFirstChar(code);
  170|  80.0k|                }
  171|  85.6k|            }
  172|   228k|            unsigned int new_idx = 258 + table_size;
  173|   228k|            if (new_idx == 4096) {
  ------------------
  |  Branch (173:17): [True: 6, False: 228k]
  ------------------
  174|      6|                throw std::runtime_error("LZWDecoder: table full");
  175|      6|            }
  176|   228k|            addToTable(next);
  177|   228k|            unsigned int change_idx = new_idx + code_change_delta;
  178|   228k|            if ((change_idx == 511) || (change_idx == 1023) || (change_idx == 2047)) {
  ------------------
  |  Branch (178:17): [True: 336, False: 227k]
  |  Branch (178:40): [True: 51, False: 227k]
  |  Branch (178:64): [True: 31, False: 227k]
  ------------------
  179|    418|                ++this->code_size;
  180|    418|            }
  181|   228k|        }
  182|       |
  183|   228k|        if (code < 256) {
  ------------------
  |  Branch (183:13): [True: 143k, False: 85.5k]
  ------------------
  184|   143k|            auto ch = static_cast<unsigned char>(code);
  185|   143k|            getNext()->write(&ch, 1);
  186|   143k|        } else {
  187|  85.5k|            unsigned int idx = code - 258;
  188|  85.5k|            if (idx >= table.size()) {
  ------------------
  |  Branch (188:17): [True: 6, False: 85.5k]
  ------------------
  189|      6|                throw std::runtime_error("Pl_LZWDecoder::handleCode: table overflow");
  190|      6|            }
  191|  85.5k|            Buffer& b = table.at(idx);
  192|  85.5k|            getNext()->write(b.getBuffer(), b.getSize());
  193|  85.5k|        }
  194|   228k|    }
  195|       |
  196|   229k|    this->last_code = code;
  197|   229k|}

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

_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|  2.65M|{
   24|  2.65M|    m->os.write(reinterpret_cast<char const*>(buf), static_cast<std::streamsize>(len));
   25|  2.65M|}
_ZN10Pl_OStream6finishEv:
   29|      2|{
   30|      2|    m->os.flush();
   31|      2|}

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

_ZN16Pl_QPDFTokenizer7MembersC2Ev:
   10|  7.78k|{
   11|  7.78k|}
_ZN16Pl_QPDFTokenizerC2EPKcPN16QPDFObjectHandle11TokenFilterEP8Pipeline:
   17|  7.78k|{
   18|  7.78k|    m->filter = filter;
   19|  7.78k|    QPDFObjectHandle::TokenFilter::PipelineAccessor::setPipeline(m->filter, next);
   20|  7.78k|    m->tokenizer.allowEOF();
   21|  7.78k|    m->tokenizer.includeIgnorable();
   22|  7.78k|}
_ZN16Pl_QPDFTokenizerD2Ev:
   25|  7.78k|{
   26|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   27|  7.78k|}
_ZN16Pl_QPDFTokenizer5writeEPKhm:
   31|  14.4k|{
   32|  14.4k|    m->buf.write(data, len);
   33|  14.4k|}
_ZN16Pl_QPDFTokenizer6finishEv:
   37|  7.63k|{
   38|  7.63k|    m->buf.finish();
   39|  7.63k|    auto input = BufferInputSource("tokenizer data", m->buf.getBuffer(), true);
   40|  7.63k|    std::string empty;
   41|  5.34M|    while (true) {
  ------------------
  |  Branch (41:12): [Folded - Ignored]
  ------------------
   42|  5.34M|        auto token = m->tokenizer.readToken(input, empty, true);
   43|  5.34M|        m->filter->handleToken(token);
   44|  5.34M|        if (token.getType() == QPDFTokenizer::tt_eof) {
  ------------------
  |  Branch (44:13): [True: 7.63k, False: 5.33M]
  ------------------
   45|  7.63k|            break;
   46|  5.33M|        } else if (token.isWord("ID")) {
  ------------------
  |  Branch (46:20): [True: 905, False: 5.33M]
  ------------------
   47|       |            // Read the space after the ID.
   48|    905|            char ch = ' ';
   49|    905|            input.read(&ch, 1);
   50|    905|            m->filter->handleToken(
   51|       |                // line-break
   52|    905|                QPDFTokenizer::Token(QPDFTokenizer::tt_space, std::string(1, ch)));
   53|    905|            QTC::TC("qpdf", "Pl_QPDFTokenizer found ID");
   54|    905|            m->tokenizer.expectInlineImage(input);
   55|    905|        }
   56|  5.34M|    }
   57|  7.63k|    m->filter->handleEOF();
   58|  7.63k|    QPDFObjectHandle::TokenFilter::PipelineAccessor::setPipeline(m->filter, nullptr);
   59|  7.63k|    Pipeline* next = this->getNext(true);
   60|  7.63k|    if (next) {
  ------------------
  |  Branch (60:9): [True: 7.63k, False: 0]
  ------------------
   61|  7.63k|        next->finish();
   62|  7.63k|    }
   63|  7.63k|}

_ZN6Pl_RC4C2EPKcP8PipelinePKhim:
   14|    163|{
   15|    163|    this->outbuf = QUtil::make_shared_array<unsigned char>(out_bufsize);
   16|    163|}
_ZN6Pl_RC45writeEPKhm:
   20|    163|{
   21|    163|    if (this->outbuf == nullptr) {
  ------------------
  |  Branch (21:9): [True: 0, False: 163]
  ------------------
   22|      0|        throw std::logic_error(this->identifier + ": Pl_RC4: write() called after finish() called");
   23|      0|    }
   24|       |
   25|    163|    size_t bytes_left = len;
   26|    163|    unsigned char const* p = data;
   27|       |
   28|    339|    while (bytes_left > 0) {
  ------------------
  |  Branch (28:12): [True: 176, False: 163]
  ------------------
   29|    176|        size_t bytes = (bytes_left < this->out_bufsize ? bytes_left : out_bufsize);
  ------------------
  |  Branch (29:25): [True: 163, False: 13]
  ------------------
   30|    176|        bytes_left -= bytes;
   31|       |        // lgtm[cpp/weak-cryptographic-algorithm]
   32|    176|        rc4.process(p, bytes, outbuf.get());
   33|    176|        p += bytes;
   34|    176|        getNext()->write(outbuf.get(), bytes);
   35|    176|    }
   36|    163|}
_ZN6Pl_RC46finishEv:
   40|    160|{
   41|    160|    this->outbuf = nullptr;
   42|    160|    this->getNext()->finish();
   43|    160|}

_ZN12Pl_RunLength7MembersC2ENS_8action_eE:
   10|    788|{
   11|    788|}
_ZN12Pl_RunLengthC2EPKcP8PipelineNS_8action_eE:
   16|    788|{
   17|    788|}
_ZN12Pl_RunLengthD2Ev:
   20|    788|{
   21|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   22|    788|}
_ZN12Pl_RunLength5writeEPKhm:
   26|  2.76k|{
   27|  2.76k|    if (m->action == a_encode) {
  ------------------
  |  Branch (27:9): [True: 0, False: 2.76k]
  ------------------
   28|      0|        encode(data, len);
   29|  2.76k|    } else {
   30|  2.76k|        decode(data, len);
   31|  2.76k|    }
   32|  2.76k|}
_ZN12Pl_RunLength6decodeEPKhm:
   68|  2.76k|{
   69|  2.76k|    m->out.reserve(len);
   70|   116M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (70:24): [True: 116M, False: 2.76k]
  ------------------
   71|   116M|        unsigned char const& ch = data[i];
   72|   116M|        switch (m->state) {
  ------------------
  |  Branch (72:17): [True: 0, False: 116M]
  ------------------
   73|  23.0M|        case st_top:
  ------------------
  |  Branch (73:9): [True: 23.0M, False: 93.0M]
  ------------------
   74|  23.0M|            if (ch < 128) {
  ------------------
  |  Branch (74:17): [True: 4.10M, False: 18.9M]
  ------------------
   75|       |                // length represents remaining number of bytes to copy
   76|  4.10M|                m->length = 1U + ch;
   77|  4.10M|                m->state = st_copying;
   78|  18.9M|            } else if (ch > 128) {
  ------------------
  |  Branch (78:24): [True: 18.9M, False: 8.61k]
  ------------------
   79|       |                // length represents number of copies of next byte
   80|  18.9M|                m->length = 257U - ch;
   81|  18.9M|                m->state = st_run;
   82|  18.9M|            } else // ch == 128
   83|  8.61k|            {
   84|       |                // EOD; stay in this state
   85|  8.61k|            }
   86|  23.0M|            break;
   87|       |
   88|  74.0M|        case st_copying:
  ------------------
  |  Branch (88:9): [True: 74.0M, False: 42.0M]
  ------------------
   89|  74.0M|            m->out.append(1, static_cast<char>(ch));
   90|  74.0M|            if (--m->length == 0) {
  ------------------
  |  Branch (90:17): [True: 4.10M, False: 69.9M]
  ------------------
   91|  4.10M|                m->state = st_top;
   92|  4.10M|            }
   93|  74.0M|            break;
   94|       |
   95|  18.9M|        case st_run:
  ------------------
  |  Branch (95:9): [True: 18.9M, False: 97.1M]
  ------------------
   96|  18.9M|            m->out.append(m->length, static_cast<char>(ch));
   97|  18.9M|            m->state = st_top;
   98|  18.9M|            break;
   99|   116M|        }
  100|   116M|    }
  101|  2.76k|}
_ZN12Pl_RunLength6finishEv:
  135|    788|{
  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|    788|    auto next = getNext();
  140|    788|    if (m->action == a_encode) {
  ------------------
  |  Branch (140:9): [True: 0, False: 788]
  ------------------
  141|      0|        flush_encode();
  142|      0|        unsigned char ch = 128;
  143|      0|        next->write(&ch, 1);
  144|    788|    } else {
  145|    788|        next->writeString(m->out);
  146|    788|    }
  147|    788|    next->finish();
  148|    788|}

_ZN7Pl_SHA2C2EiP8Pipeline:
   10|  1.16M|{
   11|  1.16M|    if (bits) {
  ------------------
  |  Branch (11:9): [True: 1.16M, False: 0]
  ------------------
   12|  1.16M|        resetBits(bits);
   13|  1.16M|    }
   14|  1.16M|}
_ZN7Pl_SHA25writeEPKhm:
   18|  1.20M|{
   19|  1.20M|    if (!this->in_progress) {
  ------------------
  |  Branch (19:9): [True: 1.16M, False: 33.0k]
  ------------------
   20|  1.16M|        this->in_progress = true;
   21|  1.16M|    }
   22|       |
   23|       |    // Write in chunks in case len is too big to fit in an int. Assume int is at least 32 bits.
   24|  1.20M|    static size_t const max_bytes = 1 << 30;
   25|  1.20M|    size_t bytes_left = len;
   26|  1.20M|    unsigned char const* data = buf;
   27|  2.39M|    while (bytes_left > 0) {
  ------------------
  |  Branch (27:12): [True: 1.19M, False: 1.20M]
  ------------------
   28|  1.19M|        size_t bytes = (bytes_left >= max_bytes ? max_bytes : bytes_left);
  ------------------
  |  Branch (28:25): [True: 0, False: 1.19M]
  ------------------
   29|  1.19M|        this->crypto->SHA2_update(data, bytes);
   30|  1.19M|        bytes_left -= bytes;
   31|  1.19M|        data += bytes;
   32|  1.19M|    }
   33|       |
   34|  1.20M|    if (this->getNext(true)) {
  ------------------
  |  Branch (34:9): [True: 0, False: 1.20M]
  ------------------
   35|      0|        this->getNext()->write(buf, len);
   36|      0|    }
   37|  1.20M|}
_ZN7Pl_SHA26finishEv:
   41|  1.16M|{
   42|  1.16M|    if (this->getNext(true)) {
  ------------------
  |  Branch (42:9): [True: 0, False: 1.16M]
  ------------------
   43|      0|        this->getNext()->finish();
   44|      0|    }
   45|  1.16M|    this->crypto->SHA2_finalize();
   46|  1.16M|    this->in_progress = false;
   47|  1.16M|}
_ZN7Pl_SHA29resetBitsEi:
   51|  1.16M|{
   52|  1.16M|    if (this->in_progress) {
  ------------------
  |  Branch (52:9): [True: 0, False: 1.16M]
  ------------------
   53|      0|        throw std::logic_error("bit reset requested for in-progress SHA2 Pipeline");
   54|      0|    }
   55|  1.16M|    this->crypto = QPDFCryptoProvider::getImpl();
   56|  1.16M|    this->crypto->SHA2_init(bits);
   57|  1.16M|}
_ZN7Pl_SHA212getRawDigestEv:
   61|  1.16M|{
   62|  1.16M|    if (this->in_progress) {
  ------------------
  |  Branch (62:9): [True: 0, False: 1.16M]
  ------------------
   63|      0|        throw std::logic_error("digest requested for in-progress SHA2 Pipeline");
   64|      0|    }
   65|  1.16M|    return this->crypto->SHA2_digest();
   66|  1.16M|}

_ZN16Pl_TIFFPredictorC2EPKcP8PipelineNS_8action_eEjjj:
   28|     27|{
   29|     27|    if (samples_per_pixel < 1) {
  ------------------
  |  Branch (29:9): [True: 0, False: 27]
  ------------------
   30|      0|        throw std::runtime_error("TIFFPredictor created with invalid samples_per_pixel");
   31|      0|    }
   32|     27|    if ((bits_per_sample < 1) || (bits_per_sample > (8 * (sizeof(unsigned long long))))) {
  ------------------
  |  Branch (32:9): [True: 0, False: 27]
  |  Branch (32:34): [True: 0, False: 27]
  ------------------
   33|      0|        throw std::runtime_error("TIFFPredictor created with invalid bits_per_sample");
   34|      0|    }
   35|     27|    unsigned long long bpr = ((columns * bits_per_sample * samples_per_pixel) + 7) / 8;
   36|     27|    if ((bpr == 0) || (bpr > (UINT_MAX - 1))) {
  ------------------
  |  Branch (36:9): [True: 0, False: 27]
  |  Branch (36:23): [True: 0, False: 27]
  ------------------
   37|      0|        throw std::runtime_error("TIFFPredictor created with invalid columns value");
   38|      0|    }
   39|     27|    if (memory_limit > 0 && bpr > (memory_limit / 2U)) {
  ------------------
  |  Branch (39:9): [True: 27, False: 0]
  |  Branch (39:29): [True: 1, False: 26]
  ------------------
   40|      1|        throw std::runtime_error("TIFFPredictor memory limit exceeded");
   41|      1|    }
   42|     26|    this->bytes_per_row = bpr & UINT_MAX;
   43|     26|}
_ZN16Pl_TIFFPredictor14setMemoryLimitEy:
   47|  8.04k|{
   48|  8.04k|    memory_limit = limit;
   49|  8.04k|}
_ZN16Pl_TIFFPredictor5writeEPKhm:
   53|     21|{
   54|     21|    auto end = data + len;
   55|     21|    auto row_end = data + (bytes_per_row - cur_row.size());
   56|  1.34k|    while (row_end <= end) {
  ------------------
  |  Branch (56:12): [True: 1.32k, False: 21]
  ------------------
   57|       |        // finish off current row
   58|  1.32k|        cur_row.insert(cur_row.end(), data, row_end);
   59|  1.32k|        data = row_end;
   60|  1.32k|        row_end += bytes_per_row;
   61|       |
   62|  1.32k|        processRow();
   63|       |
   64|       |        // Prepare for next row
   65|  1.32k|        cur_row.clear();
   66|  1.32k|    }
   67|       |
   68|     21|    cur_row.insert(cur_row.end(), data, end);
   69|     21|}
_ZN16Pl_TIFFPredictor10processRowEv:
   73|  1.33k|{
   74|  1.33k|    QTC::TC("libtests", "Pl_TIFFPredictor processRow", (action == a_decode ? 0 : 1));
  ------------------
  |  Branch (74:57): [True: 1.33k, False: 0]
  ------------------
   75|  1.33k|    previous.assign(samples_per_pixel, 0);
   76|  1.33k|    if (bits_per_sample != 8) {
  ------------------
  |  Branch (76:9): [True: 0, False: 1.33k]
  ------------------
   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|  1.33k|    } else {
   95|  1.33k|        out.clear();
   96|  1.33k|        auto next = cur_row.begin();
   97|  1.33k|        auto cr_end = cur_row.end();
   98|  1.33k|        auto pr_end = previous.end();
   99|       |
  100|  7.33k|        while (next != cr_end) {
  ------------------
  |  Branch (100:16): [True: 5.99k, False: 1.33k]
  ------------------
  101|  11.9k|            for (auto prev = previous.begin(); prev != pr_end && next != cr_end; ++prev, ++next) {
  ------------------
  |  Branch (101:48): [True: 5.99k, False: 5.99k]
  |  Branch (101:66): [True: 5.99k, False: 0]
  ------------------
  102|  5.99k|                long long sample = *next;
  103|  5.99k|                long long new_sample = sample;
  104|  5.99k|                if (action == a_encode) {
  ------------------
  |  Branch (104:21): [True: 0, False: 5.99k]
  ------------------
  105|      0|                    new_sample -= *prev;
  106|      0|                    *prev = sample;
  107|  5.99k|                } else {
  108|  5.99k|                    new_sample += *prev;
  109|  5.99k|                    *prev = new_sample;
  110|  5.99k|                }
  111|  5.99k|                out.push_back(static_cast<unsigned char>(255U & new_sample));
  112|  5.99k|            }
  113|  5.99k|        }
  114|  1.33k|        p_next->write(out.data(), out.size());
  115|  1.33k|    }
  116|  1.33k|}
_ZN16Pl_TIFFPredictor6finishEv:
  120|     26|{
  121|     26|    if (!cur_row.empty()) {
  ------------------
  |  Branch (121:9): [True: 18, False: 8]
  ------------------
  122|       |        // write partial row
  123|     18|        cur_row.insert(cur_row.end(), bytes_per_row - cur_row.size(), 0);
  124|     18|        processRow();
  125|     18|    }
  126|     26|    cur_row.clear();
  127|     26|    p_next->finish();
  128|     26|}

_ZN4QPDF15StringDecrypterC2EPS_RK10QPDFObjGen:
  169|   325k|{
  170|   325k|}
_ZN4QPDF15StringDecrypter13decryptStringERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  174|  8.14k|{
  175|  8.14k|    qpdf->decryptString(val, og);
  176|  8.14k|}
_ZN4QPDF20EncryptionParametersC2Ev:
  196|  12.4k|{
  197|  12.4k|}
_ZN4QPDF7MembersC2Ev:
  203|  12.4k|{
  204|  12.4k|}
_ZN4QPDFC2Ev:
  208|  12.4k|{
  209|  12.4k|    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|  12.4k|    static std::atomic<unsigned long long> unique_id{0};
  213|  12.4k|    m->unique_id = unique_id.fetch_add(1ULL);
  214|  12.4k|}
_ZN4QPDFD2Ev:
  217|  12.4k|{
  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|  12.4k|    m->xref_table.clear();
  231|   415k|    for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (231:26): [True: 415k, False: 12.4k]
  ------------------
  232|   415k|        iter.second.object->disconnect();
  233|   415k|        if (iter.second.object->getTypeCode() != ::ot_null) {
  ------------------
  |  Branch (233:13): [True: 351k, False: 64.6k]
  ------------------
  234|   351k|            iter.second.object->destroy();
  235|   351k|        }
  236|   415k|    }
  237|  12.4k|}
_ZN4QPDF6createEv:
  241|  12.4k|{
  242|  12.4k|    return std::make_shared<QPDF>();
  243|  12.4k|}
_ZN4QPDF18processInputSourceENSt3__110shared_ptrI11InputSourceEEPKc:
  273|  12.4k|{
  274|  12.4k|    m->file = source;
  275|  12.4k|    parse(password);
  276|  12.4k|}
_ZN4QPDF14setMaxWarningsEm:
  336|  12.4k|{
  337|  12.4k|    m->max_warnings = val;
  338|  12.4k|}
_ZN4QPDF18validatePDFVersionERPKcRNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  374|  9.53k|{
  375|  9.53k|    bool valid = QUtil::is_digit(*p);
  376|  9.53k|    if (valid) {
  ------------------
  |  Branch (376:9): [True: 8.53k, False: 1.00k]
  ------------------
  377|  21.7k|        while (QUtil::is_digit(*p)) {
  ------------------
  |  Branch (377:16): [True: 13.2k, False: 8.53k]
  ------------------
  378|  13.2k|            version.append(1, *p++);
  379|  13.2k|        }
  380|  8.53k|        if ((*p == '.') && QUtil::is_digit(*(p + 1))) {
  ------------------
  |  Branch (380:13): [True: 7.91k, False: 614]
  |  Branch (380:28): [True: 7.59k, False: 326]
  ------------------
  381|  7.59k|            version.append(1, *p++);
  382|  29.0k|            while (QUtil::is_digit(*p)) {
  ------------------
  |  Branch (382:20): [True: 21.4k, False: 7.59k]
  ------------------
  383|  21.4k|                version.append(1, *p++);
  384|  21.4k|            }
  385|  7.59k|        } else {
  386|    940|            valid = false;
  387|    940|        }
  388|  8.53k|    }
  389|  9.53k|    return valid;
  390|  9.53k|}
_ZN4QPDF10findHeaderEv:
  394|  9.53k|{
  395|  9.53k|    qpdf_offset_t global_offset = m->file->tell();
  396|  9.53k|    std::string line = m->file->readLine(1024);
  397|  9.53k|    char const* p = line.c_str();
  398|  9.53k|    if (strncmp(p, "%PDF-", 5) != 0) {
  ------------------
  |  Branch (398:9): [True: 0, False: 9.53k]
  ------------------
  399|      0|        throw std::logic_error("findHeader is not looking at %PDF-");
  400|      0|    }
  401|  9.53k|    p += 5;
  402|  9.53k|    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|  9.53k|    bool valid = validatePDFVersion(p, version);
  406|  9.53k|    if (valid) {
  ------------------
  |  Branch (406:9): [True: 7.59k, False: 1.94k]
  ------------------
  407|  7.59k|        m->pdf_version = version;
  408|  7.59k|        if (global_offset != 0) {
  ------------------
  |  Branch (408:13): [True: 1.77k, False: 5.82k]
  ------------------
  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|  1.77k|            QTC::TC("qpdf", "QPDF global offset");
  413|  1.77k|            m->file = std::shared_ptr<InputSource>(new OffsetInputSource(m->file, global_offset));
  414|  1.77k|        }
  415|  7.59k|    }
  416|  9.53k|    return valid;
  417|  9.53k|}
_ZN4QPDF13findStartxrefEv:
  421|  6.99k|{
  422|  6.99k|    if (readToken(m->file).isWord("startxref") && readToken(m->file).isInteger()) {
  ------------------
  |  Branch (422:9): [True: 6.81k, False: 177]
  |  Branch (422:9): [True: 6.08k, False: 912]
  |  Branch (422:51): [True: 6.08k, False: 735]
  ------------------
  423|       |        // Position in front of offset token
  424|  6.08k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
  425|  6.08k|        return true;
  426|  6.08k|    }
  427|    912|    return false;
  428|  6.99k|}
_ZN4QPDF5parseEPKc:
  432|  12.4k|{
  433|  12.4k|    if (password) {
  ------------------
  |  Branch (433:9): [True: 0, False: 12.4k]
  ------------------
  434|      0|        m->encp->provided_password = password;
  435|      0|    }
  436|       |
  437|       |    // Find the header anywhere in the first 1024 bytes of the file.
  438|  12.4k|    PatternFinder hf(*this, &QPDF::findHeader);
  439|  12.4k|    if (!m->file->findFirst("%PDF-", 0, 1024, hf)) {
  ------------------
  |  Branch (439:9): [True: 4.83k, False: 7.59k]
  ------------------
  440|  4.83k|        QTC::TC("qpdf", "QPDF not a pdf file");
  441|  4.83k|        warn(damagedPDF("", 0, "can't find PDF header"));
  442|       |        // QPDFWriter writes files that usually require at least version 1.2 for /FlateDecode
  443|  4.83k|        m->pdf_version = "1.2";
  444|  4.83k|    }
  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|  12.4k|    m->file->seek(0, SEEK_END);
  449|  12.4k|    qpdf_offset_t end_offset = m->file->tell();
  450|  12.4k|    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|  12.4k|    if (m->xref_table_max_id > m->xref_table_max_offset / 3) {
  ------------------
  |  Branch (453:9): [True: 12.4k, False: 0]
  ------------------
  454|  12.4k|        m->xref_table_max_id = static_cast<int>(m->xref_table_max_offset / 3);
  455|  12.4k|    }
  456|  12.4k|    qpdf_offset_t start_offset = (end_offset > 1054 ? end_offset - 1054 : 0);
  ------------------
  |  Branch (456:35): [True: 7.82k, False: 4.59k]
  ------------------
  457|  12.4k|    PatternFinder sf(*this, &QPDF::findStartxref);
  458|  12.4k|    qpdf_offset_t xref_offset = 0;
  459|  12.4k|    if (m->file->findLast("startxref", start_offset, 0, sf)) {
  ------------------
  |  Branch (459:9): [True: 5.65k, False: 6.76k]
  ------------------
  460|  5.65k|        xref_offset = QUtil::string_to_ll(readToken(m->file).getValue().c_str());
  461|  5.65k|    }
  462|       |
  463|  12.4k|    try {
  464|  12.4k|        if (xref_offset == 0) {
  ------------------
  |  Branch (464:13): [True: 6.85k, False: 5.56k]
  ------------------
  465|  6.85k|            QTC::TC("qpdf", "QPDF can't find startxref");
  466|  6.85k|            throw damagedPDF("", 0, "can't find startxref");
  467|  6.85k|        }
  468|  5.56k|        try {
  469|  5.56k|            read_xref(xref_offset);
  470|  5.56k|        } catch (QPDFExc&) {
  471|  5.16k|            throw;
  472|  5.16k|        } catch (std::exception& e) {
  473|    103|            throw damagedPDF("", 0, std::string("error reading xref: ") + e.what());
  474|    103|        }
  475|  12.1k|    } catch (QPDFExc& e) {
  476|  12.1k|        if (m->attempt_recovery) {
  ------------------
  |  Branch (476:13): [True: 12.1k, False: 0]
  ------------------
  477|  12.1k|            reconstruct_xref(e);
  478|  12.1k|            QTC::TC("qpdf", "QPDF reconstructed xref table");
  479|  12.1k|        } else {
  480|      0|            throw;
  481|      0|        }
  482|  12.1k|    }
  483|       |
  484|  12.1k|    initializeEncryption();
  485|  8.89k|    m->parsed = true;
  486|  8.89k|    if (m->xref_table.size() > 0 && !getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (486:9): [True: 8.82k, False: 67]
  |  Branch (486:9): [True: 19, False: 8.87k]
  |  Branch (486:37): [True: 19, False: 8.80k]
  ------------------
  487|       |        // QPDFs created from JSON have an empty xref table and no root object yet.
  488|     19|        throw damagedPDF("", 0, "unable to find page tree");
  489|     19|    }
  490|  8.89k|}
_ZN4QPDF7inParseEb:
  494|   743k|{
  495|   743k|    if (m->in_parse == v) {
  ------------------
  |  Branch (495:9): [True: 0, False: 743k]
  ------------------
  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|   743k|    m->in_parse = v;
  502|   743k|}
_ZN4QPDF4warnERK7QPDFExc:
  506|   865k|{
  507|   865k|    if (m->max_warnings > 0 && m->warnings.size() >= m->max_warnings) {
  ------------------
  |  Branch (507:9): [True: 865k, False: 0]
  |  Branch (507:32): [True: 3.62k, False: 861k]
  ------------------
  508|  3.62k|        stopOnError("Too many warnings - file is too badly damaged");
  509|  3.62k|    }
  510|   865k|    m->warnings.push_back(e);
  511|   865k|    if (!m->suppress_warnings) {
  ------------------
  |  Branch (511:9): [True: 861k, False: 3.62k]
  ------------------
  512|   861k|        *m->log->getWarn() << "WARNING: " << m->warnings.back().what() << "\n";
  513|   861k|    }
  514|   865k|}
_ZN4QPDF4warnE17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEExS9_:
  522|  4.04k|{
  523|  4.04k|    warn(QPDFExc(error_code, getFilename(), object, offset, message));
  524|  4.04k|}
_ZN4QPDF10setTrailerE16QPDFObjectHandle:
  528|  9.90k|{
  529|  9.90k|    if (m->trailer.isInitialized()) {
  ------------------
  |  Branch (529:9): [True: 27, False: 9.87k]
  ------------------
  530|     27|        return;
  531|     27|    }
  532|  9.87k|    m->trailer = obj;
  533|  9.87k|}
_ZN4QPDF16reconstruct_xrefER7QPDFExc:
  537|  14.0k|{
  538|  14.0k|    if (m->reconstructed_xref) {
  ------------------
  |  Branch (538:9): [True: 1.72k, False: 12.2k]
  ------------------
  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|  1.72k|        throw e;
  542|  1.72k|    }
  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|  12.2k|    const auto max_warnings = m->warnings.size() + 1000U;
  547|  12.2k|    auto check_warnings = [this, max_warnings]() {
  548|  12.2k|        if (m->warnings.size() > max_warnings) {
  549|  12.2k|            throw damagedPDF("", 0, "too many errors while reconstructing cross-reference table");
  550|  12.2k|        }
  551|  12.2k|    };
  552|       |
  553|  12.2k|    m->reconstructed_xref = true;
  554|       |    // We may find more objects, which may contain dangling references.
  555|  12.2k|    m->fixed_dangling_refs = false;
  556|       |
  557|  12.2k|    warn(damagedPDF("", 0, "file is damaged"));
  558|  12.2k|    warn(e);
  559|  12.2k|    warn(damagedPDF("", 0, "Attempting to reconstruct cross-reference table"));
  560|       |
  561|       |    // Delete all references to type 1 (uncompressed) objects
  562|  12.2k|    std::set<QPDFObjGen> to_delete;
  563|  39.4k|    for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (563:26): [True: 39.4k, False: 12.2k]
  ------------------
  564|  39.4k|        if (iter.second.getType() == 1) {
  ------------------
  |  Branch (564:13): [True: 19.1k, False: 20.2k]
  ------------------
  565|  19.1k|            to_delete.insert(iter.first);
  566|  19.1k|        }
  567|  39.4k|    }
  568|  19.1k|    for (auto const& iter: to_delete) {
  ------------------
  |  Branch (568:26): [True: 19.1k, False: 12.2k]
  ------------------
  569|  19.1k|        m->xref_table.erase(iter);
  570|  19.1k|    }
  571|       |
  572|  12.2k|    m->file->seek(0, SEEK_END);
  573|  12.2k|    qpdf_offset_t eof = m->file->tell();
  574|  12.2k|    m->file->seek(0, SEEK_SET);
  575|       |    // Don't allow very long tokens here during recovery. All the interesting tokens are covered.
  576|  12.2k|    static size_t const MAX_LEN = 10;
  577|  6.36M|    while (m->file->tell() < eof) {
  ------------------
  |  Branch (577:12): [True: 6.35M, False: 12.2k]
  ------------------
  578|  6.35M|        QPDFTokenizer::Token t1 = readToken(m->file, MAX_LEN);
  579|  6.35M|        qpdf_offset_t token_start = m->file->tell() - toO(t1.getValue().length());
  580|  6.35M|        if (t1.isInteger()) {
  ------------------
  |  Branch (580:13): [True: 1.27M, False: 5.07M]
  ------------------
  581|  1.27M|            auto pos = m->file->tell();
  582|  1.27M|            QPDFTokenizer::Token t2 = readToken(m->file, MAX_LEN);
  583|  1.27M|            if ((t2.isInteger()) && (readToken(m->file, MAX_LEN).isWord("obj"))) {
  ------------------
  |  Branch (583:17): [True: 1.09M, False: 177k]
  |  Branch (583:17): [True: 457k, False: 820k]
  |  Branch (583:37): [True: 457k, False: 642k]
  ------------------
  584|   457k|                int obj = QUtil::string_to_int(t1.getValue().c_str());
  585|   457k|                int gen = QUtil::string_to_int(t2.getValue().c_str());
  586|   457k|                if (obj <= m->xref_table_max_id) {
  ------------------
  |  Branch (586:21): [True: 457k, False: 252]
  ------------------
  587|   457k|                    insertReconstructedXrefEntry(obj, token_start, gen);
  588|   457k|                } else {
  589|    252|                    warn(damagedPDF(
  590|    252|                        "", 0, "ignoring object with impossibly large id " + std::to_string(obj)));
  591|    252|                }
  592|   457k|            }
  593|  1.27M|            m->file->seek(pos, SEEK_SET);
  594|  5.07M|        } else if (!m->trailer.isInitialized() && t1.isWord("trailer")) {
  ------------------
  |  Branch (594:20): [True: 2.77M, False: 2.30M]
  |  Branch (594:20): [True: 15.9k, False: 5.06M]
  |  Branch (594:51): [True: 15.9k, False: 2.76M]
  ------------------
  595|  15.9k|            auto pos = m->file->tell();
  596|  15.9k|            QPDFObjectHandle t = readTrailer();
  597|  15.9k|            if (!t.isDictionary()) {
  ------------------
  |  Branch (597:17): [True: 7.97k, False: 7.98k]
  ------------------
  598|       |                // Oh well.  It was worth a try.
  599|  7.98k|            } else {
  600|  7.98k|                setTrailer(t);
  601|  7.98k|            }
  602|  15.9k|            m->file->seek(pos, SEEK_SET);
  603|  15.9k|        }
  604|  6.35M|        check_warnings();
  605|  6.35M|        m->file->findAndSkipNextEOL();
  606|  6.35M|    }
  607|  12.2k|    m->deleted_objects.clear();
  608|       |
  609|  12.2k|    if (!m->trailer.isInitialized()) {
  ------------------
  |  Branch (609:9): [True: 3.86k, False: 8.43k]
  ------------------
  610|  3.86k|        qpdf_offset_t max_offset{0};
  611|       |        // If there are any xref streams, take the last one to appear.
  612|  30.8k|        for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (612:30): [True: 30.8k, False: 3.86k]
  ------------------
  613|  30.8k|            auto entry = iter.second;
  614|  30.8k|            if (entry.getType() != 1) {
  ------------------
  |  Branch (614:17): [True: 625, False: 30.2k]
  ------------------
  615|    625|                continue;
  616|    625|            }
  617|  30.2k|            auto oh = getObjectByObjGen(iter.first);
  618|  30.2k|            try {
  619|  30.2k|                if (!oh.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (619:21): [True: 27.2k, False: 2.98k]
  ------------------
  620|  27.2k|                    continue;
  621|  27.2k|                }
  622|  30.2k|            } catch (std::exception&) {
  623|  1.31k|                continue;
  624|  1.31k|            }
  625|  1.66k|            auto offset = entry.getOffset();
  626|  1.66k|            if (offset > max_offset) {
  ------------------
  |  Branch (626:17): [True: 1.37k, False: 299]
  ------------------
  627|  1.37k|                max_offset = offset;
  628|  1.37k|                setTrailer(oh.getDict());
  629|  1.37k|            }
  630|  1.66k|            check_warnings();
  631|  1.66k|        }
  632|  3.86k|        if (max_offset > 0) {
  ------------------
  |  Branch (632:13): [True: 1.34k, False: 2.51k]
  ------------------
  633|  1.34k|            try {
  634|  1.34k|                read_xref(max_offset);
  635|  1.34k|            } catch (std::exception&) {
  636|    400|                throw damagedPDF(
  637|    400|                    "", 0, "error decoding candidate xref stream while recovering damaged file");
  638|    400|            }
  639|    943|            QTC::TC("qpdf", "QPDF recover xref stream");
  640|    943|        }
  641|  3.86k|    }
  642|       |
  643|  11.8k|    if (!m->trailer.isInitialized()) {
  ------------------
  |  Branch (643:9): [True: 2.51k, False: 9.37k]
  ------------------
  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|  2.51k|        throw damagedPDF("", 0, "unable to find trailer dictionary while recovering damaged file");
  649|  2.51k|    }
  650|  9.37k|    if (m->xref_table.empty()) {
  ------------------
  |  Branch (650:9): [True: 86, False: 9.29k]
  ------------------
  651|       |        // We cannot check for an empty xref table in parse because empty tables are valid when
  652|       |        // creating QPDF objects from JSON.
  653|     86|        throw damagedPDF("", 0, "unable to find objects while recovering damaged file");
  654|     86|    }
  655|  9.29k|    check_warnings();
  656|  9.29k|    if (!m->parsed) {
  ------------------
  |  Branch (656:9): [True: 9.10k, False: 189]
  ------------------
  657|  9.10k|        m->parsed = true;
  658|  9.10k|        getAllPages();
  659|  9.10k|        check_warnings();
  660|  9.10k|        if (m->all_pages.empty()) {
  ------------------
  |  Branch (660:13): [True: 59, False: 9.04k]
  ------------------
  661|     59|            m->parsed = false;
  662|     59|            throw damagedPDF("", 0, "unable to find any pages while recovering damaged file");
  663|     59|        }
  664|  9.10k|    }
  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|  9.29k|}
_ZN4QPDF9read_xrefEx:
  674|  6.90k|{
  675|  6.90k|    std::map<int, int> free_table;
  676|  6.90k|    std::set<qpdf_offset_t> visited;
  677|  14.2k|    while (xref_offset) {
  ------------------
  |  Branch (677:12): [True: 7.42k, False: 6.86k]
  ------------------
  678|  7.42k|        visited.insert(xref_offset);
  679|  7.42k|        char buf[7];
  680|  7.42k|        memset(buf, 0, sizeof(buf));
  681|  7.42k|        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|  7.42k|        bool done = false;
  687|  7.42k|        bool skipped_space = false;
  688|   736k|        while (!done) {
  ------------------
  |  Branch (688:16): [True: 729k, False: 7.42k]
  ------------------
  689|   729k|            char ch;
  690|   729k|            if (1 == m->file->read(&ch, 1)) {
  ------------------
  |  Branch (690:17): [True: 727k, False: 1.41k]
  ------------------
  691|   727k|                if (QUtil::is_space(ch)) {
  ------------------
  |  Branch (691:21): [True: 721k, False: 5.95k]
  ------------------
  692|   721k|                    skipped_space = true;
  693|   721k|                } else {
  694|  5.95k|                    m->file->unreadCh(ch);
  695|  5.95k|                    done = true;
  696|  5.95k|                }
  697|   727k|            } else {
  698|  1.41k|                QTC::TC("qpdf", "QPDF eof skipping spaces before xref", skipped_space ? 0 : 1);
  ------------------
  |  Branch (698:73): [True: 0, False: 1.41k]
  ------------------
  699|  1.41k|                done = true;
  700|  1.41k|            }
  701|   729k|        }
  702|       |
  703|  7.42k|        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|  7.42k|        if ((strncmp(buf, "xref", 4) == 0) && QUtil::is_space(buf[4])) {
  ------------------
  |  Branch (706:13): [True: 876, False: 6.55k]
  |  Branch (706:47): [True: 867, False: 9]
  ------------------
  707|    867|            if (skipped_space) {
  ------------------
  |  Branch (707:17): [True: 153, False: 714]
  ------------------
  708|    153|                QTC::TC("qpdf", "QPDF xref skipped space");
  709|    153|                warn(damagedPDF("", 0, "extraneous whitespace seen before xref"));
  710|    153|            }
  711|    867|            QTC::TC(
  712|    867|                "qpdf",
  713|    867|                "QPDF xref space",
  714|    867|                ((buf[4] == '\n')       ? 0
  ------------------
  |  Branch (714:18): [True: 338, False: 529]
  ------------------
  715|    867|                     : (buf[4] == '\r') ? 1
  ------------------
  |  Branch (715:24): [True: 380, False: 149]
  ------------------
  716|    529|                     : (buf[4] == ' ')  ? 2
  ------------------
  |  Branch (716:24): [True: 66, False: 83]
  ------------------
  717|    149|                                        : 9999));
  718|    867|            int skip = 4;
  719|       |            // buf is null-terminated, and QUtil::is_space('\0') is false, so this won't overrun.
  720|  1.99k|            while (QUtil::is_space(buf[skip])) {
  ------------------
  |  Branch (720:20): [True: 1.13k, False: 867]
  ------------------
  721|  1.13k|                ++skip;
  722|  1.13k|            }
  723|    867|            xref_offset = read_xrefTable(xref_offset + skip);
  724|  6.56k|        } else {
  725|  6.56k|            xref_offset = read_xrefStream(xref_offset);
  726|  6.56k|        }
  727|  7.42k|        if (visited.count(xref_offset) != 0) {
  ------------------
  |  Branch (727:13): [True: 40, False: 7.38k]
  ------------------
  728|     40|            QTC::TC("qpdf", "QPDF xref loop");
  729|     40|            throw damagedPDF("", 0, "loop detected following xref tables");
  730|     40|        }
  731|  7.42k|    }
  732|       |
  733|  6.86k|    if (!m->trailer.isInitialized()) {
  ------------------
  |  Branch (733:9): [True: 0, False: 6.86k]
  ------------------
  734|      0|        throw damagedPDF("", 0, "unable to find trailer while reading xref");
  735|      0|    }
  736|  6.86k|    int size = m->trailer.getKey("/Size").getIntValueAsInt();
  737|  6.86k|    int max_obj = 0;
  738|  6.86k|    if (!m->xref_table.empty()) {
  ------------------
  |  Branch (738:9): [True: 1.20k, False: 5.65k]
  ------------------
  739|  1.20k|        max_obj = m->xref_table.rbegin()->first.getObj();
  740|  1.20k|    }
  741|  6.86k|    if (!m->deleted_objects.empty()) {
  ------------------
  |  Branch (741:9): [True: 566, False: 6.30k]
  ------------------
  742|    566|        max_obj = std::max(max_obj, *(m->deleted_objects.rbegin()));
  743|    566|    }
  744|  6.86k|    if ((size < 1) || (size - 1 != max_obj)) {
  ------------------
  |  Branch (744:9): [True: 5.68k, False: 1.18k]
  |  Branch (744:23): [True: 498, False: 683]
  ------------------
  745|    554|        QTC::TC("qpdf", "QPDF xref size mismatch");
  746|    554|        warn(damagedPDF(
  747|    554|            "",
  748|    554|            0,
  749|    554|            ("reported number of objects (" + std::to_string(size) +
  750|    554|             ") is not one plus the highest object number (" + std::to_string(max_obj) + ")")));
  751|    554|    }
  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|  6.86k|    m->deleted_objects.clear();
  756|       |
  757|       |    // Make sure we keep only the highest generation for any object.
  758|  6.86k|    QPDFObjGen last_og{-1, 0};
  759|  93.3k|    for (auto const& item: m->xref_table) {
  ------------------
  |  Branch (759:26): [True: 93.3k, False: 6.86k]
  ------------------
  760|  93.3k|        auto id = item.first.getObj();
  761|  93.3k|        if (id == last_og.getObj() && id > 0) {
  ------------------
  |  Branch (761:13): [True: 794, False: 92.5k]
  |  Branch (761:39): [True: 794, False: 0]
  ------------------
  762|    794|            removeObject(last_og);
  763|    794|        }
  764|  93.3k|        last_og = item.first;
  765|  93.3k|    }
  766|  6.86k|}
_ZN4QPDF15parse_xrefFirstERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERiS9_S9_:
  770|  1.82k|{
  771|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  772|       |    // buffer.
  773|  1.82k|    char const* p = line.c_str();
  774|  1.82k|    char const* start = line.c_str();
  775|       |
  776|       |    // Skip zero or more spaces
  777|  4.50k|    while (QUtil::is_space(*p)) {
  ------------------
  |  Branch (777:12): [True: 2.67k, False: 1.82k]
  ------------------
  778|  2.67k|        ++p;
  779|  2.67k|    }
  780|       |    // Require digit
  781|  1.82k|    if (!QUtil::is_digit(*p)) {
  ------------------
  |  Branch (781:9): [True: 86, False: 1.74k]
  ------------------
  782|     86|        return false;
  783|     86|    }
  784|       |    // Gather digits
  785|  1.74k|    std::string obj_str;
  786|  6.73k|    while (QUtil::is_digit(*p)) {
  ------------------
  |  Branch (786:12): [True: 4.99k, False: 1.74k]
  ------------------
  787|  4.99k|        obj_str.append(1, *p++);
  788|  4.99k|    }
  789|       |    // Require space
  790|  1.74k|    if (!QUtil::is_space(*p)) {
  ------------------
  |  Branch (790:9): [True: 18, False: 1.72k]
  ------------------
  791|     18|        return false;
  792|     18|    }
  793|       |    // Skip spaces
  794|  5.30k|    while (QUtil::is_space(*p)) {
  ------------------
  |  Branch (794:12): [True: 3.57k, False: 1.72k]
  ------------------
  795|  3.57k|        ++p;
  796|  3.57k|    }
  797|       |    // Require digit
  798|  1.72k|    if (!QUtil::is_digit(*p)) {
  ------------------
  |  Branch (798:9): [True: 49, False: 1.67k]
  ------------------
  799|     49|        return false;
  800|     49|    }
  801|       |    // Gather digits
  802|  1.67k|    std::string num_str;
  803|  4.17k|    while (QUtil::is_digit(*p)) {
  ------------------
  |  Branch (803:12): [True: 2.49k, False: 1.67k]
  ------------------
  804|  2.49k|        num_str.append(1, *p++);
  805|  2.49k|    }
  806|       |    // Skip any space including line terminators
  807|  6.92k|    while (QUtil::is_space(*p)) {
  ------------------
  |  Branch (807:12): [True: 5.25k, False: 1.67k]
  ------------------
  808|  5.25k|        ++p;
  809|  5.25k|    }
  810|  1.67k|    bytes = toI(p - start);
  811|  1.67k|    obj = QUtil::string_to_int(obj_str.c_str());
  812|  1.67k|    num = QUtil::string_to_int(num_str.c_str());
  813|  1.67k|    return true;
  814|  1.72k|}
_ZN4QPDF18read_bad_xrefEntryERxRiRc:
  818|  1.57k|{
  819|       |    // Reposition after initial read attempt and reread.
  820|  1.57k|    m->file->seek(m->file->getLastOffset(), SEEK_SET);
  821|  1.57k|    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|  1.57k|    char const* p = line.data();
  826|       |
  827|       |    // Skip zero or more spaces. There aren't supposed to be any.
  828|  1.57k|    bool invalid = false;
  829|  3.24k|    while (QUtil::is_space(*p)) {
  ------------------
  |  Branch (829:12): [True: 1.66k, False: 1.57k]
  ------------------
  830|  1.66k|        ++p;
  831|  1.66k|        QTC::TC("qpdf", "QPDF ignore first space in xref entry");
  832|  1.66k|        invalid = true;
  833|  1.66k|    }
  834|       |    // Require digit
  835|  1.57k|    if (!QUtil::is_digit(*p)) {
  ------------------
  |  Branch (835:9): [True: 17, False: 1.56k]
  ------------------
  836|     17|        return false;
  837|     17|    }
  838|       |    // Gather digits
  839|  1.56k|    std::string f1_str;
  840|  13.6k|    while (QUtil::is_digit(*p)) {
  ------------------
  |  Branch (840:12): [True: 12.0k, False: 1.56k]
  ------------------
  841|  12.0k|        f1_str.append(1, *p++);
  842|  12.0k|    }
  843|       |    // Require space
  844|  1.56k|    if (!QUtil::is_space(*p)) {
  ------------------
  |  Branch (844:9): [True: 27, False: 1.53k]
  ------------------
  845|     27|        return false;
  846|     27|    }
  847|  1.53k|    if (QUtil::is_space(*(p + 1))) {
  ------------------
  |  Branch (847:9): [True: 525, False: 1.00k]
  ------------------
  848|    525|        QTC::TC("qpdf", "QPDF ignore first extra space in xref entry");
  849|    525|        invalid = true;
  850|    525|    }
  851|       |    // Skip spaces
  852|  6.19k|    while (QUtil::is_space(*p)) {
  ------------------
  |  Branch (852:12): [True: 4.65k, False: 1.53k]
  ------------------
  853|  4.65k|        ++p;
  854|  4.65k|    }
  855|       |    // Require digit
  856|  1.53k|    if (!QUtil::is_digit(*p)) {
  ------------------
  |  Branch (856:9): [True: 36, False: 1.49k]
  ------------------
  857|     36|        return false;
  858|     36|    }
  859|       |    // Gather digits
  860|  1.49k|    std::string f2_str;
  861|  8.18k|    while (QUtil::is_digit(*p)) {
  ------------------
  |  Branch (861:12): [True: 6.68k, False: 1.49k]
  ------------------
  862|  6.68k|        f2_str.append(1, *p++);
  863|  6.68k|    }
  864|       |    // Require space
  865|  1.49k|    if (!QUtil::is_space(*p)) {
  ------------------
  |  Branch (865:9): [True: 34, False: 1.46k]
  ------------------
  866|     34|        return false;
  867|     34|    }
  868|  1.46k|    if (QUtil::is_space(*(p + 1))) {
  ------------------
  |  Branch (868:9): [True: 562, False: 902]
  ------------------
  869|    562|        QTC::TC("qpdf", "QPDF ignore second extra space in xref entry");
  870|    562|        invalid = true;
  871|    562|    }
  872|       |    // Skip spaces
  873|  4.59k|    while (QUtil::is_space(*p)) {
  ------------------
  |  Branch (873:12): [True: 3.12k, False: 1.46k]
  ------------------
  874|  3.12k|        ++p;
  875|  3.12k|    }
  876|  1.46k|    if ((*p == 'f') || (*p == 'n')) {
  ------------------
  |  Branch (876:9): [True: 181, False: 1.28k]
  |  Branch (876:24): [True: 1.24k, False: 39]
  ------------------
  877|  1.42k|        type = *p;
  878|  1.42k|    } else {
  879|     39|        return false;
  880|     39|    }
  881|  1.42k|    if ((f1_str.length() != 10) || (f2_str.length() != 5)) {
  ------------------
  |  Branch (881:9): [True: 398, False: 1.02k]
  |  Branch (881:36): [True: 101, False: 926]
  ------------------
  882|    499|        QTC::TC("qpdf", "QPDF ignore length error xref entry");
  883|    499|        invalid = true;
  884|    499|    }
  885|       |
  886|  1.42k|    if (invalid) {
  ------------------
  |  Branch (886:9): [True: 946, False: 479]
  ------------------
  887|    946|        warn(damagedPDF("xref table", "accepting invalid xref table entry"));
  888|    946|    }
  889|       |
  890|  1.42k|    f1 = QUtil::string_to_ll(f1_str.c_str());
  891|  1.42k|    f2 = QUtil::string_to_int(f2_str.c_str());
  892|       |
  893|  1.42k|    return true;
  894|  1.46k|}
_ZN4QPDF14read_xrefEntryERxRiRc:
  900|  17.7k|{
  901|  17.7k|    std::array<char, 21> line;
  902|  17.7k|    if (m->file->read(line.data(), 20) != 20) {
  ------------------
  |  Branch (902:9): [True: 72, False: 17.7k]
  ------------------
  903|       |        // C++20: [[unlikely]]
  904|     72|        return false;
  905|     72|    }
  906|  17.7k|    line[20] = '\0';
  907|  17.7k|    char const* p = line.data();
  908|       |
  909|  17.7k|    int f1_len = 0;
  910|  17.7k|    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|   104k|    while (*p == '0') {
  ------------------
  |  Branch (916:12): [True: 86.5k, False: 17.7k]
  ------------------
  917|  86.5k|        ++f1_len;
  918|  86.5k|        ++p;
  919|  86.5k|    }
  920|  99.1k|    while (QUtil::is_digit(*p) && f1_len++ < 10) {
  ------------------
  |  Branch (920:12): [True: 81.4k, False: 17.7k]
  |  Branch (920:35): [True: 81.3k, False: 6]
  ------------------
  921|  81.3k|        f1 *= 10;
  922|  81.3k|        f1 += *p++ - '0';
  923|  81.3k|    }
  924|       |    // Require space
  925|  17.7k|    if (!QUtil::is_space(*p++)) {
  ------------------
  |  Branch (925:9): [True: 93, False: 17.6k]
  ------------------
  926|       |        // Entry doesn't start with space or digit.
  927|       |        // C++20: [[unlikely]]
  928|     93|        return false;
  929|     93|    }
  930|       |    // Gather digits. NB No risk of overflow as 99'999 < max int.
  931|  99.2k|    while (*p == '0') {
  ------------------
  |  Branch (931:12): [True: 81.6k, False: 17.6k]
  ------------------
  932|  81.6k|        ++f2_len;
  933|  81.6k|        ++p;
  934|  81.6k|    }
  935|  19.9k|    while (QUtil::is_digit(*p) && f2_len++ < 5) {
  ------------------
  |  Branch (935:12): [True: 2.37k, False: 17.5k]
  |  Branch (935:35): [True: 2.32k, False: 49]
  ------------------
  936|  2.32k|        f2 *= 10;
  937|  2.32k|        f2 += static_cast<int>(*p++ - '0');
  938|  2.32k|    }
  939|  17.6k|    if (QUtil::is_space(*p++) && (*p == 'f' || *p == 'n')) {
  ------------------
  |  Branch (939:9): [True: 17.5k, False: 96]
  |  Branch (939:35): [True: 335, False: 17.1k]
  |  Branch (939:48): [True: 16.4k, False: 705]
  ------------------
  940|       |        // C++20: [[likely]]
  941|  16.8k|        type = *p;
  942|       |        // No test for valid line[19].
  943|  16.8k|        if (*(++p) && *(++p) && (*p == '\n' || *p == '\r') && f1_len == 10 && f2_len == 5) {
  ------------------
  |  Branch (943:13): [True: 16.8k, False: 6]
  |  Branch (943:23): [True: 16.7k, False: 21]
  |  Branch (943:34): [True: 16.1k, False: 598]
  |  Branch (943:48): [True: 42, False: 556]
  |  Branch (943:63): [True: 16.1k, False: 117]
  |  Branch (943:79): [True: 16.0k, False: 77]
  ------------------
  944|       |            // C++20: [[likely]]
  945|  16.0k|            return true;
  946|  16.0k|        }
  947|  16.8k|    }
  948|  1.57k|    return read_bad_xrefEntry(f1, f2, type);
  949|  17.6k|}
_ZN4QPDF14read_xrefTableEx:
  954|    867|{
  955|    867|    std::vector<QPDFObjGen> deleted_items;
  956|       |
  957|    867|    m->file->seek(xref_offset, SEEK_SET);
  958|    867|    std::string line;
  959|  1.85k|    while (true) {
  ------------------
  |  Branch (959:12): [Folded - Ignored]
  ------------------
  960|  1.82k|        line.assign(50, '\0');
  961|  1.82k|        m->file->read(line.data(), line.size());
  962|  1.82k|        int obj = 0;
  963|  1.82k|        int num = 0;
  964|  1.82k|        int bytes = 0;
  965|  1.82k|        if (!parse_xrefFirst(line, obj, num, bytes)) {
  ------------------
  |  Branch (965:13): [True: 153, False: 1.67k]
  ------------------
  966|    153|            QTC::TC("qpdf", "QPDF invalid xref");
  967|    153|            throw damagedPDF("xref table", "xref syntax invalid");
  968|    153|        }
  969|  1.67k|        m->file->seek(m->file->getLastOffset() + bytes, SEEK_SET);
  970|  19.1k|        for (qpdf_offset_t i = obj; i - num < obj; ++i) {
  ------------------
  |  Branch (970:37): [True: 17.7k, False: 1.35k]
  ------------------
  971|  17.7k|            if (i == 0) {
  ------------------
  |  Branch (971:17): [True: 197, False: 17.5k]
  ------------------
  972|       |                // This is needed by checkLinearization()
  973|    197|                m->first_xref_item_offset = m->file->tell();
  974|    197|            }
  975|       |            // For xref_table, these will always be small enough to be ints
  976|  17.7k|            qpdf_offset_t f1 = 0;
  977|  17.7k|            int f2 = 0;
  978|  17.7k|            char type = '\0';
  979|  17.7k|            if (!read_xrefEntry(f1, f2, type)) {
  ------------------
  |  Branch (979:17): [True: 318, False: 17.4k]
  ------------------
  980|    318|                QTC::TC("qpdf", "QPDF invalid xref entry");
  981|    318|                throw damagedPDF(
  982|    318|                    "xref table", "invalid xref entry (obj=" + std::to_string(i) + ")");
  983|    318|            }
  984|  17.4k|            if (type == 'f') {
  ------------------
  |  Branch (984:17): [True: 394, False: 17.0k]
  ------------------
  985|       |                // Save deleted items until after we've checked the XRefStm, if any.
  986|    394|                deleted_items.emplace_back(toI(i), f2);
  987|  17.0k|            } else {
  988|  17.0k|                insertXrefEntry(toI(i), 1, f1, f2);
  989|  17.0k|            }
  990|  17.4k|        }
  991|  1.35k|        qpdf_offset_t pos = m->file->tell();
  992|  1.35k|        if (readToken(m->file).isWord("trailer")) {
  ------------------
  |  Branch (992:13): [True: 373, False: 985]
  ------------------
  993|    373|            break;
  994|    985|        } else {
  995|    985|            m->file->seek(pos, SEEK_SET);
  996|    985|        }
  997|  1.35k|    }
  998|       |
  999|       |    // Set offset to previous xref table if any
 1000|    396|    QPDFObjectHandle cur_trailer = readTrailer();
 1001|    396|    if (!cur_trailer.isDictionary()) {
  ------------------
  |  Branch (1001:9): [True: 17, False: 379]
  ------------------
 1002|     17|        QTC::TC("qpdf", "QPDF missing trailer");
 1003|     17|        throw damagedPDF("", "expected trailer dictionary");
 1004|     17|    }
 1005|       |
 1006|    379|    if (!m->trailer.isInitialized()) {
  ------------------
  |  Branch (1006:9): [True: 269, False: 110]
  ------------------
 1007|    269|        setTrailer(cur_trailer);
 1008|       |
 1009|    269|        if (!m->trailer.hasKey("/Size")) {
  ------------------
  |  Branch (1009:13): [True: 3, False: 266]
  ------------------
 1010|      3|            QTC::TC("qpdf", "QPDF trailer lacks size");
 1011|      3|            throw damagedPDF("trailer", "trailer dictionary lacks /Size key");
 1012|      3|        }
 1013|    266|        if (!m->trailer.getKey("/Size").isInteger()) {
  ------------------
  |  Branch (1013:13): [True: 3, False: 263]
  ------------------
 1014|      3|            QTC::TC("qpdf", "QPDF trailer size not integer");
 1015|      3|            throw damagedPDF("trailer", "/Size key in trailer dictionary is not an integer");
 1016|      3|        }
 1017|    266|    }
 1018|       |
 1019|    373|    if (cur_trailer.hasKey("/XRefStm")) {
  ------------------
  |  Branch (1019:9): [True: 48, False: 325]
  ------------------
 1020|     48|        if (m->ignore_xref_streams) {
  ------------------
  |  Branch (1020:13): [True: 0, False: 48]
  ------------------
 1021|      0|            QTC::TC("qpdf", "QPDF ignoring XRefStm in trailer");
 1022|     48|        } else {
 1023|     48|            if (cur_trailer.getKey("/XRefStm").isInteger()) {
  ------------------
  |  Branch (1023:17): [True: 47, False: 1]
  ------------------
 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|     47|                (void)read_xrefStream(cur_trailer.getKey("/XRefStm").getIntValue());
 1027|     47|            } else {
 1028|      1|                throw damagedPDF("xref stream", xref_offset, "invalid /XRefStm");
 1029|      1|            }
 1030|     48|        }
 1031|     48|    }
 1032|       |
 1033|       |    // Handle any deleted items now that we've read the /XRefStm.
 1034|    372|    for (auto const& og: deleted_items) {
  ------------------
  |  Branch (1034:24): [True: 217, False: 372]
  ------------------
 1035|    217|        insertFreeXrefEntry(og);
 1036|    217|    }
 1037|       |
 1038|    372|    if (cur_trailer.hasKey("/Prev")) {
  ------------------
  |  Branch (1038:9): [True: 234, False: 138]
  ------------------
 1039|    234|        if (!cur_trailer.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (1039:13): [True: 3, False: 231]
  ------------------
 1040|      3|            QTC::TC("qpdf", "QPDF trailer prev not integer");
 1041|      3|            throw damagedPDF("trailer", "/Prev key in trailer dictionary is not an integer");
 1042|      3|        }
 1043|    231|        QTC::TC("qpdf", "QPDF prev key in trailer dictionary");
 1044|    231|        xref_offset = cur_trailer.getKey("/Prev").getIntValue();
 1045|    231|    } else {
 1046|    138|        xref_offset = 0;
 1047|    138|    }
 1048|       |
 1049|    369|    return xref_offset;
 1050|    372|}
_ZN4QPDF15read_xrefStreamEx:
 1055|  6.55k|{
 1056|  6.55k|    if (!m->ignore_xref_streams) {
  ------------------
  |  Branch (1056:9): [True: 6.55k, False: 0]
  ------------------
 1057|  6.55k|        QPDFObjGen x_og;
 1058|  6.55k|        QPDFObjectHandle xref_obj;
 1059|  6.55k|        try {
 1060|  6.55k|            xref_obj =
 1061|  6.55k|                readObjectAtOffset(false, xref_offset, "xref stream", QPDFObjGen(0, 0), x_og, true);
 1062|  6.55k|        } catch (QPDFExc&) {
 1063|       |            // ignore -- report error below
 1064|  4.09k|        }
 1065|  6.55k|        if (xref_obj.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (1065:13): [True: 2.27k, False: 4.26k]
  ------------------
 1066|  2.27k|            QTC::TC("qpdf", "QPDF found xref stream");
 1067|  2.27k|            return processXRefStream(xref_offset, xref_obj);
 1068|  2.27k|        }
 1069|  6.53k|    }
 1070|       |
 1071|  4.26k|    QTC::TC("qpdf", "QPDF can't find xref");
 1072|  4.26k|    throw damagedPDF("", xref_offset, "xref not found");
 1073|      0|    return 0; // unreachable
 1074|  6.55k|}
_ZN4QPDF12processXRefWER16QPDFObjectHandleNSt3__18functionIF7QPDFExcNS2_17basic_string_viewIcNS2_11char_traitsIcEEEEEEE:
 1079|  2.27k|{
 1080|  2.27k|    auto W_obj = dict.getKey("/W");
 1081|  2.27k|    if (!(W_obj.isArray() && (W_obj.getArrayNItems() >= 3) && W_obj.getArrayItem(0).isInteger() &&
  ------------------
  |  Branch (1081:9): [True: 20, False: 2.25k]
  |  Branch (1081:11): [True: 2.26k, False: 6]
  |  Branch (1081:30): [True: 2.26k, False: 3]
  |  Branch (1081:63): [True: 2.25k, False: 6]
  ------------------
 1082|  2.27k|          W_obj.getArrayItem(1).isInteger() && W_obj.getArrayItem(2).isInteger())) {
  ------------------
  |  Branch (1082:11): [True: 2.25k, False: 5]
  |  Branch (1082:48): [True: 2.25k, False: 0]
  ------------------
 1083|     20|        throw damaged("Cross-reference stream does not have a proper /W key");
 1084|     20|    }
 1085|       |
 1086|  2.25k|    std::array<int, 3> W;
 1087|  2.25k|    int entry_size = 0;
 1088|  2.25k|    auto w_vector = W_obj.getArrayAsVector();
 1089|  2.25k|    int max_bytes = sizeof(qpdf_offset_t);
 1090|  8.95k|    for (size_t i = 0; i < 3; ++i) {
  ------------------
  |  Branch (1090:24): [True: 6.72k, False: 2.22k]
  ------------------
 1091|  6.72k|        W[i] = w_vector[i].getIntValueAsInt();
 1092|  6.72k|        if (W[i] > max_bytes) {
  ------------------
  |  Branch (1092:13): [True: 16, False: 6.71k]
  ------------------
 1093|     16|            throw damaged("Cross-reference stream's /W contains impossibly large values");
 1094|     16|        }
 1095|  6.71k|        if (W[i] < 0) {
  ------------------
  |  Branch (1095:13): [True: 8, False: 6.70k]
  ------------------
 1096|      8|            throw damaged("Cross-reference stream's /W contains negative values");
 1097|      8|        }
 1098|  6.70k|        entry_size += W[i];
 1099|  6.70k|    }
 1100|  2.22k|    if (entry_size == 0) {
  ------------------
  |  Branch (1100:9): [True: 5, False: 2.22k]
  ------------------
 1101|      5|        throw damaged("Cross-reference stream's /W indicates entry size of 0");
 1102|      5|    }
 1103|  2.22k|    return {entry_size, W};
 1104|  2.22k|}
_ZN4QPDF15processXRefSizeER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS2_17basic_string_viewIcNS2_11char_traitsIcEEEEEEE:
 1110|  2.22k|{
 1111|       |    // Number of entries is limited by the highest possible object id and stream size.
 1112|  2.22k|    auto max_num_entries = std::numeric_limits<int>::max();
 1113|  2.22k|    if (max_num_entries > (std::numeric_limits<qpdf_offset_t>::max() / entry_size)) {
  ------------------
  |  Branch (1113:9): [True: 0, False: 2.22k]
  ------------------
 1114|      0|        max_num_entries = toI(std::numeric_limits<qpdf_offset_t>::max() / entry_size);
 1115|      0|    }
 1116|       |
 1117|  2.22k|    auto Size_obj = dict.getKey("/Size");
 1118|  2.22k|    long long size;
 1119|  2.22k|    if (!dict.getKey("/Size").getValueAsInt(size)) {
  ------------------
  |  Branch (1119:9): [True: 35, False: 2.18k]
  ------------------
 1120|     35|        throw damaged("Cross-reference stream does not have a proper /Size key");
 1121|  2.18k|    } else if (size < 0) {
  ------------------
  |  Branch (1121:16): [True: 5, False: 2.18k]
  ------------------
 1122|      5|        throw damaged("Cross-reference stream has a negative /Size key");
 1123|  2.18k|    } else if (size >= max_num_entries) {
  ------------------
  |  Branch (1123:16): [True: 6, False: 2.17k]
  ------------------
 1124|      6|        throw damaged("Cross-reference stream has an impossibly large /Size key");
 1125|      6|    }
 1126|       |    // We are not validating that Size <= (Size key of parent xref / trailer).
 1127|  2.17k|    return max_num_entries;
 1128|  2.22k|}
_ZN4QPDF16processXRefIndexER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS2_17basic_string_viewIcNS2_11char_traitsIcEEEEEEE:
 1134|  2.17k|{
 1135|  2.17k|    auto size = dict.getKey("/Size").getIntValueAsInt();
 1136|  2.17k|    auto Index_obj = dict.getKey("/Index");
 1137|       |
 1138|  2.17k|    if (Index_obj.isArray()) {
  ------------------
  |  Branch (1138:9): [True: 759, False: 1.41k]
  ------------------
 1139|    759|        std::vector<std::pair<int, int>> indx;
 1140|    759|        int num_entries = 0;
 1141|    759|        auto index_vec = Index_obj.getArrayAsVector();
 1142|    759|        if ((index_vec.size() % 2) || index_vec.size() < 2) {
  ------------------
  |  Branch (1142:13): [True: 5, False: 754]
  |  Branch (1142:39): [True: 1, False: 753]
  ------------------
 1143|      6|            throw damaged("Cross-reference stream's /Index has an invalid number of values");
 1144|      6|        }
 1145|       |
 1146|    753|        int i = 0;
 1147|    753|        long long first = 0;
 1148|  3.40k|        for (auto& val: index_vec) {
  ------------------
  |  Branch (1148:23): [True: 3.40k, False: 726]
  ------------------
 1149|  3.40k|            if (val.isInteger()) {
  ------------------
  |  Branch (1149:17): [True: 3.39k, False: 9]
  ------------------
 1150|  3.39k|                if (i % 2) {
  ------------------
  |  Branch (1150:21): [True: 1.68k, False: 1.70k]
  ------------------
 1151|  1.68k|                    auto count = val.getIntValue();
 1152|  1.68k|                    if (count <= 0) {
  ------------------
  |  Branch (1152:25): [True: 6, False: 1.68k]
  ------------------
 1153|      6|                        throw damaged(
 1154|      6|                            "Cross-reference stream section claims to contain " +
 1155|      6|                            std::to_string(count) + " entries");
 1156|      6|                    }
 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|  1.68k|                    if (first > (max_num_entries - count) ||
  ------------------
  |  Branch (1162:25): [True: 3, False: 1.68k]
  ------------------
 1163|  1.68k|                        count > (max_num_entries - num_entries)) {
  ------------------
  |  Branch (1163:25): [True: 0, False: 1.68k]
  ------------------
 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|  1.68k|                    indx.emplace_back(static_cast<int>(first), static_cast<int>(count));
 1170|  1.68k|                    num_entries += static_cast<int>(count);
 1171|  1.70k|                } else {
 1172|  1.70k|                    first = val.getIntValue();
 1173|  1.70k|                    if (first < 0) {
  ------------------
  |  Branch (1173:25): [True: 3, False: 1.70k]
  ------------------
 1174|      3|                        throw damaged(
 1175|      3|                            "Cross-reference stream's /Index contains a negative object id");
 1176|  1.70k|                    } else if (first > max_num_entries) {
  ------------------
  |  Branch (1176:32): [True: 6, False: 1.69k]
  ------------------
 1177|      6|                        throw damaged("Cross-reference stream's /Index contains an impossibly "
 1178|      6|                                      "large object id");
 1179|      6|                    }
 1180|  1.70k|                }
 1181|  3.39k|            } else {
 1182|      9|                throw damaged(
 1183|      9|                    "Cross-reference stream's /Index's item " + std::to_string(i) +
 1184|      9|                    " is not an integer");
 1185|      9|            }
 1186|  3.37k|            i++;
 1187|  3.37k|        }
 1188|    726|        QTC::TC("qpdf", "QPDF xref /Index is array", index_vec.size() == 2 ? 0 : 1);
  ------------------
  |  Branch (1188:54): [True: 563, False: 163]
  ------------------
 1189|    726|        return {num_entries, indx};
 1190|  1.41k|    } else if (Index_obj.isNull()) {
  ------------------
  |  Branch (1190:16): [True: 1.41k, False: 2]
  ------------------
 1191|  1.41k|        QTC::TC("qpdf", "QPDF xref /Index is null");
 1192|  1.41k|        return {size, {{0, size}}};
 1193|  1.41k|    } else {
 1194|      2|        throw damaged("Cross-reference stream does not have a proper /Index key");
 1195|      2|    }
 1196|  2.17k|}
_ZN4QPDF17processXRefStreamExR16QPDFObjectHandle:
 1200|  2.27k|{
 1201|  2.27k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1202|  2.27k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1203|  2.27k|    };
 1204|       |
 1205|  2.27k|    auto dict = xref_obj.getDict();
 1206|       |
 1207|  2.27k|    auto [entry_size, W] = processXRefW(dict, damaged);
 1208|  2.27k|    int max_num_entries = processXRefSize(dict, entry_size, damaged);
 1209|  2.27k|    auto [num_entries, indx] = processXRefIndex(dict, max_num_entries, damaged);
 1210|       |
 1211|  2.27k|    std::shared_ptr<Buffer> bp = xref_obj.getStreamData(qpdf_dl_specialized);
 1212|  2.27k|    size_t actual_size = bp->getSize();
 1213|  2.27k|    auto expected_size = toS(entry_size) * toS(num_entries);
 1214|       |
 1215|  2.27k|    if (expected_size != actual_size) {
  ------------------
  |  Branch (1215:9): [True: 617, False: 1.65k]
  ------------------
 1216|    617|        QPDFExc x = damaged(
 1217|    617|            "Cross-reference stream data has the wrong size; expected = " +
 1218|    617|            std::to_string(expected_size) + "; actual = " + std::to_string(actual_size));
 1219|    617|        if (expected_size > actual_size) {
  ------------------
  |  Branch (1219:13): [True: 89, False: 528]
  ------------------
 1220|     89|            throw x;
 1221|    528|        } else {
 1222|    528|            warn(x);
 1223|    528|        }
 1224|    617|    }
 1225|       |
 1226|  2.18k|    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|  2.18k|    auto p = bp->getBuffer();
 1231|  2.25k|    for (auto [obj, sec_entries]: indx) {
  ------------------
  |  Branch (1231:33): [True: 2.25k, False: 2.18k]
  ------------------
 1232|       |        // Process a subsection.
 1233|   121k|        for (int i = 0; i < sec_entries; ++i) {
  ------------------
  |  Branch (1233:25): [True: 119k, False: 2.25k]
  ------------------
 1234|       |            // Read this entry
 1235|   119k|            std::array<qpdf_offset_t, 3> fields{};
 1236|   119k|            if (W[0] == 0) {
  ------------------
  |  Branch (1236:17): [True: 5.90k, False: 113k]
  ------------------
 1237|  5.90k|                QTC::TC("qpdf", "QPDF default for xref stream field 0");
 1238|  5.90k|                fields[0] = 1;
 1239|  5.90k|            }
 1240|   477k|            for (size_t j = 0; j < 3; ++j) {
  ------------------
  |  Branch (1240:32): [True: 358k, False: 119k]
  ------------------
 1241|   845k|                for (int k = 0; k < W[j]; ++k) {
  ------------------
  |  Branch (1241:33): [True: 487k, False: 358k]
  ------------------
 1242|   487k|                    fields[j] <<= 8;
 1243|   487k|                    fields[j] |= *p++;
 1244|   487k|                }
 1245|   358k|            }
 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|   119k|            if (saw_first_compressed_object) {
  ------------------
  |  Branch (1249:17): [True: 96.5k, False: 22.8k]
  ------------------
 1250|  96.5k|                if (fields[0] != 2) {
  ------------------
  |  Branch (1250:21): [True: 15.7k, False: 80.8k]
  ------------------
 1251|  15.7k|                    m->uncompressed_after_compressed = true;
 1252|  15.7k|                }
 1253|  96.5k|            } else if (fields[0] == 2) {
  ------------------
  |  Branch (1253:24): [True: 1.25k, False: 21.5k]
  ------------------
 1254|  1.25k|                saw_first_compressed_object = true;
 1255|  1.25k|            }
 1256|   119k|            if (obj == 0) {
  ------------------
  |  Branch (1256:17): [True: 1.20k, False: 118k]
  ------------------
 1257|       |                // This is needed by checkLinearization()
 1258|  1.20k|                m->first_xref_item_offset = xref_offset;
 1259|   118k|            } else if (fields[0] == 0) {
  ------------------
  |  Branch (1259:24): [True: 13.5k, False: 104k]
  ------------------
 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|  13.5k|                insertFreeXrefEntry(QPDFObjGen(obj, 0));
 1264|   104k|            } else {
 1265|   104k|                insertXrefEntry(obj, toI(fields[0]), fields[1], toI(fields[2]));
 1266|   104k|            }
 1267|   119k|            ++obj;
 1268|   119k|        }
 1269|  2.25k|    }
 1270|       |
 1271|  2.18k|    if (!m->trailer.isInitialized()) {
  ------------------
  |  Branch (1271:9): [True: 304, False: 1.87k]
  ------------------
 1272|    304|        setTrailer(dict);
 1273|    304|    }
 1274|       |
 1275|  2.18k|    if (dict.hasKey("/Prev")) {
  ------------------
  |  Branch (1275:9): [True: 351, False: 1.83k]
  ------------------
 1276|    351|        if (!dict.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (1276:13): [True: 3, False: 348]
  ------------------
 1277|      3|            throw damagedPDF(
 1278|      3|                "xref stream", "/Prev key in xref stream dictionary is not an integer");
 1279|      3|        }
 1280|    348|        QTC::TC("qpdf", "QPDF prev key in xref stream dictionary");
 1281|    348|        return dict.getKey("/Prev").getIntValue();
 1282|  1.83k|    } else {
 1283|  1.83k|        return 0;
 1284|  1.83k|    }
 1285|  2.18k|}
_ZN4QPDF15insertXrefEntryEiixi:
 1289|   121k|{
 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|   121k|    if (obj > m->xref_table_max_id) {
  ------------------
  |  Branch (1297:9): [True: 1.12k, False: 120k]
  ------------------
 1298|       |        // ignore impossibly large object ids or object ids > Size.
 1299|  1.12k|        return;
 1300|  1.12k|    }
 1301|       |
 1302|   120k|    if (m->deleted_objects.count(obj)) {
  ------------------
  |  Branch (1302:9): [True: 88, False: 120k]
  ------------------
 1303|     88|        QTC::TC("qpdf", "QPDF xref deleted object");
 1304|     88|        return;
 1305|     88|    }
 1306|       |
 1307|   120k|    if (f0 == 2 && static_cast<int>(f1) == obj) {
  ------------------
  |  Branch (1307:9): [True: 81.6k, False: 38.7k]
  |  Branch (1307:20): [True: 57, False: 81.5k]
  ------------------
 1308|     57|        warn(damagedPDF("xref stream", "self-referential object stream " + std::to_string(obj)));
 1309|     57|        return;
 1310|     57|    }
 1311|       |
 1312|   120k|    auto [iter, created] = m->xref_table.try_emplace(QPDFObjGen(obj, (f0 == 2 ? 0 : f2)));
  ------------------
  |  Branch (1312:71): [True: 81.5k, False: 38.7k]
  ------------------
 1313|   120k|    if (!created) {
  ------------------
  |  Branch (1313:9): [True: 18.5k, False: 101k]
  ------------------
 1314|  18.5k|        QTC::TC("qpdf", "QPDF xref reused object");
 1315|  18.5k|        return;
 1316|  18.5k|    }
 1317|       |
 1318|   101k|    switch (f0) {
 1319|  29.0k|    case 1:
  ------------------
  |  Branch (1319:5): [True: 29.0k, False: 72.7k]
  ------------------
 1320|       |        // f2 is generation
 1321|  29.0k|        QTC::TC("qpdf", "QPDF xref gen > 0", ((f2 > 0) ? 1 : 0));
  ------------------
  |  Branch (1321:47): [True: 4.82k, False: 24.2k]
  ------------------
 1322|  29.0k|        iter->second = QPDFXRefEntry(f1);
 1323|  29.0k|        break;
 1324|       |
 1325|  72.5k|    case 2:
  ------------------
  |  Branch (1325:5): [True: 72.5k, False: 29.2k]
  ------------------
 1326|  72.5k|        iter->second = QPDFXRefEntry(toI(f1), f2);
 1327|  72.5k|        break;
 1328|       |
 1329|    200|    default:
  ------------------
  |  Branch (1329:5): [True: 200, False: 101k]
  ------------------
 1330|    200|        throw damagedPDF("xref stream", "unknown xref stream entry type " + std::to_string(f0));
 1331|      0|        break;
 1332|   101k|    }
 1333|   101k|}
_ZN4QPDF19insertFreeXrefEntryE10QPDFObjGen:
 1337|  13.7k|{
 1338|  13.7k|    if (!m->xref_table.count(og)) {
  ------------------
  |  Branch (1338:9): [True: 12.2k, False: 1.50k]
  ------------------
 1339|  12.2k|        m->deleted_objects.insert(og.getObj());
 1340|  12.2k|    }
 1341|  13.7k|}
_ZN4QPDF28insertReconstructedXrefEntryEixi:
 1347|   457k|{
 1348|   457k|    if (!(obj > 0 && obj <= m->xref_table_max_id && 0 <= f2 && f2 < 65535)) {
  ------------------
  |  Branch (1348:11): [True: 456k, False: 302]
  |  Branch (1348:22): [True: 456k, False: 0]
  |  Branch (1348:53): [True: 456k, False: 145]
  |  Branch (1348:64): [True: 456k, False: 95]
  ------------------
 1349|    542|        QTC::TC("qpdf", "QPDF xref overwrite invalid objgen");
 1350|    542|        return;
 1351|    542|    }
 1352|       |
 1353|   456k|    QPDFObjGen og(obj, f2);
 1354|   456k|    if (!m->deleted_objects.count(obj)) {
  ------------------
  |  Branch (1354:9): [True: 456k, False: 179]
  ------------------
 1355|       |        // deleted_objects stores the uncompressed objects removed from the xref table at the start
 1356|       |        // of recovery.
 1357|   456k|        QTC::TC("qpdf", "QPDF xref overwrite object");
 1358|   456k|        m->xref_table[QPDFObjGen(obj, f2)] = QPDFXRefEntry(f1);
 1359|   456k|    }
 1360|   456k|}
_ZN4QPDF16resolveXRefTableEv:
 1393|  8.39k|{
 1394|  8.39k|    bool may_change = !m->reconstructed_xref;
 1395|   361k|    for (auto& iter: m->xref_table) {
  ------------------
  |  Branch (1395:20): [True: 361k, False: 8.34k]
  ------------------
 1396|   361k|        if (isUnresolved(iter.first)) {
  ------------------
  |  Branch (1396:13): [True: 220k, False: 141k]
  ------------------
 1397|   220k|            resolve(iter.first);
 1398|   220k|            if (may_change && m->reconstructed_xref) {
  ------------------
  |  Branch (1398:17): [True: 543, False: 219k]
  |  Branch (1398:31): [True: 50, False: 493]
  ------------------
 1399|     50|                return false;
 1400|     50|            }
 1401|   220k|        }
 1402|   361k|    }
 1403|  8.34k|    return true;
 1404|  8.39k|}
_ZN4QPDF21fixDanglingReferencesEb:
 1410|  21.8k|{
 1411|  21.8k|    if (m->fixed_dangling_refs) {
  ------------------
  |  Branch (1411:9): [True: 13.4k, False: 8.34k]
  ------------------
 1412|  13.4k|        return;
 1413|  13.4k|    }
 1414|  8.34k|    if (!resolveXRefTable()) {
  ------------------
  |  Branch (1414:9): [True: 50, False: 8.29k]
  ------------------
 1415|     50|        QTC::TC("qpdf", "QPDF fix dangling triggered xref reconstruction");
 1416|     50|        resolveXRefTable();
 1417|     50|    }
 1418|  8.34k|    m->fixed_dangling_refs = true;
 1419|  8.34k|}
_ZN4QPDF14getObjectCountEv:
 1423|  13.8k|{
 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|  13.8k|    fixDanglingReferences();
 1428|  13.8k|    QPDFObjGen og;
 1429|  13.8k|    if (!m->obj_cache.empty()) {
  ------------------
  |  Branch (1429:9): [True: 13.6k, False: 198]
  ------------------
 1430|  13.6k|        og = (*(m->obj_cache.rbegin())).first;
 1431|  13.6k|    }
 1432|  13.8k|    return toS(og.getObj());
 1433|  13.8k|}
_ZN4QPDF24setLastObjectDescriptionERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERK10QPDFObjGen:
 1449|   658k|{
 1450|   658k|    m->last_object_description.clear();
 1451|   658k|    if (!description.empty()) {
  ------------------
  |  Branch (1451:9): [True: 9.84k, False: 648k]
  ------------------
 1452|  9.84k|        m->last_object_description += description;
 1453|  9.84k|        if (og.isIndirect()) {
  ------------------
  |  Branch (1453:13): [True: 3.25k, False: 6.59k]
  ------------------
 1454|  3.25k|            m->last_object_description += ": ";
 1455|  3.25k|        }
 1456|  9.84k|    }
 1457|   658k|    if (og.isIndirect()) {
  ------------------
  |  Branch (1457:9): [True: 651k, False: 6.59k]
  ------------------
 1458|   651k|        m->last_object_description += "object " + og.unparse(' ');
 1459|   651k|    }
 1460|   658k|}
_ZN4QPDF11readTrailerEv:
 1464|  16.3k|{
 1465|  16.3k|    qpdf_offset_t offset = m->file->tell();
 1466|  16.3k|    bool empty = false;
 1467|  16.3k|    auto object =
 1468|  16.3k|        QPDFParser(m->file, "trailer", m->tokenizer, nullptr, this, true).parse(empty, false);
 1469|  16.3k|    if (empty) {
  ------------------
  |  Branch (1469:9): [True: 55, False: 16.2k]
  ------------------
 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|     55|        warn(damagedPDF("trailer", "empty object treated as null"));
 1473|  16.2k|    } else if (object.isDictionary() && readToken(m->file).isWord("stream")) {
  ------------------
  |  Branch (1473:16): [True: 8.31k, False: 7.96k]
  |  Branch (1473:16): [True: 36, False: 16.2k]
  |  Branch (1473:41): [True: 36, False: 8.28k]
  ------------------
 1474|     36|        warn(damagedPDF("trailer", m->file->tell(), "stream keyword found in trailer"));
 1475|     36|    }
 1476|       |    // Override last_offset so that it points to the beginning of the object we just read
 1477|  16.3k|    m->file->setLastOffset(offset);
 1478|  16.3k|    return object;
 1479|  16.3k|}
_ZN4QPDF10readObjectERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE10QPDFObjGen:
 1483|   325k|{
 1484|   325k|    setLastObjectDescription(description, og);
 1485|   325k|    qpdf_offset_t offset = m->file->tell();
 1486|   325k|    bool empty = false;
 1487|       |
 1488|   325k|    StringDecrypter decrypter{this, og};
 1489|   325k|    StringDecrypter* decrypter_ptr = m->encp->encrypted ? &decrypter : nullptr;
  ------------------
  |  Branch (1489:38): [True: 13.6k, False: 312k]
  ------------------
 1490|   325k|    auto object =
 1491|   325k|        QPDFParser(m->file, m->last_object_description, m->tokenizer, decrypter_ptr, this, true)
 1492|   325k|            .parse(empty, false);
 1493|   325k|    if (empty) {
  ------------------
  |  Branch (1493:9): [True: 41, False: 325k]
  ------------------
 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|     41|        warn(damagedPDF(m->file, m->file->getLastOffset(), "empty object treated as null"));
 1497|     41|        return object;
 1498|     41|    }
 1499|   325k|    auto token = readToken(m->file);
 1500|   325k|    if (object.isDictionary() && token.isWord("stream")) {
  ------------------
  |  Branch (1500:9): [True: 255k, False: 70.3k]
  |  Branch (1500:9): [True: 90.4k, False: 235k]
  |  Branch (1500:34): [True: 90.4k, False: 165k]
  ------------------
 1501|  90.4k|        readStream(object, og, offset);
 1502|  90.4k|        token = readToken(m->file);
 1503|  90.4k|    }
 1504|   325k|    if (!token.isWord("endobj")) {
  ------------------
  |  Branch (1504:9): [True: 33.0k, False: 292k]
  ------------------
 1505|  33.0k|        QTC::TC("qpdf", "QPDF err expected endobj");
 1506|  33.0k|        warn(damagedPDF("expected endobj"));
 1507|  33.0k|    }
 1508|   325k|    return object;
 1509|   325k|}
_ZN4QPDF10readStreamER16QPDFObjectHandle10QPDFObjGenx:
 1514|  90.4k|{
 1515|  90.4k|    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|  90.4k|    qpdf_offset_t stream_offset = m->file->tell();
 1520|  90.4k|    size_t length = 0;
 1521|       |
 1522|  90.4k|    try {
 1523|  90.4k|        auto length_obj = object.getKey("/Length");
 1524|       |
 1525|  90.4k|        if (!length_obj.isInteger()) {
  ------------------
  |  Branch (1525:13): [True: 7.98k, False: 82.4k]
  ------------------
 1526|  7.98k|            if (length_obj.isNull()) {
  ------------------
  |  Branch (1526:17): [True: 6.58k, False: 1.40k]
  ------------------
 1527|  6.58k|                QTC::TC("qpdf", "QPDF stream without length");
 1528|  6.58k|                throw damagedPDF(offset, "stream dictionary lacks /Length key");
 1529|  6.58k|            }
 1530|  1.40k|            QTC::TC("qpdf", "QPDF stream length not integer");
 1531|  1.40k|            throw damagedPDF(offset, "/Length key in stream dictionary is not an integer");
 1532|  7.98k|        }
 1533|       |
 1534|  82.4k|        length = toS(length_obj.getUIntValue());
 1535|       |        // Seek in two steps to avoid potential integer overflow
 1536|  82.4k|        m->file->seek(stream_offset, SEEK_SET);
 1537|  82.4k|        m->file->seek(toO(length), SEEK_CUR);
 1538|  82.4k|        if (!readToken(m->file).isWord("endstream")) {
  ------------------
  |  Branch (1538:13): [True: 13.5k, False: 68.9k]
  ------------------
 1539|  13.5k|            QTC::TC("qpdf", "QPDF missing endstream");
 1540|  13.5k|            throw damagedPDF("expected endstream");
 1541|  13.5k|        }
 1542|  82.4k|    } catch (QPDFExc& e) {
 1543|  21.6k|        if (m->attempt_recovery) {
  ------------------
  |  Branch (1543:13): [True: 21.6k, False: 0]
  ------------------
 1544|  21.6k|            warn(e);
 1545|  21.6k|            length = recoverStreamLength(m->file, og, stream_offset);
 1546|  21.6k|        } else {
 1547|      0|            throw;
 1548|      0|        }
 1549|  21.6k|    }
 1550|  89.8k|    object = newIndirect(og, QPDF_Stream::create(this, og, object, stream_offset, length));
 1551|  89.8k|}
_ZN4QPDF21validateStreamLineEndER16QPDFObjectHandle10QPDFObjGenx:
 1555|  90.4k|{
 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|  92.6k|    while (true) {
  ------------------
  |  Branch (1563:12): [Folded - Ignored]
  ------------------
 1564|  92.6k|        char ch;
 1565|  92.6k|        if (m->file->read(&ch, 1) == 0) {
  ------------------
  |  Branch (1565:13): [True: 12, False: 92.6k]
  ------------------
 1566|       |            // A premature EOF here will result in some other problem that will get reported at
 1567|       |            // another time.
 1568|     12|            return;
 1569|     12|        }
 1570|  92.6k|        if (ch == '\n') {
  ------------------
  |  Branch (1570:13): [True: 34.6k, False: 57.9k]
  ------------------
 1571|       |            // ready to read stream data
 1572|  34.6k|            QTC::TC("qpdf", "QPDF stream with NL only");
 1573|  34.6k|            return;
 1574|  34.6k|        }
 1575|  57.9k|        if (ch == '\r') {
  ------------------
  |  Branch (1575:13): [True: 55.1k, False: 2.77k]
  ------------------
 1576|       |            // Read another character
 1577|  55.1k|            if (m->file->read(&ch, 1) != 0) {
  ------------------
  |  Branch (1577:17): [True: 55.1k, False: 4]
  ------------------
 1578|  55.1k|                if (ch == '\n') {
  ------------------
  |  Branch (1578:21): [True: 54.8k, False: 294]
  ------------------
 1579|       |                    // Ready to read stream data
 1580|  54.8k|                    QTC::TC("qpdf", "QPDF stream with CRNL");
 1581|  54.8k|                } 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|    294|                    QTC::TC("qpdf", "QPDF stream with CR only");
 1585|    294|                    m->file->unreadCh(ch);
 1586|    294|                    warn(damagedPDF(
 1587|    294|                        m->file->tell(), "stream keyword followed by carriage return only"));
 1588|    294|                }
 1589|  55.1k|            }
 1590|  55.1k|            return;
 1591|  55.1k|        }
 1592|  2.77k|        if (!QUtil::is_space(ch)) {
  ------------------
  |  Branch (1592:13): [True: 566, False: 2.21k]
  ------------------
 1593|    566|            QTC::TC("qpdf", "QPDF stream without newline");
 1594|    566|            m->file->unreadCh(ch);
 1595|    566|            warn(damagedPDF(
 1596|    566|                m->file->tell(), "stream keyword not followed by proper line terminator"));
 1597|    566|            return;
 1598|    566|        }
 1599|  2.21k|        warn(damagedPDF(m->file->tell(), "stream keyword followed by extraneous whitespace"));
 1600|  2.21k|    }
 1601|  90.4k|}
_ZN4QPDF18readObjectInStreamERNSt3__110shared_ptrI11InputSourceEEi:
 1605|  29.4k|{
 1606|  29.4k|    m->last_object_description.erase(7); // last_object_description starts with "object "
 1607|  29.4k|    m->last_object_description += std::to_string(obj);
 1608|  29.4k|    m->last_object_description += " 0";
 1609|       |
 1610|  29.4k|    bool empty = false;
 1611|  29.4k|    auto object = QPDFParser(input, m->last_object_description, m->tokenizer, nullptr, this, true)
 1612|  29.4k|                      .parse(empty, false);
 1613|  29.4k|    if (empty) {
  ------------------
  |  Branch (1613:9): [True: 0, False: 29.4k]
  ------------------
 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|  29.4k|    return object;
 1619|  29.4k|}
_ZN4QPDF13findEndstreamEv:
 1623|  25.6k|{
 1624|       |    // Find endstream or endobj. Position the input at that token.
 1625|  25.6k|    auto t = readToken(m->file, 20);
 1626|  25.6k|    if (t.isWord("endobj") || t.isWord("endstream")) {
  ------------------
  |  Branch (1626:9): [True: 7.08k, False: 18.6k]
  |  Branch (1626:9): [True: 19.8k, False: 5.81k]
  |  Branch (1626:31): [True: 12.7k, False: 5.81k]
  ------------------
 1627|  19.8k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1628|  19.8k|        return true;
 1629|  19.8k|    }
 1630|  5.81k|    return false;
 1631|  25.6k|}
_ZN4QPDF19recoverStreamLengthENSt3__110shared_ptrI11InputSourceEERK10QPDFObjGenx:
 1636|  21.1k|{
 1637|       |    // Try to reconstruct stream length by looking for endstream or endobj
 1638|  21.1k|    warn(damagedPDF(input, stream_offset, "attempting to recover stream length"));
 1639|       |
 1640|  21.1k|    PatternFinder ef(*this, &QPDF::findEndstream);
 1641|  21.1k|    size_t length = 0;
 1642|  21.1k|    if (m->file->findFirst("end", stream_offset, 0, ef)) {
  ------------------
  |  Branch (1642:9): [True: 19.8k, False: 1.23k]
  ------------------
 1643|  19.8k|        length = toS(m->file->tell() - stream_offset);
 1644|       |        // Reread endstream but, if it was endobj, don't skip that.
 1645|  19.8k|        QPDFTokenizer::Token t = readToken(m->file);
 1646|  19.8k|        if (t.getValue() == "endobj") {
  ------------------
  |  Branch (1646:13): [True: 7.08k, False: 12.7k]
  ------------------
 1647|  7.08k|            m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1648|  7.08k|        }
 1649|  19.8k|    }
 1650|       |
 1651|  21.1k|    if (length) {
  ------------------
  |  Branch (1651:9): [True: 19.8k, False: 1.28k]
  ------------------
 1652|  19.8k|        qpdf_offset_t this_obj_offset = 0;
 1653|  19.8k|        QPDFObjGen this_og;
 1654|       |
 1655|       |        // Make sure this is inside this object
 1656|  1.77M|        for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (1656:30): [True: 1.77M, False: 19.8k]
  ------------------
 1657|  1.77M|            QPDFXRefEntry const& entry = iter.second;
 1658|  1.77M|            if (entry.getType() == 1) {
  ------------------
  |  Branch (1658:17): [True: 1.73M, False: 39.9k]
  ------------------
 1659|  1.73M|                qpdf_offset_t obj_offset = entry.getOffset();
 1660|  1.73M|                if ((obj_offset > stream_offset) &&
  ------------------
  |  Branch (1660:21): [True: 765k, False: 966k]
  ------------------
 1661|  1.73M|                    ((this_obj_offset == 0) || (this_obj_offset > obj_offset))) {
  ------------------
  |  Branch (1661:22): [True: 17.9k, False: 747k]
  |  Branch (1661:48): [True: 23.5k, False: 723k]
  ------------------
 1662|  41.5k|                    this_obj_offset = obj_offset;
 1663|  41.5k|                    this_og = iter.first;
 1664|  41.5k|                }
 1665|  1.73M|            }
 1666|  1.77M|        }
 1667|  19.8k|        if (this_obj_offset && (this_og == og)) {
  ------------------
  |  Branch (1667:13): [True: 17.9k, False: 1.88k]
  |  Branch (1667:32): [True: 1, False: 17.9k]
  ------------------
 1668|       |            // Well, we found endstream\nendobj within the space allowed for this object, so we're
 1669|       |            // probably in good shape.
 1670|  19.8k|        } else {
 1671|  19.8k|            QTC::TC("qpdf", "QPDF found wrong endstream in recovery");
 1672|  19.8k|        }
 1673|  19.8k|    }
 1674|       |
 1675|  21.1k|    if (length == 0) {
  ------------------
  |  Branch (1675:9): [True: 1.27k, False: 19.8k]
  ------------------
 1676|  1.27k|        warn(damagedPDF(
 1677|  1.27k|            input, stream_offset, "unable to recover stream data; treating stream as empty"));
 1678|  19.8k|    } else {
 1679|  19.8k|        warn(
 1680|  19.8k|            damagedPDF(input, stream_offset, "recovered stream length: " + std::to_string(length)));
 1681|  19.8k|    }
 1682|       |
 1683|  21.1k|    QTC::TC("qpdf", "QPDF recovered stream length");
 1684|  21.1k|    return length;
 1685|  21.1k|}
_ZN4QPDF9readTokenENSt3__110shared_ptrI11InputSourceEEm:
 1689|  10.3M|{
 1690|  10.3M|    return m->tokenizer.readToken(input, m->last_object_description, true, max_len);
 1691|  10.3M|}
_ZN4QPDF18readObjectAtOffsetEbxRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE10QPDFObjGenRS9_b:
 1701|   331k|{
 1702|   331k|    bool check_og = true;
 1703|   331k|    if (exp_og.getObj() == 0) {
  ------------------
  |  Branch (1703:9): [True: 6.55k, False: 325k]
  ------------------
 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|  6.55k|        check_og = false;
 1711|  6.55k|        try_recovery = false;
 1712|  6.55k|    }
 1713|   331k|    setLastObjectDescription(description, exp_og);
 1714|       |
 1715|   331k|    if (!m->attempt_recovery) {
  ------------------
  |  Branch (1715:9): [True: 0, False: 331k]
  ------------------
 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|   331k|    if (offset == 0) {
  ------------------
  |  Branch (1723:9): [True: 165, False: 331k]
  ------------------
 1724|    165|        QTC::TC("qpdf", "QPDF bogus 0 offset", 0);
 1725|    165|        warn(damagedPDF(0, "object has offset 0"));
 1726|    165|        return QPDFObjectHandle::newNull();
 1727|    165|    }
 1728|       |
 1729|   331k|    m->file->seek(offset, SEEK_SET);
 1730|   331k|    try {
 1731|   331k|        QPDFTokenizer::Token tobjid = readToken(m->file);
 1732|   331k|        bool objidok = tobjid.isInteger();
 1733|   331k|        QTC::TC("qpdf", "QPDF check objid", objidok ? 1 : 0);
  ------------------
  |  Branch (1733:45): [True: 326k, False: 4.85k]
  ------------------
 1734|   331k|        if (!objidok) {
  ------------------
  |  Branch (1734:13): [True: 4.85k, False: 326k]
  ------------------
 1735|  4.85k|            QTC::TC("qpdf", "QPDF expected n n obj");
 1736|  4.85k|            throw damagedPDF(offset, "expected n n obj");
 1737|  4.85k|        }
 1738|   326k|        QPDFTokenizer::Token tgen = readToken(m->file);
 1739|   326k|        bool genok = tgen.isInteger();
 1740|   326k|        QTC::TC("qpdf", "QPDF check generation", genok ? 1 : 0);
  ------------------
  |  Branch (1740:50): [True: 326k, False: 424]
  ------------------
 1741|   326k|        if (!genok) {
  ------------------
  |  Branch (1741:13): [True: 424, False: 326k]
  ------------------
 1742|    424|            throw damagedPDF(offset, "expected n n obj");
 1743|    424|        }
 1744|   326k|        QPDFTokenizer::Token tobj = readToken(m->file);
 1745|       |
 1746|   326k|        bool objok = tobj.isWord("obj");
 1747|   326k|        QTC::TC("qpdf", "QPDF check obj", objok ? 1 : 0);
  ------------------
  |  Branch (1747:43): [True: 326k, False: 486]
  ------------------
 1748|       |
 1749|   326k|        if (!objok) {
  ------------------
  |  Branch (1749:13): [True: 486, False: 326k]
  ------------------
 1750|    486|            throw damagedPDF(offset, "expected n n obj");
 1751|    486|        }
 1752|   326k|        int objid = QUtil::string_to_int(tobjid.getValue().c_str());
 1753|   326k|        int generation = QUtil::string_to_int(tgen.getValue().c_str());
 1754|   326k|        og = QPDFObjGen(objid, generation);
 1755|   326k|        if (objid == 0) {
  ------------------
  |  Branch (1755:13): [True: 4, False: 325k]
  ------------------
 1756|      4|            QTC::TC("qpdf", "QPDF object id 0");
 1757|      4|            throw damagedPDF(offset, "object with ID 0");
 1758|      4|        }
 1759|   325k|        if (check_og && (exp_og != og)) {
  ------------------
  |  Branch (1759:13): [True: 323k, False: 2.54k]
  |  Branch (1759:25): [True: 128, False: 323k]
  ------------------
 1760|    128|            QTC::TC("qpdf", "QPDF err wrong objid/generation");
 1761|    128|            QPDFExc e = damagedPDF(offset, "expected " + exp_og.unparse(' ') + " obj");
 1762|    128|            if (try_recovery) {
  ------------------
  |  Branch (1762:17): [True: 128, False: 0]
  ------------------
 1763|       |                // Will be retried below
 1764|    128|                throw e;
 1765|    128|            } else {
 1766|       |                // We can try reading the object anyway even if the ID doesn't match.
 1767|      0|                warn(e);
 1768|      0|            }
 1769|    128|        }
 1770|   325k|    } catch (QPDFExc& e) {
 1771|  5.89k|        if (try_recovery) {
  ------------------
  |  Branch (1771:13): [True: 1.89k, False: 4.00k]
  ------------------
 1772|       |            // Try again after reconstructing xref table
 1773|  1.89k|            reconstruct_xref(e);
 1774|  1.89k|            if (m->xref_table.count(exp_og) && (m->xref_table[exp_og].getType() == 1)) {
  ------------------
  |  Branch (1774:17): [True: 93, False: 1.80k]
  |  Branch (1774:48): [True: 93, False: 0]
  ------------------
 1775|     93|                qpdf_offset_t new_offset = m->xref_table[exp_og].getOffset();
 1776|     93|                QPDFObjectHandle result =
 1777|     93|                    readObjectAtOffset(false, new_offset, description, exp_og, og, false);
 1778|     93|                QTC::TC("qpdf", "QPDF recovered in readObjectAtOffset");
 1779|     93|                return result;
 1780|  1.80k|            } else {
 1781|  1.80k|                QTC::TC("qpdf", "QPDF object gone after xref reconstruction");
 1782|  1.80k|                warn(damagedPDF(
 1783|  1.80k|                    "",
 1784|  1.80k|                    0,
 1785|  1.80k|                    ("object " + exp_og.unparse(' ') +
 1786|  1.80k|                     " not found in file after regenerating cross reference "
 1787|  1.80k|                     "table")));
 1788|  1.80k|                return QPDFObjectHandle::newNull();
 1789|  1.80k|            }
 1790|  4.00k|        } else {
 1791|  4.00k|            throw;
 1792|  4.00k|        }
 1793|  5.89k|    }
 1794|       |
 1795|   325k|    QPDFObjectHandle oh = readObject(description, og);
 1796|       |
 1797|   325k|    if (isUnresolved(og)) {
  ------------------
  |  Branch (1797:9): [True: 322k, False: 3.61k]
  ------------------
 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|   322k|        qpdf_offset_t end_before_space = m->file->tell();
 1806|       |
 1807|       |        // skip over spaces
 1808|   864k|        while (true) {
  ------------------
  |  Branch (1808:16): [Folded - Ignored]
  ------------------
 1809|   864k|            char ch;
 1810|   864k|            if (m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1810:17): [True: 859k, False: 5.71k]
  ------------------
 1811|   859k|                if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1811:21): [True: 316k, False: 542k]
  ------------------
 1812|   316k|                    m->file->seek(-1, SEEK_CUR);
 1813|   316k|                    break;
 1814|   316k|                }
 1815|   859k|            } else {
 1816|  5.71k|                throw damagedPDF(m->file->tell(), "EOF after endobj");
 1817|  5.71k|            }
 1818|   864k|        }
 1819|   316k|        qpdf_offset_t end_after_space = m->file->tell();
 1820|   316k|        if (skip_cache_if_in_xref && m->xref_table.count(og)) {
  ------------------
  |  Branch (1820:13): [True: 1.08k, False: 315k]
  |  Branch (1820:38): [True: 11, False: 1.06k]
  ------------------
 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|     11|            QTC::TC("qpdf", "QPDF skipping cache for known unchecked object");
 1847|   316k|        } else {
 1848|   316k|            updateCache(og, oh.getObj(), end_before_space, end_after_space);
 1849|   316k|        }
 1850|   316k|    }
 1851|       |
 1852|   320k|    return oh;
 1853|   325k|}
_ZN4QPDF7resolveE10QPDFObjGen:
 1857|   367k|{
 1858|   367k|    if (!isUnresolved(og)) {
  ------------------
  |  Branch (1858:9): [True: 0, False: 367k]
  ------------------
 1859|      0|        return m->obj_cache[og].object.get();
 1860|      0|    }
 1861|       |
 1862|   367k|    if (m->resolving.count(og)) {
  ------------------
  |  Branch (1862:9): [True: 84, False: 367k]
  ------------------
 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|     84|        QTC::TC("qpdf", "QPDF recursion loop in resolve");
 1866|     84|        warn(damagedPDF("", "loop detected resolving object " + og.unparse(' ')));
 1867|     84|        updateCache(og, QPDF_Null::create(), -1, -1);
 1868|     84|        return m->obj_cache[og].object.get();
 1869|     84|    }
 1870|   367k|    ResolveRecorder rr(this, og);
 1871|       |
 1872|   367k|    if (m->xref_table.count(og) != 0) {
  ------------------
  |  Branch (1872:9): [True: 352k, False: 15.4k]
  ------------------
 1873|   352k|        QPDFXRefEntry const& entry = m->xref_table[og];
 1874|   352k|        try {
 1875|   352k|            switch (entry.getType()) {
 1876|   325k|            case 1:
  ------------------
  |  Branch (1876:13): [True: 325k, False: 26.7k]
  ------------------
 1877|   325k|                {
 1878|   325k|                    qpdf_offset_t offset = entry.getOffset();
 1879|       |                    // Object stored in cache by readObjectAtOffset
 1880|   325k|                    QPDFObjGen a_og;
 1881|   325k|                    QPDFObjectHandle oh = readObjectAtOffset(true, offset, "", og, a_og, false);
 1882|   325k|                }
 1883|   325k|                break;
 1884|       |
 1885|  26.6k|            case 2:
  ------------------
  |  Branch (1885:13): [True: 26.6k, False: 325k]
  ------------------
 1886|  26.6k|                resolveObjectsInStream(entry.getObjStreamNumber());
 1887|  26.6k|                break;
 1888|       |
 1889|     45|            default:
  ------------------
  |  Branch (1889:13): [True: 45, False: 351k]
  ------------------
 1890|     45|                throw damagedPDF(
 1891|     45|                    "", 0, ("object " + og.unparse('/') + " has unexpected xref entry type"));
 1892|   352k|            }
 1893|   352k|        } catch (QPDFExc& e) {
 1894|  10.7k|            warn(e);
 1895|  10.7k|        } catch (std::exception& e) {
 1896|    581|            warn(damagedPDF(
 1897|    581|                "", 0, ("object " + og.unparse('/') + ": error reading object: " + e.what())));
 1898|    581|        }
 1899|   352k|    }
 1900|       |
 1901|   365k|    if (isUnresolved(og)) {
  ------------------
  |  Branch (1901:9): [True: 48.4k, False: 317k]
  ------------------
 1902|       |        // PDF spec says unknown objects resolve to the null object.
 1903|  48.4k|        QTC::TC("qpdf", "QPDF resolve failure to null");
 1904|  48.4k|        updateCache(og, QPDF_Null::create(), -1, -1);
 1905|  48.4k|    }
 1906|       |
 1907|   365k|    auto result(m->obj_cache[og].object);
 1908|   365k|    result->setDefaultDescription(this, og);
 1909|   365k|    return result.get();
 1910|   367k|}
_ZN4QPDF22resolveObjectsInStreamEi:
 1914|  26.6k|{
 1915|  26.6k|    if (m->resolved_object_streams.count(obj_stream_number)) {
  ------------------
  |  Branch (1915:9): [True: 23.1k, False: 3.55k]
  ------------------
 1916|  23.1k|        return;
 1917|  23.1k|    }
 1918|  3.55k|    m->resolved_object_streams.insert(obj_stream_number);
 1919|       |    // Force resolution of object stream
 1920|  3.55k|    QPDFObjectHandle obj_stream = getObjectByID(obj_stream_number, 0);
 1921|  3.55k|    if (!obj_stream.isStream()) {
  ------------------
  |  Branch (1921:9): [True: 1.11k, False: 2.44k]
  ------------------
 1922|  1.11k|        throw damagedPDF(
 1923|  1.11k|            "supposed object stream " + std::to_string(obj_stream_number) + " is not a stream");
 1924|  1.11k|    }
 1925|       |
 1926|       |    // For linearization data in the object, use the data from the object stream for the objects in
 1927|       |    // the stream.
 1928|  2.44k|    QPDFObjGen stream_og(obj_stream_number, 0);
 1929|  2.44k|    qpdf_offset_t end_before_space = m->obj_cache[stream_og].end_before_space;
 1930|  2.44k|    qpdf_offset_t end_after_space = m->obj_cache[stream_og].end_after_space;
 1931|       |
 1932|  2.44k|    QPDFObjectHandle dict = obj_stream.getDict();
 1933|  2.44k|    if (!dict.isDictionaryOfType("/ObjStm")) {
  ------------------
  |  Branch (1933:9): [True: 173, False: 2.26k]
  ------------------
 1934|    173|        QTC::TC("qpdf", "QPDF ERR object stream with wrong type");
 1935|    173|        warn(damagedPDF(
 1936|    173|            "supposed object stream " + std::to_string(obj_stream_number) + " has wrong type"));
 1937|    173|    }
 1938|       |
 1939|  2.44k|    if (!(dict.getKey("/N").isInteger() && dict.getKey("/First").isInteger())) {
  ------------------
  |  Branch (1939:9): [True: 186, False: 2.25k]
  |  Branch (1939:11): [True: 2.33k, False: 105]
  |  Branch (1939:44): [True: 2.25k, False: 86]
  ------------------
 1940|    186|        throw damagedPDF(
 1941|    186|            ("object stream " + std::to_string(obj_stream_number) + " has incorrect keys"));
 1942|    186|    }
 1943|       |
 1944|  2.25k|    int n = dict.getKey("/N").getIntValueAsInt();
 1945|  2.25k|    int first = dict.getKey("/First").getIntValueAsInt();
 1946|       |
 1947|  2.25k|    std::map<int, int> offsets;
 1948|       |
 1949|  2.25k|    std::shared_ptr<Buffer> bp = obj_stream.getStreamData(qpdf_dl_specialized);
 1950|  2.25k|    auto input = std::shared_ptr<InputSource>(
 1951|       |        // line-break
 1952|  2.25k|        new BufferInputSource(
 1953|  2.25k|            (m->file->getName() + " object stream " + std::to_string(obj_stream_number)),
 1954|  2.25k|            bp.get()));
 1955|       |
 1956|  44.6k|    for (int i = 0; i < n; ++i) {
  ------------------
  |  Branch (1956:21): [True: 42.4k, False: 2.14k]
  ------------------
 1957|  42.4k|        QPDFTokenizer::Token tnum = readToken(input);
 1958|  42.4k|        QPDFTokenizer::Token toffset = readToken(input);
 1959|  42.4k|        if (!(tnum.isInteger() && toffset.isInteger())) {
  ------------------
  |  Branch (1959:15): [True: 42.4k, False: 31]
  |  Branch (1959:35): [True: 42.3k, False: 82]
  ------------------
 1960|    113|            throw damagedPDF(
 1961|    113|                input,
 1962|    113|                m->last_object_description,
 1963|    113|                input->getLastOffset(),
 1964|    113|                "expected integer in object stream header");
 1965|    113|        }
 1966|       |
 1967|  42.3k|        int num = QUtil::string_to_int(tnum.getValue().c_str());
 1968|  42.3k|        long long offset = QUtil::string_to_int(toffset.getValue().c_str());
 1969|  42.3k|        if (num > m->xref_table_max_id) {
  ------------------
  |  Branch (1969:13): [True: 754, False: 41.6k]
  ------------------
 1970|    754|            continue;
 1971|    754|        }
 1972|  41.6k|        if (num == obj_stream_number) {
  ------------------
  |  Branch (1972:13): [True: 5, False: 41.5k]
  ------------------
 1973|      5|            QTC::TC("qpdf", "QPDF ignore self-referential object stream");
 1974|      5|            warn(damagedPDF(
 1975|      5|                input,
 1976|      5|                m->last_object_description,
 1977|      5|                input->getLastOffset(),
 1978|      5|                "object stream claims to contain itself"));
 1979|      5|            continue;
 1980|      5|        }
 1981|  41.5k|        offsets[num] = toI(offset + first);
 1982|  41.5k|    }
 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|  2.14k|    m->last_object_description.clear();
 1989|  2.14k|    m->last_object_description += "object ";
 1990|  32.4k|    for (auto const& iter: offsets) {
  ------------------
  |  Branch (1990:26): [True: 32.4k, False: 2.14k]
  ------------------
 1991|  32.4k|        QPDFObjGen og(iter.first, 0);
 1992|  32.4k|        auto entry = m->xref_table.find(og);
 1993|  32.4k|        if (entry != m->xref_table.end() && entry->second.getType() == 2 &&
  ------------------
  |  Branch (1993:13): [True: 32.1k, False: 331]
  |  Branch (1993:13): [True: 29.4k, False: 3.03k]
  |  Branch (1993:45): [True: 30.5k, False: 1.55k]
  ------------------
 1994|  32.4k|            entry->second.getObjStreamNumber() == obj_stream_number) {
  ------------------
  |  Branch (1994:13): [True: 29.4k, False: 1.15k]
  ------------------
 1995|  29.4k|            int offset = iter.second;
 1996|  29.4k|            input->seek(offset, SEEK_SET);
 1997|  29.4k|            QPDFObjectHandle oh = readObjectInStream(input, iter.first);
 1998|  29.4k|            updateCache(og, oh.getObj(), end_before_space, end_after_space);
 1999|  29.4k|        } else {
 2000|  3.03k|            QTC::TC("qpdf", "QPDF not caching overridden objstm object");
 2001|  3.03k|        }
 2002|  32.4k|    }
 2003|  2.14k|}
_ZN4QPDF11newIndirectERK10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEE:
 2007|  94.7k|{
 2008|  94.7k|    obj->setDefaultDescription(this, og);
 2009|  94.7k|    return {obj};
 2010|  94.7k|}
_ZN4QPDF11updateCacheERK10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEExx:
 2018|   394k|{
 2019|   394k|    object->setObjGen(this, og);
 2020|   394k|    if (isCached(og)) {
  ------------------
  |  Branch (2020:9): [True: 294k, False: 100k]
  ------------------
 2021|   294k|        auto& cache = m->obj_cache[og];
 2022|   294k|        cache.object->assign(object);
 2023|   294k|        cache.end_before_space = end_before_space;
 2024|   294k|        cache.end_after_space = end_after_space;
 2025|   294k|    } else {
 2026|   100k|        m->obj_cache[og] = ObjCache(object, end_before_space, end_after_space);
 2027|   100k|    }
 2028|   394k|}
_ZN4QPDF8isCachedERK10QPDFObjGen:
 2032|  1.81M|{
 2033|  1.81M|    return m->obj_cache.count(og) != 0;
 2034|  1.81M|}
_ZN4QPDF12isUnresolvedERK10QPDFObjGen:
 2038|  1.41M|{
 2039|  1.41M|    return !isCached(og) || m->obj_cache[og].object->isUnresolved();
  ------------------
  |  Branch (2039:12): [True: 264k, False: 1.15M]
  |  Branch (2039:29): [True: 693k, False: 459k]
  ------------------
 2040|  1.41M|}
_ZN4QPDF10nextObjGenEv:
 2044|  4.96k|{
 2045|  4.96k|    int max_objid = toI(getObjectCount());
 2046|  4.96k|    if (max_objid == std::numeric_limits<int>::max()) {
  ------------------
  |  Branch (2046:9): [True: 1, False: 4.96k]
  ------------------
 2047|      1|        throw std::range_error("max object id is too high to create new objects");
 2048|      1|    }
 2049|  4.96k|    return QPDFObjGen(max_objid + 1, 0);
 2050|  4.96k|}
_ZN4QPDF26makeIndirectFromQPDFObjectERKNSt3__110shared_ptrI10QPDFObjectEE:
 2054|  4.96k|{
 2055|  4.96k|    QPDFObjGen next{nextObjGen()};
 2056|  4.96k|    m->obj_cache[next] = ObjCache(obj, -1, -1);
 2057|  4.96k|    return newIndirect(next, m->obj_cache[next].object);
 2058|  4.96k|}
_ZN4QPDF18makeIndirectObjectE16QPDFObjectHandle:
 2062|  4.96k|{
 2063|  4.96k|    if (!oh.isInitialized()) {
  ------------------
  |  Branch (2063:9): [True: 0, False: 4.96k]
  ------------------
 2064|      0|        throw std::logic_error("attempted to make an uninitialized QPDFObjectHandle indirect");
 2065|      0|    }
 2066|  4.96k|    return makeIndirectFromQPDFObject(oh.getObj());
 2067|  4.96k|}
_ZN4QPDF18getObjectForParserEiib:
 2112|  1.41M|{
 2113|       |    // This method is called by the parser and therefore must not resolve any objects.
 2114|  1.41M|    auto og = QPDFObjGen(id, gen);
 2115|  1.41M|    if (auto iter = m->obj_cache.find(og); iter != m->obj_cache.end()) {
  ------------------
  |  Branch (2115:44): [True: 812k, False: 600k]
  ------------------
 2116|   812k|        return iter->second.object;
 2117|   812k|    }
 2118|   600k|    if (m->xref_table.count(og) || !m->parsed) {
  ------------------
  |  Branch (2118:9): [True: 254k, False: 345k]
  |  Branch (2118:36): [True: 41.2k, False: 304k]
  ------------------
 2119|   295k|        return m->obj_cache.insert({og, QPDF_Unresolved::create(this, og)}).first->second.object;
 2120|   295k|    }
 2121|   304k|    if (parse_pdf) {
  ------------------
  |  Branch (2121:9): [True: 304k, False: 0]
  ------------------
 2122|   304k|        return QPDF_Null::create();
 2123|   304k|    }
 2124|      0|    return m->obj_cache.insert({og, QPDF_Null::create(this, og)}).first->second.object;
 2125|   304k|}
_ZN4QPDF9getObjectERK10QPDFObjGen:
 2142|   150k|{
 2143|   150k|    if (auto it = m->obj_cache.find(og); it != m->obj_cache.end()) {
  ------------------
  |  Branch (2143:42): [True: 133k, False: 17.4k]
  ------------------
 2144|   133k|        return {it->second.object};
 2145|   133k|    } else if (m->parsed && !m->xref_table.count(og)) {
  ------------------
  |  Branch (2145:16): [True: 1.39k, False: 16.0k]
  |  Branch (2145:29): [True: 1.15k, False: 237]
  ------------------
 2146|  1.15k|        return QPDF_Null::create();
 2147|  16.3k|    } else {
 2148|  16.3k|        auto result = m->obj_cache.try_emplace(og, QPDF_Unresolved::create(this, og), -1, -1);
 2149|  16.3k|        return {result.first->second.object};
 2150|  16.3k|    }
 2151|   150k|}
_ZN4QPDF9getObjectEii:
 2155|  1.29k|{
 2156|  1.29k|    return getObject(QPDFObjGen(objid, generation));
 2157|  1.29k|}
_ZN4QPDF17getObjectByObjGenERK10QPDFObjGen:
 2161|  30.2k|{
 2162|  30.2k|    return getObject(og);
 2163|  30.2k|}
_ZN4QPDF13getObjectByIDEii:
 2167|  3.55k|{
 2168|  3.55k|    return getObject(QPDFObjGen(objid, generation));
 2169|  3.55k|}
_ZN4QPDF12removeObjectE10QPDFObjGen:
 2189|  1.00k|{
 2190|  1.00k|    m->xref_table.erase(og);
 2191|  1.00k|    if (auto cached = m->obj_cache.find(og); cached != m->obj_cache.end()) {
  ------------------
  |  Branch (2191:46): [True: 925, False: 81]
  ------------------
 2192|       |        // Take care of any object handles that may be floating around.
 2193|    925|        cached->second.object->assign(QPDF_Null::create());
 2194|    925|        cached->second.object->setObjGen(nullptr, QPDFObjGen());
 2195|    925|        m->obj_cache.erase(cached);
 2196|    925|    }
 2197|  1.00k|}
_ZNK4QPDF11getFilenameEv:
 2493|  94.4k|{
 2494|  94.4k|    return m->file->getName();
 2495|  94.4k|}
_ZNK4QPDF13getPDFVersionEv:
 2516|  8.23k|{
 2517|  8.23k|    return m->pdf_version;
 2518|  8.23k|}
_ZN4QPDF17getExtensionLevelEv:
 2522|  8.23k|{
 2523|  8.23k|    int result = 0;
 2524|  8.23k|    QPDFObjectHandle obj = getRoot();
 2525|  8.23k|    if (obj.hasKey("/Extensions")) {
  ------------------
  |  Branch (2525:9): [True: 205, False: 8.02k]
  ------------------
 2526|    205|        obj = obj.getKey("/Extensions");
 2527|    205|        if (obj.isDictionary() && obj.hasKey("/ADBE")) {
  ------------------
  |  Branch (2527:13): [True: 202, False: 3]
  |  Branch (2527:13): [True: 186, False: 19]
  |  Branch (2527:35): [True: 186, False: 16]
  ------------------
 2528|    186|            obj = obj.getKey("/ADBE");
 2529|    186|            if (obj.isDictionary() && obj.hasKey("/ExtensionLevel")) {
  ------------------
  |  Branch (2529:17): [True: 178, False: 8]
  |  Branch (2529:17): [True: 64, False: 122]
  |  Branch (2529:39): [True: 64, False: 114]
  ------------------
 2530|     64|                obj = obj.getKey("/ExtensionLevel");
 2531|     64|                if (obj.isInteger()) {
  ------------------
  |  Branch (2531:21): [True: 58, False: 6]
  ------------------
 2532|     58|                    result = obj.getIntValueAsInt();
 2533|     58|                }
 2534|     64|            }
 2535|    186|        }
 2536|    205|    }
 2537|  8.23k|    return result;
 2538|  8.23k|}
_ZN4QPDF10getTrailerEv:
 2542|  42.8k|{
 2543|  42.8k|    return m->trailer;
 2544|  42.8k|}
_ZN4QPDF7getRootEv:
 2548|  66.6k|{
 2549|  66.6k|    QPDFObjectHandle root = m->trailer.getKey("/Root");
 2550|  66.6k|    if (!root.isDictionary()) {
  ------------------
  |  Branch (2550:9): [True: 284, False: 66.4k]
  ------------------
 2551|    284|        throw damagedPDF("", 0, "unable to find /Root dictionary");
 2552|  66.4k|    } 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|  66.4k|        m->check_mode && !root.getKey("/Type").isNameAndEquals("/Catalog")) {
  ------------------
  |  Branch (2555:9): [True: 0, False: 66.4k]
  |  Branch (2555:9): [True: 0, False: 66.4k]
  |  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|  66.4k|    return root;
 2560|  66.6k|}
_ZN4QPDF20getXRefTableInternalEv:
 2570|  8.26k|{
 2571|  8.26k|    if (!m->parsed) {
  ------------------
  |  Branch (2571:9): [True: 0, False: 8.26k]
  ------------------
 2572|      0|        throw std::logic_error("QPDF::getXRefTable called before parsing.");
 2573|      0|    }
 2574|       |
 2575|  8.26k|    return m->xref_table;
 2576|  8.26k|}
_ZN4QPDF9tableSizeEv:
 2580|  8.26k|{
 2581|       |    // If obj_cache is dense, accommodate all object in tables,else accommodate only original
 2582|       |    // objects.
 2583|  8.26k|    auto max_xref = m->xref_table.size() ? m->xref_table.crbegin()->first.getObj() : 0;
  ------------------
  |  Branch (2583:21): [True: 8.26k, False: 0]
  ------------------
 2584|  8.26k|    auto max_obj = m->obj_cache.size() ? m->obj_cache.crbegin()->first.getObj() : 0;
  ------------------
  |  Branch (2584:20): [True: 8.26k, False: 0]
  ------------------
 2585|  8.26k|    auto max_id = std::numeric_limits<int>::max() - 1;
 2586|  8.26k|    if (max_obj >= max_id || max_xref >= max_id) {
  ------------------
  |  Branch (2586:9): [True: 4, False: 8.26k]
  |  Branch (2586:30): [True: 0, False: 8.26k]
  ------------------
 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|      4|        stopOnError("Impossibly large object id encountered.");
 2591|      4|    }
 2592|  8.26k|    if (max_obj < 1.1 * std::max(toI(m->obj_cache.size()), max_xref)) {
  ------------------
  |  Branch (2592:9): [True: 6.86k, False: 1.40k]
  ------------------
 2593|  6.86k|        return toS(++max_obj);
 2594|  6.86k|    }
 2595|  1.40k|    return toS(++max_xref);
 2596|  8.26k|}
_ZN4QPDF21getCompressibleObjSetEv:
 2606|    805|{
 2607|    805|    return getCompressibleObjGens<bool>();
 2608|    805|}
_ZN4QPDF14pipeStreamDataENSt3__110shared_ptrINS_20EncryptionParametersEEENS1_I11InputSourceEERS_RK10QPDFObjGenxm16QPDFObjectHandleP8Pipelinebb:
 2718|   103k|{
 2719|   103k|    std::unique_ptr<Pipeline> to_delete;
 2720|   103k|    if (encp->encrypted) {
  ------------------
  |  Branch (2720:9): [True: 1.79k, False: 101k]
  ------------------
 2721|  1.79k|        decryptStream(encp, file, qpdf_for_warning, pipeline, og, stream_dict, to_delete);
 2722|  1.79k|    }
 2723|       |
 2724|   103k|    bool attempted_finish = false;
 2725|   103k|    try {
 2726|   103k|        file->seek(offset, SEEK_SET);
 2727|   103k|        auto buf = std::make_unique<char[]>(length);
 2728|   103k|        if (auto read = file->read(buf.get(), length); read != length) {
  ------------------
  |  Branch (2728:56): [True: 0, False: 103k]
  ------------------
 2729|      0|            throw damagedPDF(file, "", offset + toO(read), "unexpected EOF reading stream data");
 2730|      0|        }
 2731|   103k|        pipeline->write(buf.get(), length);
 2732|   103k|        attempted_finish = true;
 2733|   103k|        pipeline->finish();
 2734|   103k|        return true;
 2735|   103k|    } 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|  5.16k|    } catch (std::exception& e) {
 2740|  5.16k|        if (!suppress_warnings) {
  ------------------
  |  Branch (2740:13): [True: 5.16k, False: 0]
  ------------------
 2741|  5.16k|            QTC::TC("qpdf", "QPDF decoding error warning");
 2742|  5.16k|            qpdf_for_warning.warn(
 2743|       |                // line-break
 2744|  5.16k|                damagedPDF(
 2745|  5.16k|                    file,
 2746|  5.16k|                    "",
 2747|  5.16k|                    file->getLastOffset(),
 2748|  5.16k|                    ("error decoding stream data for object " + og.unparse(' ') + ": " +
 2749|  5.16k|                     e.what())));
 2750|  5.16k|            if (will_retry) {
  ------------------
  |  Branch (2750:17): [True: 4.62k, False: 546]
  ------------------
 2751|  4.62k|                qpdf_for_warning.warn(
 2752|       |                    // line-break
 2753|  4.62k|                    damagedPDF(
 2754|  4.62k|                        file,
 2755|  4.62k|                        "",
 2756|  4.62k|                        file->getLastOffset(),
 2757|  4.62k|                        "stream will be re-processed without filtering to avoid data loss"));
 2758|  4.62k|            }
 2759|  5.16k|        }
 2760|  5.16k|    }
 2761|  5.07k|    if (!attempted_finish) {
  ------------------
  |  Branch (2761:9): [True: 3.12k, False: 1.94k]
  ------------------
 2762|  3.12k|        try {
 2763|  3.12k|            pipeline->finish();
 2764|  3.12k|        } catch (std::exception&) {
 2765|       |            // ignore
 2766|  2.15k|        }
 2767|  3.12k|    }
 2768|  5.07k|    return false;
 2769|  5.07k|}
_ZN4QPDF14pipeStreamDataERK10QPDFObjGenxm16QPDFObjectHandleP8Pipelinebb:
 2780|   103k|{
 2781|   103k|    return pipeStreamData(
 2782|   103k|        m->encp,
 2783|   103k|        m->file,
 2784|   103k|        *this,
 2785|   103k|        og,
 2786|   103k|        offset,
 2787|   103k|        length,
 2788|   103k|        stream_dict,
 2789|   103k|        pipeline,
 2790|   103k|        suppress_warnings,
 2791|   103k|        will_retry);
 2792|   103k|}
_ZN4QPDF11stopOnErrorERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2821|  4.04k|{
 2822|  4.04k|    throw damagedPDF("", message);
 2823|  4.04k|}
_ZN4QPDF10damagedPDFERKNSt3__110shared_ptrI11InputSourceEERKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEExSD_:
 2832|  52.1k|{
 2833|  52.1k|    return {qpdf_e_damaged_pdf, input->getName(), object, offset, message};
 2834|  52.1k|}
_ZN4QPDF10damagedPDFERKNSt3__110shared_ptrI11InputSourceEExRKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2841|  42.2k|{
 2842|  42.2k|    return damagedPDF(input, m->last_object_description, offset, message);
 2843|  42.2k|}
_ZN4QPDF10damagedPDFERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEExS8_:
 2848|   123k|{
 2849|   123k|    return {qpdf_e_damaged_pdf, m->file->getName(), object, offset, message};
 2850|   123k|}
_ZN4QPDF10damagedPDFERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
 2856|  5.96k|{
 2857|  5.96k|    return damagedPDF(object, m->file->getLastOffset(), message);
 2858|  5.96k|}
_ZN4QPDF10damagedPDFExRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2864|  22.8k|{
 2865|  22.8k|    return damagedPDF(m->last_object_description, offset, message);
 2866|  22.8k|}
_ZN4QPDF10damagedPDFERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2872|  48.0k|{
 2873|  48.0k|    return damagedPDF(m->last_object_description, m->file->getLastOffset(), message);
 2874|  48.0k|}
QPDF.cc:_ZZN4QPDF16reconstruct_xrefER7QPDFExcENK3$_0clEv:
  547|  6.37M|    auto check_warnings = [this, max_warnings]() {
  548|  6.37M|        if (m->warnings.size() > max_warnings) {
  ------------------
  |  Branch (548:13): [True: 0, False: 6.37M]
  ------------------
  549|      0|            throw damagedPDF("", 0, "too many errors while reconstructing cross-reference table");
  550|      0|        }
  551|  6.37M|    };
QPDF.cc:_ZZN4QPDF17processXRefStreamExR16QPDFObjectHandleENK3$_0clENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
 1201|    747|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1202|    747|        return damagedPDF("xref stream", xref_offset, msg.data());
 1203|    747|    };
_ZN4QPDF22getCompressibleObjGensIbEENSt3__16vectorIT_NS1_9allocatorIS3_EEEEv:
 2613|    805|{
 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|    805|    QPDFObjectHandle encryption_dict = m->trailer.getKey("/Encrypt");
 2622|    805|    QPDFObjGen encryption_dict_og = encryption_dict.getObjGen();
 2623|       |
 2624|    805|    const size_t max_obj = getObjectCount();
 2625|    805|    std::vector<bool> visited(max_obj, false);
 2626|    805|    std::vector<QPDFObjectHandle> queue;
 2627|    805|    queue.reserve(512);
 2628|    805|    queue.push_back(m->trailer);
 2629|    805|    std::vector<T> result;
 2630|    805|    if constexpr (std::is_same_v<T, QPDFObjGen>) {
  ------------------
  |  Branch (2630:19): [Folded - Ignored]
  ------------------
 2631|    805|        result.reserve(m->obj_cache.size());
 2632|    805|    } else if constexpr (std::is_same_v<T, bool>) {
  ------------------
  |  Branch (2632:26): [Folded - Ignored]
  ------------------
 2633|    776|        result.resize(max_obj + 1U, false);
 2634|    776|    } else {
 2635|    805|        throw std::logic_error("Unsupported type in QPDF::getCompressibleObjGens");
 2636|    805|    }
 2637|   451k|    while (!queue.empty()) {
  ------------------
  |  Branch (2637:12): [True: 450k, False: 805]
  ------------------
 2638|   450k|        auto obj = queue.back();
 2639|   450k|        queue.pop_back();
 2640|   450k|        if (obj.getObjectID() > 0) {
  ------------------
  |  Branch (2640:13): [True: 75.7k, False: 375k]
  ------------------
 2641|  75.7k|            QPDFObjGen og = obj.getObjGen();
 2642|  75.7k|            const size_t id = toS(og.getObj() - 1);
 2643|  75.7k|            if (id >= max_obj) {
  ------------------
  |  Branch (2643:17): [True: 0, False: 75.7k]
  ------------------
 2644|      0|                throw std::logic_error(
 2645|      0|                    "unexpected object id encountered in getCompressibleObjGens");
 2646|      0|            }
 2647|  75.7k|            if (visited[id]) {
  ------------------
  |  Branch (2647:17): [True: 37.5k, False: 38.1k]
  ------------------
 2648|  37.5k|                QTC::TC("qpdf", "QPDF loop detected traversing objects");
 2649|  37.5k|                continue;
 2650|  37.5k|            }
 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|  38.1k|            auto upper = m->obj_cache.upper_bound(og);
 2656|  38.1k|            if (upper != m->obj_cache.end() && upper->first.getObj() == og.getObj()) {
  ------------------
  |  Branch (2656:17): [True: 38.1k, False: 92]
  |  Branch (2656:17): [True: 212, False: 37.9k]
  |  Branch (2656:48): [True: 212, False: 37.8k]
  ------------------
 2657|    212|                removeObject(og);
 2658|    212|                continue;
 2659|    212|            }
 2660|       |
 2661|  37.9k|            visited[id] = true;
 2662|       |
 2663|  37.9k|            if (og == encryption_dict_og) {
  ------------------
  |  Branch (2663:17): [True: 121, False: 37.8k]
  ------------------
 2664|    121|                QTC::TC("qpdf", "QPDF exclude encryption dictionary");
 2665|  37.8k|            } else if (!(obj.isStream() ||
  ------------------
  |  Branch (2665:24): [True: 33.6k, False: 4.19k]
  |  Branch (2665:26): [True: 4.18k, False: 33.6k]
  ------------------
 2666|  37.8k|                         (obj.isDictionaryOfType("/Sig") && obj.hasKey("/ByteRange") &&
  ------------------
  |  Branch (2666:27): [True: 8, False: 33.6k]
  |  Branch (2666:61): [True: 8, False: 0]
  ------------------
 2667|  33.6k|                          obj.hasKey("/Contents")))) {
  ------------------
  |  Branch (2667:27): [True: 4, False: 4]
  ------------------
 2668|  33.6k|                if constexpr (std::is_same_v<T, QPDFObjGen>) {
  ------------------
  |  Branch (2668:31): [Folded - Ignored]
  ------------------
 2669|  33.6k|                    result.push_back(og);
 2670|  33.6k|                } else if constexpr (std::is_same_v<T, bool>) {
  ------------------
  |  Branch (2670:38): [Folded - Ignored]
  ------------------
 2671|  33.6k|                    result[id + 1U] = true;
 2672|  33.6k|                }
 2673|  33.6k|            }
 2674|  37.9k|        }
 2675|   413k|        if (obj.isStream()) {
  ------------------
  |  Branch (2675:13): [True: 4.18k, False: 409k]
  ------------------
 2676|  4.18k|            QPDFObjectHandle dict = obj.getDict();
 2677|  4.18k|            std::set<std::string> keys = dict.getKeys();
 2678|  24.9k|            for (auto iter = keys.rbegin(); iter != keys.rend(); ++iter) {
  ------------------
  |  Branch (2678:45): [True: 20.7k, False: 4.18k]
  ------------------
 2679|  20.7k|                std::string const& key = *iter;
 2680|  20.7k|                QPDFObjectHandle value = dict.getKey(key);
 2681|  20.7k|                if (key == "/Length") {
  ------------------
  |  Branch (2681:21): [True: 3.96k, False: 16.8k]
  ------------------
 2682|       |                    // omit stream lengths
 2683|  3.96k|                    if (value.isIndirect()) {
  ------------------
  |  Branch (2683:25): [True: 787, False: 3.17k]
  ------------------
 2684|    787|                        QTC::TC("qpdf", "QPDF exclude indirect length");
 2685|    787|                    }
 2686|  16.8k|                } else {
 2687|  16.8k|                    queue.push_back(value);
 2688|  16.8k|                }
 2689|  20.7k|            }
 2690|   409k|        } else if (obj.isDictionary()) {
  ------------------
  |  Branch (2690:20): [True: 44.1k, False: 364k]
  ------------------
 2691|  44.1k|            std::set<std::string> keys = obj.getKeys();
 2692|   210k|            for (auto iter = keys.rbegin(); iter != keys.rend(); ++iter) {
  ------------------
  |  Branch (2692:45): [True: 166k, False: 44.1k]
  ------------------
 2693|   166k|                queue.push_back(obj.getKey(*iter));
 2694|   166k|            }
 2695|   364k|        } else if (obj.isArray()) {
  ------------------
  |  Branch (2695:20): [True: 26.5k, False: 338k]
  ------------------
 2696|  26.5k|            int n = obj.getArrayNItems();
 2697|   293k|            for (int i = 1; i <= n; ++i) {
  ------------------
  |  Branch (2697:29): [True: 266k, False: 26.5k]
  ------------------
 2698|   266k|                queue.push_back(obj.getArrayItem(n - i));
 2699|   266k|            }
 2700|  26.5k|        }
 2701|   413k|    }
 2702|       |
 2703|    805|    return result;
 2704|    805|}

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

_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_:
   15|   876k|{
   16|   876k|}
_ZN7QPDFExc10createWhatERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_xS8_:
   24|   876k|{
   25|   876k|    std::string result;
   26|   876k|    if (!filename.empty()) {
  ------------------
  |  Branch (26:9): [True: 802k, False: 73.5k]
  ------------------
   27|   802k|        result += filename;
   28|   802k|    }
   29|   876k|    if (!(object.empty() && offset == 0)) {
  ------------------
  |  Branch (29:11): [True: 64.5k, False: 811k]
  |  Branch (29:29): [True: 42.4k, False: 22.1k]
  ------------------
   30|   833k|        if (!filename.empty()) {
  ------------------
  |  Branch (30:13): [True: 760k, False: 72.7k]
  ------------------
   31|   760k|            result += " (";
   32|   760k|        }
   33|   833k|        if (!object.empty()) {
  ------------------
  |  Branch (33:13): [True: 811k, False: 22.1k]
  ------------------
   34|   811k|            result += object;
   35|   811k|            if (offset > 0) {
  ------------------
  |  Branch (35:17): [True: 737k, False: 73.6k]
  ------------------
   36|   737k|                result += ", ";
   37|   737k|            }
   38|   811k|        }
   39|   833k|        if (offset > 0) {
  ------------------
  |  Branch (39:13): [True: 760k, False: 73.6k]
  ------------------
   40|   760k|            result += "offset " + std::to_string(offset);
   41|   760k|        }
   42|   833k|        if (!filename.empty()) {
  ------------------
  |  Branch (42:13): [True: 760k, False: 72.7k]
  ------------------
   43|   760k|            result += ")";
   44|   760k|        }
   45|   833k|    }
   46|   876k|    if (!result.empty()) {
  ------------------
  |  Branch (46:9): [True: 875k, False: 876]
  ------------------
   47|   875k|        result += ": ";
   48|   875k|    }
   49|   876k|    result += message;
   50|   876k|    return result;
   51|   876k|}

_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|  45.7k|{
   75|  45.7k|    static auto l = create();
   76|  45.7k|    return l;
   77|  45.7k|}
_ZN10QPDFLogger7getWarnEb:
  111|   861k|{
  112|   861k|    if (m->p_warn) {
  ------------------
  |  Branch (112:9): [True: 0, False: 861k]
  ------------------
  113|      0|        return m->p_warn;
  114|      0|    }
  115|   861k|    return getError(null_okay);
  116|   861k|}
_ZN10QPDFLogger8getErrorEb:
  132|   894k|{
  133|   894k|    return throwIfNull(m->p_error, null_okay);
  134|   894k|}
_ZN10QPDFLogger11throwIfNullENSt3__110shared_ptrI8PipelineEEb:
  250|   894k|{
  251|   894k|    if (!(null_okay || p)) {
  ------------------
  |  Branch (251:11): [True: 0, False: 894k]
  |  Branch (251:24): [True: 894k, False: 0]
  ------------------
  252|      0|        throw std::logic_error("QPDFLogger: requested a null pipeline without null_okay == true");
  253|      0|    }
  254|   894k|    return p;
  255|   894k|}
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|   862k|{
   21|   862k|    return std::to_string(obj) + separator + std::to_string(gen);
   22|   862k|}
_ZN10QPDFObjGen3set3addERK16QPDFObjectHandle:
   26|  49.5k|{
   27|  49.5k|    if (auto* ptr = oh.getObjectPtr()) {
  ------------------
  |  Branch (27:15): [True: 49.5k, False: 0]
  ------------------
   28|  49.5k|        return add(ptr->getObjGen());
   29|  49.5k|    } else {
   30|      0|        throw std::logic_error(
   31|      0|            "attempt to retrieve QPDFObjGen from uninitialized QPDFObjectHandle");
   32|      0|        return false;
   33|      0|    }
   34|  49.5k|}

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

_ZN16QPDFObjectHandle11TokenFilter9handleEOFEv:
  123|  7.63k|{
  124|  7.63k|}
_ZN16QPDFObjectHandle11TokenFilter11setPipelineEP8Pipeline:
  128|  15.4k|{
  129|  15.4k|    this->pipeline = p;
  130|  15.4k|}
_ZN16QPDFObjectHandle11TokenFilter5writeEPKcm:
  134|  5.35M|{
  135|  5.35M|    if (!this->pipeline) {
  ------------------
  |  Branch (135:9): [True: 0, False: 5.35M]
  ------------------
  136|      0|        return;
  137|      0|    }
  138|  5.35M|    if (len) {
  ------------------
  |  Branch (138:9): [True: 5.35M, False: 7.63k]
  ------------------
  139|  5.35M|        this->pipeline->write(data, len);
  140|  5.35M|    }
  141|  5.35M|}
_ZN16QPDFObjectHandle11TokenFilter5writeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  145|   510k|{
  146|   510k|    write(str.c_str(), str.length());
  147|   510k|}
_ZN16QPDFObjectHandle11TokenFilter10writeTokenERKN13QPDFTokenizer5TokenE:
  151|  2.60M|{
  152|  2.60M|    std::string const& value = token.getRawValue();
  153|  2.60M|    write(value.c_str(), value.length());
  154|  2.60M|}
_ZN16QPDFObjectHandle10disconnectEv:
  239|  2.39M|{
  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|  2.39M|    if (obj && !isIndirect()) {
  ------------------
  |  Branch (243:9): [True: 2.39M, False: 0]
  |  Branch (243:16): [True: 2.01M, False: 382k]
  ------------------
  244|  2.01M|        this->obj->disconnect();
  245|  2.01M|    }
  246|  2.39M|}
_ZNK16QPDFObjectHandle11getTypeCodeEv:
  255|  4.20M|{
  256|  4.20M|    return obj ? obj->getResolvedTypeCode() : ::ot_uninitialized;
  ------------------
  |  Branch (256:12): [True: 4.20M, False: 0]
  ------------------
  257|  4.20M|}
_ZNK16QPDFObjectHandle11getTypeNameEv:
  266|  6.84k|{
  267|  6.84k|    static constexpr std::array<char const*, 15> tn{
  268|  6.84k|        "uninitialized",
  269|  6.84k|        "reserved",
  270|  6.84k|        "null",
  271|  6.84k|        "boolean",
  272|  6.84k|        "integer",
  273|  6.84k|        "real",
  274|  6.84k|        "string",
  275|  6.84k|        "name",
  276|  6.84k|        "array",
  277|  6.84k|        "dictionary",
  278|  6.84k|        "stream",
  279|  6.84k|        "operator",
  280|  6.84k|        "inline-image",
  281|  6.84k|        "unresolved",
  282|  6.84k|        "destroyed"};
  283|  6.84k|    return obj ? tn[getTypeCode()] : "uninitialized";
  ------------------
  |  Branch (283:12): [True: 6.84k, False: 0]
  ------------------
  284|  6.84k|}
_ZNK16QPDFObjectHandle7asArrayEv:
  288|  4.85M|{
  289|  4.85M|    return obj ? obj->as<QPDF_Array>() : nullptr;
  ------------------
  |  Branch (289:12): [True: 4.85M, False: 0]
  ------------------
  290|  4.85M|}
_ZNK16QPDFObjectHandle12asDictionaryEv:
  300|  8.40M|{
  301|  8.40M|    return obj ? obj->as<QPDF_Dictionary>() : nullptr;
  ------------------
  |  Branch (301:12): [True: 8.40M, False: 0]
  ------------------
  302|  8.40M|}
_ZNK16QPDFObjectHandle9asIntegerEv:
  312|   116k|{
  313|   116k|    return obj ? obj->as<QPDF_Integer>() : nullptr;
  ------------------
  |  Branch (313:12): [True: 116k, False: 0]
  ------------------
  314|   116k|}
_ZNK16QPDFObjectHandle8asStreamEv:
  348|   885k|{
  349|   885k|    return obj ? obj->as<QPDF_Stream>() : nullptr;
  ------------------
  |  Branch (349:12): [True: 885k, False: 0]
  ------------------
  350|   885k|}
_ZNK16QPDFObjectHandle18asStreamWithAssertEv:
  354|   885k|{
  355|   885k|    auto stream = asStream();
  356|   885k|    assertType("stream", stream);
  357|   885k|    return stream;
  358|   885k|}
_ZNK16QPDFObjectHandle6isBoolEv:
  384|  8.77k|{
  385|  8.77k|    return obj && obj->getResolvedTypeCode() == ::ot_boolean;
  ------------------
  |  Branch (385:12): [True: 8.77k, False: 0]
  |  Branch (385:19): [True: 6, False: 8.76k]
  ------------------
  386|  8.77k|}
_ZNK16QPDFObjectHandle6isNullEv:
  403|  10.6M|{
  404|  10.6M|    return obj && obj->getResolvedTypeCode() == ::ot_null;
  ------------------
  |  Branch (404:12): [True: 10.6M, False: 0]
  |  Branch (404:19): [True: 635k, False: 10.0M]
  ------------------
  405|  10.6M|}
_ZNK16QPDFObjectHandle9isIntegerEv:
  414|   227k|{
  415|   227k|    return obj && obj->getResolvedTypeCode() == ::ot_integer;
  ------------------
  |  Branch (415:12): [True: 227k, False: 0]
  |  Branch (415:19): [True: 203k, False: 23.6k]
  ------------------
  416|   227k|}
_ZNK16QPDFObjectHandle6isRealEv:
  425|  13.3k|{
  426|  13.3k|    return obj && obj->getResolvedTypeCode() == ::ot_real;
  ------------------
  |  Branch (426:12): [True: 13.3k, False: 0]
  |  Branch (426:19): [True: 8.34k, False: 4.99k]
  ------------------
  427|  13.3k|}
_ZNK16QPDFObjectHandle8isNumberEv:
  436|   106k|{
  437|   106k|    return (isInteger() || isReal());
  ------------------
  |  Branch (437:13): [True: 97.6k, False: 8.76k]
  |  Branch (437:28): [True: 7.96k, False: 797]
  ------------------
  438|   106k|}
_ZNK16QPDFObjectHandle6isNameEv:
  481|  3.45M|{
  482|  3.45M|    return obj && obj->getResolvedTypeCode() == ::ot_name;
  ------------------
  |  Branch (482:12): [True: 3.45M, False: 0]
  |  Branch (482:19): [True: 2.78M, False: 667k]
  ------------------
  483|  3.45M|}
_ZNK16QPDFObjectHandle8isStringEv:
  492|   186k|{
  493|   186k|    return obj && obj->getResolvedTypeCode() == ::ot_string;
  ------------------
  |  Branch (493:12): [True: 186k, False: 0]
  |  Branch (493:19): [True: 180k, False: 6.53k]
  ------------------
  494|   186k|}
_ZNK16QPDFObjectHandle7isArrayEv:
  525|  13.2M|{
  526|  13.2M|    return obj && obj->getResolvedTypeCode() == ::ot_array;
  ------------------
  |  Branch (526:12): [True: 13.2M, False: 0]
  |  Branch (526:19): [True: 891k, False: 12.3M]
  ------------------
  527|  13.2M|}
_ZNK16QPDFObjectHandle12isDictionaryEv:
  536|  19.1M|{
  537|  19.1M|    return obj && obj->getResolvedTypeCode() == ::ot_dictionary;
  ------------------
  |  Branch (537:12): [True: 19.1M, False: 0]
  |  Branch (537:19): [True: 3.71M, False: 15.4M]
  ------------------
  538|  19.1M|}
_ZNK16QPDFObjectHandle8isStreamEv:
  547|  6.55M|{
  548|  6.55M|    return obj && obj->getResolvedTypeCode() == ::ot_stream;
  ------------------
  |  Branch (548:12): [True: 6.55M, False: 4.09k]
  |  Branch (548:19): [True: 527k, False: 6.02M]
  ------------------
  549|  6.55M|}
_ZNK16QPDFObjectHandle8isScalarEv:
  569|  1.69k|{
  570|  1.69k|    return isBool() || isInteger() || isName() || isNull() || isReal() || isString();
  ------------------
  |  Branch (570:12): [True: 0, False: 1.69k]
  |  Branch (570:24): [True: 209, False: 1.48k]
  |  Branch (570:39): [True: 117, False: 1.37k]
  |  Branch (570:51): [True: 0, False: 1.37k]
  |  Branch (570:63): [True: 7, False: 1.36k]
  |  Branch (570:75): [True: 67, False: 1.29k]
  ------------------
  571|  1.69k|}
_ZNK16QPDFObjectHandle15isNameAndEqualsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  580|  1.91M|{
  581|  1.91M|    return isName() && (getName() == name);
  ------------------
  |  Branch (581:12): [True: 1.31M, False: 600k]
  |  Branch (581:24): [True: 215k, False: 1.10M]
  ------------------
  582|  1.91M|}
_ZNK16QPDFObjectHandle18isDictionaryOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  591|  6.32M|{
  592|  6.32M|    return isDictionary() && (type.empty() || getKey("/Type").isNameAndEquals(type)) &&
  ------------------
  |  Branch (592:12): [True: 1.88M, False: 4.44M]
  |  Branch (592:31): [True: 0, False: 1.88M]
  |  Branch (592:47): [True: 215k, False: 1.66M]
  ------------------
  593|  6.32M|        (subtype.empty() || getKey("/Subtype").isNameAndEquals(subtype));
  ------------------
  |  Branch (593:10): [True: 215k, False: 0]
  |  Branch (593:29): [True: 0, False: 0]
  ------------------
  594|  6.32M|}
_ZNK16QPDFObjectHandle14isStreamOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  603|  1.25M|{
  604|  1.25M|    return isStream() && getDict().isDictionaryOfType(type, subtype);
  ------------------
  |  Branch (604:12): [True: 256k, False: 1.00M]
  |  Branch (604:26): [True: 4.56k, False: 251k]
  ------------------
  605|  1.25M|}
_ZNK16QPDFObjectHandle11getIntValueEv:
  652|   114k|{
  653|   114k|    auto integer = asInteger();
  654|   114k|    if (integer) {
  ------------------
  |  Branch (654:9): [True: 114k, False: 113]
  ------------------
  655|   114k|        return integer->getVal();
  656|   114k|    } else {
  657|    113|        typeWarning("integer", "returning 0");
  658|    113|        QTC::TC("qpdf", "QPDFObjectHandle integer returning 0");
  659|    113|        return 0;
  660|    113|    }
  661|   114k|}
_ZNK16QPDFObjectHandle13getValueAsIntERx:
  670|  2.22k|{
  671|  2.22k|    auto integer = asInteger();
  672|  2.22k|    if (integer == nullptr) {
  ------------------
  |  Branch (672:9): [True: 35, False: 2.18k]
  ------------------
  673|     35|        return false;
  674|     35|    }
  675|  2.18k|    value = integer->getVal();
  676|  2.18k|    return true;
  677|  2.22k|}
_ZNK16QPDFObjectHandle16getIntValueAsIntEv:
  686|  20.2k|{
  687|  20.2k|    int result = 0;
  688|  20.2k|    long long v = getIntValue();
  689|  20.2k|    if (v < INT_MIN) {
  ------------------
  |  Branch (689:9): [True: 4, False: 20.2k]
  ------------------
  690|      4|        QTC::TC("qpdf", "QPDFObjectHandle int returning INT_MIN");
  691|      4|        warnIfPossible("requested value of integer is too small; returning INT_MIN");
  692|      4|        result = INT_MIN;
  693|  20.2k|    } else if (v > INT_MAX) {
  ------------------
  |  Branch (693:16): [True: 35, False: 20.2k]
  ------------------
  694|     35|        QTC::TC("qpdf", "QPDFObjectHandle int returning INT_MAX");
  695|     35|        warnIfPossible("requested value of integer is too big; returning INT_MAX");
  696|     35|        result = INT_MAX;
  697|  20.2k|    } else {
  698|  20.2k|        result = static_cast<int>(v);
  699|  20.2k|    }
  700|  20.2k|    return result;
  701|  20.2k|}
_ZNK16QPDFObjectHandle12getUIntValueEv:
  725|  89.8k|{
  726|  89.8k|    long long v = getIntValue();
  727|  89.8k|    if (v < 0) {
  ------------------
  |  Branch (727:9): [True: 22, False: 89.8k]
  ------------------
  728|     22|        QTC::TC("qpdf", "QPDFObjectHandle uint returning 0");
  729|     22|        warnIfPossible("unsigned value request for negative number; returning 0");
  730|     22|        return 0;
  731|  89.8k|    } else {
  732|  89.8k|        return static_cast<unsigned long long>(v);
  733|  89.8k|    }
  734|  89.8k|}
_ZNK16QPDFObjectHandle7getNameEv:
  831|  1.39M|{
  832|  1.39M|    if (isName()) {
  ------------------
  |  Branch (832:9): [True: 1.39M, False: 0]
  ------------------
  833|  1.39M|        return obj->getStringValue();
  834|  1.39M|    } 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|  1.39M|}
_ZNK16QPDFObjectHandle14getStringValueEv:
  865|   177k|{
  866|   177k|    if (isString()) {
  ------------------
  |  Branch (866:9): [True: 175k, False: 1.65k]
  ------------------
  867|   175k|        return obj->getStringValue();
  868|   175k|    } else {
  869|  1.65k|        typeWarning("string", "returning empty string");
  870|  1.65k|        QTC::TC("qpdf", "QPDFObjectHandle string returning empty string");
  871|  1.65k|        return "";
  872|  1.65k|    }
  873|   177k|}
_ZN16QPDFObjectHandle6aitemsEv:
  994|  7.49k|{
  995|  7.49k|    return *this;
  996|  7.49k|}
_ZNK16QPDFObjectHandle14getArrayNItemsEv:
 1005|   649k|{
 1006|   649k|    if (auto array = asArray()) {
  ------------------
  |  Branch (1006:14): [True: 649k, False: 177]
  ------------------
 1007|   649k|        return array->size();
 1008|   649k|    } else {
 1009|    177|        typeWarning("array", "treating as empty");
 1010|    177|        QTC::TC("qpdf", "QPDFObjectHandle array treating as empty");
 1011|    177|        return 0;
 1012|    177|    }
 1013|   649k|}
_ZNK16QPDFObjectHandle12getArrayItemEi:
 1022|  3.39M|{
 1023|  3.39M|    if (auto array = asArray()) {
  ------------------
  |  Branch (1023:14): [True: 3.39M, False: 799]
  ------------------
 1024|  3.39M|        if (auto result = array->at(n); result.obj != nullptr) {
  ------------------
  |  Branch (1024:41): [True: 3.39M, False: 11]
  ------------------
 1025|  3.39M|            return result;
 1026|  3.39M|        } else {
 1027|     11|            objectWarning("returning null for out of bounds array access");
 1028|     11|            QTC::TC("qpdf", "QPDFObjectHandle array bounds");
 1029|     11|        }
 1030|  3.39M|    } else {
 1031|    799|        typeWarning("array", "returning null");
 1032|    799|        QTC::TC("qpdf", "QPDFObjectHandle array null for non-array");
 1033|    799|    }
 1034|    810|    static auto constexpr msg = " -> null returned from invalid array access"sv;
 1035|    810|    return QPDF_Null::create(obj, msg, "");
 1036|  3.39M|}
_ZNK16QPDFObjectHandle11isRectangleEv:
 1045|  45.5k|{
 1046|  45.5k|    if (auto array = asArray()) {
  ------------------
  |  Branch (1046:14): [True: 26.9k, False: 18.6k]
  ------------------
 1047|   132k|        for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1047:25): [True: 106k, False: 26.0k]
  ------------------
 1048|   106k|            if (auto item = array->at(i); !(item.obj && item.isNumber())) {
  ------------------
  |  Branch (1048:45): [True: 106k, False: 160]
  |  Branch (1048:57): [True: 105k, False: 797]
  ------------------
 1049|    957|                return false;
 1050|    957|            }
 1051|   106k|        }
 1052|  26.0k|        return array->size() == 4;
 1053|  26.9k|    }
 1054|  18.6k|    return false;
 1055|  45.5k|}
_ZNK16QPDFObjectHandle16getArrayAsVectorEv:
 1133|   757k|{
 1134|   757k|    auto array = asArray();
 1135|   757k|    if (array) {
  ------------------
  |  Branch (1135:9): [True: 757k, False: 0]
  ------------------
 1136|   757k|        return array->getAsVector();
 1137|   757k|    } 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|   757k|}
_ZN16QPDFObjectHandle12setArrayItemEiRKS_:
 1148|  3.65k|{
 1149|  3.65k|    if (auto array = asArray()) {
  ------------------
  |  Branch (1149:14): [True: 3.65k, False: 0]
  ------------------
 1150|  3.65k|        if (!array->setAt(n, item)) {
  ------------------
  |  Branch (1150:13): [True: 0, False: 3.65k]
  ------------------
 1151|      0|            objectWarning("ignoring attempt to set out of bounds array item");
 1152|      0|            QTC::TC("qpdf", "QPDFObjectHandle set array bounds");
 1153|      0|        }
 1154|  3.65k|    } else {
 1155|      0|        typeWarning("array", "ignoring attempt to set item");
 1156|      0|        QTC::TC("qpdf", "QPDFObjectHandle array ignoring set item");
 1157|      0|    }
 1158|  3.65k|}
_ZN16QPDFObjectHandle9eraseItemEi:
 1211|      8|{
 1212|      8|    if (auto array = asArray()) {
  ------------------
  |  Branch (1212:14): [True: 4, False: 4]
  ------------------
 1213|      4|        if (!array->erase(at)) {
  ------------------
  |  Branch (1213:13): [True: 0, False: 4]
  ------------------
 1214|      0|            objectWarning("ignoring attempt to erase out of bounds array item");
 1215|      0|            QTC::TC("qpdf", "QPDFObjectHandle erase array bounds");
 1216|      0|        }
 1217|      4|    } else {
 1218|      4|        typeWarning("array", "ignoring attempt to erase item");
 1219|      4|        QTC::TC("qpdf", "QPDFObjectHandle array ignoring erase item");
 1220|      4|    }
 1221|      8|}
_ZNK16QPDFObjectHandle6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1247|   118k|{
 1248|   118k|    auto dict = asDictionary();
 1249|   118k|    if (dict) {
  ------------------
  |  Branch (1249:9): [True: 116k, False: 2.03k]
  ------------------
 1250|   116k|        return dict->hasKey(key);
 1251|   116k|    } else {
 1252|  2.03k|        typeWarning("dictionary", "returning false for a key containment request");
 1253|  2.03k|        QTC::TC("qpdf", "QPDFObjectHandle dictionary false for hasKey");
 1254|  2.03k|        return false;
 1255|  2.03k|    }
 1256|   118k|}
_ZNK16QPDFObjectHandle6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1265|  5.83M|{
 1266|  5.83M|    if (auto dict = asDictionary()) {
  ------------------
  |  Branch (1266:14): [True: 5.83M, False: 0]
  ------------------
 1267|  5.83M|        return dict->getKey(key);
 1268|  5.83M|    } 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|  5.83M|}
_ZNK16QPDFObjectHandle7getKeysEv:
 1294|   715k|{
 1295|   715k|    std::set<std::string> result;
 1296|   715k|    auto dict = asDictionary();
 1297|   715k|    if (dict) {
  ------------------
  |  Branch (1297:9): [True: 715k, False: 102]
  ------------------
 1298|   715k|        result = dict->getKeys();
 1299|   715k|    } else {
 1300|    102|        typeWarning("dictionary", "treating as empty");
 1301|    102|        QTC::TC("qpdf", "QPDFObjectHandle dictionary empty set for getKeys");
 1302|    102|    }
 1303|   715k|    return result;
 1304|   715k|}
_ZNK16QPDFObjectHandle12getDictAsMapEv:
 1313|  1.29M|{
 1314|  1.29M|    std::map<std::string, QPDFObjectHandle> result;
 1315|  1.29M|    auto dict = asDictionary();
 1316|  1.29M|    if (dict) {
  ------------------
  |  Branch (1316:9): [True: 1.29M, False: 0]
  ------------------
 1317|  1.29M|        result = dict->getAsMap();
 1318|  1.29M|    } else {
 1319|      0|        typeWarning("dictionary", "treating as empty");
 1320|      0|        QTC::TC("qpdf", "QPDFObjectHandle dictionary empty map for asMap");
 1321|      0|    }
 1322|  1.29M|    return result;
 1323|  1.29M|}
_ZNK16QPDFObjectHandle11isOrHasNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1333|  23.9k|{
 1334|  23.9k|    if (isNameAndEquals(value)) {
  ------------------
  |  Branch (1334:9): [True: 12, False: 23.9k]
  ------------------
 1335|     12|        return true;
 1336|  23.9k|    } else if (isArray()) {
  ------------------
  |  Branch (1336:16): [True: 2.78k, False: 21.1k]
  ------------------
 1337|  8.98k|        for (auto& item: getArrayAsVector()) {
  ------------------
  |  Branch (1337:24): [True: 8.98k, False: 2.77k]
  ------------------
 1338|  8.98k|            if (item.isNameAndEquals(value)) {
  ------------------
  |  Branch (1338:17): [True: 8, False: 8.97k]
  ------------------
 1339|      8|                return true;
 1340|      8|            }
 1341|  8.98k|        }
 1342|  2.78k|    }
 1343|  23.9k|    return false;
 1344|  23.9k|}
_ZN16QPDFObjectHandle10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
 1517|  76.7k|{
 1518|  76.7k|    auto dict = asDictionary();
 1519|  76.7k|    if (dict) {
  ------------------
  |  Branch (1519:9): [True: 74.8k, False: 1.91k]
  ------------------
 1520|  74.8k|        checkOwnership(value);
 1521|  74.8k|        dict->replaceKey(key, value);
 1522|  74.8k|    } else {
 1523|  1.91k|        typeWarning("dictionary", "ignoring key replacement request");
 1524|  1.91k|        QTC::TC("qpdf", "QPDFObjectHandle dictionary ignoring replaceKey");
 1525|  1.91k|    }
 1526|  76.7k|}
_ZN16QPDFObjectHandle19replaceKeyAndGetNewERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
 1530|  5.72k|{
 1531|  5.72k|    replaceKey(key, value);
 1532|  5.72k|    return value;
 1533|  5.72k|}
_ZN16QPDFObjectHandle9removeKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1545|   365k|{
 1546|   365k|    auto dict = asDictionary();
 1547|   365k|    if (dict) {
  ------------------
  |  Branch (1547:9): [True: 365k, False: 0]
  ------------------
 1548|   365k|        dict->removeKey(key);
 1549|   365k|    } else {
 1550|      0|        typeWarning("dictionary", "ignoring key removal request");
 1551|      0|        QTC::TC("qpdf", "QPDFObjectHandle dictionary ignoring removeKey");
 1552|      0|    }
 1553|   365k|}
_ZNK16QPDFObjectHandle7getDictEv:
 1581|   526k|{
 1582|   526k|    return asStreamWithAssert()->getDict();
 1583|   526k|}
_ZN16QPDFObjectHandle16setFilterOnWriteEb:
 1587|  5.39k|{
 1588|  5.39k|    asStreamWithAssert()->setFilterOnWrite(val);
 1589|  5.39k|}
_ZN16QPDFObjectHandle16getFilterOnWriteEv:
 1593|  93.4k|{
 1594|  93.4k|    return asStreamWithAssert()->getFilterOnWrite();
 1595|  93.4k|}
_ZN16QPDFObjectHandle14isDataModifiedEv:
 1599|   156k|{
 1600|   156k|    return asStreamWithAssert()->isDataModified();
 1601|   156k|}
_ZN16QPDFObjectHandle13getStreamDataE26qpdf_stream_decode_level_e:
 1611|  4.39k|{
 1612|  4.39k|    return asStreamWithAssert()->getStreamData(level);
 1613|  4.39k|}
_ZN16QPDFObjectHandle14pipeStreamDataEP8Pipelinei26qpdf_stream_decode_level_ebb:
 1641|  98.8k|{
 1642|  98.8k|    bool filtering_attempted;
 1643|  98.8k|    asStreamWithAssert()->pipeStreamData(
 1644|  98.8k|        p, &filtering_attempted, encode_flags, decode_level, suppress_warnings, will_retry);
 1645|  98.8k|    return filtering_attempted;
 1646|  98.8k|}
_ZNK16QPDFObjectHandle7unparseEv:
 1902|   180k|{
 1903|   180k|    if (this->isIndirect()) {
  ------------------
  |  Branch (1903:9): [True: 117, False: 180k]
  ------------------
 1904|    117|        return getObjGen().unparse(' ') + " R";
 1905|   180k|    } else {
 1906|   180k|        return unparseResolved();
 1907|   180k|    }
 1908|   180k|}
_ZNK16QPDFObjectHandle15unparseResolvedEv:
 1917|  3.33M|{
 1918|  3.33M|    if (!obj) {
  ------------------
  |  Branch (1918:9): [True: 0, False: 3.33M]
  ------------------
 1919|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1920|      0|    }
 1921|  3.33M|    return obj->unparse();
 1922|  3.33M|}
_ZN16QPDFObjectHandle5parseERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
 2027|  20.9k|{
 2028|  20.9k|    return parse(nullptr, object_str, object_description);
 2029|  20.9k|}
_ZN16QPDFObjectHandle5parseEP4QPDFRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
 2034|  20.9k|{
 2035|  20.9k|    auto input = std::shared_ptr<InputSource>(new BufferInputSource("parsed object", object_str));
 2036|  20.9k|    QPDFTokenizer tokenizer;
 2037|  20.9k|    bool empty = false;
 2038|  20.9k|    QPDFObjectHandle result = parse(input, object_description, tokenizer, empty, nullptr, context);
 2039|  20.9k|    size_t offset = QIntC::to_size(input->tell());
 2040|  20.9k|    while (offset < object_str.length()) {
  ------------------
  |  Branch (2040:12): [True: 0, False: 20.9k]
  ------------------
 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|  20.9k|    return result;
 2053|  20.9k|}
_ZN16QPDFObjectHandle5parseENSt3__110shared_ptrI11InputSourceEERKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEER13QPDFTokenizerRbPNS_15StringDecrypterEP4QPDF:
 2225|  20.9k|{
 2226|  20.9k|    return QPDFParser(input, object_description, tokenizer, decrypter, context, false)
 2227|  20.9k|        .parse(empty, false);
 2228|  20.9k|}
_ZN16QPDFObjectHandle7newNullEv:
 2249|    239|{
 2250|    239|    return {QPDF_Null::create()};
 2251|    239|}
_ZN16QPDFObjectHandle10newIntegerEx:
 2255|  3.68k|{
 2256|  3.68k|    return {QPDF_Integer::create(value)};
 2257|  3.68k|}
_ZN16QPDFObjectHandle7newRealEdib:
 2267|  43.7k|{
 2268|  43.7k|    return {QPDF_Real::create(value, decimal_places, trim_trailing_zeroes)};
 2269|  43.7k|}
_ZN16QPDFObjectHandle9newStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2279|   180k|{
 2280|   180k|    return {QPDF_String::create(str)};
 2281|   180k|}
_ZN16QPDFObjectHandle8newArrayERKNSt3__16vectorIS_NS0_9allocatorIS_EEEE:
 2309|  14.7k|{
 2310|  14.7k|    return {QPDF_Array::create(items)};
 2311|  14.7k|}
_ZN16QPDFObjectHandle8newArrayERKNS_9RectangleE:
 2315|  10.9k|{
 2316|  10.9k|    return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)});
 2317|  10.9k|}
_ZN16QPDFObjectHandle13newDictionaryEv:
 2363|  5.72k|{
 2364|  5.72k|    return newDictionary(std::map<std::string, QPDFObjectHandle>());
 2365|  5.72k|}
_ZN16QPDFObjectHandle13newDictionaryERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S_EEEEEE:
 2369|  5.72k|{
 2370|  5.72k|    return {QPDF_Dictionary::create(items)};
 2371|  5.72k|}
_ZNK16QPDFObjectHandle20hasObjectDescriptionEv:
 2428|  89.8k|{
 2429|  89.8k|    return obj && obj->hasDescription();
  ------------------
  |  Branch (2429:12): [True: 89.8k, False: 0]
  |  Branch (2429:19): [True: 89.8k, False: 0]
  ------------------
 2430|  89.8k|}
_ZN16QPDFObjectHandle11shallowCopyEv:
 2434|  37.1k|{
 2435|  37.1k|    if (!obj) {
  ------------------
  |  Branch (2435:9): [True: 0, False: 37.1k]
  ------------------
 2436|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2437|      0|    }
 2438|  37.1k|    return {obj->copy()};
 2439|  37.1k|}
_ZN16QPDFObjectHandle17unsafeShallowCopyEv:
 2443|   549k|{
 2444|   549k|    if (!obj) {
  ------------------
  |  Branch (2444:9): [True: 0, False: 549k]
  ------------------
 2445|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2446|      0|    }
 2447|   549k|    return {obj->copy(true)};
 2448|   549k|}
_ZN16QPDFObjectHandle10makeDirectERN10QPDFObjGen3setEb:
 2452|  6.78k|{
 2453|  6.78k|    assertInitialized();
 2454|       |
 2455|  6.78k|    auto cur_og = getObjGen();
 2456|  6.78k|    if (!visited.add(cur_og)) {
  ------------------
  |  Branch (2456:9): [True: 58, False: 6.72k]
  ------------------
 2457|     58|        QTC::TC("qpdf", "QPDFObjectHandle makeDirect loop");
 2458|     58|        throw std::runtime_error("loop detected while converting object from indirect to direct");
 2459|     58|    }
 2460|       |
 2461|  6.72k|    if (isBool() || isInteger() || isName() || isNull() || isReal() || isString()) {
  ------------------
  |  Branch (2461:9): [True: 6, False: 6.72k]
  |  Branch (2461:21): [True: 1.77k, False: 4.94k]
  |  Branch (2461:36): [True: 1.04k, False: 3.90k]
  |  Branch (2461:48): [True: 693, False: 3.20k]
  |  Branch (2461:60): [True: 370, False: 2.83k]
  |  Branch (2461:72): [True: 939, False: 1.89k]
  ------------------
 2462|  4.82k|        this->obj = obj->copy(true);
 2463|  4.82k|    } else if (isArray()) {
  ------------------
  |  Branch (2463:16): [True: 456, False: 1.44k]
  ------------------
 2464|    456|        std::vector<QPDFObjectHandle> items;
 2465|    456|        auto array = asArray();
 2466|    456|        int n = array->size();
 2467|  3.39k|        for (int i = 0; i < n; ++i) {
  ------------------
  |  Branch (2467:25): [True: 2.93k, False: 456]
  ------------------
 2468|  2.93k|            items.push_back(array->at(i));
 2469|  2.93k|            items.back().makeDirect(visited, stop_at_streams);
 2470|  2.93k|        }
 2471|    456|        this->obj = QPDF_Array::create(items);
 2472|  1.44k|    } else if (isDictionary()) {
  ------------------
  |  Branch (2472:16): [True: 1.43k, False: 7]
  ------------------
 2473|  1.43k|        std::map<std::string, QPDFObjectHandle> items;
 2474|  1.43k|        auto dict = asDictionary();
 2475|  3.77k|        for (auto const& key: getKeys()) {
  ------------------
  |  Branch (2475:29): [True: 3.77k, False: 1.43k]
  ------------------
 2476|  3.77k|            items[key] = dict->getKey(key);
 2477|  3.77k|            items[key].makeDirect(visited, stop_at_streams);
 2478|  3.77k|        }
 2479|  1.43k|        this->obj = QPDF_Dictionary::create(items);
 2480|  1.43k|    } else if (isStream()) {
  ------------------
  |  Branch (2480:16): [True: 7, False: 0]
  ------------------
 2481|      7|        QTC::TC("qpdf", "QPDFObjectHandle copy stream", stop_at_streams ? 0 : 1);
  ------------------
  |  Branch (2481:57): [True: 0, False: 7]
  ------------------
 2482|      7|        if (!stop_at_streams) {
  ------------------
  |  Branch (2482:13): [True: 7, False: 0]
  ------------------
 2483|      7|            throw std::runtime_error("attempt to make a stream into a direct object");
 2484|      7|        }
 2485|      7|    } else if (isReserved()) {
  ------------------
  |  Branch (2485:16): [True: 0, False: 0]
  ------------------
 2486|      0|        throw std::logic_error(
 2487|      0|            "QPDFObjectHandle: attempting to make a reserved object handle direct");
 2488|      0|    } else {
 2489|      0|        throw std::logic_error("QPDFObjectHandle::makeDirectInternal: unknown object type");
 2490|      0|    }
 2491|       |
 2492|  6.72k|    visited.erase(cur_og);
 2493|  6.72k|}
_ZN16QPDFObjectHandle10makeDirectEb:
 2515|     78|{
 2516|     78|    QPDFObjGen::set visited;
 2517|     78|    makeDirect(visited, allow_streams);
 2518|     78|}
_ZNK16QPDFObjectHandle17assertInitializedEv:
 2522|  6.78k|{
 2523|  6.78k|    if (!isInitialized()) {
  ------------------
  |  Branch (2523:9): [True: 0, False: 6.78k]
  ------------------
 2524|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2525|      0|    }
 2526|  6.78k|}
_ZNK16QPDFObjectHandle11typeWarningEPKcRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2530|  6.80k|{
 2531|  6.80k|    QPDF* context = nullptr;
 2532|  6.80k|    std::string description;
 2533|       |    // Type checks above guarantee that the object has been dereferenced. Nevertheless, dereference
 2534|       |    // throws exceptions in the test suite
 2535|  6.80k|    if (!obj) {
  ------------------
  |  Branch (2535:9): [True: 0, False: 6.80k]
  ------------------
 2536|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 2537|      0|    }
 2538|  6.80k|    obj->getDescription(context, description);
 2539|       |    // Null context handled by warn
 2540|  6.80k|    warn(
 2541|  6.80k|        context,
 2542|  6.80k|        QPDFExc(
 2543|  6.80k|            qpdf_e_object,
 2544|  6.80k|            "",
 2545|  6.80k|            description,
 2546|  6.80k|            0,
 2547|  6.80k|            std::string("operation for ") + expected_type + " attempted on object of type " +
 2548|  6.80k|                QPDFObjectHandle(*this).getTypeName() + ": " + warning));
 2549|  6.80k|}
_ZNK16QPDFObjectHandle14warnIfPossibleERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2558|   100k|{
 2559|   100k|    QPDF* context = nullptr;
 2560|   100k|    std::string description;
 2561|   100k|    if (obj && obj->getDescription(context, description)) {
  ------------------
  |  Branch (2561:9): [True: 100k, False: 0]
  |  Branch (2561:16): [True: 66.7k, False: 33.3k]
  ------------------
 2562|  66.7k|        warn(context, QPDFExc(qpdf_e_damaged_pdf, "", description, 0, warning));
 2563|  66.7k|    } else {
 2564|  33.3k|        *QPDFLogger::defaultLogger()->getError() << warning << "\n";
 2565|  33.3k|    }
 2566|   100k|}
_ZNK16QPDFObjectHandle13objectWarningERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2570|     11|{
 2571|     11|    QPDF* context = nullptr;
 2572|     11|    std::string description;
 2573|       |    // Type checks above guarantee that the object is initialized.
 2574|     11|    obj->getDescription(context, description);
 2575|       |    // Null context handled by warn
 2576|     11|    warn(context, QPDFExc(qpdf_e_object, "", description, 0, warning));
 2577|     11|}
_ZNK16QPDFObjectHandle10assertTypeEPKcb:
 2581|   885k|{
 2582|   885k|    if (!istype) {
  ------------------
  |  Branch (2582:9): [True: 40, False: 885k]
  ------------------
 2583|     40|        throw std::runtime_error(
 2584|     40|            std::string("operation for ") + type_name + " attempted on object of type " +
 2585|     40|            QPDFObjectHandle(*this).getTypeName());
 2586|     40|    }
 2587|   885k|}
_ZNK16QPDFObjectHandle14checkOwnershipERKS_:
 2817|  74.8k|{
 2818|  74.8k|    auto qpdf = getOwningQPDF();
 2819|  74.8k|    auto item_qpdf = item.getOwningQPDF();
 2820|  74.8k|    if ((qpdf != nullptr) && (item_qpdf != nullptr) && (qpdf != item_qpdf)) {
  ------------------
  |  Branch (2820:9): [True: 63.3k, False: 11.4k]
  |  Branch (2820:30): [True: 29.7k, False: 33.6k]
  |  Branch (2820:56): [True: 0, False: 29.7k]
  ------------------
 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|  74.8k|}
_ZN16QPDFObjectHandle4warnEP4QPDFRK7QPDFExc:
 2842|  73.5k|{
 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|  73.5k|    if (qpdf) {
  ------------------
  |  Branch (2846:9): [True: 72.7k, False: 880]
  ------------------
 2847|  72.7k|        qpdf->warn(e);
 2848|  72.7k|    } else {
 2849|    880|        throw e;
 2850|    880|    }
 2851|  73.5k|}
_ZN16QPDFObjectHandle14QPDFArrayItemsC2ERKS_:
 2940|  7.49k|{
 2941|  7.49k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorppEv:
 2945|  99.0k|{
 2946|  99.0k|    if (!m->is_end) {
  ------------------
  |  Branch (2946:9): [True: 99.0k, False: 0]
  ------------------
 2947|  99.0k|        ++m->item_number;
 2948|  99.0k|        updateIValue();
 2949|  99.0k|    }
 2950|  99.0k|    return *this;
 2951|  99.0k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratordeEv:
 2965|  99.1k|{
 2966|  99.1k|    updateIValue();
 2967|  99.1k|    return this->ivalue;
 2968|  99.1k|}
_ZNK16QPDFObjectHandle14QPDFArrayItems8iteratoreqERKS1_:
 2979|   106k|{
 2980|   106k|    return (m->item_number == other.m->item_number);
 2981|   106k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorC2ERS_b:
 2985|  14.9k|{
 2986|  14.9k|    updateIValue();
 2987|  14.9k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iterator12updateIValueEv:
 2991|   213k|{
 2992|   213k|    m->is_end = (m->item_number >= m->oh.getArrayNItems());
 2993|   213k|    if (m->is_end) {
  ------------------
  |  Branch (2993:9): [True: 14.9k, False: 198k]
  ------------------
 2994|  14.9k|        this->ivalue = QPDFObjectHandle();
 2995|   198k|    } else {
 2996|   198k|        this->ivalue = m->oh.getArrayItem(m->item_number);
 2997|   198k|    }
 2998|   213k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iterator7MembersC2ERS_b:
 3002|  14.9k|{
 3003|  14.9k|    this->item_number = for_begin ? 0 : oh.getArrayNItems();
  ------------------
  |  Branch (3003:25): [True: 7.49k, False: 7.49k]
  ------------------
 3004|  14.9k|}
_ZN16QPDFObjectHandle14QPDFArrayItems5beginEv:
 3008|  7.49k|{
 3009|  7.49k|    return {oh, true};
 3010|  7.49k|}
_ZN16QPDFObjectHandle14QPDFArrayItems3endEv:
 3014|  7.49k|{
 3015|  7.49k|    return {oh, false};
 3016|  7.49k|}
_ZNK16QPDFObjectHandle9getObjGenEv:
 3020|  31.8M|{
 3021|  31.8M|    return isInitialized() ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (3021:12): [True: 31.8M, False: 0]
  ------------------
 3022|  31.8M|}
_ZNK16QPDFObjectHandle13getOwningQPDFEv:
 3027|  1.45M|{
 3028|  1.45M|    return isInitialized() ? this->obj->getQPDF() : nullptr;
  ------------------
  |  Branch (3028:12): [True: 1.45M, False: 0]
  ------------------
 3029|  1.45M|}
_Zli5_qpdfPKcm:
 3054|  15.1k|{
 3055|  15.1k|    return QPDFObjectHandle::parse(std::string(v, len), "QPDFObjectHandle literal");
 3056|  15.1k|}

_ZN10QPDFParser5parseERbb:
   28|   392k|{
   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|   392k|    QPDF::ParseGuard pg(context);
   35|   392k|    empty = false;
   36|   392k|    start = input->tell();
   37|       |
   38|   392k|    if (!tokenizer.nextToken(*input, object_description)) {
  ------------------
  |  Branch (38:9): [True: 3.26k, False: 389k]
  ------------------
   39|  3.26k|        warn(tokenizer.getErrorMessage());
   40|  3.26k|    }
   41|       |
   42|   392k|    switch (tokenizer.getType()) {
   43|  1.26k|    case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (43:5): [True: 1.26k, False: 391k]
  ------------------
   44|  1.26k|        if (content_stream) {
  ------------------
  |  Branch (44:13): [True: 0, False: 1.26k]
  ------------------
   45|       |            // In content stream mode, leave object uninitialized to indicate EOF
   46|      0|            return {};
   47|      0|        }
   48|  1.26k|        QTC::TC("qpdf", "QPDFParser eof in parse");
   49|  1.26k|        warn("unexpected EOF");
   50|  1.26k|        return {QPDF_Null::create()};
   51|       |
   52|  3.05k|    case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (52:5): [True: 3.05k, False: 389k]
  ------------------
   53|  3.05k|        QTC::TC("qpdf", "QPDFParser bad token in parse");
   54|  3.05k|        return {QPDF_Null::create()};
   55|       |
   56|     29|    case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (56:5): [True: 29, False: 392k]
  ------------------
   57|     41|    case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (57:5): [True: 12, False: 392k]
  ------------------
   58|     41|        QTC::TC("qpdf", "QPDFParser bad brace");
   59|     41|        warn("treating unexpected brace token as null");
   60|     41|        return {QPDF_Null::create()};
   61|       |
   62|     64|    case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (62:5): [True: 64, False: 392k]
  ------------------
   63|     64|        QTC::TC("qpdf", "QPDFParser bad array close");
   64|     64|        warn("treating unexpected array close token as null");
   65|     64|        return {QPDF_Null::create()};
   66|       |
   67|    224|    case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (67:5): [True: 224, False: 392k]
  ------------------
   68|    224|        QTC::TC("qpdf", "QPDFParser bad dictionary close");
   69|    224|        warn("unexpected dictionary close token");
   70|    224|        return {QPDF_Null::create()};
   71|       |
   72|  6.20k|    case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (72:5): [True: 6.20k, False: 386k]
  ------------------
   73|   316k|    case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (73:5): [True: 310k, False: 81.8k]
  ------------------
   74|   316k|        stack.clear();
   75|   316k|        stack.emplace_back(
   76|   316k|            input,
   77|   316k|            (tokenizer.getType() == QPDFTokenizer::tt_array_open) ? st_array : st_dictionary_key);
  ------------------
  |  Branch (77:13): [True: 6.20k, False: 310k]
  ------------------
   78|   316k|        frame = &stack.back();
   79|   316k|        return parseRemainder(content_stream);
   80|       |
   81|    561|    case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (81:5): [True: 561, False: 391k]
  ------------------
   82|    561|        return withDescription<QPDF_Bool>(tokenizer.getValue() == "true");
   83|       |
   84|    150|    case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (84:5): [True: 150, False: 392k]
  ------------------
   85|    150|        return {QPDF_Null::create()};
   86|       |
   87|  48.2k|    case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (87:5): [True: 48.2k, False: 344k]
  ------------------
   88|  48.2k|        return withDescription<QPDF_Integer>(QUtil::string_to_ll(tokenizer.getValue().c_str()));
   89|       |
   90|    141|    case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (90:5): [True: 141, False: 392k]
  ------------------
   91|    141|        return withDescription<QPDF_Real>(tokenizer.getValue());
   92|       |
   93|  16.2k|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (93:5): [True: 16.2k, False: 376k]
  ------------------
   94|  16.2k|        return withDescription<QPDF_Name>(tokenizer.getValue());
   95|       |
   96|  5.29k|    case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (96:5): [True: 5.29k, False: 387k]
  ------------------
   97|  5.29k|        {
   98|  5.29k|            auto const& value = tokenizer.getValue();
   99|  5.29k|            if (content_stream) {
  ------------------
  |  Branch (99:17): [True: 0, False: 5.29k]
  ------------------
  100|      0|                return withDescription<QPDF_Operator>(value);
  101|  5.29k|            } else if (value == "endobj") {
  ------------------
  |  Branch (101:24): [True: 96, False: 5.19k]
  ------------------
  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|     96|                input->seek(input->getLastOffset(), SEEK_SET);
  105|     96|                empty = true;
  106|     96|                return {QPDF_Null::create()};
  107|  5.19k|            } else {
  108|  5.19k|                QTC::TC("qpdf", "QPDFParser treat word as string");
  109|  5.19k|                warn("unknown token while reading object; treating as string");
  110|  5.19k|                return withDescription<QPDF_String>(value);
  111|  5.19k|            }
  112|  5.29k|        }
  113|       |
  114|    396|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (114:5): [True: 396, False: 392k]
  ------------------
  115|    396|        if (decrypter) {
  ------------------
  |  Branch (115:13): [True: 56, False: 340]
  ------------------
  116|     56|            std::string s{tokenizer.getValue()};
  117|     56|            decrypter->decryptString(s);
  118|     56|            return withDescription<QPDF_String>(s);
  119|    340|        } else {
  120|    340|            return withDescription<QPDF_String>(tokenizer.getValue());
  121|    340|        }
  122|       |
  123|      0|    default:
  ------------------
  |  Branch (123:5): [True: 0, False: 392k]
  ------------------
  124|      0|        warn("treating unknown token type as null while reading object");
  125|      0|        return {QPDF_Null::create()};
  126|   392k|    }
  127|   392k|}
_ZN10QPDFParser14parseRemainderEb:
  131|   316k|{
  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|   316k|    bad_count = 0;
  138|   316k|    bool b_contents = false;
  139|       |
  140|  12.7M|    while (true) {
  ------------------
  |  Branch (140:12): [Folded - Ignored]
  ------------------
  141|  12.7M|        if (!tokenizer.nextToken(*input, object_description)) {
  ------------------
  |  Branch (141:13): [True: 47.8k, False: 12.6M]
  ------------------
  142|  47.8k|            warn(tokenizer.getErrorMessage());
  143|  47.8k|        }
  144|  12.7M|        ++good_count; // optimistically
  145|       |
  146|  12.7M|        if (int_count != 0) {
  ------------------
  |  Branch (146:13): [True: 4.34M, False: 8.37M]
  ------------------
  147|       |            // Special handling of indirect references. Treat integer tokens as part of an indirect
  148|       |            // reference until proven otherwise.
  149|  4.34M|            if (tokenizer.getType() == QPDFTokenizer::tt_integer) {
  ------------------
  |  Branch (149:17): [True: 2.27M, False: 2.07M]
  ------------------
  150|  2.27M|                if (++int_count > 2) {
  ------------------
  |  Branch (150:21): [True: 679k, False: 1.59M]
  ------------------
  151|       |                    // Process the oldest buffered integer.
  152|   679k|                    addInt(int_count);
  153|   679k|                }
  154|  2.27M|                last_offset_buffer[int_count % 2] = input->getLastOffset();
  155|  2.27M|                int_buffer[int_count % 2] = QUtil::string_to_ll(tokenizer.getValue().c_str());
  156|  2.27M|                continue;
  157|       |
  158|  2.27M|            } else if (
  159|  2.07M|                int_count >= 2 && tokenizer.getType() == QPDFTokenizer::tt_word &&
  ------------------
  |  Branch (159:17): [True: 1.59M, False: 487k]
  |  Branch (159:35): [True: 1.47M, False: 114k]
  ------------------
  160|  2.07M|                tokenizer.getValue() == "R") {
  ------------------
  |  Branch (160:17): [True: 1.41M, False: 61.3k]
  ------------------
  161|  1.41M|                if (context == nullptr) {
  ------------------
  |  Branch (161:21): [True: 0, False: 1.41M]
  ------------------
  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|  1.41M|                auto id = QIntC::to_int(int_buffer[(int_count - 1) % 2]);
  167|  1.41M|                auto gen = QIntC::to_int(int_buffer[(int_count) % 2]);
  168|  1.41M|                if (!(id < 1 || gen < 0 || gen >= 65535)) {
  ------------------
  |  Branch (168:23): [True: 1.28k, False: 1.41M]
  |  Branch (168:33): [True: 420, False: 1.41M]
  |  Branch (168:44): [True: 160, False: 1.41M]
  ------------------
  169|  1.41M|                    add(QPDF::ParseGuard::getObject(context, id, gen, parse_pdf));
  170|  1.41M|                } else {
  171|  1.86k|                    QTC::TC("qpdf", "QPDFParser invalid objgen");
  172|  1.86k|                    addNull();
  173|  1.86k|                }
  174|  1.41M|                int_count = 0;
  175|  1.41M|                continue;
  176|       |
  177|  1.41M|            } else if (int_count > 0) {
  ------------------
  |  Branch (177:24): [True: 663k, False: 0]
  ------------------
  178|       |                // Process the buffered integers before processing the current token.
  179|   663k|                if (int_count > 1) {
  ------------------
  |  Branch (179:21): [True: 175k, False: 487k]
  ------------------
  180|   175k|                    addInt(int_count - 1);
  181|   175k|                }
  182|   663k|                addInt(int_count);
  183|   663k|                int_count = 0;
  184|   663k|            }
  185|  4.34M|        }
  186|       |
  187|  9.03M|        switch (tokenizer.getType()) {
  188|  6.03k|        case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (188:9): [True: 6.03k, False: 9.02M]
  ------------------
  189|  6.03k|            warn("parse error while reading object");
  190|  6.03k|            if (content_stream) {
  ------------------
  |  Branch (190:17): [True: 0, False: 6.03k]
  ------------------
  191|       |                // In content stream mode, leave object uninitialized to indicate EOF
  192|      0|                return {};
  193|      0|            }
  194|  6.03k|            QTC::TC("qpdf", "QPDFParser eof in parseRemainder");
  195|  6.03k|            warn("unexpected EOF");
  196|  6.03k|            return {QPDF_Null::create()};
  197|       |
  198|  44.1k|        case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (198:9): [True: 44.1k, False: 8.99M]
  ------------------
  199|  44.1k|            QTC::TC("qpdf", "QPDFParser bad token in parseRemainder");
  200|  44.1k|            if (tooManyBadTokens()) {
  ------------------
  |  Branch (200:17): [True: 1.61k, False: 42.5k]
  ------------------
  201|  1.61k|                return {QPDF_Null::create()};
  202|  1.61k|            }
  203|  42.5k|            addNull();
  204|  42.5k|            continue;
  205|       |
  206|  3.00k|        case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (206:9): [True: 3.00k, False: 9.03M]
  ------------------
  207|  4.48k|        case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (207:9): [True: 1.47k, False: 9.03M]
  ------------------
  208|  4.48k|            QTC::TC("qpdf", "QPDFParser bad brace in parseRemainder");
  209|  4.48k|            warn("treating unexpected brace token as null");
  210|  4.48k|            if (tooManyBadTokens()) {
  ------------------
  |  Branch (210:17): [True: 367, False: 4.11k]
  ------------------
  211|    367|                return {QPDF_Null::create()};
  212|    367|            }
  213|  4.11k|            addNull();
  214|  4.11k|            continue;
  215|       |
  216|   332k|        case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (216:9): [True: 332k, False: 8.70M]
  ------------------
  217|   332k|            if (frame->state == st_array) {
  ------------------
  |  Branch (217:17): [True: 320k, False: 11.7k]
  ------------------
  218|   320k|                auto object = QPDF_Array::create(std::move(frame->olist), frame->null_count > 100);
  219|   320k|                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|   320k|                if (stack.size() <= 1) {
  ------------------
  |  Branch (224:21): [True: 4.12k, False: 316k]
  ------------------
  225|  4.12k|                    return object;
  226|  4.12k|                }
  227|   316k|                stack.pop_back();
  228|   316k|                frame = &stack.back();
  229|   316k|                add(std::move(object));
  230|   316k|            } else {
  231|  11.7k|                QTC::TC("qpdf", "QPDFParser bad array close in parseRemainder");
  232|  11.7k|                warn("treating unexpected array close token as null");
  233|  11.7k|                if (tooManyBadTokens()) {
  ------------------
  |  Branch (233:21): [True: 324, False: 11.4k]
  ------------------
  234|    324|                    return {QPDF_Null::create()};
  235|    324|                }
  236|  11.4k|                addNull();
  237|  11.4k|            }
  238|   327k|            continue;
  239|       |
  240|   598k|        case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (240:9): [True: 598k, False: 8.43M]
  ------------------
  241|   598k|            if (frame->state <= st_dictionary_value) {
  ------------------
  |  Branch (241:17): [True: 591k, False: 6.61k]
  ------------------
  242|       |                // Attempt to recover more or less gracefully from invalid dictionaries.
  243|   591k|                auto& dict = frame->dict;
  244|       |
  245|   591k|                if (frame->state == st_dictionary_value) {
  ------------------
  |  Branch (245:21): [True: 5.71k, False: 586k]
  ------------------
  246|  5.71k|                    QTC::TC("qpdf", "QPDFParser no val for last key");
  247|  5.71k|                    warn(
  248|  5.71k|                        frame->offset,
  249|  5.71k|                        "dictionary ended prematurely; using null as value for last key");
  250|  5.71k|                    dict[frame->key] = QPDF_Null::create();
  251|  5.71k|                }
  252|       |
  253|   591k|                if (!frame->olist.empty()) {
  ------------------
  |  Branch (253:21): [True: 58.0k, False: 533k]
  ------------------
  254|  58.0k|                    fixMissingKeys();
  255|  58.0k|                }
  256|       |
  257|   591k|                if (!frame->contents_string.empty() && dict.count("/Type") &&
  ------------------
  |  Branch (257:21): [True: 28, False: 591k]
  |  Branch (257:21): [True: 0, False: 591k]
  |  Branch (257:56): [True: 26, False: 2]
  ------------------
  258|   591k|                    dict["/Type"].isNameAndEquals("/Sig") && dict.count("/ByteRange") &&
  ------------------
  |  Branch (258:21): [True: 0, False: 26]
  |  Branch (258:62): [True: 0, False: 0]
  ------------------
  259|   591k|                    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|   591k|                auto object = QPDF_Dictionary::create(std::move(dict));
  264|   591k|                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|   591k|                if (stack.size() <= 1) {
  ------------------
  |  Branch (269:21): [True: 289k, False: 301k]
  ------------------
  270|   289k|                    return object;
  271|   289k|                }
  272|   301k|                stack.pop_back();
  273|   301k|                frame = &stack.back();
  274|   301k|                add(std::move(object));
  275|   301k|            } else {
  276|  6.61k|                QTC::TC("qpdf", "QPDFParser bad dictionary close in parseRemainder");
  277|  6.61k|                warn("unexpected dictionary close token");
  278|  6.61k|                if (tooManyBadTokens()) {
  ------------------
  |  Branch (278:21): [True: 137, False: 6.47k]
  ------------------
  279|    137|                    return {QPDF_Null::create()};
  280|    137|                }
  281|  6.47k|                addNull();
  282|  6.47k|            }
  283|   308k|            continue;
  284|       |
  285|   341k|        case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (285:9): [True: 341k, False: 8.69M]
  ------------------
  286|   793k|        case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (286:9): [True: 452k, False: 8.58M]
  ------------------
  287|   793k|            if (stack.size() > 499) {
  ------------------
  |  Branch (287:17): [True: 277, False: 793k]
  ------------------
  288|    277|                QTC::TC("qpdf", "QPDFParser too deep");
  289|    277|                warn("ignoring excessively deeply nested data structure");
  290|    277|                return {QPDF_Null::create()};
  291|   793k|            } else {
  292|   793k|                b_contents = false;
  293|   793k|                stack.emplace_back(
  294|   793k|                    input,
  295|   793k|                    (tokenizer.getType() == QPDFTokenizer::tt_array_open) ? st_array
  ------------------
  |  Branch (295:21): [True: 341k, False: 451k]
  ------------------
  296|   793k|                                                                          : st_dictionary_key);
  297|   793k|                frame = &stack.back();
  298|   793k|                continue;
  299|   793k|            }
  300|       |
  301|  17.1k|        case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (301:9): [True: 17.1k, False: 9.01M]
  ------------------
  302|  17.1k|            addScalar<QPDF_Bool>(tokenizer.getValue() == "true");
  303|  17.1k|            continue;
  304|       |
  305|   632k|        case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (305:9): [True: 632k, False: 8.40M]
  ------------------
  306|   632k|            addNull();
  307|   632k|            continue;
  308|       |
  309|  2.07M|        case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (309:9): [True: 2.07M, False: 6.95M]
  ------------------
  310|  2.07M|            if (!content_stream) {
  ------------------
  |  Branch (310:17): [True: 2.07M, False: 0]
  ------------------
  311|       |                // Buffer token in case it is part of an indirect reference.
  312|  2.07M|                last_offset_buffer[1] = input->getLastOffset();
  313|  2.07M|                int_buffer[1] = QUtil::string_to_ll(tokenizer.getValue().c_str());
  314|  2.07M|                int_count = 1;
  315|  2.07M|            } else {
  316|      0|                addScalar<QPDF_Integer>(QUtil::string_to_ll(tokenizer.getValue().c_str()));
  317|      0|            }
  318|  2.07M|            continue;
  319|       |
  320|   377k|        case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (320:9): [True: 377k, False: 8.65M]
  ------------------
  321|   377k|            addScalar<QPDF_Real>(tokenizer.getValue());
  322|   377k|            continue;
  323|       |
  324|  3.65M|        case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (324:9): [True: 3.65M, False: 5.37M]
  ------------------
  325|  3.65M|            if (frame->state == st_dictionary_key) {
  ------------------
  |  Branch (325:17): [True: 2.57M, False: 1.08M]
  ------------------
  326|  2.57M|                frame->key = tokenizer.getValue();
  327|  2.57M|                frame->state = st_dictionary_value;
  328|  2.57M|                b_contents = decrypter && frame->key == "/Contents";
  ------------------
  |  Branch (328:30): [True: 85.0k, False: 2.49M]
  |  Branch (328:43): [True: 1.26k, False: 83.7k]
  ------------------
  329|  2.57M|                continue;
  330|  2.57M|            } else {
  331|  1.08M|                addScalar<QPDF_Name>(tokenizer.getValue());
  332|  1.08M|            }
  333|  1.08M|            continue;
  334|       |
  335|  1.08M|        case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (335:9): [True: 290k, False: 8.74M]
  ------------------
  336|   290k|            if (content_stream) {
  ------------------
  |  Branch (336:17): [True: 0, False: 290k]
  ------------------
  337|      0|                addScalar<QPDF_Operator>(tokenizer.getValue());
  338|   290k|            } else {
  339|   290k|                QTC::TC("qpdf", "QPDFParser treat word as string in parseRemainder");
  340|   290k|                warn("unknown token while reading object; treating as string");
  341|   290k|                if (tooManyBadTokens()) {
  ------------------
  |  Branch (341:21): [True: 12.8k, False: 277k]
  ------------------
  342|  12.8k|                    return {QPDF_Null::create()};
  343|  12.8k|                }
  344|   277k|                addScalar<QPDF_String>(tokenizer.getValue());
  345|   277k|            }
  346|   277k|            continue;
  347|       |
  348|   277k|        case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (348:9): [True: 200k, False: 8.83M]
  ------------------
  349|   200k|            {
  350|   200k|                auto const& val = tokenizer.getValue();
  351|   200k|                if (decrypter) {
  ------------------
  |  Branch (351:21): [True: 8.09k, False: 192k]
  ------------------
  352|  8.09k|                    if (b_contents) {
  ------------------
  |  Branch (352:25): [True: 32, False: 8.05k]
  ------------------
  353|     32|                        frame->contents_string = val;
  354|     32|                        frame->contents_offset = input->getLastOffset();
  355|     32|                        b_contents = false;
  356|     32|                    }
  357|  8.09k|                    std::string s{val};
  358|  8.09k|                    decrypter->decryptString(s);
  359|  8.09k|                    addScalar<QPDF_String>(s);
  360|   192k|                } else {
  361|   192k|                    addScalar<QPDF_String>(val);
  362|   192k|                }
  363|   200k|            }
  364|   200k|            continue;
  365|       |
  366|      0|        default:
  ------------------
  |  Branch (366:9): [True: 0, False: 9.03M]
  ------------------
  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|  9.03M|        }
  373|  9.03M|    }
  374|   316k|}
_ZN10QPDFParser3addEONSt3__110shared_ptrI10QPDFObjectEE:
  378|  5.50M|{
  379|  5.50M|    if (frame->state != st_dictionary_value) {
  ------------------
  |  Branch (379:9): [True: 2.95M, False: 2.54M]
  ------------------
  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|  2.95M|        frame->olist.emplace_back(std::move(obj));
  383|  2.95M|    } else {
  384|  2.54M|        if (auto res = frame->dict.insert_or_assign(frame->key, std::move(obj)); !res.second) {
  ------------------
  |  Branch (384:82): [True: 17.5k, False: 2.53M]
  ------------------
  385|  17.5k|            warnDuplicateKey();
  386|  17.5k|        }
  387|  2.54M|        frame->state = st_dictionary_key;
  388|  2.54M|    }
  389|  5.50M|}
_ZN10QPDFParser7addNullEv:
  393|   698k|{
  394|   698k|    const static ObjectPtr null_obj = QPDF_Null::create();
  395|       |
  396|   698k|    if (frame->state != st_dictionary_value) {
  ------------------
  |  Branch (396:9): [True: 687k, False: 11.2k]
  ------------------
  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|   687k|        frame->olist.emplace_back(null_obj);
  400|   687k|    } else {
  401|  11.2k|        if (auto res = frame->dict.insert_or_assign(frame->key, null_obj); !res.second) {
  ------------------
  |  Branch (401:76): [True: 699, False: 10.5k]
  ------------------
  402|    699|            warnDuplicateKey();
  403|    699|        }
  404|  11.2k|        frame->state = st_dictionary_key;
  405|  11.2k|    }
  406|   698k|    ++frame->null_count;
  407|   698k|}
_ZN10QPDFParser6addIntEi:
  411|  1.51M|{
  412|  1.51M|    auto obj = QPDF_Integer::create(int_buffer[count % 2]);
  413|  1.51M|    obj->setDescription(context, description, last_offset_buffer[count % 2]);
  414|  1.51M|    add(std::move(obj));
  415|  1.51M|}
_ZN10QPDFParser14setDescriptionERNSt3__110shared_ptrI10QPDFObjectEEx:
  437|   911k|{
  438|   911k|    if (obj) {
  ------------------
  |  Branch (438:9): [True: 911k, False: 0]
  ------------------
  439|   911k|        obj->setDescription(context, description, parsed_offset);
  440|   911k|    }
  441|   911k|}
_ZN10QPDFParser14fixMissingKeysEv:
  445|  58.0k|{
  446|  58.0k|    std::set<std::string> names;
  447|   206k|    for (auto& obj: frame->olist) {
  ------------------
  |  Branch (447:19): [True: 206k, False: 58.0k]
  ------------------
  448|   206k|        if (obj->getTypeCode() == ::ot_name) {
  ------------------
  |  Branch (448:13): [True: 188, False: 206k]
  ------------------
  449|    188|            names.insert(obj->getStringValue());
  450|    188|        }
  451|   206k|    }
  452|  58.0k|    int next_fake_key = 1;
  453|   199k|    for (auto const& item: frame->olist) {
  ------------------
  |  Branch (453:26): [True: 199k, False: 58.0k]
  ------------------
  454|   199k|        while (true) {
  ------------------
  |  Branch (454:16): [Folded - Ignored]
  ------------------
  455|   199k|            const std::string key = "/QPDFFake" + std::to_string(next_fake_key++);
  456|   199k|            const bool found_fake = frame->dict.count(key) == 0 && names.count(key) == 0;
  ------------------
  |  Branch (456:37): [True: 199k, False: 69]
  |  Branch (456:68): [True: 199k, False: 12]
  ------------------
  457|   199k|            QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1));
  ------------------
  |  Branch (457:55): [True: 199k, False: 81]
  ------------------
  458|   199k|            if (found_fake) {
  ------------------
  |  Branch (458:17): [True: 199k, False: 81]
  ------------------
  459|   199k|                warn(
  460|   199k|                    frame->offset,
  461|   199k|                    "expected dictionary key but found non-name object; inserting key " + key);
  462|   199k|                frame->dict[key] = item;
  463|   199k|                break;
  464|   199k|            }
  465|   199k|        }
  466|   199k|    }
  467|  58.0k|}
_ZN10QPDFParser16tooManyBadTokensEv:
  471|   357k|{
  472|   357k|    if (good_count <= 4) {
  ------------------
  |  Branch (472:9): [True: 227k, False: 130k]
  ------------------
  473|   227k|        if (++bad_count > 5) {
  ------------------
  |  Branch (473:13): [True: 15.3k, False: 211k]
  ------------------
  474|  15.3k|            warn("too many errors; giving up on reading object");
  475|  15.3k|            return true;
  476|  15.3k|        }
  477|   227k|    } else {
  478|   130k|        bad_count = 1;
  479|   130k|    }
  480|   341k|    good_count = 0;
  481|   341k|    return false;
  482|   357k|}
_ZNK10QPDFParser4warnERK7QPDFExc:
  486|   622k|{
  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|   622k|    if (context) {
  ------------------
  |  Branch (490:9): [True: 622k, False: 0]
  ------------------
  491|   622k|        context->warn(e);
  492|   622k|    } else {
  493|      0|        throw e;
  494|      0|    }
  495|   622k|}
_ZN10QPDFParser16warnDuplicateKeyEv:
  499|  18.2k|{
  500|  18.2k|    QTC::TC("qpdf", "QPDFParser duplicate dict key");
  501|  18.2k|    warn(
  502|  18.2k|        frame->offset,
  503|  18.2k|        "dictionary has duplicated key " + frame->key + "; last occurrence overrides earlier ones");
  504|  18.2k|}
_ZNK10QPDFParser4warnExRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  508|   622k|{
  509|   622k|    warn(QPDFExc(qpdf_e_damaged_pdf, input->getName(), object_description, offset, msg));
  510|   622k|}
_ZNK10QPDFParser4warnERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  514|   399k|{
  515|   399k|    warn(input->getLastOffset(), msg);
  516|   399k|}
_ZN10QPDFParser15withDescriptionI9QPDF_BoolJbEEE16QPDFObjectHandleDpOT0_:
  429|    561|{
  430|    561|    auto obj = T::create(args...);
  431|    561|    obj->setDescription(context, description, start);
  432|    561|    return {obj};
  433|    561|}
_ZN10QPDFParser15withDescriptionI12QPDF_IntegerJxEEE16QPDFObjectHandleDpOT0_:
  429|  48.1k|{
  430|  48.1k|    auto obj = T::create(args...);
  431|  48.1k|    obj->setDescription(context, description, start);
  432|  48.1k|    return {obj};
  433|  48.1k|}
_ZN10QPDFParser15withDescriptionI9QPDF_RealJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  429|    141|{
  430|    141|    auto obj = T::create(args...);
  431|    141|    obj->setDescription(context, description, start);
  432|    141|    return {obj};
  433|    141|}
_ZN10QPDFParser15withDescriptionI9QPDF_NameJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  429|  16.2k|{
  430|  16.2k|    auto obj = T::create(args...);
  431|  16.2k|    obj->setDescription(context, description, start);
  432|  16.2k|    return {obj};
  433|  16.2k|}
_ZN10QPDFParser15withDescriptionI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  429|  5.50k|{
  430|  5.50k|    auto obj = T::create(args...);
  431|  5.50k|    obj->setDescription(context, description, start);
  432|  5.50k|    return {obj};
  433|  5.50k|}
_ZN10QPDFParser15withDescriptionI11QPDF_StringJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  429|     56|{
  430|     56|    auto obj = T::create(args...);
  431|     56|    obj->setDescription(context, description, start);
  432|     56|    return {obj};
  433|     56|}
_ZN10QPDFParser9addScalarI9QPDF_BoolJbEEEvDpOT0_:
  420|  17.1k|{
  421|  17.1k|    auto obj = T::create(args...);
  422|  17.1k|    obj->setDescription(context, description, input->getLastOffset());
  423|  17.1k|    add(std::move(obj));
  424|  17.1k|}
_ZN10QPDFParser9addScalarI9QPDF_RealJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEEvDpOT0_:
  420|   377k|{
  421|   377k|    auto obj = T::create(args...);
  422|   377k|    obj->setDescription(context, description, input->getLastOffset());
  423|   377k|    add(std::move(obj));
  424|   377k|}
_ZN10QPDFParser9addScalarI9QPDF_NameJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEEvDpOT0_:
  420|  1.08M|{
  421|  1.08M|    auto obj = T::create(args...);
  422|  1.08M|    obj->setDescription(context, description, input->getLastOffset());
  423|  1.08M|    add(std::move(obj));
  424|  1.08M|}
_ZN10QPDFParser9addScalarI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEEvDpOT0_:
  420|   469k|{
  421|   469k|    auto obj = T::create(args...);
  422|   469k|    obj->setDescription(context, description, input->getLastOffset());
  423|   469k|    add(std::move(obj));
  424|   469k|}
_ZN10QPDFParser9addScalarI11QPDF_StringJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEEvDpOT0_:
  420|  8.08k|{
  421|  8.08k|    auto obj = T::create(args...);
  422|  8.08k|    obj->setDescription(context, description, input->getLastOffset());
  423|  8.08k|    add(std::move(obj));
  424|  8.08k|}

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

_ZN13QPDFTokenizer5resetEv:
   78|  44.6M|{
   79|  44.6M|    state = st_before_token;
   80|  44.6M|    type = tt_bad;
   81|  44.6M|    val.clear();
   82|  44.6M|    raw_val.clear();
   83|  44.6M|    error_message = "";
   84|  44.6M|    before_token = true;
   85|  44.6M|    in_token = false;
   86|  44.6M|    char_to_unread = '\0';
   87|  44.6M|    inline_image_bytes = 0;
   88|  44.6M|    string_depth = 0;
   89|  44.6M|    bad = false;
   90|  44.6M|}
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
   96|  11.4k|{
   97|  11.4k|    if (type == tt_string) {
  ------------------
  |  Branch (97:9): [True: 0, False: 11.4k]
  ------------------
   98|      0|        raw_value = QPDFObjectHandle::newString(value).unparse();
   99|  11.4k|    } else if (type == tt_name) {
  ------------------
  |  Branch (99:16): [True: 0, False: 11.4k]
  ------------------
  100|      0|        raw_value = QPDFObjectHandle::newName(value).unparse();
  101|      0|    }
  102|  11.4k|}
_ZN13QPDFTokenizerC2Ev:
  107|  60.2k|{
  108|  60.2k|    reset();
  109|  60.2k|}
_ZN13QPDFTokenizer8allowEOFEv:
  113|  20.2k|{
  114|  20.2k|    this->allow_eof = true;
  115|  20.2k|}
_ZN13QPDFTokenizer16includeIgnorableEv:
  119|  7.78k|{
  120|  7.78k|    this->include_ignorable = true;
  121|  7.78k|}
_ZN13QPDFTokenizer7isSpaceEc:
  125|  83.2M|{
  126|  83.2M|    return ((ch == '\0') || QUtil::is_space(ch));
  ------------------
  |  Branch (126:13): [True: 18.6M, False: 64.6M]
  |  Branch (126:29): [True: 35.5M, False: 29.0M]
  ------------------
  127|  83.2M|}
_ZN13QPDFTokenizer11isDelimiterEc:
  131|   146M|{
  132|   146M|    return is_delimiter(ch);
  133|   146M|}
_ZN13QPDFTokenizer16presentCharacterEc:
  137|  20.7k|{
  138|  20.7k|    handleCharacter(ch);
  139|       |
  140|  20.7k|    if (this->in_token) {
  ------------------
  |  Branch (140:9): [True: 0, False: 20.7k]
  ------------------
  141|      0|        this->raw_val += ch;
  142|      0|    }
  143|  20.7k|}
_ZN13QPDFTokenizer15handleCharacterEc:
  147|   665M|{
  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|   665M|    switch (this->state) {
  152|      0|    case st_top:
  ------------------
  |  Branch (152:5): [True: 0, False: 665M]
  ------------------
  153|      0|        inTop(ch);
  154|      0|        return;
  155|       |
  156|  3.20M|    case st_in_space:
  ------------------
  |  Branch (156:5): [True: 3.20M, False: 662M]
  ------------------
  157|  3.20M|        inSpace(ch);
  158|  3.20M|        return;
  159|       |
  160|  4.48M|    case st_in_comment:
  ------------------
  |  Branch (160:5): [True: 4.48M, False: 661M]
  ------------------
  161|  4.48M|        inComment(ch);
  162|  4.48M|        return;
  163|       |
  164|  1.46M|    case st_lt:
  ------------------
  |  Branch (164:5): [True: 1.46M, False: 664M]
  ------------------
  165|  1.46M|        inLt(ch);
  166|  1.46M|        return;
  167|       |
  168|   946k|    case st_gt:
  ------------------
  |  Branch (168:5): [True: 946k, False: 664M]
  ------------------
  169|   946k|        inGt(ch);
  170|   946k|        return;
  171|       |
  172|   392M|    case st_in_string:
  ------------------
  |  Branch (172:5): [True: 392M, False: 273M]
  ------------------
  173|   392M|        inString(ch);
  174|   392M|        return;
  175|       |
  176|  60.9M|    case st_name:
  ------------------
  |  Branch (176:5): [True: 60.9M, False: 604M]
  ------------------
  177|  60.9M|        inName(ch);
  178|  60.9M|        return;
  179|       |
  180|  25.9M|    case st_number:
  ------------------
  |  Branch (180:5): [True: 25.9M, False: 639M]
  ------------------
  181|  25.9M|        inNumber(ch);
  182|  25.9M|        return;
  183|       |
  184|  3.19M|    case st_real:
  ------------------
  |  Branch (184:5): [True: 3.19M, False: 662M]
  ------------------
  185|  3.19M|        inReal(ch);
  186|  3.19M|        return;
  187|       |
  188|  2.01M|    case st_string_after_cr:
  ------------------
  |  Branch (188:5): [True: 2.01M, False: 663M]
  ------------------
  189|  2.01M|        inStringAfterCR(ch);
  190|  2.01M|        return;
  191|       |
  192|   136k|    case st_string_escape:
  ------------------
  |  Branch (192:5): [True: 136k, False: 665M]
  ------------------
  193|   136k|        inStringEscape(ch);
  194|   136k|        return;
  195|       |
  196|  16.4k|    case st_char_code:
  ------------------
  |  Branch (196:5): [True: 16.4k, False: 665M]
  ------------------
  197|  16.4k|        inCharCode(ch);
  198|  16.4k|        return;
  199|       |
  200|  76.1M|    case st_literal:
  ------------------
  |  Branch (200:5): [True: 76.1M, False: 589M]
  ------------------
  201|  76.1M|        inLiteral(ch);
  202|  76.1M|        return;
  203|       |
  204|  12.5M|    case st_inline_image:
  ------------------
  |  Branch (204:5): [True: 12.5M, False: 653M]
  ------------------
  205|  12.5M|        inInlineImage(ch);
  206|  12.5M|        return;
  207|       |
  208|  1.40M|    case st_in_hexstring:
  ------------------
  |  Branch (208:5): [True: 1.40M, False: 664M]
  ------------------
  209|  1.40M|        inHexstring(ch);
  210|  1.40M|        return;
  211|       |
  212|  1.20M|    case st_in_hexstring_2nd:
  ------------------
  |  Branch (212:5): [True: 1.20M, False: 664M]
  ------------------
  213|  1.20M|        inHexstring2nd(ch);
  214|  1.20M|        return;
  215|       |
  216|  18.4k|    case st_name_hex1:
  ------------------
  |  Branch (216:5): [True: 18.4k, False: 665M]
  ------------------
  217|  18.4k|        inNameHex1(ch);
  218|  18.4k|        return;
  219|       |
  220|  5.17k|    case st_name_hex2:
  ------------------
  |  Branch (220:5): [True: 5.17k, False: 665M]
  ------------------
  221|  5.17k|        inNameHex2(ch);
  222|  5.17k|        return;
  223|       |
  224|   234k|    case st_sign:
  ------------------
  |  Branch (224:5): [True: 234k, False: 665M]
  ------------------
  225|   234k|        inSign(ch);
  226|   234k|        return;
  227|       |
  228|  15.6k|    case st_decimal:
  ------------------
  |  Branch (228:5): [True: 15.6k, False: 665M]
  ------------------
  229|  15.6k|        inDecimal(ch);
  230|  15.6k|        return;
  231|       |
  232|  79.6M|    case (st_before_token):
  ------------------
  |  Branch (232:5): [True: 79.6M, False: 586M]
  ------------------
  233|  79.6M|        inBeforeToken(ch);
  234|  79.6M|        return;
  235|       |
  236|      0|    case (st_token_ready):
  ------------------
  |  Branch (236:5): [True: 0, False: 665M]
  ------------------
  237|      0|        inTokenReady(ch);
  238|      0|        return;
  239|       |
  240|      0|    default:
  ------------------
  |  Branch (240:5): [True: 0, False: 665M]
  ------------------
  241|      0|        throw std::logic_error("INTERNAL ERROR: invalid state while reading token");
  242|   665M|    }
  243|   665M|}
_ZN13QPDFTokenizer13inBeforeTokenEc:
  254|  79.6M|{
  255|       |    // Note: we specifically do not use ctype here.  It is locale-dependent.
  256|  79.6M|    if (isSpace(ch)) {
  ------------------
  |  Branch (256:9): [True: 52.9M, False: 26.6M]
  ------------------
  257|  52.9M|        this->before_token = !this->include_ignorable;
  258|  52.9M|        this->in_token = this->include_ignorable;
  259|  52.9M|        if (this->include_ignorable) {
  ------------------
  |  Branch (259:13): [True: 2.25M, False: 50.7M]
  ------------------
  260|  2.25M|            this->state = st_in_space;
  261|  2.25M|        }
  262|  52.9M|    } else if (ch == '%') {
  ------------------
  |  Branch (262:16): [True: 117k, False: 26.5M]
  ------------------
  263|   117k|        this->before_token = !this->include_ignorable;
  264|   117k|        this->in_token = this->include_ignorable;
  265|   117k|        this->state = st_in_comment;
  266|  26.5M|    } else {
  267|  26.5M|        this->before_token = false;
  268|  26.5M|        this->in_token = true;
  269|  26.5M|        inTop(ch);
  270|  26.5M|    }
  271|  79.6M|}
_ZN13QPDFTokenizer5inTopEc:
  275|  26.5M|{
  276|  26.5M|    switch (ch) {
  277|   362k|    case '(':
  ------------------
  |  Branch (277:5): [True: 362k, False: 26.2M]
  ------------------
  278|   362k|        this->string_depth = 1;
  279|   362k|        this->state = st_in_string;
  280|   362k|        return;
  281|       |
  282|  1.46M|    case '<':
  ------------------
  |  Branch (282:5): [True: 1.46M, False: 25.1M]
  ------------------
  283|  1.46M|        this->state = st_lt;
  284|  1.46M|        return;
  285|       |
  286|   946k|    case '>':
  ------------------
  |  Branch (286:5): [True: 946k, False: 25.6M]
  ------------------
  287|   946k|        this->state = st_gt;
  288|   946k|        return;
  289|       |
  290|   159k|    case (')'):
  ------------------
  |  Branch (290:5): [True: 159k, False: 26.4M]
  ------------------
  291|   159k|        this->type = tt_bad;
  292|   159k|        QTC::TC("qpdf", "QPDFTokenizer bad )");
  293|   159k|        this->error_message = "unexpected )";
  294|   159k|        this->state = st_token_ready;
  295|   159k|        return;
  296|       |
  297|   412k|    case '[':
  ------------------
  |  Branch (297:5): [True: 412k, False: 26.1M]
  ------------------
  298|   412k|        this->type = tt_array_open;
  299|   412k|        this->state = st_token_ready;
  300|   412k|        return;
  301|       |
  302|   531k|    case ']':
  ------------------
  |  Branch (302:5): [True: 531k, False: 26.0M]
  ------------------
  303|   531k|        this->type = tt_array_close;
  304|   531k|        this->state = st_token_ready;
  305|   531k|        return;
  306|       |
  307|  9.41k|    case '{':
  ------------------
  |  Branch (307:5): [True: 9.41k, False: 26.5M]
  ------------------
  308|  9.41k|        this->type = tt_brace_open;
  309|  9.41k|        this->state = st_token_ready;
  310|  9.41k|        return;
  311|       |
  312|  8.50k|    case '}':
  ------------------
  |  Branch (312:5): [True: 8.50k, False: 26.5M]
  ------------------
  313|  8.50k|        this->type = tt_brace_close;
  314|  8.50k|        this->state = st_token_ready;
  315|  8.50k|        return;
  316|       |
  317|  5.28M|    case '/':
  ------------------
  |  Branch (317:5): [True: 5.28M, False: 21.2M]
  ------------------
  318|  5.28M|        this->state = st_name;
  319|  5.28M|        this->val += ch;
  320|  5.28M|        return;
  321|       |
  322|  3.77M|    case '0':
  ------------------
  |  Branch (322:5): [True: 3.77M, False: 22.7M]
  ------------------
  323|  5.63M|    case '1':
  ------------------
  |  Branch (323:5): [True: 1.86M, False: 24.7M]
  ------------------
  324|  6.37M|    case '2':
  ------------------
  |  Branch (324:5): [True: 736k, False: 25.8M]
  ------------------
  325|  6.89M|    case '3':
  ------------------
  |  Branch (325:5): [True: 524k, False: 26.0M]
  ------------------
  326|  7.39M|    case '4':
  ------------------
  |  Branch (326:5): [True: 497k, False: 26.0M]
  ------------------
  327|  8.14M|    case '5':
  ------------------
  |  Branch (327:5): [True: 750k, False: 25.8M]
  ------------------
  328|  8.73M|    case '6':
  ------------------
  |  Branch (328:5): [True: 588k, False: 25.9M]
  ------------------
  329|  9.23M|    case '7':
  ------------------
  |  Branch (329:5): [True: 500k, False: 26.0M]
  ------------------
  330|  9.67M|    case '8':
  ------------------
  |  Branch (330:5): [True: 439k, False: 26.1M]
  ------------------
  331|  9.90M|    case '9':
  ------------------
  |  Branch (331:5): [True: 229k, False: 26.3M]
  ------------------
  332|  9.90M|        this->state = st_number;
  333|  9.90M|        return;
  334|       |
  335|  5.12k|    case '+':
  ------------------
  |  Branch (335:5): [True: 5.12k, False: 26.5M]
  ------------------
  336|   234k|    case '-':
  ------------------
  |  Branch (336:5): [True: 229k, False: 26.3M]
  ------------------
  337|   234k|        this->state = st_sign;
  338|   234k|        return;
  339|       |
  340|  14.7k|    case '.':
  ------------------
  |  Branch (340:5): [True: 14.7k, False: 26.5M]
  ------------------
  341|  14.7k|        this->state = st_decimal;
  342|  14.7k|        return;
  343|       |
  344|  7.23M|    default:
  ------------------
  |  Branch (344:5): [True: 7.23M, False: 19.3M]
  ------------------
  345|  7.23M|        this->state = st_literal;
  346|  7.23M|        return;
  347|  26.5M|    }
  348|  26.5M|}
_ZN13QPDFTokenizer7inSpaceEc:
  352|  3.20M|{
  353|       |    // We only enter this state if include_ignorable is true.
  354|  3.20M|    if (!isSpace(ch)) {
  ------------------
  |  Branch (354:9): [True: 2.24M, False: 962k]
  ------------------
  355|  2.24M|        this->type = tt_space;
  356|  2.24M|        this->in_token = false;
  357|  2.24M|        this->char_to_unread = ch;
  358|  2.24M|        this->state = st_token_ready;
  359|  2.24M|    }
  360|  3.20M|}
_ZN13QPDFTokenizer9inCommentEc:
  364|  4.48M|{
  365|  4.48M|    if ((ch == '\r') || (ch == '\n')) {
  ------------------
  |  Branch (365:9): [True: 18.8k, False: 4.46M]
  |  Branch (365:25): [True: 97.6k, False: 4.36M]
  ------------------
  366|   116k|        if (this->include_ignorable) {
  ------------------
  |  Branch (366:13): [True: 1.86k, False: 114k]
  ------------------
  367|  1.86k|            this->type = tt_comment;
  368|  1.86k|            this->in_token = false;
  369|  1.86k|            this->char_to_unread = ch;
  370|  1.86k|            this->state = st_token_ready;
  371|   114k|        } else {
  372|   114k|            this->state = st_before_token;
  373|   114k|        }
  374|   116k|    }
  375|  4.48M|}
_ZN13QPDFTokenizer8inStringEc:
  379|   393M|{
  380|   393M|    switch (ch) {
  381|   136k|    case '\\':
  ------------------
  |  Branch (381:5): [True: 136k, False: 393M]
  ------------------
  382|   136k|        this->state = st_string_escape;
  383|   136k|        return;
  384|       |
  385|  9.10M|    case '(':
  ------------------
  |  Branch (385:5): [True: 9.10M, False: 384M]
  ------------------
  386|  9.10M|        this->val += ch;
  387|  9.10M|        ++this->string_depth;
  388|  9.10M|        return;
  389|       |
  390|   881k|    case ')':
  ------------------
  |  Branch (390:5): [True: 881k, False: 392M]
  ------------------
  391|   881k|        if (--this->string_depth == 0) {
  ------------------
  |  Branch (391:13): [True: 318k, False: 563k]
  ------------------
  392|   318k|            this->type = tt_string;
  393|   318k|            this->state = st_token_ready;
  394|   318k|            return;
  395|   318k|        }
  396|       |
  397|   563k|        this->val += ch;
  398|   563k|        return;
  399|       |
  400|  2.01M|    case '\r':
  ------------------
  |  Branch (400:5): [True: 2.01M, False: 391M]
  ------------------
  401|       |        // CR by itself is converted to LF
  402|  2.01M|        this->val += '\n';
  403|  2.01M|        this->state = st_string_after_cr;
  404|  2.01M|        return;
  405|       |
  406|  2.82M|    case '\n':
  ------------------
  |  Branch (406:5): [True: 2.82M, False: 390M]
  ------------------
  407|  2.82M|        this->val += ch;
  408|  2.82M|        return;
  409|       |
  410|   378M|    default:
  ------------------
  |  Branch (410:5): [True: 378M, False: 14.9M]
  ------------------
  411|   378M|        this->val += ch;
  412|   378M|        return;
  413|   393M|    }
  414|   393M|}
_ZN13QPDFTokenizer6inNameEc:
  418|  60.9M|{
  419|  60.9M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (419:9): [True: 5.14M, False: 55.8M]
  ------------------
  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|  5.14M|        this->type = this->bad ? tt_bad : tt_name;
  ------------------
  |  Branch (426:22): [True: 53, False: 5.14M]
  ------------------
  427|  5.14M|        this->in_token = false;
  428|  5.14M|        this->char_to_unread = ch;
  429|  5.14M|        this->state = st_token_ready;
  430|  55.8M|    } else if (ch == '#') {
  ------------------
  |  Branch (430:16): [True: 18.5k, False: 55.8M]
  ------------------
  431|  18.5k|        this->char_code = 0;
  432|  18.5k|        this->state = st_name_hex1;
  433|  55.8M|    } else {
  434|  55.8M|        this->val += ch;
  435|  55.8M|    }
  436|  60.9M|}
_ZN13QPDFTokenizer10inNameHex1Ec:
  440|  18.4k|{
  441|  18.4k|    this->hex_char = ch;
  442|       |
  443|  18.4k|    if (char hval = QUtil::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (443:49): [True: 5.21k, False: 13.2k]
  ------------------
  444|  5.21k|        this->char_code = int(hval) << 4;
  445|  5.21k|        this->state = st_name_hex2;
  446|  13.2k|    } else {
  447|  13.2k|        QTC::TC("qpdf", "QPDFTokenizer bad name 1");
  448|  13.2k|        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|  13.2k|        this->val += '\0';
  451|  13.2k|        this->state = st_name;
  452|  13.2k|        inName(ch);
  453|  13.2k|    }
  454|  18.4k|}
_ZN13QPDFTokenizer10inNameHex2Ec:
  458|  5.17k|{
  459|  5.17k|    if (char hval = QUtil::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (459:49): [True: 4.05k, False: 1.11k]
  ------------------
  460|  4.05k|        this->char_code |= int(hval);
  461|  4.05k|    } else {
  462|  1.11k|        QTC::TC("qpdf", "QPDFTokenizer bad name 2");
  463|  1.11k|        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|  1.11k|        this->val += '\0';
  466|  1.11k|        this->val += this->hex_char;
  467|  1.11k|        this->state = st_name;
  468|  1.11k|        inName(ch);
  469|  1.11k|        return;
  470|  1.11k|    }
  471|  4.05k|    if (this->char_code == 0) {
  ------------------
  |  Branch (471:9): [True: 76, False: 3.98k]
  ------------------
  472|     76|        QTC::TC("qpdf", "QPDFTokenizer null in name");
  473|     76|        this->error_message = "null character not allowed in name token";
  474|     76|        this->val += "#00";
  475|     76|        this->state = st_name;
  476|     76|        this->bad = true;
  477|  3.98k|    } else {
  478|  3.98k|        this->val += char(this->char_code);
  479|  3.98k|        this->state = st_name;
  480|  3.98k|    }
  481|  4.05k|}
_ZN13QPDFTokenizer6inSignEc:
  485|   234k|{
  486|   234k|    if (QUtil::is_digit(ch)) {
  ------------------
  |  Branch (486:9): [True: 221k, False: 13.4k]
  ------------------
  487|   221k|        this->state = st_number;
  488|   221k|    } else if (ch == '.') {
  ------------------
  |  Branch (488:16): [True: 928, False: 12.5k]
  ------------------
  489|    928|        this->state = st_decimal;
  490|  12.5k|    } else {
  491|  12.5k|        this->state = st_literal;
  492|  12.5k|        inLiteral(ch);
  493|  12.5k|    }
  494|   234k|}
_ZN13QPDFTokenizer9inDecimalEc:
  498|  15.6k|{
  499|  15.6k|    if (QUtil::is_digit(ch)) {
  ------------------
  |  Branch (499:9): [True: 6.23k, False: 9.40k]
  ------------------
  500|  6.23k|        this->state = st_real;
  501|  9.40k|    } else {
  502|  9.40k|        this->state = st_literal;
  503|  9.40k|        inLiteral(ch);
  504|  9.40k|    }
  505|  15.6k|}
_ZN13QPDFTokenizer8inNumberEc:
  509|  25.9M|{
  510|  25.9M|    if (QUtil::is_digit(ch)) {
  ------------------
  |  Branch (510:9): [True: 16.2M, False: 9.73M]
  ------------------
  511|  16.2M|    } else if (ch == '.') {
  ------------------
  |  Branch (511:16): [True: 1.00M, False: 8.72M]
  ------------------
  512|  1.00M|        this->state = st_real;
  513|  8.72M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (513:16): [True: 8.58M, False: 137k]
  ------------------
  514|  8.58M|        this->type = tt_integer;
  515|  8.58M|        this->state = st_token_ready;
  516|  8.58M|        this->in_token = false;
  517|  8.58M|        this->char_to_unread = ch;
  518|  8.58M|    } else {
  519|   137k|        this->state = st_literal;
  520|   137k|    }
  521|  25.9M|}
_ZN13QPDFTokenizer6inRealEc:
  525|  3.19M|{
  526|  3.19M|    if (QUtil::is_digit(ch)) {
  ------------------
  |  Branch (526:9): [True: 2.18M, False: 1.01M]
  ------------------
  527|  2.18M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (527:16): [True: 1.00M, False: 11.5k]
  ------------------
  528|  1.00M|        this->type = tt_real;
  529|  1.00M|        this->state = st_token_ready;
  530|  1.00M|        this->in_token = false;
  531|  1.00M|        this->char_to_unread = ch;
  532|  1.00M|    } else {
  533|  11.5k|        this->state = st_literal;
  534|  11.5k|    }
  535|  3.19M|}
_ZN13QPDFTokenizer14inStringEscapeEc:
  538|   136k|{
  539|   136k|    this->state = st_in_string;
  540|   136k|    switch (ch) {
  541|  3.07k|    case '0':
  ------------------
  |  Branch (541:5): [True: 3.07k, False: 133k]
  ------------------
  542|  4.13k|    case '1':
  ------------------
  |  Branch (542:5): [True: 1.06k, False: 135k]
  ------------------
  543|  5.34k|    case '2':
  ------------------
  |  Branch (543:5): [True: 1.21k, False: 135k]
  ------------------
  544|  6.42k|    case '3':
  ------------------
  |  Branch (544:5): [True: 1.07k, False: 135k]
  ------------------
  545|  8.89k|    case '4':
  ------------------
  |  Branch (545:5): [True: 2.46k, False: 134k]
  ------------------
  546|  10.2k|    case '5':
  ------------------
  |  Branch (546:5): [True: 1.39k, False: 135k]
  ------------------
  547|  10.7k|    case '6':
  ------------------
  |  Branch (547:5): [True: 508, False: 136k]
  ------------------
  548|  11.3k|    case '7':
  ------------------
  |  Branch (548:5): [True: 574, False: 136k]
  ------------------
  549|  11.3k|        this->state = st_char_code;
  550|  11.3k|        this->char_code = 0;
  551|  11.3k|        this->digit_count = 0;
  552|  11.3k|        inCharCode(ch);
  553|  11.3k|        return;
  554|       |
  555|  6.12k|    case 'n':
  ------------------
  |  Branch (555:5): [True: 6.12k, False: 130k]
  ------------------
  556|  6.12k|        this->val += '\n';
  557|  6.12k|        return;
  558|       |
  559|  8.71k|    case 'r':
  ------------------
  |  Branch (559:5): [True: 8.71k, False: 128k]
  ------------------
  560|  8.71k|        this->val += '\r';
  561|  8.71k|        return;
  562|       |
  563|    763|    case 't':
  ------------------
  |  Branch (563:5): [True: 763, False: 136k]
  ------------------
  564|    763|        this->val += '\t';
  565|    763|        return;
  566|       |
  567|  1.15k|    case 'b':
  ------------------
  |  Branch (567:5): [True: 1.15k, False: 135k]
  ------------------
  568|  1.15k|        this->val += '\b';
  569|  1.15k|        return;
  570|       |
  571|  1.41k|    case 'f':
  ------------------
  |  Branch (571:5): [True: 1.41k, False: 135k]
  ------------------
  572|  1.41k|        this->val += '\f';
  573|  1.41k|        return;
  574|       |
  575|  1.00k|    case '\n':
  ------------------
  |  Branch (575:5): [True: 1.00k, False: 135k]
  ------------------
  576|  1.00k|        return;
  577|       |
  578|  1.82k|    case '\r':
  ------------------
  |  Branch (578:5): [True: 1.82k, False: 135k]
  ------------------
  579|  1.82k|        this->state = st_string_after_cr;
  580|  1.82k|        return;
  581|       |
  582|   104k|    default:
  ------------------
  |  Branch (582:5): [True: 104k, False: 32.3k]
  ------------------
  583|       |        // PDF spec says backslash is ignored before anything else
  584|   104k|        this->val += ch;
  585|   104k|        return;
  586|   136k|    }
  587|   136k|}
_ZN13QPDFTokenizer15inStringAfterCREc:
  591|  2.01M|{
  592|  2.01M|    this->state = st_in_string;
  593|  2.01M|    if (ch != '\n') {
  ------------------
  |  Branch (593:9): [True: 1.57M, False: 441k]
  ------------------
  594|  1.57M|        inString(ch);
  595|  1.57M|    }
  596|  2.01M|}
_ZN13QPDFTokenizer4inLtEc:
  600|  1.46M|{
  601|  1.46M|    if (ch == '<') {
  ------------------
  |  Branch (601:9): [True: 1.21M, False: 252k]
  ------------------
  602|  1.21M|        this->type = tt_dict_open;
  603|  1.21M|        this->state = st_token_ready;
  604|  1.21M|        return;
  605|  1.21M|    }
  606|       |
  607|   252k|    this->state = st_in_hexstring;
  608|   252k|    inHexstring(ch);
  609|   252k|}
_ZN13QPDFTokenizer4inGtEc:
  613|   946k|{
  614|   946k|    if (ch == '>') {
  ------------------
  |  Branch (614:9): [True: 918k, False: 28.3k]
  ------------------
  615|   918k|        this->type = tt_dict_close;
  616|   918k|        this->state = st_token_ready;
  617|   918k|    } else {
  618|  28.3k|        this->type = tt_bad;
  619|  28.3k|        QTC::TC("qpdf", "QPDFTokenizer bad >");
  620|  28.3k|        this->error_message = "unexpected >";
  621|  28.3k|        this->in_token = false;
  622|  28.3k|        this->char_to_unread = ch;
  623|  28.3k|        this->state = st_token_ready;
  624|  28.3k|    }
  625|   946k|}
_ZN13QPDFTokenizer9inLiteralEc:
  629|  76.1M|{
  630|  76.1M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (630:9): [True: 6.80M, False: 69.3M]
  ------------------
  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|  6.80M|        this->in_token = false;
  637|  6.80M|        this->char_to_unread = ch;
  638|  6.80M|        this->state = st_token_ready;
  639|  6.80M|        this->type = (this->raw_val == "true") || (this->raw_val == "false")
  ------------------
  |  Branch (639:22): [True: 13.9k, False: 6.78M]
  |  Branch (639:51): [True: 5.27k, False: 6.78M]
  ------------------
  640|  6.80M|            ? tt_bool
  641|  6.80M|            : (this->raw_val == "null" ? tt_null : tt_word);
  ------------------
  |  Branch (641:16): [True: 641k, False: 6.14M]
  ------------------
  642|  6.80M|    }
  643|  76.1M|}
_ZN13QPDFTokenizer11inHexstringEc:
  647|  1.65M|{
  648|  1.65M|    if (char hval = QUtil::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (648:49): [True: 1.19M, False: 456k]
  ------------------
  649|  1.19M|        this->char_code = int(hval) << 4;
  650|  1.19M|        this->state = st_in_hexstring_2nd;
  651|       |
  652|  1.19M|    } else if (ch == '>') {
  ------------------
  |  Branch (652:16): [True: 90.1k, False: 366k]
  ------------------
  653|  90.1k|        this->type = tt_string;
  654|  90.1k|        this->state = st_token_ready;
  655|       |
  656|   366k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (656:16): [True: 232k, False: 134k]
  ------------------
  657|       |        // ignore
  658|       |
  659|   232k|    } else {
  660|   134k|        this->type = tt_bad;
  661|   134k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
  662|   134k|        this->error_message = std::string("invalid character (") + ch + ") in hexstring";
  663|   134k|        this->state = st_token_ready;
  664|   134k|    }
  665|  1.65M|}
_ZN13QPDFTokenizer14inHexstring2ndEc:
  669|  1.20M|{
  670|  1.20M|    if (char hval = QUtil::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (670:49): [True: 1.16M, False: 38.6k]
  ------------------
  671|  1.16M|        this->val += char(this->char_code) | hval;
  672|  1.16M|        this->state = st_in_hexstring;
  673|       |
  674|  1.16M|    } else if (ch == '>') {
  ------------------
  |  Branch (674:16): [True: 1.05k, False: 37.5k]
  ------------------
  675|       |        // PDF spec says odd hexstrings have implicit trailing 0.
  676|  1.05k|        this->val += char(this->char_code);
  677|  1.05k|        this->type = tt_string;
  678|  1.05k|        this->state = st_token_ready;
  679|       |
  680|  37.5k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (680:16): [True: 30.8k, False: 6.79k]
  ------------------
  681|       |        // ignore
  682|       |
  683|  30.8k|    } else {
  684|  6.79k|        this->type = tt_bad;
  685|  6.79k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
  686|  6.79k|        this->error_message = std::string("invalid character (") + ch + ") in hexstring";
  687|  6.79k|        this->state = st_token_ready;
  688|  6.79k|    }
  689|  1.20M|}
_ZN13QPDFTokenizer10inCharCodeEc:
  693|  27.8k|{
  694|  27.8k|    bool handled = false;
  695|  27.8k|    if (('0' <= ch) && (ch <= '7')) {
  ------------------
  |  Branch (695:9): [True: 22.7k, False: 5.04k]
  |  Branch (695:24): [True: 20.9k, False: 1.86k]
  ------------------
  696|  20.9k|        this->char_code = 8 * this->char_code + (int(ch) - int('0'));
  697|  20.9k|        if (++(this->digit_count) < 3) {
  ------------------
  |  Branch (697:13): [True: 16.4k, False: 4.45k]
  ------------------
  698|  16.4k|            return;
  699|  16.4k|        }
  700|  4.45k|        handled = true;
  701|  4.45k|    }
  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|  11.3k|    this->val += char(this->char_code % 256);
  705|  11.3k|    this->state = st_in_string;
  706|  11.3k|    if (!handled) {
  ------------------
  |  Branch (706:9): [True: 6.91k, False: 4.45k]
  ------------------
  707|  6.91k|        inString(ch);
  708|  6.91k|    }
  709|  11.3k|}
_ZN13QPDFTokenizer13inInlineImageEc:
  713|  12.5M|{
  714|  12.5M|    if ((this->raw_val.length() + 1) == this->inline_image_bytes) {
  ------------------
  |  Branch (714:9): [True: 864, False: 12.5M]
  ------------------
  715|    864|        QTC::TC("qpdf", "QPDFTokenizer found EI by byte count");
  716|    864|        this->type = tt_inline_image;
  717|    864|        this->inline_image_bytes = 0;
  718|    864|        this->state = st_token_ready;
  719|    864|    }
  720|  12.5M|}
_ZN13QPDFTokenizer10presentEOFEv:
  724|  64.4k|{
  725|  64.4k|    switch (this->state) {
  726|  16.3k|    case st_name:
  ------------------
  |  Branch (726:5): [True: 16.3k, False: 48.1k]
  ------------------
  727|  16.3k|    case st_name_hex1:
  ------------------
  |  Branch (727:5): [True: 16, False: 64.4k]
  ------------------
  728|  16.3k|    case st_name_hex2:
  ------------------
  |  Branch (728:5): [True: 26, False: 64.4k]
  ------------------
  729|  18.6k|    case st_number:
  ------------------
  |  Branch (729:5): [True: 2.32k, False: 62.1k]
  ------------------
  730|  18.7k|    case st_real:
  ------------------
  |  Branch (730:5): [True: 74, False: 64.3k]
  ------------------
  731|  18.7k|    case st_sign:
  ------------------
  |  Branch (731:5): [True: 30, False: 64.4k]
  ------------------
  732|  18.8k|    case st_decimal:
  ------------------
  |  Branch (732:5): [True: 22, False: 64.4k]
  ------------------
  733|  20.7k|    case st_literal:
  ------------------
  |  Branch (733:5): [True: 1.94k, False: 62.4k]
  ------------------
  734|  20.7k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
  735|       |        // Push any delimiter to the state machine to finish off the final token.
  736|  20.7k|        presentCharacter('\f');
  737|  20.7k|        this->in_token = true;
  738|  20.7k|        break;
  739|       |
  740|      0|    case st_top:
  ------------------
  |  Branch (740:5): [True: 0, False: 64.4k]
  ------------------
  741|  31.9k|    case st_before_token:
  ------------------
  |  Branch (741:5): [True: 31.9k, False: 32.5k]
  ------------------
  742|  31.9k|        this->type = tt_eof;
  743|  31.9k|        break;
  744|       |
  745|  6.68k|    case st_in_space:
  ------------------
  |  Branch (745:5): [True: 6.68k, False: 57.7k]
  ------------------
  746|  6.68k|        this->type = this->include_ignorable ? tt_space : tt_eof;
  ------------------
  |  Branch (746:22): [True: 6.68k, False: 0]
  ------------------
  747|  6.68k|        break;
  748|       |
  749|    944|    case st_in_comment:
  ------------------
  |  Branch (749:5): [True: 944, False: 63.4k]
  ------------------
  750|    944|        this->type = this->include_ignorable ? tt_comment : tt_bad;
  ------------------
  |  Branch (750:22): [True: 9, False: 935]
  ------------------
  751|    944|        break;
  752|       |
  753|      0|    case st_token_ready:
  ------------------
  |  Branch (753:5): [True: 0, False: 64.4k]
  ------------------
  754|      0|        break;
  755|       |
  756|  4.13k|    default:
  ------------------
  |  Branch (756:5): [True: 4.13k, False: 60.2k]
  ------------------
  757|  4.13k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
  758|  4.13k|        this->type = tt_bad;
  759|  4.13k|        this->error_message = "EOF while reading token";
  760|  64.4k|    }
  761|  64.4k|    this->state = st_token_ready;
  762|  64.4k|}
_ZN13QPDFTokenizer17expectInlineImageER11InputSource:
  772|    905|{
  773|    905|    if (this->state == st_token_ready) {
  ------------------
  |  Branch (773:9): [True: 0, False: 905]
  ------------------
  774|      0|        reset();
  775|    905|    } else if (this->state != st_before_token) {
  ------------------
  |  Branch (775:16): [True: 0, False: 905]
  ------------------
  776|      0|        throw std::logic_error(
  777|      0|            "QPDFTokenizer::expectInlineImage called when tokenizer is in improper state");
  778|      0|    }
  779|    905|    findEI(input);
  780|    905|    this->before_token = false;
  781|    905|    this->in_token = true;
  782|    905|    this->state = st_inline_image;
  783|    905|}
_ZN13QPDFTokenizer6findEIER11InputSource:
  787|    905|{
  788|    905|    qpdf_offset_t last_offset = input.getLastOffset();
  789|    905|    qpdf_offset_t pos = input.tell();
  790|       |
  791|       |    // Use QPDFWordTokenFinder to find EI surrounded by delimiters. Then read the next several
  792|       |    // tokens or up to EOF. If we find any suspicious-looking or tokens, this is probably still part
  793|       |    // of the image data, so keep looking for EI. Stop at the first EI that passes. If we get to the
  794|       |    // end without finding one, return the last EI we found. Store the number of bytes expected in
  795|       |    // the inline image including the EI and use that to break out of inline image, falling back to
  796|       |    // the old method if needed.
  797|       |
  798|    905|    bool okay = false;
  799|    905|    bool first_try = true;
  800|  9.56k|    while (!okay) {
  ------------------
  |  Branch (800:12): [True: 9.51k, False: 51]
  ------------------
  801|  9.51k|        QPDFWordTokenFinder f(input, "EI");
  802|  9.51k|        if (!input.findFirst("EI", input.tell(), 0, f)) {
  ------------------
  |  Branch (802:13): [True: 854, False: 8.65k]
  ------------------
  803|    854|            break;
  804|    854|        }
  805|  8.65k|        inline_image_bytes = QIntC::to_size(input.tell() - pos - 2);
  806|       |
  807|  8.65k|        QPDFTokenizer check;
  808|  8.65k|        bool found_bad = false;
  809|       |        // Look at the next 10 tokens or up to EOF. The next inline image's image data would look
  810|       |        // like bad tokens, but there will always be at least 10 tokens between one inline image's
  811|       |        // EI and the next valid one's ID since width, height, bits per pixel, and color space are
  812|       |        // all required as well as a BI and ID. If we get 10 good tokens in a row or hit EOF, we can
  813|       |        // be pretty sure we've found the actual EI.
  814|  11.2k|        for (int i = 0; i < 10; ++i) {
  ------------------
  |  Branch (814:25): [True: 11.1k, False: 51]
  ------------------
  815|  11.1k|            QPDFTokenizer::Token t = check.readToken(input, "checker", true);
  816|  11.1k|            token_type_e type = t.getType();
  817|  11.1k|            if (type == tt_eof) {
  ------------------
  |  Branch (817:17): [True: 0, False: 11.1k]
  ------------------
  818|      0|                okay = true;
  819|  11.1k|            } else if (type == tt_bad) {
  ------------------
  |  Branch (819:24): [True: 715, False: 10.4k]
  ------------------
  820|    715|                found_bad = true;
  821|  10.4k|            } else if (t.isWord()) {
  ------------------
  |  Branch (821:24): [True: 9.64k, False: 832]
  ------------------
  822|       |                // The qpdf tokenizer lumps alphabetic and otherwise uncategorized characters into
  823|       |                // "words". We recognize strings of alphabetic characters as potential valid
  824|       |                // operators for purposes of telling whether we're in valid content or not. It's not
  825|       |                // perfect, but it should work more reliably than what we used to do, which was
  826|       |                // already good enough for the vast majority of files.
  827|  9.64k|                bool found_alpha = false;
  828|  9.64k|                bool found_non_printable = false;
  829|  9.64k|                bool found_other = false;
  830|   239k|                for (char ch: t.getValue()) {
  ------------------
  |  Branch (830:29): [True: 239k, False: 7.40k]
  ------------------
  831|   239k|                    if (((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) ||
  ------------------
  |  Branch (831:26): [True: 43.1k, False: 196k]
  |  Branch (831:41): [True: 43.1k, False: 0]
  |  Branch (831:58): [True: 18.3k, False: 177k]
  |  Branch (831:73): [True: 18.3k, False: 28]
  ------------------
  832|   239k|                        (ch == '*')) {
  ------------------
  |  Branch (832:25): [True: 32, False: 177k]
  ------------------
  833|       |                        // Treat '*' as alpha since there are valid PDF operators that contain *
  834|       |                        // along with alphabetic characters.
  835|  61.5k|                        found_alpha = true;
  836|   177k|                    } else if ((static_cast<signed char>(ch) < 32) && (!isSpace(ch))) {
  ------------------
  |  Branch (836:32): [True: 2.24k, False: 175k]
  |  Branch (836:71): [True: 2.24k, False: 0]
  ------------------
  837|       |                        // Compare ch as a signed char so characters outside of 7-bit will be < 0.
  838|  2.24k|                        found_non_printable = true;
  839|  2.24k|                        break;
  840|   175k|                    } else {
  841|   175k|                        found_other = true;
  842|   175k|                    }
  843|   239k|                }
  844|  9.64k|                if (found_non_printable || (found_alpha && found_other)) {
  ------------------
  |  Branch (844:21): [True: 2.24k, False: 7.40k]
  |  Branch (844:45): [True: 7.34k, False: 66]
  |  Branch (844:60): [True: 5.64k, False: 1.69k]
  ------------------
  845|  7.89k|                    found_bad = true;
  846|  7.89k|                }
  847|  9.64k|            }
  848|  11.1k|            if (okay || found_bad) {
  ------------------
  |  Branch (848:17): [True: 0, False: 11.1k]
  |  Branch (848:25): [True: 8.60k, False: 2.59k]
  ------------------
  849|  8.60k|                break;
  850|  8.60k|            }
  851|  11.1k|        }
  852|  8.65k|        if (!found_bad) {
  ------------------
  |  Branch (852:13): [True: 51, False: 8.60k]
  ------------------
  853|     51|            okay = true;
  854|     51|        }
  855|  8.65k|        if (!okay) {
  ------------------
  |  Branch (855:13): [True: 8.60k, False: 51]
  ------------------
  856|  8.60k|            first_try = false;
  857|  8.60k|        }
  858|  8.65k|    }
  859|    905|    if (okay && (!first_try)) {
  ------------------
  |  Branch (859:9): [True: 51, False: 854]
  |  Branch (859:17): [True: 2, False: 49]
  ------------------
  860|      2|        QTC::TC("qpdf", "QPDFTokenizer found EI after more than one try");
  861|      2|    }
  862|       |
  863|    905|    input.seek(pos, SEEK_SET);
  864|    905|    input.setLastOffset(last_offset);
  865|    905|}
_ZN13QPDFTokenizer8getTokenERNS_5TokenERbRc:
  869|  15.7M|{
  870|  15.7M|    bool ready = (this->state == st_token_ready);
  871|  15.7M|    unread_char = !this->in_token && !this->before_token;
  ------------------
  |  Branch (871:19): [True: 12.9M, False: 2.74M]
  |  Branch (871:38): [True: 12.9M, False: 25.3k]
  ------------------
  872|  15.7M|    ch = this->char_to_unread;
  873|  15.7M|    if (ready) {
  ------------------
  |  Branch (873:9): [True: 15.7M, False: 0]
  ------------------
  874|  15.7M|        token = (!(this->type == tt_name || this->type == tt_string))
  ------------------
  |  Branch (874:20): [True: 1.46M, False: 14.2M]
  |  Branch (874:45): [True: 209k, False: 14.0M]
  ------------------
  875|  15.7M|            ? Token(this->type, this->raw_val, this->raw_val, this->error_message)
  876|  15.7M|            : Token(this->type, this->val, this->raw_val, this->error_message);
  877|       |
  878|  15.7M|        this->reset();
  879|  15.7M|    }
  880|  15.7M|    return ready;
  881|  15.7M|}
_ZN13QPDFTokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbm:
  892|  15.7M|{
  893|  15.7M|    nextToken(input, context, max_len);
  894|       |
  895|  15.7M|    Token token;
  896|  15.7M|    bool unread_char;
  897|  15.7M|    char char_to_unread;
  898|  15.7M|    getToken(token, unread_char, char_to_unread);
  899|       |
  900|  15.7M|    if (token.getType() == tt_bad) {
  ------------------
  |  Branch (900:9): [True: 1.48M, False: 14.2M]
  ------------------
  901|  1.48M|        if (allow_bad) {
  ------------------
  |  Branch (901:13): [True: 1.48M, False: 0]
  ------------------
  902|  1.48M|            QTC::TC("qpdf", "QPDFTokenizer allowing bad token");
  903|  1.48M|        } 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|  1.48M|    }
  912|  15.7M|    return token;
  913|  15.7M|}
_ZN13QPDFTokenizer9readTokenENSt3__110shared_ptrI11InputSourceEERKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEbm:
  918|  10.3M|{
  919|  10.3M|    return readToken(*input, context, allow_bad, max_len);
  920|  10.3M|}
_ZN13QPDFTokenizer9nextTokenER11InputSourceRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEm:
  924|  28.8M|{
  925|  28.8M|    if (this->state != st_inline_image) {
  ------------------
  |  Branch (925:9): [True: 28.8M, False: 905]
  ------------------
  926|  28.8M|        reset();
  927|  28.8M|    }
  928|  28.8M|    qpdf_offset_t offset = input.fastTell();
  929|       |
  930|   694M|    while (this->state != st_token_ready) {
  ------------------
  |  Branch (930:12): [True: 665M, False: 28.8M]
  ------------------
  931|   665M|        char ch;
  932|   665M|        if (!input.fastRead(ch)) {
  ------------------
  |  Branch (932:13): [True: 64.4k, False: 665M]
  ------------------
  933|  64.4k|            presentEOF();
  934|       |
  935|  64.4k|            if ((this->type == tt_eof) && (!this->allow_eof)) {
  ------------------
  |  Branch (935:17): [True: 31.9k, False: 32.5k]
  |  Branch (935:43): [True: 7, False: 31.9k]
  ------------------
  936|       |                // Nothing in the qpdf library calls readToken without allowEOF anymore, so this
  937|       |                // case is not exercised.
  938|      7|                this->type = tt_bad;
  939|      7|                this->error_message = "unexpected EOF";
  940|      7|                offset = input.getLastOffset();
  941|      7|            }
  942|   665M|        } else {
  943|   665M|            handleCharacter(ch);
  944|   665M|            if (this->before_token) {
  ------------------
  |  Branch (944:17): [True: 54.9M, False: 610M]
  ------------------
  945|  54.9M|                ++offset;
  946|  54.9M|            }
  947|   665M|            if (this->in_token) {
  ------------------
  |  Branch (947:17): [True: 586M, False: 78.7M]
  ------------------
  948|   586M|                this->raw_val += ch;
  949|   586M|            }
  950|   665M|            if (max_len && (this->raw_val.length() >= max_len) && (this->state != st_token_ready)) {
  ------------------
  |  Branch (950:17): [True: 66.8M, False: 598M]
  |  Branch (950:28): [True: 1.20M, False: 65.5M]
  |  Branch (950:67): [True: 1.20M, False: 4.31k]
  ------------------
  951|       |                // terminate this token now
  952|  1.20M|                QTC::TC("qpdf", "QPDFTokenizer block long token");
  953|  1.20M|                this->type = tt_bad;
  954|  1.20M|                this->state = st_token_ready;
  955|  1.20M|                this->error_message = "exceeded allowable length while reading token";
  956|  1.20M|            }
  957|   665M|        }
  958|   665M|    }
  959|       |
  960|  28.8M|    input.fastUnread(!this->in_token && !this->before_token);
  ------------------
  |  Branch (960:22): [True: 23.8M, False: 5.03M]
  |  Branch (960:41): [True: 23.7M, False: 32.8k]
  ------------------
  961|       |
  962|  28.8M|    if (this->type != tt_eof) {
  ------------------
  |  Branch (962:9): [True: 28.8M, False: 31.9k]
  ------------------
  963|  28.8M|        input.setLastOffset(offset);
  964|  28.8M|    }
  965|       |
  966|  28.8M|    return this->error_message.empty();
  967|  28.8M|}
QPDFTokenizer.cc:_ZL12is_delimiterc:
   18|   146M|{
   19|   146M|    return (
   20|   146M|        ch == ' ' || ch == '\n' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (20:9): [True: 12.5M, False: 134M]
  |  Branch (20:22): [True: 4.21M, False: 130M]
  |  Branch (20:36): [True: 1.61M, False: 128M]
  |  Branch (20:49): [True: 260k, False: 128M]
  |  Branch (20:62): [True: 149k, False: 128M]
  |  Branch (20:75): [True: 32.5k, False: 128M]
  |  Branch (20:88): [True: 29.2k, False: 127M]
  ------------------
   21|   146M|        ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch == '\t' || ch == '\r' ||
  ------------------
  |  Branch (21:9): [True: 178k, False: 127M]
  |  Branch (21:22): [True: 225k, False: 127M]
  |  Branch (21:35): [True: 201k, False: 127M]
  |  Branch (21:48): [True: 206k, False: 127M]
  |  Branch (21:61): [True: 49.3k, False: 127M]
  |  Branch (21:74): [True: 34.7k, False: 127M]
  |  Branch (21:88): [True: 1.13M, False: 125M]
  ------------------
   22|   146M|        ch == '\v' || ch == '\f' || ch == 0);
  ------------------
  |  Branch (22:9): [True: 33.2k, False: 125M]
  |  Branch (22:23): [True: 77.4k, False: 125M]
  |  Branch (22:37): [True: 513k, False: 125M]
  ------------------
   23|   146M|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderC2ER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   33|  9.51k|        {
   34|  9.51k|        }
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinder5checkEv:
   46|  10.4k|{
   47|       |    // Find a word token matching the given string, preceded by a delimiter, and followed by a
   48|       |    // delimiter or EOF.
   49|  10.4k|    QPDFTokenizer tokenizer;
   50|  10.4k|    QPDFTokenizer::Token t = tokenizer.readToken(is, "finder", true);
   51|  10.4k|    qpdf_offset_t pos = is.tell();
   52|  10.4k|    if (!(t == QPDFTokenizer::Token(QPDFTokenizer::tt_word, str))) {
  ------------------
  |  Branch (52:9): [True: 1.83k, False: 8.65k]
  ------------------
   53|  1.83k|        QTC::TC("qpdf", "QPDFTokenizer finder found wrong word");
   54|  1.83k|        return false;
   55|  1.83k|    }
   56|  8.65k|    qpdf_offset_t token_start = is.getLastOffset();
   57|  8.65k|    char next;
   58|  8.65k|    bool next_okay = false;
   59|  8.65k|    if (is.read(&next, 1) == 0) {
  ------------------
  |  Branch (59:9): [True: 2, False: 8.65k]
  ------------------
   60|      2|        QTC::TC("qpdf", "QPDFTokenizer inline image at EOF");
   61|      2|        next_okay = true;
   62|  8.65k|    } else {
   63|  8.65k|        next_okay = is_delimiter(next);
   64|  8.65k|    }
   65|  8.65k|    is.seek(pos, SEEK_SET);
   66|  8.65k|    if (!next_okay) {
  ------------------
  |  Branch (66:9): [True: 0, False: 8.65k]
  ------------------
   67|      0|        return false;
   68|      0|    }
   69|  8.65k|    if (token_start == 0) {
  ------------------
  |  Branch (69:9): [True: 0, False: 8.65k]
  ------------------
   70|       |        // Can't actually happen...we never start the search at the beginning of the input.
   71|      0|        return false;
   72|      0|    }
   73|  8.65k|    return true;
   74|  8.65k|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderD2Ev:
   35|  9.51k|        ~QPDFWordTokenFinder() override = default;

_ZN9QPDFValue9do_createEPS_:
    7|  7.07M|{
    8|  7.07M|    std::shared_ptr<QPDFObject> obj(new QPDFObject());
    9|  7.07M|    obj->value = std::shared_ptr<QPDFValue>(object);
   10|  7.07M|    return obj;
   11|  7.07M|}
_ZN9QPDFValue14getDescriptionEv:
   15|   107k|{
   16|   107k|    if (object_description) {
  ------------------
  |  Branch (16:9): [True: 63.4k, False: 44.4k]
  ------------------
   17|  63.4k|        switch (object_description->index()) {
  ------------------
  |  Branch (17:17): [True: 0, False: 63.4k]
  ------------------
   18|  62.5k|        case 0:
  ------------------
  |  Branch (18:9): [True: 62.5k, False: 945]
  ------------------
   19|  62.5k|            {
   20|       |                // Simple template string
   21|  62.5k|                auto description = std::get<0>(*object_description);
   22|       |
   23|  62.5k|                if (auto pos = description.find("$OG"); pos != std::string::npos) {
  ------------------
  |  Branch (23:57): [True: 0, False: 62.5k]
  ------------------
   24|      0|                    description.replace(pos, 3, og.unparse(' '));
   25|      0|                }
   26|  62.5k|                if (auto pos = description.find("$PO"); pos != std::string::npos) {
  ------------------
  |  Branch (26:57): [True: 59.4k, False: 3.11k]
  ------------------
   27|  59.4k|                    qpdf_offset_t shift = (type_code == ::ot_dictionary) ? 2
  ------------------
  |  Branch (27:43): [True: 30.4k, False: 28.9k]
  ------------------
   28|  59.4k|                        : (type_code == ::ot_array)                      ? 1
  ------------------
  |  Branch (28:27): [True: 442, False: 28.5k]
  ------------------
   29|  28.9k|                                                                         : 0;
   30|       |
   31|  59.4k|                    description.replace(pos, 3, std::to_string(parsed_offset + shift));
   32|  59.4k|                }
   33|  62.5k|                return description;
   34|      0|            }
   35|      0|        case 1:
  ------------------
  |  Branch (35:9): [True: 0, False: 63.4k]
  ------------------
   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|    945|        case 2:
  ------------------
  |  Branch (43:9): [True: 945, False: 62.5k]
  ------------------
   44|    945|            {
   45|       |                // Child object description
   46|    945|                auto j_descr = std::get<2>(*object_description);
   47|    945|                std::string result;
   48|    945|                if (auto p = j_descr.parent.lock()) {
  ------------------
  |  Branch (48:26): [True: 945, False: 0]
  ------------------
   49|    945|                    result = p->getDescription();
   50|    945|                }
   51|    945|                result += j_descr.static_descr;
   52|    945|                if (auto pos = result.find("$VD"); pos != std::string::npos) {
  ------------------
  |  Branch (52:52): [True: 162, False: 783]
  ------------------
   53|    162|                    result.replace(pos, 3, j_descr.var_descr);
   54|    162|                }
   55|    945|                return result;
   56|      0|            }
   57|  63.4k|        }
   58|  63.4k|    } else if (og.isIndirect()) {
  ------------------
  |  Branch (58:16): [True: 10.1k, False: 34.2k]
  ------------------
   59|  10.1k|        return "object " + og.unparse(' ');
   60|  10.1k|    }
   61|  34.2k|    return {};
   62|   107k|}

_ZN10QPDFWriter7MembersC2ER4QPDF:
   54|  8.78k|{
   55|  8.78k|}
_ZN10QPDFWriter7MembersD2Ev:
   58|  8.75k|{
   59|  8.75k|    if (file && close_file) {
  ------------------
  |  Branch (59:9): [True: 0, False: 8.75k]
  |  Branch (59:17): [True: 0, False: 0]
  ------------------
   60|      0|        fclose(file);
   61|      0|    }
   62|  8.75k|    delete output_buffer;
   63|  8.75k|}
_ZN10QPDFWriterC2ER4QPDF:
   67|  8.78k|{
   68|  8.78k|}
_ZN10QPDFWriter17setOutputPipelineEP8Pipeline:
  137|  8.75k|{
  138|  8.75k|    m->filename = "custom pipeline";
  139|  8.75k|    initializePipelineStack(p);
  140|  8.75k|}
_ZN10QPDFWriter14setDecodeLevelE26qpdf_stream_decode_level_e:
  180|  8.75k|{
  181|  8.75k|    m->stream_decode_level = val;
  182|  8.75k|    m->stream_decode_level_set = true;
  183|  8.75k|}
_ZN10QPDFWriter10setQDFModeEb:
  200|  4.37k|{
  201|  4.37k|    m->qdf_mode = val;
  202|  4.37k|}
_ZN10QPDFWriter20setMinimumPDFVersionERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEi:
  218|  12.8k|{
  219|  12.8k|    bool set_version = false;
  220|  12.8k|    bool set_extension_level = false;
  221|  12.8k|    if (m->min_pdf_version.empty()) {
  ------------------
  |  Branch (221:9): [True: 8.28k, False: 4.52k]
  ------------------
  222|  8.28k|        set_version = true;
  223|  8.28k|        set_extension_level = true;
  224|  8.28k|    } else {
  225|  4.52k|        int old_major = 0;
  226|  4.52k|        int old_minor = 0;
  227|  4.52k|        int min_major = 0;
  228|  4.52k|        int min_minor = 0;
  229|  4.52k|        parseVersion(version, old_major, old_minor);
  230|  4.52k|        parseVersion(m->min_pdf_version, min_major, min_minor);
  231|  4.52k|        int compare = compareVersions(old_major, old_minor, min_major, min_minor);
  232|  4.52k|        if (compare > 0) {
  ------------------
  |  Branch (232:13): [True: 387, False: 4.14k]
  ------------------
  233|    387|            QTC::TC("qpdf", "QPDFWriter increasing minimum version", extension_level == 0 ? 0 : 1);
  ------------------
  |  Branch (233:70): [True: 382, False: 5]
  ------------------
  234|    387|            set_version = true;
  235|    387|            set_extension_level = true;
  236|  4.14k|        } else if (compare == 0) {
  ------------------
  |  Branch (236:20): [True: 341, False: 3.79k]
  ------------------
  237|    341|            if (extension_level > m->min_extension_level) {
  ------------------
  |  Branch (237:17): [True: 0, False: 341]
  ------------------
  238|      0|                QTC::TC("qpdf", "QPDFWriter increasing extension level");
  239|      0|                set_extension_level = true;
  240|      0|            }
  241|    341|        }
  242|  4.52k|    }
  243|       |
  244|  12.8k|    if (set_version) {
  ------------------
  |  Branch (244:9): [True: 8.66k, False: 4.14k]
  ------------------
  245|  8.66k|        m->min_pdf_version = version;
  246|  8.66k|    }
  247|  12.8k|    if (set_extension_level) {
  ------------------
  |  Branch (247:9): [True: 8.66k, False: 4.14k]
  ------------------
  248|  8.66k|        m->min_extension_level = extension_level;
  249|  8.66k|    }
  250|  12.8k|}
_ZN10QPDFWriter11setStaticIDEb:
  282|  4.37k|{
  283|  4.37k|    m->static_id = val;
  284|  4.37k|}
_ZN10QPDFWriter18setDeterministicIDEb:
  288|  4.37k|{
  289|  4.37k|    m->deterministic_id = val;
  290|  4.37k|}
_ZN10QPDFWriter16setLinearizationEb:
  314|  4.37k|{
  315|  4.37k|    m->linearized = val;
  316|  4.37k|    if (val) {
  ------------------
  |  Branch (316:9): [True: 4.37k, False: 0]
  ------------------
  317|  4.37k|        m->pclm = false;
  318|  4.37k|    }
  319|  4.37k|}
_ZN10QPDFWriter25setR6EncryptionParametersEPKcS1_bbbbbb15qpdf_r3_print_eb:
  465|  4.37k|{
  466|  4.37k|    std::set<int> clear;
  467|  4.37k|    interpretR3EncryptionParameters(
  468|  4.37k|        clear,
  469|  4.37k|        user_password,
  470|  4.37k|        owner_password,
  471|  4.37k|        allow_accessibility,
  472|  4.37k|        allow_extract,
  473|  4.37k|        allow_assemble,
  474|  4.37k|        allow_annotate_and_form,
  475|  4.37k|        allow_form_filling,
  476|  4.37k|        allow_modify_other,
  477|  4.37k|        print,
  478|  4.37k|        qpdf_r3m_all);
  479|  4.37k|    m->encrypt_use_aes = true;
  480|  4.37k|    m->encrypt_metadata = encrypt_metadata;
  481|  4.37k|    setEncryptionParameters(user_password, owner_password, 5, 6, 32, clear);
  482|  4.37k|}
_ZN10QPDFWriter31interpretR3EncryptionParametersERNSt3__13setIiNS0_4lessIiEENS0_9allocatorIiEEEEPKcS9_bbbbbb15qpdf_r3_print_e16qpdf_r3_modify_e:
  497|  4.37k|{
  498|       |    // Acrobat 5 security options:
  499|       |
  500|       |    // Checkboxes:
  501|       |    //   Enable Content Access for the Visually Impaired
  502|       |    //   Allow Content Copying and Extraction
  503|       |
  504|       |    // Allowed changes menu:
  505|       |    //   None
  506|       |    //   Only Document Assembly
  507|       |    //   Only Form Field Fill-in or Signing
  508|       |    //   Comment Authoring, Form Field Fill-in or Signing
  509|       |    //   General Editing, Comment and Form Field Authoring
  510|       |
  511|       |    // Allowed printing menu:
  512|       |    //   None
  513|       |    //   Low Resolution
  514|       |    //   Full printing
  515|       |
  516|       |    // Meanings of bits in P when R >= 3
  517|       |    //
  518|       |    //  3: low-resolution printing
  519|       |    //  4: document modification except as controlled by 6, 9, and 11
  520|       |    //  5: extraction
  521|       |    //  6: add/modify annotations (comment), fill in forms
  522|       |    //     if 4+6 are set, also allows modification of form fields
  523|       |    //  9: fill in forms even if 6 is clear
  524|       |    // 10: accessibility; ignored by readers, should always be set
  525|       |    // 11: document assembly even if 4 is clear
  526|       |    // 12: high-resolution printing
  527|       |
  528|  4.37k|    if (!allow_accessibility) {
  ------------------
  |  Branch (528:9): [True: 0, False: 4.37k]
  ------------------
  529|       |        // setEncryptionParameters sets this if R > 3
  530|      0|        clear.insert(10);
  531|      0|    }
  532|  4.37k|    if (!allow_extract) {
  ------------------
  |  Branch (532:9): [True: 0, False: 4.37k]
  ------------------
  533|      0|        clear.insert(5);
  534|      0|    }
  535|       |
  536|       |    // Note: these switch statements all "fall through" (no break statements).  Each option clears
  537|       |    // successively more access bits.
  538|  4.37k|    switch (print) {
  ------------------
  |  Branch (538:13): [True: 0, False: 4.37k]
  ------------------
  539|      0|    case qpdf_r3p_none:
  ------------------
  |  Branch (539:5): [True: 0, False: 4.37k]
  ------------------
  540|      0|        clear.insert(3); // any printing
  541|       |
  542|      0|    case qpdf_r3p_low:
  ------------------
  |  Branch (542:5): [True: 0, False: 4.37k]
  ------------------
  543|      0|        clear.insert(12); // high resolution printing
  544|       |
  545|  4.37k|    case qpdf_r3p_full:
  ------------------
  |  Branch (545:5): [True: 4.37k, False: 0]
  ------------------
  546|  4.37k|        break;
  547|       |
  548|       |        // no default so gcc warns for missing cases
  549|  4.37k|    }
  550|       |
  551|       |    // Modify options. The qpdf_r3_modify_e options control groups of bits and lack the full
  552|       |    // flexibility of the spec. This is unfortunate, but it's been in the API for ages, and we're
  553|       |    // stuck with it. See also allow checks below to control the bits individually.
  554|       |
  555|       |    // NOT EXERCISED IN TEST SUITE
  556|  4.37k|    switch (modify) {
  ------------------
  |  Branch (556:13): [True: 0, False: 4.37k]
  ------------------
  557|      0|    case qpdf_r3m_none:
  ------------------
  |  Branch (557:5): [True: 0, False: 4.37k]
  ------------------
  558|      0|        clear.insert(11); // document assembly
  559|       |
  560|      0|    case qpdf_r3m_assembly:
  ------------------
  |  Branch (560:5): [True: 0, False: 4.37k]
  ------------------
  561|      0|        clear.insert(9); // filling in form fields
  562|       |
  563|      0|    case qpdf_r3m_form:
  ------------------
  |  Branch (563:5): [True: 0, False: 4.37k]
  ------------------
  564|      0|        clear.insert(6); // modify annotations, fill in form fields
  565|       |
  566|      0|    case qpdf_r3m_annotate:
  ------------------
  |  Branch (566:5): [True: 0, False: 4.37k]
  ------------------
  567|      0|        clear.insert(4); // other modifications
  568|       |
  569|  4.37k|    case qpdf_r3m_all:
  ------------------
  |  Branch (569:5): [True: 4.37k, False: 0]
  ------------------
  570|  4.37k|        break;
  571|       |
  572|       |        // no default so gcc warns for missing cases
  573|  4.37k|    }
  574|       |    // END NOT EXERCISED IN TEST SUITE
  575|       |
  576|  4.37k|    if (!allow_assemble) {
  ------------------
  |  Branch (576:9): [True: 0, False: 4.37k]
  ------------------
  577|      0|        clear.insert(11);
  578|      0|    }
  579|  4.37k|    if (!allow_annotate_and_form) {
  ------------------
  |  Branch (579:9): [True: 0, False: 4.37k]
  ------------------
  580|      0|        clear.insert(6);
  581|      0|    }
  582|  4.37k|    if (!allow_form_filling) {
  ------------------
  |  Branch (582:9): [True: 0, False: 4.37k]
  ------------------
  583|      0|        clear.insert(9);
  584|      0|    }
  585|  4.37k|    if (!allow_modify_other) {
  ------------------
  |  Branch (585:9): [True: 0, False: 4.37k]
  ------------------
  586|      0|        clear.insert(4);
  587|      0|    }
  588|  4.37k|}
_ZN10QPDFWriter23setEncryptionParametersEPKcS1_iiiRNSt3__13setIiNS2_4lessIiEENS2_9allocatorIiEEEE:
  598|  4.37k|{
  599|       |    // PDF specification refers to bits with the low bit numbered 1.
  600|       |    // We have to convert this into a bit field.
  601|       |
  602|       |    // Specification always requires bits 1 and 2 to be cleared.
  603|  4.37k|    bits_to_clear.insert(1);
  604|  4.37k|    bits_to_clear.insert(2);
  605|       |
  606|  4.37k|    if (R > 3) {
  ------------------
  |  Branch (606:9): [True: 4.37k, False: 0]
  ------------------
  607|       |        // Bit 10 is deprecated and should always be set.  This used to mean accessibility.  There
  608|       |        // is no way to disable accessibility with R > 3.
  609|  4.37k|        bits_to_clear.erase(10);
  610|  4.37k|    }
  611|       |
  612|  4.37k|    int P = 0;
  613|       |    // Create the complement of P, then invert.
  614|  8.75k|    for (int b: bits_to_clear) {
  ------------------
  |  Branch (614:15): [True: 8.75k, False: 4.37k]
  ------------------
  615|  8.75k|        P |= (1 << (b - 1));
  616|  8.75k|    }
  617|  4.37k|    P = ~P;
  618|       |
  619|  4.37k|    generateID();
  620|  4.37k|    std::string O;
  621|  4.37k|    std::string U;
  622|  4.37k|    std::string OE;
  623|  4.37k|    std::string UE;
  624|  4.37k|    std::string Perms;
  625|  4.37k|    std::string encryption_key;
  626|  4.37k|    if (V < 5) {
  ------------------
  |  Branch (626:9): [True: 0, False: 4.37k]
  ------------------
  627|      0|        QPDF::compute_encryption_O_U(
  628|      0|            user_password, owner_password, V, R, key_len, P, m->encrypt_metadata, m->id1, O, U);
  629|  4.37k|    } else {
  630|  4.37k|        QPDF::compute_encryption_parameters_V5(
  631|  4.37k|            user_password,
  632|  4.37k|            owner_password,
  633|  4.37k|            V,
  634|  4.37k|            R,
  635|  4.37k|            key_len,
  636|  4.37k|            P,
  637|  4.37k|            m->encrypt_metadata,
  638|  4.37k|            m->id1,
  639|  4.37k|            encryption_key,
  640|  4.37k|            O,
  641|  4.37k|            U,
  642|  4.37k|            OE,
  643|  4.37k|            UE,
  644|  4.37k|            Perms);
  645|  4.37k|    }
  646|  4.37k|    setEncryptionParametersInternal(
  647|  4.37k|        V, R, key_len, P, O, U, OE, UE, Perms, m->id1, user_password, encryption_key);
  648|  4.37k|}
_ZNK10QPDFWriter12parseVersionERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERiS9_:
  745|  8.93k|{
  746|  8.93k|    major = QUtil::string_to_int(version.c_str());
  747|  8.93k|    minor = 0;
  748|  8.93k|    size_t p = version.find('.');
  749|  8.93k|    if ((p != std::string::npos) && (version.length() > p)) {
  ------------------
  |  Branch (749:9): [True: 8.91k, False: 18]
  |  Branch (749:37): [True: 8.91k, False: 0]
  ------------------
  750|  8.91k|        minor = QUtil::string_to_int(version.substr(p + 1).c_str());
  751|  8.91k|    }
  752|  8.93k|    std::string tmp = std::to_string(major) + "." + std::to_string(minor);
  753|  8.93k|    if (tmp != version) {
  ------------------
  |  Branch (753:9): [True: 11, False: 8.92k]
  ------------------
  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|     11|    }
  758|  8.93k|}
_ZNK10QPDFWriter15compareVersionsEiiii:
  762|  4.40k|{
  763|  4.40k|    if (major1 < major2) {
  ------------------
  |  Branch (763:9): [True: 42, False: 4.36k]
  ------------------
  764|     42|        return -1;
  765|  4.36k|    } else if (major1 > major2) {
  ------------------
  |  Branch (765:16): [True: 140, False: 4.22k]
  ------------------
  766|    140|        return 1;
  767|  4.22k|    } else if (minor1 < minor2) {
  ------------------
  |  Branch (767:16): [True: 3.63k, False: 588]
  ------------------
  768|  3.63k|        return -1;
  769|  3.63k|    } else if (minor1 > minor2) {
  ------------------
  |  Branch (769:16): [True: 247, False: 341]
  ------------------
  770|    247|        return 1;
  771|    341|    } else {
  772|    341|        return 0;
  773|    341|    }
  774|  4.40k|}
_ZN10QPDFWriter31setEncryptionParametersInternalEiiiiRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_S8_S8_S8_S8_S8_:
  790|  3.95k|{
  791|  3.95k|    m->encryption_V = V;
  792|  3.95k|    m->encryption_R = R;
  793|  3.95k|    m->encryption_dictionary["/Filter"] = "/Standard";
  794|  3.95k|    m->encryption_dictionary["/V"] = std::to_string(V);
  795|  3.95k|    m->encryption_dictionary["/Length"] = std::to_string(key_len * 8);
  796|  3.95k|    m->encryption_dictionary["/R"] = std::to_string(R);
  797|  3.95k|    m->encryption_dictionary["/P"] = std::to_string(P);
  798|  3.95k|    m->encryption_dictionary["/O"] = QPDF_String(O).unparse(true);
  799|  3.95k|    m->encryption_dictionary["/U"] = QPDF_String(U).unparse(true);
  800|  3.95k|    if (V >= 5) {
  ------------------
  |  Branch (800:9): [True: 3.95k, False: 0]
  ------------------
  801|  3.95k|        m->encryption_dictionary["/OE"] = QPDF_String(OE).unparse(true);
  802|  3.95k|        m->encryption_dictionary["/UE"] = QPDF_String(UE).unparse(true);
  803|  3.95k|        m->encryption_dictionary["/Perms"] = QPDF_String(Perms).unparse(true);
  804|  3.95k|    }
  805|  3.95k|    if (R >= 6) {
  ------------------
  |  Branch (805:9): [True: 3.95k, False: 0]
  ------------------
  806|  3.95k|        setMinimumPDFVersion("1.7", 8);
  807|  3.95k|    } else if (R == 5) {
  ------------------
  |  Branch (807:16): [True: 0, False: 0]
  ------------------
  808|      0|        setMinimumPDFVersion("1.7", 3);
  809|      0|    } else if (R == 4) {
  ------------------
  |  Branch (809:16): [True: 0, False: 0]
  ------------------
  810|      0|        setMinimumPDFVersion(m->encrypt_use_aes ? "1.6" : "1.5");
  ------------------
  |  Branch (810:30): [True: 0, False: 0]
  ------------------
  811|      0|    } else if (R == 3) {
  ------------------
  |  Branch (811:16): [True: 0, False: 0]
  ------------------
  812|      0|        setMinimumPDFVersion("1.4");
  813|      0|    } else {
  814|      0|        setMinimumPDFVersion("1.3");
  815|      0|    }
  816|       |
  817|  3.95k|    if ((R >= 4) && (!m->encrypt_metadata)) {
  ------------------
  |  Branch (817:9): [True: 3.95k, False: 0]
  |  Branch (817:21): [True: 0, False: 3.95k]
  ------------------
  818|      0|        m->encryption_dictionary["/EncryptMetadata"] = "false";
  819|      0|    }
  820|  3.95k|    if ((V == 4) || (V == 5)) {
  ------------------
  |  Branch (820:9): [True: 0, False: 3.95k]
  |  Branch (820:21): [True: 3.95k, False: 0]
  ------------------
  821|       |        // The spec says the value for the crypt filter key can be anything, and xpdf seems to
  822|       |        // agree.  However, Adobe Reader won't open our files unless we use /StdCF.
  823|  3.95k|        m->encryption_dictionary["/StmF"] = "/StdCF";
  824|  3.95k|        m->encryption_dictionary["/StrF"] = "/StdCF";
  825|  3.95k|        std::string method = (m->encrypt_use_aes ? ((V < 5) ? "/AESV2" : "/AESV3") : "/V2");
  ------------------
  |  Branch (825:31): [True: 3.95k, False: 0]
  |  Branch (825:53): [True: 0, False: 3.95k]
  ------------------
  826|       |        // The PDF spec says the /Length key is optional, but the PDF previewer on some versions of
  827|       |        // MacOS won't open encrypted files without it.
  828|  3.95k|        m->encryption_dictionary["/CF"] = "<< /StdCF << /AuthEvent /DocOpen /CFM " + method +
  829|  3.95k|            " /Length " + std::string((V < 5) ? "16" : "32") + " >> >>";
  ------------------
  |  Branch (829:39): [True: 0, False: 3.95k]
  ------------------
  830|  3.95k|    }
  831|       |
  832|  3.95k|    m->encrypted = true;
  833|  3.95k|    QPDF::EncryptionData encryption_data(
  834|  3.95k|        V, R, key_len, P, O, U, OE, UE, Perms, id1, m->encrypt_metadata);
  835|  3.95k|    if (V < 5) {
  ------------------
  |  Branch (835:9): [True: 0, False: 3.95k]
  ------------------
  836|      0|        m->encryption_key = QPDF::compute_encryption_key(user_password, encryption_data);
  837|  3.95k|    } else {
  838|  3.95k|        m->encryption_key = encryption_key;
  839|  3.95k|    }
  840|  3.95k|}
_ZN10QPDFWriter10setDataKeyEi:
  844|   267k|{
  845|   267k|    m->cur_data_key = QPDF::compute_data_key(
  846|   267k|        m->encryption_key, objid, 0, m->encrypt_use_aes, m->encryption_V, m->encryption_R);
  847|   267k|}
_ZN10QPDFWriter11bytesNeededEx:
  851|  3.28k|{
  852|  3.28k|    unsigned int bytes = 0;
  853|  7.81k|    while (n) {
  ------------------
  |  Branch (853:12): [True: 4.53k, False: 3.28k]
  ------------------
  854|  4.53k|        ++bytes;
  855|  4.53k|        n >>= 8;
  856|  4.53k|    }
  857|  3.28k|    return bytes;
  858|  3.28k|}
_ZN10QPDFWriter11writeBinaryEyj:
  862|   121k|{
  863|   121k|    if (bytes > sizeof(unsigned long long)) {
  ------------------
  |  Branch (863:9): [True: 0, False: 121k]
  ------------------
  864|      0|        throw std::logic_error("QPDFWriter::writeBinary called with too many bytes");
  865|      0|    }
  866|   121k|    unsigned char data[sizeof(unsigned long long)];
  867|   303k|    for (unsigned int i = 0; i < bytes; ++i) {
  ------------------
  |  Branch (867:30): [True: 182k, False: 121k]
  ------------------
  868|   182k|        data[bytes - i - 1] = static_cast<unsigned char>(val & 0xff);
  869|   182k|        val >>= 8;
  870|   182k|    }
  871|   121k|    m->pipeline->write(data, bytes);
  872|   121k|}
_ZN10QPDFWriter11writeStringENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  876|  20.1M|{
  877|  20.1M|    m->pipeline->write(reinterpret_cast<unsigned char const*>(str.data()), str.size());
  878|  20.1M|}
_ZN10QPDFWriter11writeBufferERNSt3__110shared_ptrI6BufferEE:
  882|  77.8k|{
  883|  77.8k|    m->pipeline->write(b->getBuffer(), b->getSize());
  884|  77.8k|}
_ZN10QPDFWriter14writeStringQDFENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  888|  5.40M|{
  889|  5.40M|    if (m->qdf_mode) {
  ------------------
  |  Branch (889:9): [True: 2.13M, False: 3.26M]
  ------------------
  890|  2.13M|        m->pipeline->write(reinterpret_cast<unsigned char const*>(str.data()), str.size());
  891|  2.13M|    }
  892|  5.40M|}
_ZN10QPDFWriter16writeStringNoQDFENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  896|   103k|{
  897|   103k|    if (!m->qdf_mode) {
  ------------------
  |  Branch (897:9): [True: 57.4k, False: 45.5k]
  ------------------
  898|  57.4k|        m->pipeline->write(reinterpret_cast<unsigned char const*>(str.data()), str.size());
  899|  57.4k|    }
  900|   103k|}
_ZN10QPDFWriter8writePadEm:
  904|  10.6k|{
  905|  10.6k|    writeString(std::string(nspaces, ' '));
  906|  10.6k|}
_ZN10QPDFWriter12pushPipelineEP8Pipeline:
  910|   163k|{
  911|   163k|    qpdf_assert_debug(dynamic_cast<Pl_Count*>(p) == nullptr);
  ------------------
  |  |   16|   163k|# define qpdf_assert_debug assert
  ------------------
  912|   163k|    m->pipeline_stack.push_back(p);
  913|   163k|    return p;
  914|   163k|}
_ZN10QPDFWriter23initializePipelineStackEP8Pipeline:
  918|  8.75k|{
  919|  8.75k|    m->pipeline = new Pl_Count("pipeline stack base", p);
  920|  8.75k|    m->to_delete.push_back(std::shared_ptr<Pipeline>(m->pipeline));
  921|  8.75k|    m->pipeline_stack.push_back(m->pipeline);
  922|  8.75k|}
_ZN10QPDFWriter21activatePipelineStackERNS_14PipelinePopperE:
  926|   189k|{
  927|   189k|    std::string stack_id("stack " + std::to_string(m->next_stack_id));
  928|   189k|    auto* c = new Pl_Count(stack_id.c_str(), m->pipeline_stack.back());
  929|   189k|    ++m->next_stack_id;
  930|   189k|    m->pipeline_stack.push_back(c);
  931|   189k|    m->pipeline = c;
  932|   189k|    pp.stack_id = stack_id;
  933|   189k|}
_ZN10QPDFWriter14PipelinePopperD2Ev:
  936|   192k|{
  937|   192k|    if (stack_id.empty()) {
  ------------------
  |  Branch (937:9): [True: 2.95k, False: 189k]
  ------------------
  938|  2.95k|        return;
  939|  2.95k|    }
  940|   189k|    qpdf_assert_debug(qw->m->pipeline_stack.size() >= 2);
  ------------------
  |  |   16|   189k|# define qpdf_assert_debug assert
  ------------------
  941|   189k|    qw->m->pipeline->finish();
  942|   189k|    qpdf_assert_debug(dynamic_cast<Pl_Count*>(qw->m->pipeline_stack.back()) == qw->m->pipeline);
  ------------------
  |  |   16|   189k|# 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|   189k|    qpdf_assert_debug(qw->m->pipeline->getIdentifier() == stack_id);
  ------------------
  |  |   16|   189k|# define qpdf_assert_debug assert
  ------------------
  948|   189k|    delete qw->m->pipeline_stack.back();
  949|   189k|    qw->m->pipeline_stack.pop_back();
  950|   352k|    while (dynamic_cast<Pl_Count*>(qw->m->pipeline_stack.back()) == nullptr) {
  ------------------
  |  Branch (950:12): [True: 163k, False: 189k]
  ------------------
  951|   163k|        Pipeline* p = qw->m->pipeline_stack.back();
  952|   163k|        if (dynamic_cast<Pl_MD5*>(p) == qw->m->md5_pipeline) {
  ------------------
  |  Branch (952:13): [True: 130k, False: 33.4k]
  ------------------
  953|   130k|            qw->m->md5_pipeline = nullptr;
  954|   130k|        }
  955|   163k|        qw->m->pipeline_stack.pop_back();
  956|   163k|        auto* buf = dynamic_cast<Pl_Buffer*>(p);
  957|   163k|        if (bp && buf) {
  ------------------
  |  Branch (957:13): [True: 82.4k, False: 81.0k]
  |  Branch (957:19): [True: 78.5k, False: 3.89k]
  ------------------
  958|  78.5k|            *bp = buf->getBufferSharedPointer();
  959|  78.5k|        }
  960|   163k|        delete p;
  961|   163k|    }
  962|   189k|    qw->m->pipeline = dynamic_cast<Pl_Count*>(qw->m->pipeline_stack.back());
  963|   189k|}
_ZN10QPDFWriter21adjustAESStreamLengthERm:
  967|  73.9k|{
  968|  73.9k|    if (m->encrypted && (!m->cur_data_key.empty()) && m->encrypt_use_aes) {
  ------------------
  |  Branch (968:9): [True: 46.0k, False: 27.8k]
  |  Branch (968:25): [True: 46.0k, False: 0]
  |  Branch (968:55): [True: 46.0k, 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|  46.0k|        length += 32 - (length & 0xf);
  972|  46.0k|    }
  973|  73.9k|}
_ZN10QPDFWriter20pushEncryptionFilterERNS_14PipelinePopperE:
  977|  73.8k|{
  978|  73.8k|    if (m->encrypted && (!m->cur_data_key.empty())) {
  ------------------
  |  Branch (978:9): [True: 46.0k, False: 27.8k]
  |  Branch (978:25): [True: 46.0k, False: 0]
  ------------------
  979|  46.0k|        Pipeline* p = nullptr;
  980|  46.0k|        if (m->encrypt_use_aes) {
  ------------------
  |  Branch (980:13): [True: 46.0k, False: 0]
  ------------------
  981|  46.0k|            p = new Pl_AES_PDF(
  982|  46.0k|                "aes stream encryption",
  983|  46.0k|                m->pipeline,
  984|  46.0k|                true,
  985|  46.0k|                QUtil::unsigned_char_pointer(m->cur_data_key),
  986|  46.0k|                m->cur_data_key.length());
  987|  46.0k|        } 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|  46.0k|        pushPipeline(p);
  995|  46.0k|    }
  996|       |    // Must call this unconditionally so we can call popPipelineStack to balance
  997|       |    // pushEncryptionFilter().
  998|  73.8k|    activatePipelineStack(pp);
  999|  73.8k|}
_ZN10QPDFWriter17pushDiscardFilterERNS_14PipelinePopperE:
 1003|  6.51k|{
 1004|  6.51k|    pushPipeline(new Pl_Discard());
 1005|  6.51k|    activatePipelineStack(pp);
 1006|  6.51k|}
_ZN10QPDFWriter15pushMD5PipelineERNS_14PipelinePopperE:
 1010|  4.20k|{
 1011|  4.20k|    if (!m->id2.empty()) {
  ------------------
  |  Branch (1011:9): [True: 0, False: 4.20k]
  ------------------
 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|  4.20k|    qpdf_assert_debug(m->deterministic_id);
  ------------------
  |  |   16|  4.20k|# define qpdf_assert_debug assert
  ------------------
 1017|  4.20k|    qpdf_assert_debug(m->md5_pipeline == nullptr);
  ------------------
  |  |   16|  4.20k|# define qpdf_assert_debug assert
  ------------------
 1018|  4.20k|    qpdf_assert_debug(m->pipeline->getCount() == 0);
  ------------------
  |  |   16|  4.20k|# define qpdf_assert_debug assert
  ------------------
 1019|  4.20k|    m->md5_pipeline = new Pl_MD5("qpdf md5", m->pipeline);
 1020|  4.20k|    m->md5_pipeline->persistAcrossFinish(true);
 1021|       |    // Special case code in popPipelineStack clears m->md5_pipeline upon deletion.
 1022|  4.20k|    pushPipeline(m->md5_pipeline);
 1023|  4.20k|    activatePipelineStack(pp);
 1024|  4.20k|}
_ZN10QPDFWriter26computeDeterministicIDDataEv:
 1028|  4.09k|{
 1029|  4.09k|    qpdf_assert_debug(m->md5_pipeline != nullptr);
  ------------------
  |  |   16|  4.09k|# define qpdf_assert_debug assert
  ------------------
 1030|  4.09k|    qpdf_assert_debug(m->deterministic_id_data.empty());
  ------------------
  |  |   16|  4.09k|# define qpdf_assert_debug assert
  ------------------
 1031|  4.09k|    m->deterministic_id_data = m->md5_pipeline->getHexDigest();
 1032|  4.09k|    m->md5_pipeline->enable(false);
 1033|  4.09k|}
_ZN10QPDFWriter10openObjectEi:
 1037|   307k|{
 1038|   307k|    if (objid == 0) {
  ------------------
  |  Branch (1038:9): [True: 0, False: 307k]
  ------------------
 1039|      0|        objid = m->next_objid++;
 1040|      0|    }
 1041|   307k|    m->new_obj[objid].xref = QPDFXRefEntry(m->pipeline->getCount());
 1042|   307k|    writeString(std::to_string(objid));
 1043|   307k|    writeString(" 0 obj\n");
 1044|   307k|    return objid;
 1045|   307k|}
_ZN10QPDFWriter11closeObjectEi:
 1049|   307k|{
 1050|       |    // Write a newline before endobj as it makes the file easier to repair.
 1051|   307k|    writeString("\nendobj\n");
 1052|   307k|    writeStringQDF("\n");
 1053|   307k|    auto& new_obj = m->new_obj[objid];
 1054|   307k|    new_obj.length = m->pipeline->getCount() - new_obj.xref.getOffset();
 1055|   307k|}
_ZN10QPDFWriter29assignCompressedObjectNumbersERK10QPDFObjGen:
 1059|  85.8k|{
 1060|  85.8k|    int objid = og.getObj();
 1061|  85.8k|    if ((og.getGen() != 0) || (m->object_stream_to_objects.count(objid) == 0)) {
  ------------------
  |  Branch (1061:9): [True: 137, False: 85.7k]
  |  Branch (1061:31): [True: 84.3k, False: 1.41k]
  ------------------
 1062|       |        // This is not an object stream.
 1063|  84.4k|        return;
 1064|  84.4k|    }
 1065|       |
 1066|       |    // Reserve numbers for the objects that belong to this object stream.
 1067|  20.1k|    for (auto const& iter: m->object_stream_to_objects[objid]) {
  ------------------
  |  Branch (1067:26): [True: 20.1k, False: 1.41k]
  ------------------
 1068|  20.1k|        m->obj[iter].renumber = m->next_objid++;
 1069|  20.1k|    }
 1070|  1.41k|}
_ZN10QPDFWriter13enqueueObjectE16QPDFObjectHandle:
 1074|  9.10M|{
 1075|  9.10M|    if (object.isIndirect()) {
  ------------------
  |  Branch (1075:9): [True: 1.30M, False: 7.80M]
  ------------------
 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|  1.30M|        if (object.getOwningQPDF() != &(m->pdf)) {
  ------------------
  |  Branch (1080:13): [True: 0, False: 1.30M]
  ------------------
 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|  1.30M|        if (m->qdf_mode && object.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (1086:13): [True: 1.22M, False: 83.4k]
  |  Branch (1086:13): [True: 626, False: 1.30M]
  |  Branch (1086:28): [True: 626, False: 1.22M]
  ------------------
 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|    626|            QTC::TC("qpdf", "QPDFWriter ignore XRef in qdf mode");
 1093|    626|            return;
 1094|    626|        }
 1095|       |
 1096|  1.30M|        QPDFObjGen og = object.getObjGen();
 1097|  1.30M|        auto& obj = m->obj[og];
 1098|       |
 1099|  1.30M|        if (obj.renumber == 0) {
  ------------------
  |  Branch (1099:13): [True: 190k, False: 1.11M]
  ------------------
 1100|   190k|            if (obj.object_stream > 0) {
  ------------------
  |  Branch (1100:17): [True: 1.27k, False: 189k]
  ------------------
 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|  1.27k|                obj.renumber = -1;
 1105|  1.27k|                enqueueObject(m->pdf.getObject(obj.object_stream, 0));
 1106|   189k|            } else {
 1107|   189k|                m->object_queue.push_back(object);
 1108|   189k|                obj.renumber = m->next_objid++;
 1109|       |
 1110|   189k|                if ((og.getGen() == 0) && m->object_stream_to_objects.count(og.getObj())) {
  ------------------
  |  Branch (1110:21): [True: 189k, False: 209]
  |  Branch (1110:21): [True: 1.41k, False: 188k]
  |  Branch (1110:43): [True: 1.41k, False: 187k]
  ------------------
 1111|       |                    // For linearized files, uncompressed objects go at end, and we take care of
 1112|       |                    // assigning numbers to them elsewhere.
 1113|  1.41k|                    if (!m->linearized) {
  ------------------
  |  Branch (1113:25): [True: 854, False: 557]
  ------------------
 1114|    854|                        assignCompressedObjectNumbers(og);
 1115|    854|                    }
 1116|   188k|                } else if ((!m->direct_stream_lengths) && object.isStream()) {
  ------------------
  |  Branch (1116:28): [True: 105k, False: 82.8k]
  |  Branch (1116:59): [True: 27.6k, False: 77.5k]
  ------------------
 1117|       |                    // reserve next object ID for length
 1118|  27.6k|                    ++m->next_objid;
 1119|  27.6k|                }
 1120|   189k|            }
 1121|  1.11M|        } else if (obj.renumber == -1) {
  ------------------
  |  Branch (1121:20): [True: 1.07k, False: 1.11M]
  ------------------
 1122|       |            // This can happen if a specially constructed file indicates that an object stream is
 1123|       |            // inside itself.
 1124|  1.07k|        }
 1125|  1.30M|        return;
 1126|  7.80M|    } else if (!m->linearized) {
  ------------------
  |  Branch (1126:16): [True: 7.80M, False: 243]
  ------------------
 1127|  7.80M|        if (object.isArray()) {
  ------------------
  |  Branch (1127:13): [True: 470k, False: 7.33M]
  ------------------
 1128|  2.71M|            for (auto& item: object.getArrayAsVector()) {
  ------------------
  |  Branch (1128:28): [True: 2.71M, False: 470k]
  ------------------
 1129|  2.71M|                enqueueObject(item);
 1130|  2.71M|            }
 1131|  7.33M|        } else if (object.isDictionary()) {
  ------------------
  |  Branch (1131:20): [True: 761k, False: 6.57M]
  ------------------
 1132|  4.45M|            for (auto& item: object.getDictAsMap()) {
  ------------------
  |  Branch (1132:28): [True: 4.45M, False: 761k]
  ------------------
 1133|  4.45M|                if (!item.second.isNull()) {
  ------------------
  |  Branch (1133:21): [True: 4.37M, False: 82.7k]
  ------------------
 1134|  4.37M|                    enqueueObject(item.second);
 1135|  4.37M|                }
 1136|  4.45M|            }
 1137|   761k|        }
 1138|  7.80M|    } else {
 1139|       |        // ignore
 1140|    243|    }
 1141|  9.10M|}
_ZN10QPDFWriter12unparseChildE16QPDFObjectHandleii:
 1145|  4.83M|{
 1146|  4.83M|    if (!m->linearized) {
  ------------------
  |  Branch (1146:9): [True: 1.91M, False: 2.92M]
  ------------------
 1147|  1.91M|        enqueueObject(child);
 1148|  1.91M|    }
 1149|  4.83M|    if (child.isIndirect()) {
  ------------------
  |  Branch (1149:9): [True: 1.01M, False: 3.82M]
  ------------------
 1150|  1.01M|        writeString(std::to_string(m->obj[child].renumber));
 1151|  1.01M|        writeString(" 0 R");
 1152|  3.82M|    } else {
 1153|  3.82M|        unparseObject(child, level, flags);
 1154|  3.82M|    }
 1155|  4.83M|}
_ZN10QPDFWriter12writeTrailerENS_9trailer_eEibxi:
 1160|  15.8k|{
 1161|  15.8k|    QPDFObjectHandle trailer = getTrimmedTrailer();
 1162|  15.8k|    if (xref_stream) {
  ------------------
  |  Branch (1162:9): [True: 1.09k, False: 14.7k]
  ------------------
 1163|  1.09k|        m->cur_data_key.clear();
 1164|  14.7k|    } else {
 1165|  14.7k|        writeString("trailer <<");
 1166|  14.7k|    }
 1167|  15.8k|    writeStringQDF("\n");
 1168|  15.8k|    if (which == t_lin_second) {
  ------------------
  |  Branch (1168:9): [True: 5.84k, False: 9.97k]
  ------------------
 1169|  5.84k|        writeString(" /Size ");
 1170|  5.84k|        writeString(std::to_string(size));
 1171|  9.97k|    } else {
 1172|  45.6k|        for (auto const& key: trailer.getKeys()) {
  ------------------
  |  Branch (1172:29): [True: 45.6k, False: 9.97k]
  ------------------
 1173|  45.6k|            writeStringQDF("  ");
 1174|  45.6k|            writeStringNoQDF(" ");
 1175|  45.6k|            writeString(QPDF_Name::normalizeName(key));
 1176|  45.6k|            writeString(" ");
 1177|  45.6k|            if (key == "/Size") {
  ------------------
  |  Branch (1177:17): [True: 6.80k, False: 38.7k]
  ------------------
 1178|  6.80k|                writeString(std::to_string(size));
 1179|  6.80k|                if (which == t_lin_first) {
  ------------------
  |  Branch (1179:21): [True: 3.98k, False: 2.82k]
  ------------------
 1180|  3.98k|                    writeString(" /Prev ");
 1181|  3.98k|                    qpdf_offset_t pos = m->pipeline->getCount();
 1182|  3.98k|                    writeString(std::to_string(prev));
 1183|  3.98k|                    writePad(QIntC::to_size(pos - m->pipeline->getCount() + 21));
 1184|  3.98k|                }
 1185|  38.7k|            } else {
 1186|  38.7k|                unparseChild(trailer.getKey(key), 1, 0);
 1187|  38.7k|            }
 1188|  45.6k|            writeStringQDF("\n");
 1189|  45.6k|        }
 1190|  9.97k|    }
 1191|       |
 1192|       |    // Write ID
 1193|  15.8k|    writeStringQDF(" ");
 1194|  15.8k|    writeString(" /ID [");
 1195|  15.8k|    if (linearization_pass == 1) {
  ------------------
  |  Branch (1195:9): [True: 5.88k, False: 9.93k]
  ------------------
 1196|  5.88k|        std::string original_id1 = getOriginalID1();
 1197|  5.88k|        if (original_id1.empty()) {
  ------------------
  |  Branch (1197:13): [True: 3.16k, False: 2.72k]
  ------------------
 1198|  3.16k|            writeString("<00000000000000000000000000000000>");
 1199|  3.16k|        } 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.72k|            writeString("<");
 1205|  2.72k|            size_t len = QPDF_String(original_id1).unparse(true).length() - 2;
 1206|   176k|            for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (1206:32): [True: 173k, False: 2.72k]
  ------------------
 1207|   173k|                writeString("0");
 1208|   173k|            }
 1209|  2.72k|            writeString(">");
 1210|  2.72k|        }
 1211|  5.88k|        writeString("<00000000000000000000000000000000>");
 1212|  9.93k|    } else {
 1213|  9.93k|        if ((linearization_pass == 0) && (m->deterministic_id)) {
  ------------------
  |  Branch (1213:13): [True: 4.09k, False: 5.84k]
  |  Branch (1213:42): [True: 4.09k, False: 0]
  ------------------
 1214|  4.09k|            computeDeterministicIDData();
 1215|  4.09k|        }
 1216|  9.93k|        generateID();
 1217|  9.93k|        writeString(QPDF_String(m->id1).unparse(true));
 1218|  9.93k|        writeString(QPDF_String(m->id2).unparse(true));
 1219|  9.93k|    }
 1220|  15.8k|    writeString("]");
 1221|       |
 1222|  15.8k|    if (which != t_lin_second) {
  ------------------
  |  Branch (1222:9): [True: 9.53k, False: 6.28k]
  ------------------
 1223|       |        // Write reference to encryption dictionary
 1224|  9.53k|        if (m->encrypted) {
  ------------------
  |  Branch (1224:13): [True: 5.86k, False: 3.67k]
  ------------------
 1225|  5.86k|            writeString(" /Encrypt ");
 1226|  5.86k|            writeString(std::to_string(m->encryption_dict_objid));
 1227|  5.86k|            writeString(" 0 R");
 1228|  5.86k|        }
 1229|  9.53k|    }
 1230|       |
 1231|  15.8k|    writeStringQDF("\n");
 1232|  15.8k|    writeStringNoQDF(" ");
 1233|  15.8k|    writeString(">>");
 1234|  15.8k|}
_ZN10QPDFWriter16willFilterStreamE16QPDFObjectHandleRbS1_PNSt3__110shared_ptrI6BufferEE:
 1242|  93.4k|{
 1243|  93.4k|    compress_stream = false;
 1244|  93.4k|    is_metadata = false;
 1245|       |
 1246|  93.4k|    QPDFObjGen old_og = stream.getObjGen();
 1247|  93.4k|    QPDFObjectHandle stream_dict = stream.getDict();
 1248|       |
 1249|  93.4k|    if (stream_dict.isDictionaryOfType("/Metadata")) {
  ------------------
  |  Branch (1249:9): [True: 1.47k, False: 91.9k]
  ------------------
 1250|  1.47k|        is_metadata = true;
 1251|  1.47k|    }
 1252|  93.4k|    bool filter = (stream.isDataModified() || m->compress_streams || m->stream_decode_level);
  ------------------
  |  Branch (1252:20): [True: 0, False: 93.4k]
  |  Branch (1252:47): [True: 66.3k, False: 27.1k]
  |  Branch (1252:70): [True: 27.1k, False: 0]
  ------------------
 1253|  93.4k|    bool filter_on_write = stream.getFilterOnWrite();
 1254|  93.4k|    if (!filter_on_write) {
  ------------------
  |  Branch (1254:9): [True: 3.17k, False: 90.2k]
  ------------------
 1255|  3.17k|        QTC::TC("qpdf", "QPDFWriter getFilterOnWrite false");
 1256|  3.17k|        filter = false;
 1257|  3.17k|    }
 1258|  93.4k|    if (filter_on_write && m->compress_streams) {
  ------------------
  |  Branch (1258:9): [True: 90.2k, False: 3.17k]
  |  Branch (1258:28): [True: 63.1k, False: 27.1k]
  ------------------
 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|  63.1k|        QPDFObjectHandle filter_obj = stream_dict.getKey("/Filter");
 1264|  63.1k|        if ((!m->recompress_flate) && (!stream.isDataModified()) && filter_obj.isName() &&
  ------------------
  |  Branch (1264:13): [True: 63.1k, False: 0]
  |  Branch (1264:13): [True: 24.8k, False: 38.3k]
  |  Branch (1264:39): [True: 63.1k, False: 0]
  |  Branch (1264:69): [True: 26.9k, False: 36.2k]
  ------------------
 1265|  63.1k|            ((filter_obj.getName() == "/FlateDecode") || (filter_obj.getName() == "/Fl"))) {
  ------------------
  |  Branch (1265:14): [True: 24.7k, False: 2.16k]
  |  Branch (1265:58): [True: 37, False: 2.13k]
  ------------------
 1266|  24.8k|            QTC::TC("qpdf", "QPDFWriter not recompressing /FlateDecode");
 1267|  24.8k|            filter = false;
 1268|  24.8k|        }
 1269|  63.1k|    }
 1270|  93.4k|    bool normalize = false;
 1271|  93.4k|    bool uncompress = false;
 1272|  93.4k|    if (filter_on_write && is_metadata && ((!m->encrypted) || (m->encrypt_metadata == false))) {
  ------------------
  |  Branch (1272:9): [True: 90.2k, False: 3.17k]
  |  Branch (1272:28): [True: 1.47k, False: 88.8k]
  |  Branch (1272:44): [True: 432, False: 1.04k]
  |  Branch (1272:63): [True: 0, False: 1.04k]
  ------------------
 1273|    432|        QTC::TC("qpdf", "QPDFWriter not compressing metadata");
 1274|    432|        filter = true;
 1275|    432|        compress_stream = false;
 1276|    432|        uncompress = true;
 1277|  93.0k|    } else if (filter_on_write && m->normalize_content && m->normalized_streams.count(old_og)) {
  ------------------
  |  Branch (1277:16): [True: 89.8k, False: 3.17k]
  |  Branch (1277:35): [True: 26.6k, False: 63.1k]
  |  Branch (1277:59): [True: 7.91k, False: 18.7k]
  ------------------
 1278|  7.91k|        normalize = true;
 1279|  7.91k|        filter = true;
 1280|  85.1k|    } else if (filter_on_write && filter && m->compress_streams) {
  ------------------
  |  Branch (1280:16): [True: 81.9k, False: 3.17k]
  |  Branch (1280:35): [True: 57.1k, False: 24.8k]
  |  Branch (1280:45): [True: 38.3k, False: 18.7k]
  ------------------
 1281|  38.3k|        compress_stream = true;
 1282|  38.3k|        QTC::TC("qpdf", "QPDFWriter compressing uncompressed stream");
 1283|  38.3k|    }
 1284|       |
 1285|  93.4k|    bool filtered = false;
 1286|  98.8k|    for (int attempt = 1; attempt <= 2; ++attempt) {
  ------------------
  |  Branch (1286:27): [True: 98.8k, False: 0]
  ------------------
 1287|  98.8k|        pushPipeline(new Pl_Buffer("stream data"));
 1288|  98.8k|        PipelinePopper pp_stream_data(this, stream_data);
 1289|  98.8k|        activatePipelineStack(pp_stream_data);
 1290|  98.8k|        try {
 1291|  98.8k|            filtered = stream.pipeStreamData(
 1292|  98.8k|                m->pipeline,
 1293|  98.8k|                (((filter && normalize) ? qpdf_ef_normalize : 0) |
  ------------------
  |  Branch (1293:20): [True: 65.4k, False: 33.3k]
  |  Branch (1293:30): [True: 7.91k, False: 57.5k]
  ------------------
 1294|  98.8k|                 ((filter && compress_stream) ? qpdf_ef_compress : 0)),
  ------------------
  |  Branch (1294:20): [True: 65.4k, False: 33.3k]
  |  Branch (1294:30): [True: 38.3k, False: 27.1k]
  ------------------
 1295|  98.8k|                (filter ? (uncompress ? qpdf_dl_all : m->stream_decode_level) : qpdf_dl_none),
  ------------------
  |  Branch (1295:18): [True: 65.4k, False: 33.3k]
  |  Branch (1295:28): [True: 432, False: 65.0k]
  ------------------
 1296|  98.8k|                false,
 1297|  98.8k|                (attempt == 1));
 1298|  98.8k|        } catch (std::runtime_error& e) {
 1299|    117|            throw std::runtime_error(
 1300|    117|                "error while getting stream data for " + stream.unparse() + ": " + e.what());
 1301|    117|        }
 1302|  98.7k|        if (filter && !filtered) {
  ------------------
  |  Branch (1302:13): [True: 65.3k, False: 33.3k]
  |  Branch (1302:23): [True: 5.39k, False: 59.9k]
  ------------------
 1303|       |            // Try again
 1304|  5.39k|            filter = false;
 1305|  5.39k|            stream.setFilterOnWrite(false);
 1306|  93.3k|        } else {
 1307|  93.3k|            break;
 1308|  93.3k|        }
 1309|  98.7k|    }
 1310|  93.3k|    if (!filtered) {
  ------------------
  |  Branch (1310:9): [True: 33.3k, False: 59.9k]
  ------------------
 1311|  33.3k|        compress_stream = false;
 1312|  33.3k|    }
 1313|  93.3k|    return filtered;
 1314|  93.4k|}
_ZN10QPDFWriter13unparseObjectE16QPDFObjectHandleiimb:
 1319|  4.19M|{
 1320|  4.19M|    QPDFObjGen old_og = object.getObjGen();
 1321|  4.19M|    int child_flags = flags & ~f_stream;
 1322|  4.19M|    if (level < 0) {
  ------------------
  |  Branch (1322:9): [True: 0, False: 4.19M]
  ------------------
 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|  4.19M|    std::string indent = " ";
 1328|  4.19M|    if (m->qdf_mode) {
  ------------------
  |  Branch (1328:9): [True: 1.66M, False: 2.53M]
  ------------------
 1329|  1.66M|        indent.append(static_cast<size_t>(2 * level), ' ');
 1330|  1.66M|        indent[0] = '\n';
 1331|  1.66M|    }
 1332|       |
 1333|  4.19M|    if (auto const tc = object.getTypeCode(); tc == ::ot_array) {
  ------------------
  |  Branch (1333:47): [True: 281k, False: 3.91M]
  ------------------
 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|   281k|        writeString("[");
 1338|  2.70M|        for (auto const& item: object.getArrayAsVector()) {
  ------------------
  |  Branch (1338:30): [True: 2.70M, False: 281k]
  ------------------
 1339|  2.70M|            writeString(indent);
 1340|  2.70M|            writeStringQDF("  ");
 1341|  2.70M|            unparseChild(item, level + 1, child_flags);
 1342|  2.70M|        }
 1343|   281k|        writeString(indent);
 1344|   281k|        writeString("]");
 1345|  3.91M|    } else if (tc == ::ot_dictionary) {
  ------------------
  |  Branch (1345:16): [True: 529k, False: 3.38M]
  ------------------
 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|   529k|        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|   529k|        const bool is_root = (old_og == m->root_og);
 1374|   529k|        bool have_extensions_other = false;
 1375|   529k|        bool have_extensions_adbe = false;
 1376|       |
 1377|   529k|        QPDFObjectHandle extensions;
 1378|   529k|        if (is_root) {
  ------------------
  |  Branch (1378:13): [True: 9.85k, False: 519k]
  ------------------
 1379|  9.85k|            if (object.hasKey("/Extensions") && object.getKey("/Extensions").isDictionary()) {
  ------------------
  |  Branch (1379:17): [True: 26, False: 9.82k]
  |  Branch (1379:17): [True: 22, False: 9.83k]
  |  Branch (1379:49): [True: 22, False: 4]
  ------------------
 1380|     22|                extensions = object.getKey("/Extensions");
 1381|     22|            }
 1382|  9.85k|        }
 1383|       |
 1384|   529k|        if (extensions.isInitialized()) {
  ------------------
  |  Branch (1384:13): [True: 22, False: 529k]
  ------------------
 1385|     22|            std::set<std::string> keys = extensions.getKeys();
 1386|     22|            if (keys.count("/ADBE") > 0) {
  ------------------
  |  Branch (1386:17): [True: 17, False: 5]
  ------------------
 1387|     17|                have_extensions_adbe = true;
 1388|     17|                keys.erase("/ADBE");
 1389|     17|            }
 1390|     22|            if (keys.size() > 0) {
  ------------------
  |  Branch (1390:17): [True: 6, False: 16]
  ------------------
 1391|      6|                have_extensions_other = true;
 1392|      6|            }
 1393|     22|        }
 1394|       |
 1395|   529k|        bool need_extensions_adbe = (m->final_extension_level > 0);
 1396|       |
 1397|   529k|        if (is_root) {
  ------------------
  |  Branch (1397:13): [True: 9.85k, False: 519k]
  ------------------
 1398|  9.85k|            if (need_extensions_adbe) {
  ------------------
  |  Branch (1398:17): [True: 5.74k, False: 4.10k]
  ------------------
 1399|  5.74k|                if (!(have_extensions_other || have_extensions_adbe)) {
  ------------------
  |  Branch (1399:23): [True: 2, False: 5.74k]
  |  Branch (1399:48): [True: 15, False: 5.72k]
  ------------------
 1400|       |                    // We need Extensions and don't have it.  Create it here.
 1401|  5.72k|                    QTC::TC("qpdf", "QPDFWriter create Extensions", m->qdf_mode ? 0 : 1);
  ------------------
  |  Branch (1401:69): [True: 0, False: 5.72k]
  ------------------
 1402|  5.72k|                    extensions = object.replaceKeyAndGetNew(
 1403|  5.72k|                        "/Extensions", QPDFObjectHandle::newDictionary());
 1404|  5.72k|                }
 1405|  5.74k|            } else if (!have_extensions_other) {
  ------------------
  |  Branch (1405:24): [True: 4.10k, False: 4]
  ------------------
 1406|       |                // We have Extensions dictionary and don't want one.
 1407|  4.10k|                if (have_extensions_adbe) {
  ------------------
  |  Branch (1407:21): [True: 1, False: 4.10k]
  ------------------
 1408|      1|                    QTC::TC("qpdf", "QPDFWriter remove existing Extensions");
 1409|      1|                    object.removeKey("/Extensions");
 1410|      1|                    extensions = QPDFObjectHandle(); // uninitialized
 1411|      1|                }
 1412|  4.10k|            }
 1413|  9.85k|        }
 1414|       |
 1415|   529k|        if (extensions.isInitialized()) {
  ------------------
  |  Branch (1415:13): [True: 5.74k, False: 523k]
  ------------------
 1416|  5.74k|            QTC::TC("qpdf", "QPDFWriter preserve Extensions");
 1417|  5.74k|            QPDFObjectHandle adbe = extensions.getKey("/ADBE");
 1418|  5.74k|            if (adbe.isDictionary() &&
  ------------------
  |  Branch (1418:17): [True: 16, False: 5.73k]
  |  Branch (1418:17): [True: 11, False: 5.73k]
  ------------------
 1419|  5.74k|                adbe.getKey("/BaseVersion").isNameAndEquals("/" + m->final_pdf_version) &&
  ------------------
  |  Branch (1419:17): [True: 16, False: 0]
  ------------------
 1420|  5.74k|                adbe.getKey("/ExtensionLevel").isInteger() &&
  ------------------
  |  Branch (1420:17): [True: 16, False: 0]
  ------------------
 1421|  5.74k|                (adbe.getKey("/ExtensionLevel").getIntValue() == m->final_extension_level)) {
  ------------------
  |  Branch (1421:17): [True: 11, False: 5]
  ------------------
 1422|     11|                QTC::TC("qpdf", "QPDFWriter preserve ADBE");
 1423|  5.73k|            } else {
 1424|  5.73k|                if (need_extensions_adbe) {
  ------------------
  |  Branch (1424:21): [True: 5.73k, False: 4]
  ------------------
 1425|  5.73k|                    extensions.replaceKey(
 1426|  5.73k|                        "/ADBE",
 1427|  5.73k|                        QPDFObjectHandle::parse(
 1428|  5.73k|                            "<< /BaseVersion /" + m->final_pdf_version + " /ExtensionLevel " +
 1429|  5.73k|                            std::to_string(m->final_extension_level) + " >>"));
 1430|  5.73k|                } else {
 1431|      4|                    QTC::TC("qpdf", "QPDFWriter remove ADBE");
 1432|      4|                    extensions.removeKey("/ADBE");
 1433|      4|                }
 1434|  5.73k|            }
 1435|  5.74k|        }
 1436|       |
 1437|       |        // Stream dictionaries.
 1438|       |
 1439|   529k|        if (flags & f_stream) {
  ------------------
  |  Branch (1439:13): [True: 69.2k, False: 459k]
  ------------------
 1440|       |            // Suppress /Length since we will write it manually
 1441|  69.2k|            object.removeKey("/Length");
 1442|       |
 1443|       |            // If /DecodeParms is an empty list, remove it.
 1444|  69.2k|            if (object.getKey("/DecodeParms").isArray() &&
  ------------------
  |  Branch (1444:17): [True: 371, False: 68.8k]
  |  Branch (1444:17): [True: 0, False: 69.2k]
  ------------------
 1445|  69.2k|                (0 == object.getKey("/DecodeParms").getArrayNItems())) {
  ------------------
  |  Branch (1445:17): [True: 0, False: 371]
  ------------------
 1446|      0|                QTC::TC("qpdf", "QPDFWriter remove empty DecodeParms");
 1447|      0|                object.removeKey("/DecodeParms");
 1448|      0|            }
 1449|       |
 1450|  69.2k|            if (flags & f_filtered) {
  ------------------
  |  Branch (1450:17): [True: 46.8k, False: 22.4k]
  ------------------
 1451|       |                // We will supply our own filter and decode
 1452|       |                // parameters.
 1453|  46.8k|                object.removeKey("/Filter");
 1454|  46.8k|                object.removeKey("/DecodeParms");
 1455|  46.8k|            } else {
 1456|       |                // Make sure, no matter what else we have, that we don't have /Crypt in the output
 1457|       |                // filters.
 1458|  22.4k|                QPDFObjectHandle filter = object.getKey("/Filter");
 1459|  22.4k|                QPDFObjectHandle decode_parms = object.getKey("/DecodeParms");
 1460|  22.4k|                if (filter.isOrHasName("/Crypt")) {
  ------------------
  |  Branch (1460:21): [True: 16, False: 22.3k]
  ------------------
 1461|     16|                    if (filter.isName()) {
  ------------------
  |  Branch (1461:25): [True: 12, False: 4]
  ------------------
 1462|     12|                        object.removeKey("/Filter");
 1463|     12|                        object.removeKey("/DecodeParms");
 1464|     12|                    } else {
 1465|      4|                        int idx = -1;
 1466|      8|                        for (int i = 0; i < filter.getArrayNItems(); ++i) {
  ------------------
  |  Branch (1466:41): [True: 8, False: 0]
  ------------------
 1467|      8|                            QPDFObjectHandle item = filter.getArrayItem(i);
 1468|      8|                            if (item.isNameAndEquals("/Crypt")) {
  ------------------
  |  Branch (1468:33): [True: 4, False: 4]
  ------------------
 1469|      4|                                idx = i;
 1470|      4|                                break;
 1471|      4|                            }
 1472|      8|                        }
 1473|      4|                        if (idx >= 0) {
  ------------------
  |  Branch (1473:29): [True: 4, 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|      4|                            QTC::TC("qpdf", "QPDFWriter remove Crypt");
 1479|      4|                            filter.eraseItem(idx);
 1480|      4|                            decode_parms.eraseItem(idx);
 1481|      4|                        }
 1482|      4|                    }
 1483|     16|                }
 1484|  22.4k|            }
 1485|  69.2k|        }
 1486|       |
 1487|   529k|        writeString("<<");
 1488|       |
 1489|  2.24M|        for (auto& item: object.getDictAsMap()) {
  ------------------
  |  Branch (1489:24): [True: 2.24M, False: 529k]
  ------------------
 1490|  2.24M|            if (!item.second.isNull()) {
  ------------------
  |  Branch (1490:17): [True: 2.08M, False: 159k]
  ------------------
 1491|  2.08M|                auto const& key = item.first;
 1492|  2.08M|                writeString(indent);
 1493|  2.08M|                writeStringQDF("  ");
 1494|  2.08M|                writeString(QPDF_Name::normalizeName(key));
 1495|  2.08M|                writeString(" ");
 1496|  2.08M|                if (key == "/Contents" && object.isDictionaryOfType("/Sig") &&
  ------------------
  |  Branch (1496:21): [True: 24.5k, False: 2.06M]
  |  Branch (1496:21): [True: 8, False: 2.08M]
  |  Branch (1496:43): [True: 8, False: 24.5k]
  ------------------
 1497|  2.08M|                    object.hasKey("/ByteRange")) {
  ------------------
  |  Branch (1497:21): [True: 8, False: 0]
  ------------------
 1498|      8|                    QTC::TC("qpdf", "QPDFWriter no encryption sig contents");
 1499|      8|                    unparseChild(
 1500|      8|                        item.second, level + 1, child_flags | f_hex_string | f_no_encryption);
 1501|  2.08M|                } else {
 1502|  2.08M|                    unparseChild(item.second, level + 1, child_flags);
 1503|  2.08M|                }
 1504|  2.08M|            }
 1505|  2.24M|        }
 1506|       |
 1507|   529k|        if (flags & f_stream) {
  ------------------
  |  Branch (1507:13): [True: 69.2k, False: 459k]
  ------------------
 1508|  69.2k|            writeString(indent);
 1509|  69.2k|            writeStringQDF("  ");
 1510|  69.2k|            writeString("/Length ");
 1511|       |
 1512|  69.2k|            if (m->direct_stream_lengths) {
  ------------------
  |  Branch (1512:17): [True: 42.1k, False: 27.0k]
  ------------------
 1513|  42.1k|                writeString(std::to_string(stream_length));
 1514|  42.1k|            } else {
 1515|  27.0k|                writeString(std::to_string(m->cur_stream_length_id));
 1516|  27.0k|                writeString(" 0 R");
 1517|  27.0k|            }
 1518|  69.2k|            if (compress && (flags & f_filtered)) {
  ------------------
  |  Branch (1518:17): [True: 23.2k, False: 45.9k]
  |  Branch (1518:29): [True: 23.2k, False: 0]
  ------------------
 1519|  23.2k|                writeString(indent);
 1520|  23.2k|                writeStringQDF("  ");
 1521|  23.2k|                writeString("/Filter /FlateDecode");
 1522|  23.2k|            }
 1523|  69.2k|        }
 1524|       |
 1525|   529k|        writeString(indent);
 1526|   529k|        writeString(">>");
 1527|  3.38M|    } else if (tc == ::ot_stream) {
  ------------------
  |  Branch (1527:16): [True: 69.3k, False: 3.31M]
  ------------------
 1528|       |        // Write stream data to a buffer.
 1529|  69.3k|        if (!m->direct_stream_lengths) {
  ------------------
  |  Branch (1529:13): [True: 27.1k, False: 42.1k]
  ------------------
 1530|  27.1k|            m->cur_stream_length_id = m->obj[old_og].renumber + 1;
 1531|  27.1k|        }
 1532|       |
 1533|  69.3k|        flags |= f_stream;
 1534|  69.3k|        bool compress_stream = false;
 1535|  69.3k|        bool is_metadata = false;
 1536|  69.3k|        std::shared_ptr<Buffer> stream_data;
 1537|  69.3k|        if (willFilterStream(object, compress_stream, is_metadata, &stream_data)) {
  ------------------
  |  Branch (1537:13): [True: 46.8k, False: 22.4k]
  ------------------
 1538|  46.8k|            flags |= f_filtered;
 1539|  46.8k|        }
 1540|  69.3k|        QPDFObjectHandle stream_dict = object.getDict();
 1541|       |
 1542|  69.3k|        m->cur_stream_length = stream_data->getSize();
 1543|  69.3k|        if (is_metadata && m->encrypted && (!m->encrypt_metadata)) {
  ------------------
  |  Branch (1543:13): [True: 1.09k, False: 68.2k]
  |  Branch (1543:28): [True: 660, False: 432]
  |  Branch (1543:44): [True: 0, False: 660]
  ------------------
 1544|       |            // Don't encrypt stream data for the metadata stream
 1545|      0|            m->cur_data_key.clear();
 1546|      0|        }
 1547|  69.3k|        adjustAESStreamLength(m->cur_stream_length);
 1548|  69.3k|        unparseObject(stream_dict, 0, flags, m->cur_stream_length, compress_stream);
 1549|  69.3k|        unsigned char last_char = '\0';
 1550|  69.3k|        writeString("\nstream\n");
 1551|  69.3k|        {
 1552|  69.3k|            PipelinePopper pp_enc(this);
 1553|  69.3k|            pushEncryptionFilter(pp_enc);
 1554|  69.3k|            writeBuffer(stream_data);
 1555|  69.3k|            last_char = m->pipeline->getLastChar();
 1556|  69.3k|        }
 1557|       |
 1558|  69.3k|        if (m->newline_before_endstream || (m->qdf_mode && (last_char != '\n'))) {
  ------------------
  |  Branch (1558:13): [True: 86, False: 69.2k]
  |  Branch (1558:45): [True: 27.0k, False: 42.1k]
  |  Branch (1558:60): [True: 9.76k, False: 17.2k]
  ------------------
 1559|  9.76k|            writeString("\n");
 1560|  9.76k|            m->added_newline = true;
 1561|  59.5k|        } else {
 1562|  59.5k|            m->added_newline = false;
 1563|  59.5k|        }
 1564|  69.3k|        writeString("endstream");
 1565|  3.31M|    } else if (tc == ::ot_string) {
  ------------------
  |  Branch (1565:16): [True: 284k, False: 3.03M]
  ------------------
 1566|   284k|        std::string val;
 1567|   284k|        if (m->encrypted && (!(flags & f_in_ostream)) && (!(flags & f_no_encryption)) &&
  ------------------
  |  Branch (1567:13): [True: 173k, False: 111k]
  |  Branch (1567:29): [True: 168k, False: 5.28k]
  |  Branch (1567:58): [True: 168k, False: 4]
  ------------------
 1568|   284k|            (!m->cur_data_key.empty())) {
  ------------------
  |  Branch (1568:13): [True: 165k, False: 2.89k]
  ------------------
 1569|   165k|            val = object.getStringValue();
 1570|   165k|            if (m->encrypt_use_aes) {
  ------------------
  |  Branch (1570:17): [True: 165k, False: 0]
  ------------------
 1571|   165k|                Pl_Buffer bufpl("encrypted string");
 1572|   165k|                Pl_AES_PDF pl(
 1573|   165k|                    "aes encrypt string",
 1574|   165k|                    &bufpl,
 1575|   165k|                    true,
 1576|   165k|                    QUtil::unsigned_char_pointer(m->cur_data_key),
 1577|   165k|                    m->cur_data_key.length());
 1578|   165k|                pl.writeString(val);
 1579|   165k|                pl.finish();
 1580|   165k|                val = QPDF_String(bufpl.getString()).unparse(true);
 1581|   165k|            } 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|   165k|        } else if (flags & f_hex_string) {
  ------------------
  |  Branch (1592:20): [True: 8, False: 119k]
  ------------------
 1593|      8|            val = QPDF_String(object.getStringValue()).unparse(true);
 1594|   119k|        } else {
 1595|   119k|            val = object.unparseResolved();
 1596|   119k|        }
 1597|   284k|        writeString(val);
 1598|  3.03M|    } else {
 1599|  3.03M|        writeString(object.unparseResolved());
 1600|  3.03M|    }
 1601|  4.19M|}
_ZN10QPDFWriter24writeObjectStreamOffsetsERNSt3__16vectorIxNS0_9allocatorIxEEEEi:
 1605|  3.55k|{
 1606|  47.4k|    for (size_t i = 0; i < offsets.size(); ++i) {
  ------------------
  |  Branch (1606:24): [True: 43.8k, False: 3.55k]
  ------------------
 1607|  43.8k|        if (i != 0) {
  ------------------
  |  Branch (1607:13): [True: 40.3k, False: 3.55k]
  ------------------
 1608|  40.3k|            writeStringQDF("\n");
 1609|  40.3k|            writeStringNoQDF(" ");
 1610|  40.3k|        }
 1611|  43.8k|        writeString(std::to_string(i + QIntC::to_size(first_obj)));
 1612|  43.8k|        writeString(" ");
 1613|  43.8k|        writeString(std::to_string(offsets.at(i)));
 1614|  43.8k|    }
 1615|  3.55k|    writeString("\n");
 1616|  3.55k|}
_ZN10QPDFWriter17writeObjectStreamE16QPDFObjectHandle:
 1620|  1.77k|{
 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|  1.77k|    QPDFObjGen old_og = object.getObjGen();
 1625|  1.77k|    qpdf_assert_debug(old_og.getGen() == 0);
  ------------------
  |  |   16|  1.77k|# define qpdf_assert_debug assert
  ------------------
 1626|  1.77k|    int old_id = old_og.getObj();
 1627|  1.77k|    int new_stream_id = m->obj[old_og].renumber;
 1628|       |
 1629|  1.77k|    std::vector<qpdf_offset_t> offsets;
 1630|  1.77k|    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|  1.77k|    std::shared_ptr<Buffer> stream_buffer;
 1635|  1.77k|    int first_obj = -1;
 1636|  1.77k|    bool compressed = false;
 1637|  5.33k|    for (int pass = 1; pass <= 2; ++pass) {
  ------------------
  |  Branch (1637:24): [True: 3.55k, False: 1.77k]
  ------------------
 1638|       |        // stream_buffer will be initialized only for pass 2
 1639|  3.55k|        PipelinePopper pp_ostream(this, &stream_buffer);
 1640|  3.55k|        if (pass == 1) {
  ------------------
  |  Branch (1640:13): [True: 1.77k, False: 1.77k]
  ------------------
 1641|  1.77k|            pushDiscardFilter(pp_ostream);
 1642|  1.77k|        } else {
 1643|       |            // Adjust offsets to skip over comment before first object
 1644|  1.77k|            first = offsets.at(0);
 1645|  21.9k|            for (auto& iter: offsets) {
  ------------------
  |  Branch (1645:28): [True: 21.9k, False: 1.77k]
  ------------------
 1646|  21.9k|                iter -= first;
 1647|  21.9k|            }
 1648|       |
 1649|       |            // Take one pass at writing pairs of numbers so we can get their size information
 1650|  1.77k|            {
 1651|  1.77k|                PipelinePopper pp_discard(this);
 1652|  1.77k|                pushDiscardFilter(pp_discard);
 1653|  1.77k|                writeObjectStreamOffsets(offsets, first_obj);
 1654|  1.77k|                first += m->pipeline->getCount();
 1655|  1.77k|            }
 1656|       |
 1657|       |            // Set up a stream to write the stream data into a buffer.
 1658|  1.77k|            Pipeline* next = pushPipeline(new Pl_Buffer("object stream"));
 1659|  1.77k|            if (m->compress_streams && !m->qdf_mode) {
  ------------------
  |  Branch (1659:17): [True: 929, False: 848]
  |  Branch (1659:40): [True: 929, False: 0]
  ------------------
 1660|    929|                compressed = true;
 1661|    929|                next =
 1662|    929|                    pushPipeline(new Pl_Flate("compress object stream", next, Pl_Flate::a_deflate));
 1663|    929|            }
 1664|  1.77k|            activatePipelineStack(pp_ostream);
 1665|  1.77k|            writeObjectStreamOffsets(offsets, first_obj);
 1666|  1.77k|        }
 1667|       |
 1668|  3.55k|        int count = -1;
 1669|  43.8k|        for (auto const& obj: m->object_stream_to_objects[old_id]) {
  ------------------
  |  Branch (1669:29): [True: 43.8k, False: 3.55k]
  ------------------
 1670|  43.8k|            ++count;
 1671|  43.8k|            int new_obj = m->obj[obj].renumber;
 1672|  43.8k|            if (first_obj == -1) {
  ------------------
  |  Branch (1672:17): [True: 1.77k, False: 42.1k]
  ------------------
 1673|  1.77k|                first_obj = new_obj;
 1674|  1.77k|            }
 1675|  43.8k|            if (m->qdf_mode) {
  ------------------
  |  Branch (1675:17): [True: 21.8k, False: 22.0k]
  ------------------
 1676|  21.8k|                writeString(
 1677|  21.8k|                    "%% Object stream: object " + std::to_string(new_obj) + ", index " +
 1678|  21.8k|                    std::to_string(count));
 1679|  21.8k|                if (!m->suppress_original_object_ids) {
  ------------------
  |  Branch (1679:21): [True: 21.8k, False: 0]
  ------------------
 1680|  21.8k|                    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|  21.8k|                    if (obj.getGen() != 0) {
  ------------------
  |  Branch (1684:25): [True: 0, False: 21.8k]
  ------------------
 1685|      0|                        QTC::TC("qpdf", "QPDFWriter original obj non-zero gen");
 1686|      0|                        writeString(" " + std::to_string(obj.getGen()));
 1687|      0|                    }
 1688|  21.8k|                }
 1689|  21.8k|                writeString("\n");
 1690|  21.8k|            }
 1691|  43.8k|            if (pass == 1) {
  ------------------
  |  Branch (1691:17): [True: 21.9k, False: 21.9k]
  ------------------
 1692|  21.9k|                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|  21.9k|                indicateProgress(true, false);
 1696|  21.9k|            }
 1697|  43.8k|            QPDFObjectHandle obj_to_write = m->pdf.getObject(obj);
 1698|  43.8k|            if (obj_to_write.isStream()) {
  ------------------
  |  Branch (1698:17): [True: 0, False: 43.8k]
  ------------------
 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|  43.8k|            writeObject(obj_to_write, count);
 1706|       |
 1707|  43.8k|            m->new_obj[new_obj].xref = QPDFXRefEntry(new_stream_id, count);
 1708|  43.8k|        }
 1709|  3.55k|    }
 1710|       |
 1711|       |    // Write the object
 1712|  1.77k|    openObject(new_stream_id);
 1713|  1.77k|    setDataKey(new_stream_id);
 1714|  1.77k|    writeString("<<");
 1715|  1.77k|    writeStringQDF("\n ");
 1716|  1.77k|    writeString(" /Type /ObjStm");
 1717|  1.77k|    writeStringQDF("\n ");
 1718|  1.77k|    size_t length = stream_buffer->getSize();
 1719|  1.77k|    adjustAESStreamLength(length);
 1720|  1.77k|    writeString(" /Length " + std::to_string(length));
 1721|  1.77k|    writeStringQDF("\n ");
 1722|  1.77k|    if (compressed) {
  ------------------
  |  Branch (1722:9): [True: 929, False: 848]
  ------------------
 1723|    929|        writeString(" /Filter /FlateDecode");
 1724|    929|    }
 1725|  1.77k|    writeString(" /N " + std::to_string(offsets.size()));
 1726|  1.77k|    writeStringQDF("\n ");
 1727|  1.77k|    writeString(" /First " + std::to_string(first));
 1728|  1.77k|    if (!object.isNull()) {
  ------------------
  |  Branch (1728:9): [True: 1.72k, False: 55]
  ------------------
 1729|       |        // If the original object has an /Extends key, preserve it.
 1730|  1.72k|        QPDFObjectHandle dict = object.getDict();
 1731|  1.72k|        QPDFObjectHandle extends = dict.getKey("/Extends");
 1732|  1.72k|        if (extends.isIndirect()) {
  ------------------
  |  Branch (1732:13): [True: 96, False: 1.62k]
  ------------------
 1733|     96|            QTC::TC("qpdf", "QPDFWriter copy Extends");
 1734|     96|            writeStringQDF("\n ");
 1735|     96|            writeString(" /Extends ");
 1736|     96|            unparseChild(extends, 1, f_in_ostream);
 1737|     96|        }
 1738|  1.72k|    }
 1739|  1.77k|    writeStringQDF("\n");
 1740|  1.77k|    writeStringNoQDF(" ");
 1741|  1.77k|    writeString(">>\nstream\n");
 1742|  1.77k|    if (m->encrypted) {
  ------------------
  |  Branch (1742:9): [True: 914, False: 863]
  ------------------
 1743|    914|        QTC::TC("qpdf", "QPDFWriter encrypt object stream");
 1744|    914|    }
 1745|  1.77k|    {
 1746|  1.77k|        PipelinePopper pp_enc(this);
 1747|  1.77k|        pushEncryptionFilter(pp_enc);
 1748|  1.77k|        writeBuffer(stream_buffer);
 1749|  1.77k|    }
 1750|  1.77k|    if (m->newline_before_endstream) {
  ------------------
  |  Branch (1750:9): [True: 0, False: 1.77k]
  ------------------
 1751|      0|        writeString("\n");
 1752|      0|    }
 1753|  1.77k|    writeString("endstream");
 1754|  1.77k|    m->cur_data_key.clear();
 1755|  1.77k|    closeObject(new_stream_id);
 1756|  1.77k|}
_ZN10QPDFWriter11writeObjectE16QPDFObjectHandlei:
 1760|   308k|{
 1761|   308k|    QPDFObjGen old_og = object.getObjGen();
 1762|       |
 1763|   308k|    if ((object_stream_index == -1) && (old_og.getGen() == 0) &&
  ------------------
  |  Branch (1763:9): [True: 264k, False: 43.8k]
  |  Branch (1763:9): [True: 1.77k, False: 307k]
  |  Branch (1763:40): [True: 264k, False: 264]
  ------------------
 1764|   308k|        (m->object_stream_to_objects.count(old_og.getObj()))) {
  ------------------
  |  Branch (1764:9): [True: 1.77k, False: 262k]
  ------------------
 1765|  1.77k|        writeObjectStream(object);
 1766|  1.77k|        return;
 1767|  1.77k|    }
 1768|       |
 1769|   307k|    indicateProgress(false, false);
 1770|   307k|    auto new_id = m->obj[old_og].renumber;
 1771|   307k|    if (m->qdf_mode) {
  ------------------
  |  Branch (1771:9): [True: 125k, False: 181k]
  ------------------
 1772|   125k|        if (m->page_object_to_seq.count(old_og)) {
  ------------------
  |  Branch (1772:13): [True: 17.5k, False: 108k]
  ------------------
 1773|  17.5k|            writeString("%% Page ");
 1774|  17.5k|            writeString(std::to_string(m->page_object_to_seq[old_og]));
 1775|  17.5k|            writeString("\n");
 1776|  17.5k|        }
 1777|   125k|        if (m->contents_to_page_seq.count(old_og)) {
  ------------------
  |  Branch (1777:13): [True: 8.73k, False: 116k]
  ------------------
 1778|  8.73k|            writeString("%% Contents for page ");
 1779|  8.73k|            writeString(std::to_string(m->contents_to_page_seq[old_og]));
 1780|  8.73k|            writeString("\n");
 1781|  8.73k|        }
 1782|   125k|    }
 1783|   307k|    if (object_stream_index == -1) {
  ------------------
  |  Branch (1783:9): [True: 263k, False: 43.8k]
  ------------------
 1784|   263k|        if (m->qdf_mode && (!m->suppress_original_object_ids)) {
  ------------------
  |  Branch (1784:13): [True: 103k, False: 159k]
  |  Branch (1784:28): [True: 103k, False: 0]
  ------------------
 1785|   103k|            writeString("%% Original object ID: " + object.getObjGen().unparse(' ') + "\n");
 1786|   103k|        }
 1787|   263k|        openObject(new_id);
 1788|   263k|        setDataKey(new_id);
 1789|   263k|        unparseObject(object, 0, 0);
 1790|   263k|        m->cur_data_key.clear();
 1791|   263k|        closeObject(new_id);
 1792|   263k|    } else {
 1793|  43.8k|        unparseObject(object, 0, f_in_ostream);
 1794|  43.8k|        writeString("\n");
 1795|  43.8k|    }
 1796|       |
 1797|   307k|    if ((!m->direct_stream_lengths) && object.isStream()) {
  ------------------
  |  Branch (1797:9): [True: 125k, False: 181k]
  |  Branch (1797:40): [True: 27.0k, False: 98.5k]
  ------------------
 1798|  27.0k|        if (m->qdf_mode) {
  ------------------
  |  Branch (1798:13): [True: 27.0k, False: 0]
  ------------------
 1799|  27.0k|            if (m->added_newline) {
  ------------------
  |  Branch (1799:17): [True: 9.76k, False: 17.2k]
  ------------------
 1800|  9.76k|                writeString("%QDF: ignore_newline\n");
 1801|  9.76k|            }
 1802|  27.0k|        }
 1803|  27.0k|        openObject(new_id + 1);
 1804|  27.0k|        writeString(std::to_string(m->cur_stream_length));
 1805|  27.0k|        closeObject(new_id + 1);
 1806|  27.0k|    }
 1807|   307k|}
_ZN10QPDFWriter14getOriginalID1Ev:
 1811|  14.3k|{
 1812|  14.3k|    QPDFObjectHandle trailer = m->pdf.getTrailer();
 1813|  14.3k|    if (trailer.hasKey("/ID")) {
  ------------------
  |  Branch (1813:9): [True: 7.76k, False: 6.59k]
  ------------------
 1814|  7.76k|        return trailer.getKey("/ID").getArrayItem(0).getStringValue();
 1815|  7.76k|    } else {
 1816|  6.59k|        return "";
 1817|  6.59k|    }
 1818|  14.3k|}
_ZN10QPDFWriter10generateIDEv:
 1822|  14.3k|{
 1823|       |    // Generate the ID lazily so that we can handle the user's preference to use static or
 1824|       |    // deterministic ID generation.
 1825|       |
 1826|  14.3k|    if (!m->id2.empty()) {
  ------------------
  |  Branch (1826:9): [True: 5.84k, False: 8.47k]
  ------------------
 1827|  5.84k|        return;
 1828|  5.84k|    }
 1829|       |
 1830|  8.47k|    QPDFObjectHandle trailer = m->pdf.getTrailer();
 1831|       |
 1832|  8.47k|    std::string result;
 1833|       |
 1834|  8.47k|    if (m->static_id) {
  ------------------
  |  Branch (1834:9): [True: 4.37k, False: 4.09k]
  ------------------
 1835|       |        // For test suite use only...
 1836|  4.37k|        static unsigned char tmp[] = {
 1837|  4.37k|            0x31,
 1838|  4.37k|            0x41,
 1839|  4.37k|            0x59,
 1840|  4.37k|            0x26,
 1841|  4.37k|            0x53,
 1842|  4.37k|            0x58,
 1843|  4.37k|            0x97,
 1844|  4.37k|            0x93,
 1845|  4.37k|            0x23,
 1846|  4.37k|            0x84,
 1847|  4.37k|            0x62,
 1848|  4.37k|            0x64,
 1849|  4.37k|            0x33,
 1850|  4.37k|            0x83,
 1851|  4.37k|            0x27,
 1852|  4.37k|            0x95,
 1853|  4.37k|            0x00};
 1854|  4.37k|        result = reinterpret_cast<char*>(tmp);
 1855|  4.37k|    } 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|  4.09k|        std::string seed;
 1866|  4.09k|        if (m->deterministic_id) {
  ------------------
  |  Branch (1866:13): [True: 4.09k, False: 0]
  ------------------
 1867|  4.09k|            if (m->deterministic_id_data.empty()) {
  ------------------
  |  Branch (1867:17): [True: 0, False: 4.09k]
  ------------------
 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|  4.09k|            seed += m->deterministic_id_data;
 1874|  4.09k|        } else {
 1875|      0|            seed += std::to_string(QUtil::get_current_time());
 1876|      0|            seed += m->filename;
 1877|      0|            seed += " ";
 1878|      0|        }
 1879|  4.09k|        seed += " QPDF ";
 1880|  4.09k|        if (trailer.hasKey("/Info")) {
  ------------------
  |  Branch (1880:13): [True: 915, False: 3.17k]
  ------------------
 1881|    915|            QPDFObjectHandle info = trailer.getKey("/Info");
 1882|  3.98k|            for (auto const& key: info.getKeys()) {
  ------------------
  |  Branch (1882:33): [True: 3.98k, False: 915]
  ------------------
 1883|  3.98k|                QPDFObjectHandle obj = info.getKey(key);
 1884|  3.98k|                if (obj.isString()) {
  ------------------
  |  Branch (1884:21): [True: 2.31k, False: 1.66k]
  ------------------
 1885|  2.31k|                    seed += " ";
 1886|  2.31k|                    seed += obj.getStringValue();
 1887|  2.31k|                }
 1888|  3.98k|            }
 1889|    915|        }
 1890|       |
 1891|  4.09k|        MD5 m;
 1892|  4.09k|        m.encodeString(seed.c_str());
 1893|  4.09k|        MD5::Digest digest;
 1894|  4.09k|        m.digest(digest);
 1895|  4.09k|        result = std::string(reinterpret_cast<char*>(digest), sizeof(MD5::Digest));
 1896|  4.09k|    }
 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|  8.47k|    m->id2 = result;
 1902|       |    // Note: keep /ID from old file even if --static-id was given.
 1903|  8.47k|    m->id1 = getOriginalID1();
 1904|  8.47k|    if (m->id1.empty()) {
  ------------------
  |  Branch (1904:9): [True: 4.24k, False: 4.22k]
  ------------------
 1905|  4.24k|        m->id1 = m->id2;
 1906|  4.24k|    }
 1907|  8.47k|}
_ZN10QPDFWriter24initializeSpecialStreamsEv:
 1911|  8.32k|{
 1912|       |    // Mark all page content streams in case we are filtering or
 1913|       |    // normalizing.
 1914|  8.32k|    std::vector<QPDFObjectHandle> pages = m->pdf.getAllPages();
 1915|  8.32k|    int num = 0;
 1916|  34.7k|    for (auto& page: pages) {
  ------------------
  |  Branch (1916:20): [True: 34.7k, False: 8.32k]
  ------------------
 1917|  34.7k|        m->page_object_to_seq[page.getObjGen()] = ++num;
 1918|  34.7k|        QPDFObjectHandle contents = page.getKey("/Contents");
 1919|  34.7k|        std::vector<QPDFObjGen> contents_objects;
 1920|  34.7k|        if (contents.isArray()) {
  ------------------
  |  Branch (1920:13): [True: 817, False: 33.9k]
  ------------------
 1921|    817|            int n = contents.getArrayNItems();
 1922|  10.3k|            for (int i = 0; i < n; ++i) {
  ------------------
  |  Branch (1922:29): [True: 9.54k, False: 817]
  ------------------
 1923|  9.54k|                contents_objects.push_back(contents.getArrayItem(i).getObjGen());
 1924|  9.54k|            }
 1925|  33.9k|        } else if (contents.isStream()) {
  ------------------
  |  Branch (1925:20): [True: 13.5k, False: 20.3k]
  ------------------
 1926|  13.5k|            contents_objects.push_back(contents.getObjGen());
 1927|  13.5k|        }
 1928|       |
 1929|  34.7k|        for (auto const& c: contents_objects) {
  ------------------
  |  Branch (1929:27): [True: 23.1k, False: 34.7k]
  ------------------
 1930|  23.1k|            m->contents_to_page_seq[c] = num;
 1931|  23.1k|            m->normalized_streams.insert(c);
 1932|  23.1k|        }
 1933|  34.7k|    }
 1934|  8.32k|}
_ZN10QPDFWriter21preserveObjectStreamsEv:
 1938|  8.26k|{
 1939|  8.26k|    auto const& xref = QPDF::Writer::getXRefTable(m->pdf);
 1940|       |    // Our object_to_object_stream map has to map ObjGen -> ObjGen since we may be generating object
 1941|       |    // streams out of old objects that have generation numbers greater than zero. However in an
 1942|       |    // existing PDF, all object stream objects and all objects in them must have generation 0
 1943|       |    // because the PDF spec does not provide any way to do otherwise. This code filters out objects
 1944|       |    // that are not allowed to be in object streams. In addition to removing objects that were
 1945|       |    // erroneously included in object streams in the source PDF, it also prevents unreferenced
 1946|       |    // objects from being included.
 1947|  8.26k|    auto end = xref.cend();
 1948|  8.26k|    m->obj.streams_empty = true;
 1949|  8.26k|    if (m->preserve_unreferenced_objects) {
  ------------------
  |  Branch (1949:9): [True: 0, False: 8.26k]
  ------------------
 1950|      0|        for (auto iter = xref.cbegin(); iter != end; ++iter) {
  ------------------
  |  Branch (1950:41): [True: 0, False: 0]
  ------------------
 1951|      0|            if (iter->second.getType() == 2) {
  ------------------
  |  Branch (1951:17): [True: 0, False: 0]
  ------------------
 1952|       |                // Pdf contains object streams.
 1953|      0|                QTC::TC("qpdf", "QPDFWriter preserve object streams preserve unreferenced");
 1954|      0|                m->obj.streams_empty = false;
 1955|      0|                m->obj[iter->first].object_stream = iter->second.getObjStreamNumber();
 1956|      0|            }
 1957|      0|        }
 1958|  8.26k|    } else {
 1959|       |        // Start by scanning for first compressed object in case we don't have any object streams to
 1960|       |        // process.
 1961|   301k|        for (auto iter = xref.cbegin(); iter != end; ++iter) {
  ------------------
  |  Branch (1961:41): [True: 293k, False: 7.45k]
  ------------------
 1962|   293k|            if (iter->second.getType() == 2) {
  ------------------
  |  Branch (1962:17): [True: 805, False: 292k]
  ------------------
 1963|       |                // Pdf contains object streams.
 1964|    805|                QTC::TC("qpdf", "QPDFWriter preserve object streams");
 1965|    805|                m->obj.streams_empty = false;
 1966|    805|                auto eligible = QPDF::Writer::getCompressibleObjSet(m->pdf);
 1967|       |                // The object pointed to by iter may be a previous generation, in which case it is
 1968|       |                // removed by getCompressibleObjSet. We need to restart the loop (while the object
 1969|       |                // table may contain multiple generations of an object).
 1970|  77.6k|                for (iter = xref.cbegin(); iter != end; ++iter) {
  ------------------
  |  Branch (1970:44): [True: 76.8k, False: 805]
  ------------------
 1971|  76.8k|                    if (iter->second.getType() == 2) {
  ------------------
  |  Branch (1971:25): [True: 50.5k, False: 26.2k]
  ------------------
 1972|  50.5k|                        auto id = static_cast<size_t>(iter->first.getObj());
 1973|  50.5k|                        if (id < eligible.size() && eligible[id]) {
  ------------------
  |  Branch (1973:29): [True: 50.5k, False: 0]
  |  Branch (1973:29): [True: 21.7k, False: 28.8k]
  |  Branch (1973:53): [True: 21.7k, False: 28.8k]
  ------------------
 1974|  21.7k|                            m->obj[iter->first].object_stream = iter->second.getObjStreamNumber();
 1975|  28.8k|                        } else {
 1976|  28.8k|                            QTC::TC("qpdf", "QPDFWriter exclude from object stream");
 1977|  28.8k|                        }
 1978|  50.5k|                    }
 1979|  76.8k|                }
 1980|    805|                return;
 1981|    805|            }
 1982|   293k|        }
 1983|  8.26k|    }
 1984|  8.26k|}
_ZN10QPDFWriter17getTrimmedTrailerEv:
 2028|  20.0k|{
 2029|       |    // Remove keys from the trailer that necessarily have to be replaced when writing the file.
 2030|       |
 2031|  20.0k|    QPDFObjectHandle trailer = m->pdf.getTrailer().unsafeShallowCopy();
 2032|       |
 2033|       |    // Remove encryption keys
 2034|  20.0k|    trailer.removeKey("/ID");
 2035|  20.0k|    trailer.removeKey("/Encrypt");
 2036|       |
 2037|       |    // Remove modification information
 2038|  20.0k|    trailer.removeKey("/Prev");
 2039|       |
 2040|       |    // Remove all trailer keys that potentially come from a cross-reference stream
 2041|  20.0k|    trailer.removeKey("/Index");
 2042|  20.0k|    trailer.removeKey("/W");
 2043|  20.0k|    trailer.removeKey("/Length");
 2044|  20.0k|    trailer.removeKey("/Filter");
 2045|  20.0k|    trailer.removeKey("/DecodeParms");
 2046|  20.0k|    trailer.removeKey("/Type");
 2047|  20.0k|    trailer.removeKey("/XRefStm");
 2048|       |
 2049|  20.0k|    return trailer;
 2050|  20.0k|}
_ZN10QPDFWriter19prepareFileForWriteEv:
 2055|  7.93k|{
 2056|  7.93k|    m->pdf.fixDanglingReferences();
 2057|  7.93k|    auto root = m->pdf.getRoot();
 2058|  7.93k|    auto oh = root.getKey("/Extensions");
 2059|  7.93k|    if (oh.isDictionary()) {
  ------------------
  |  Branch (2059:9): [True: 178, False: 7.75k]
  ------------------
 2060|    178|        const bool extensions_indirect = oh.isIndirect();
 2061|    178|        if (extensions_indirect) {
  ------------------
  |  Branch (2061:13): [True: 0, False: 178]
  ------------------
 2062|      0|            QTC::TC("qpdf", "QPDFWriter make Extensions direct");
 2063|      0|            oh = root.replaceKeyAndGetNew("/Extensions", oh.shallowCopy());
 2064|      0|        }
 2065|    178|        if (oh.hasKey("/ADBE")) {
  ------------------
  |  Branch (2065:13): [True: 165, False: 13]
  ------------------
 2066|    165|            auto adbe = oh.getKey("/ADBE");
 2067|    165|            if (adbe.isIndirect()) {
  ------------------
  |  Branch (2067:17): [True: 78, False: 87]
  ------------------
 2068|     78|                QTC::TC("qpdf", "QPDFWriter make ADBE direct", extensions_indirect ? 0 : 1);
  ------------------
  |  Branch (2068:64): [True: 0, False: 78]
  ------------------
 2069|     78|                adbe.makeDirect();
 2070|     78|                oh.replaceKey("/ADBE", adbe);
 2071|     78|            }
 2072|    165|        }
 2073|    178|    }
 2074|  7.93k|}
_ZN10QPDFWriter16initializeTablesEm:
 2078|  8.26k|{
 2079|  8.26k|    auto size = QIntC::to_size(QPDF::Writer::tableSize(m->pdf) + 100) + extra;
 2080|  8.26k|    m->obj.resize(size);
 2081|  8.26k|    m->new_obj.resize(size);
 2082|  8.26k|}
_ZN10QPDFWriter12doWriteSetupEv:
 2086|  8.32k|{
 2087|  8.32k|    if (m->did_write_setup) {
  ------------------
  |  Branch (2087:9): [True: 0, False: 8.32k]
  ------------------
 2088|      0|        return;
 2089|      0|    }
 2090|  8.32k|    m->did_write_setup = true;
 2091|       |
 2092|       |    // Do preliminary setup
 2093|       |
 2094|  8.32k|    if (m->linearized) {
  ------------------
  |  Branch (2094:9): [True: 3.95k, False: 4.37k]
  ------------------
 2095|  3.95k|        m->qdf_mode = false;
 2096|  3.95k|    }
 2097|       |
 2098|  8.32k|    if (m->pclm) {
  ------------------
  |  Branch (2098:9): [True: 0, False: 8.32k]
  ------------------
 2099|      0|        m->stream_decode_level = qpdf_dl_none;
 2100|      0|        m->compress_streams = false;
 2101|      0|        m->encrypted = false;
 2102|      0|    }
 2103|       |
 2104|  8.32k|    if (m->qdf_mode) {
  ------------------
  |  Branch (2104:9): [True: 4.37k, False: 3.95k]
  ------------------
 2105|  4.37k|        if (!m->normalize_content_set) {
  ------------------
  |  Branch (2105:13): [True: 4.37k, False: 0]
  ------------------
 2106|  4.37k|            m->normalize_content = true;
 2107|  4.37k|        }
 2108|  4.37k|        if (!m->compress_streams_set) {
  ------------------
  |  Branch (2108:13): [True: 4.37k, False: 0]
  ------------------
 2109|  4.37k|            m->compress_streams = false;
 2110|  4.37k|        }
 2111|  4.37k|        if (!m->stream_decode_level_set) {
  ------------------
  |  Branch (2111:13): [True: 0, False: 4.37k]
  ------------------
 2112|      0|            m->stream_decode_level = qpdf_dl_generalized;
 2113|      0|        }
 2114|  4.37k|    }
 2115|       |
 2116|  8.32k|    if (m->encrypted) {
  ------------------
  |  Branch (2116:9): [True: 3.95k, False: 4.37k]
  ------------------
 2117|       |        // Encryption has been explicitly set
 2118|  3.95k|        m->preserve_encryption = false;
 2119|  4.37k|    } else if (m->normalize_content || m->stream_decode_level || m->pclm || m->qdf_mode) {
  ------------------
  |  Branch (2119:16): [True: 4.37k, False: 0]
  |  Branch (2119:40): [True: 0, 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|  4.37k|        m->preserve_encryption = false;
 2123|  4.37k|    }
 2124|       |
 2125|  8.32k|    if (m->preserve_encryption) {
  ------------------
  |  Branch (2125:9): [True: 0, False: 8.32k]
  ------------------
 2126|      0|        copyEncryptionParameters(m->pdf);
 2127|      0|    }
 2128|       |
 2129|  8.32k|    if (!m->forced_pdf_version.empty()) {
  ------------------
  |  Branch (2129:9): [True: 0, False: 8.32k]
  ------------------
 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|  8.32k|    if (m->qdf_mode || m->normalize_content || m->stream_decode_level) {
  ------------------
  |  Branch (2140:9): [True: 4.37k, False: 3.95k]
  |  Branch (2140:24): [True: 0, False: 3.95k]
  |  Branch (2140:48): [True: 3.95k, False: 0]
  ------------------
 2141|  8.32k|        initializeSpecialStreams();
 2142|  8.32k|    }
 2143|       |
 2144|  8.32k|    if (m->qdf_mode) {
  ------------------
  |  Branch (2144:9): [True: 4.34k, False: 3.98k]
  ------------------
 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|  4.34k|        m->direct_stream_lengths = false;
 2149|  4.34k|    }
 2150|       |
 2151|  8.32k|    switch (m->object_stream_mode) {
  ------------------
  |  Branch (2151:13): [True: 61, False: 8.26k]
  ------------------
 2152|      0|    case qpdf_o_disable:
  ------------------
  |  Branch (2152:5): [True: 0, False: 8.32k]
  ------------------
 2153|      0|        initializeTables();
 2154|      0|        m->obj.streams_empty = true;
 2155|      0|        break;
 2156|       |
 2157|  8.26k|    case qpdf_o_preserve:
  ------------------
  |  Branch (2157:5): [True: 8.26k, False: 61]
  ------------------
 2158|  8.26k|        initializeTables();
 2159|  8.26k|        preserveObjectStreams();
 2160|  8.26k|        break;
 2161|       |
 2162|      0|    case qpdf_o_generate:
  ------------------
  |  Branch (2162:5): [True: 0, False: 8.32k]
  ------------------
 2163|      0|        generateObjectStreams();
 2164|      0|        break;
 2165|       |
 2166|       |        // no default so gcc will warn for missing case tag
 2167|  8.32k|    }
 2168|       |
 2169|  8.23k|    if (!m->obj.streams_empty) {
  ------------------
  |  Branch (2169:9): [True: 776, False: 7.45k]
  ------------------
 2170|    776|        if (m->linearized) {
  ------------------
  |  Branch (2170:13): [True: 359, False: 417]
  ------------------
 2171|       |            // Page dictionaries are not allowed to be compressed objects.
 2172|  1.03k|            for (auto& page: m->pdf.getAllPages()) {
  ------------------
  |  Branch (2172:28): [True: 1.03k, False: 359]
  ------------------
 2173|  1.03k|                if (m->obj[page].object_stream > 0) {
  ------------------
  |  Branch (2173:21): [True: 109, False: 928]
  ------------------
 2174|    109|                    QTC::TC("qpdf", "QPDFWriter uncompressing page dictionary");
 2175|    109|                    m->obj[page].object_stream = 0;
 2176|    109|                }
 2177|  1.03k|            }
 2178|    359|        }
 2179|       |
 2180|    776|        if (m->linearized || m->encrypted) {
  ------------------
  |  Branch (2180:13): [True: 359, False: 417]
  |  Branch (2180:30): [True: 0, False: 417]
  ------------------
 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|    359|            if (m->obj[m->root_og].object_stream > 0) {
  ------------------
  |  Branch (2185:17): [True: 0, False: 359]
  ------------------
 2186|      0|                QTC::TC("qpdf", "QPDFWriter uncompressing root");
 2187|      0|                m->obj[m->root_og].object_stream = 0;
 2188|      0|            }
 2189|    359|        }
 2190|       |
 2191|       |        // Generate reverse mapping from object stream to objects
 2192|    776|        m->obj.forEach([this](auto id, auto const& item) -> void {
 2193|    776|            if (item.object_stream > 0) {
 2194|    776|                auto& vec = m->object_stream_to_objects[item.object_stream];
 2195|    776|                vec.emplace_back(id, item.gen);
 2196|    776|                if (m->max_ostream_index < vec.size()) {
 2197|    776|                    ++m->max_ostream_index;
 2198|    776|                }
 2199|    776|            }
 2200|    776|        });
 2201|    776|        --m->max_ostream_index;
 2202|       |
 2203|    776|        if (m->object_stream_to_objects.empty()) {
  ------------------
  |  Branch (2203:13): [True: 151, False: 625]
  ------------------
 2204|    151|            m->obj.streams_empty = true;
 2205|    625|        } else {
 2206|    625|            setMinimumPDFVersion("1.5");
 2207|    625|        }
 2208|    776|    }
 2209|       |
 2210|  8.23k|    setMinimumPDFVersion(m->pdf.getPDFVersion(), m->pdf.getExtensionLevel());
 2211|  8.23k|    m->final_pdf_version = m->min_pdf_version;
 2212|  8.23k|    m->final_extension_level = m->min_extension_level;
 2213|  8.23k|    if (!m->forced_pdf_version.empty()) {
  ------------------
  |  Branch (2213:9): [True: 0, False: 8.23k]
  ------------------
 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|  8.23k|}
_ZN10QPDFWriter5writeEv:
 2222|  8.32k|{
 2223|  8.32k|    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|  8.32k|    m->events_expected = QIntC::to_int(m->pdf.getObjectCount() * (m->linearized ? 2 : 1));
  ------------------
  |  Branch (2227:67): [True: 3.71k, False: 4.61k]
  ------------------
 2228|       |
 2229|  8.32k|    prepareFileForWrite();
 2230|       |
 2231|  8.32k|    if (m->linearized) {
  ------------------
  |  Branch (2231:9): [True: 3.66k, False: 4.66k]
  ------------------
 2232|  3.66k|        writeLinearized();
 2233|  4.66k|    } else {
 2234|  4.66k|        writeStandard();
 2235|  4.66k|    }
 2236|       |
 2237|  8.32k|    m->pipeline->finish();
 2238|  8.32k|    if (m->close_file) {
  ------------------
  |  Branch (2238:9): [True: 0, False: 8.32k]
  ------------------
 2239|      0|        fclose(m->file);
 2240|      0|    }
 2241|  8.32k|    m->file = nullptr;
 2242|  8.32k|    if (m->buffer_pipeline) {
  ------------------
  |  Branch (2242:9): [True: 0, False: 8.32k]
  ------------------
 2243|      0|        m->output_buffer = m->buffer_pipeline->getBuffer();
 2244|      0|        m->buffer_pipeline = nullptr;
 2245|      0|    }
 2246|  8.32k|    indicateProgress(false, true);
 2247|  8.32k|}
_ZN10QPDFWriter11enqueuePartERNSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
 2271|  15.2k|{
 2272|  83.7k|    for (auto const& oh: part) {
  ------------------
  |  Branch (2272:24): [True: 83.7k, False: 15.2k]
  ------------------
 2273|  83.7k|        enqueueObject(oh);
 2274|  83.7k|    }
 2275|  15.2k|}
_ZN10QPDFWriter25writeEncryptionDictionaryEv:
 2279|  5.86k|{
 2280|  5.86k|    m->encryption_dict_objid = openObject(m->encryption_dict_objid);
 2281|  5.86k|    writeString("<<");
 2282|  76.2k|    for (auto const& iter: m->encryption_dictionary) {
  ------------------
  |  Branch (2282:26): [True: 76.2k, False: 5.86k]
  ------------------
 2283|  76.2k|        writeString(" ");
 2284|  76.2k|        writeString(iter.first);
 2285|  76.2k|        writeString(" ");
 2286|  76.2k|        writeString(iter.second);
 2287|  76.2k|    }
 2288|  5.86k|    writeString(" >>");
 2289|  5.86k|    closeObject(m->encryption_dict_objid);
 2290|  5.86k|}
_ZN10QPDFWriter11writeHeaderEv:
 2301|  10.0k|{
 2302|  10.0k|    writeString("%PDF-");
 2303|  10.0k|    writeString(m->final_pdf_version);
 2304|  10.0k|    if (m->pclm) {
  ------------------
  |  Branch (2304:9): [True: 0, False: 10.0k]
  ------------------
 2305|       |        // PCLm version
 2306|      0|        writeString("\n%PCLm 1.0\n");
 2307|  10.0k|    } else {
 2308|       |        // This string of binary characters would not be valid UTF-8, so it really should be treated
 2309|       |        // as binary.
 2310|  10.0k|        writeString("\n%\xbf\xf7\xa2\xfe\n");
 2311|  10.0k|    }
 2312|  10.0k|    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|  10.0k|}
_ZN10QPDFWriter15writeHintStreamEi:
 2322|  2.92k|{
 2323|  2.92k|    std::shared_ptr<Buffer> hint_buffer;
 2324|  2.92k|    int S = 0;
 2325|  2.92k|    int O = 0;
 2326|  2.92k|    bool compressed = (m->compress_streams && !m->qdf_mode);
  ------------------
  |  Branch (2326:24): [True: 2.92k, False: 0]
  |  Branch (2326:47): [True: 2.92k, False: 0]
  ------------------
 2327|  2.92k|    QPDF::Writer::generateHintStream(m->pdf, m->new_obj, m->obj, hint_buffer, S, O, compressed);
 2328|       |
 2329|  2.92k|    openObject(hint_id);
 2330|  2.92k|    setDataKey(hint_id);
 2331|       |
 2332|  2.92k|    size_t hlen = hint_buffer->getSize();
 2333|       |
 2334|  2.92k|    writeString("<< ");
 2335|  2.92k|    if (compressed) {
  ------------------
  |  Branch (2335:9): [True: 2.92k, False: 0]
  ------------------
 2336|  2.92k|        writeString("/Filter /FlateDecode ");
 2337|  2.92k|    }
 2338|  2.92k|    writeString("/S ");
 2339|  2.92k|    writeString(std::to_string(S));
 2340|  2.92k|    if (O) {
  ------------------
  |  Branch (2340:9): [True: 471, False: 2.45k]
  ------------------
 2341|    471|        writeString(" /O ");
 2342|    471|        writeString(std::to_string(O));
 2343|    471|    }
 2344|  2.92k|    writeString(" /Length ");
 2345|  2.92k|    adjustAESStreamLength(hlen);
 2346|  2.92k|    writeString(std::to_string(hlen));
 2347|  2.92k|    writeString(" >>\nstream\n");
 2348|       |
 2349|  2.92k|    if (m->encrypted) {
  ------------------
  |  Branch (2349:9): [True: 2.92k, False: 0]
  ------------------
 2350|  2.92k|        QTC::TC("qpdf", "QPDFWriter encrypted hint stream");
 2351|  2.92k|    }
 2352|  2.92k|    unsigned char last_char = '\0';
 2353|  2.92k|    {
 2354|  2.92k|        PipelinePopper pp_enc(this);
 2355|  2.92k|        pushEncryptionFilter(pp_enc);
 2356|  2.92k|        writeBuffer(hint_buffer);
 2357|  2.92k|        last_char = m->pipeline->getLastChar();
 2358|  2.92k|    }
 2359|       |
 2360|  2.92k|    if (last_char != '\n') {
  ------------------
  |  Branch (2360:9): [True: 2.91k, False: 11]
  ------------------
 2361|  2.91k|        writeString("\n");
 2362|  2.91k|    }
 2363|  2.92k|    writeString("endstream");
 2364|  2.92k|    closeObject(hint_id);
 2365|  2.92k|}
_ZN10QPDFWriter14writeXRefTableENS_9trailer_eEiii:
 2369|  3.79k|{
 2370|       |    // There are too many extra arguments to replace overloaded function with defaults in the header
 2371|       |    // file...too much risk of leaving something off.
 2372|  3.79k|    return writeXRefTable(which, first, last, size, 0, false, 0, 0, 0, 0);
 2373|  3.79k|}
_ZN10QPDFWriter14writeXRefTableENS_9trailer_eEiiixbixxi:
 2387|  14.7k|{
 2388|  14.7k|    writeString("xref\n");
 2389|  14.7k|    writeString(std::to_string(first));
 2390|  14.7k|    writeString(" ");
 2391|  14.7k|    writeString(std::to_string(last - first + 1));
 2392|  14.7k|    qpdf_offset_t space_before_zero = m->pipeline->getCount();
 2393|  14.7k|    writeString("\n");
 2394|   310k|    for (int i = first; i <= last; ++i) {
  ------------------
  |  Branch (2394:25): [True: 296k, False: 14.7k]
  ------------------
 2395|   296k|        if (i == 0) {
  ------------------
  |  Branch (2395:13): [True: 9.25k, False: 286k]
  ------------------
 2396|  9.25k|            writeString("0000000000 65535 f \n");
 2397|   286k|        } else {
 2398|   286k|            qpdf_offset_t offset = 0;
 2399|   286k|            if (!suppress_offsets) {
  ------------------
  |  Branch (2399:17): [True: 239k, False: 47.2k]
  ------------------
 2400|   239k|                offset = m->new_obj[i].xref.getOffset();
 2401|   239k|                if ((hint_id != 0) && (i != hint_id) && (offset >= hint_offset)) {
  ------------------
  |  Branch (2401:21): [True: 47.0k, False: 192k]
  |  Branch (2401:39): [True: 44.2k, False: 2.72k]
  |  Branch (2401:57): [True: 23.8k, False: 20.4k]
  ------------------
 2402|  23.8k|                    offset += hint_length;
 2403|  23.8k|                }
 2404|   239k|            }
 2405|   286k|            writeString(QUtil::int_to_string(offset, 10));
 2406|   286k|            writeString(" 00000 n \n");
 2407|   286k|        }
 2408|   296k|    }
 2409|  14.7k|    writeTrailer(which, size, false, prev, linearization_pass);
 2410|  14.7k|    writeString("\n");
 2411|  14.7k|    return space_before_zero;
 2412|  14.7k|}
_ZN10QPDFWriter15writeXRefStreamEiixNS_9trailer_eEiii:
 2417|    299|{
 2418|       |    // There are too many extra arguments to replace overloaded function with defaults in the header
 2419|       |    // file...too much risk of leaving something off.
 2420|    299|    return writeXRefStream(
 2421|    299|        objid, max_id, max_offset, which, first, last, size, 0, 0, 0, 0, false, 0);
 2422|    299|}
_ZN10QPDFWriter15writeXRefStreamEiixNS_9trailer_eEiiixixxbi:
 2439|  1.09k|{
 2440|  1.09k|    qpdf_offset_t xref_offset = m->pipeline->getCount();
 2441|  1.09k|    qpdf_offset_t space_before_zero = xref_offset - 1;
 2442|       |
 2443|       |    // field 1 contains offsets and object stream identifiers
 2444|  1.09k|    unsigned int f1_size = std::max(bytesNeeded(max_offset + hint_length), bytesNeeded(max_id));
 2445|       |
 2446|       |    // field 2 contains object stream indices
 2447|  1.09k|    unsigned int f2_size = bytesNeeded(QIntC::to_longlong(m->max_ostream_index));
 2448|       |
 2449|  1.09k|    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|  1.09k|    m->new_obj[xref_id].xref = QPDFXRefEntry(m->pipeline->getCount());
 2454|       |
 2455|  1.09k|    Pipeline* p = pushPipeline(new Pl_Buffer("xref stream"));
 2456|  1.09k|    bool compressed = false;
 2457|  1.09k|    if (m->compress_streams && !m->qdf_mode) {
  ------------------
  |  Branch (2457:9): [True: 795, False: 299]
  |  Branch (2457:32): [True: 795, False: 0]
  ------------------
 2458|    795|        compressed = true;
 2459|    795|        if (!skip_compression) {
  ------------------
  |  Branch (2459:13): [True: 390, False: 405]
  ------------------
 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|    390|            p = pushPipeline(new Pl_Flate("compress xref", p, Pl_Flate::a_deflate));
 2463|    390|        }
 2464|    795|        p = pushPipeline(new Pl_PNGFilter("pngify xref", p, Pl_PNGFilter::a_encode, esize));
 2465|    795|    }
 2466|  1.09k|    std::shared_ptr<Buffer> xref_data;
 2467|  1.09k|    {
 2468|  1.09k|        PipelinePopper pp_xref(this, &xref_data);
 2469|  1.09k|        activatePipelineStack(pp_xref);
 2470|  41.6k|        for (int i = first; i <= last; ++i) {
  ------------------
  |  Branch (2470:29): [True: 40.5k, False: 1.09k]
  ------------------
 2471|  40.5k|            QPDFXRefEntry& e = m->new_obj[i].xref;
 2472|  40.5k|            switch (e.getType()) {
 2473|  5.04k|            case 0:
  ------------------
  |  Branch (2473:13): [True: 5.04k, False: 35.4k]
  ------------------
 2474|  5.04k|                writeBinary(0, 1);
 2475|  5.04k|                writeBinary(0, f1_size);
 2476|  5.04k|                writeBinary(0, f2_size);
 2477|  5.04k|                break;
 2478|       |
 2479|  15.2k|            case 1:
  ------------------
  |  Branch (2479:13): [True: 15.2k, False: 25.2k]
  ------------------
 2480|  15.2k|                {
 2481|  15.2k|                    qpdf_offset_t offset = e.getOffset();
 2482|  15.2k|                    if ((hint_id != 0) && (i != hint_id) && (offset >= hint_offset)) {
  ------------------
  |  Branch (2482:25): [True: 3.37k, False: 11.9k]
  |  Branch (2482:43): [True: 3.17k, False: 195]
  |  Branch (2482:61): [True: 2.01k, False: 1.15k]
  ------------------
 2483|  2.01k|                        offset += hint_length;
 2484|  2.01k|                    }
 2485|  15.2k|                    writeBinary(1, 1);
 2486|  15.2k|                    writeBinary(QIntC::to_ulonglong(offset), f1_size);
 2487|  15.2k|                    writeBinary(0, f2_size);
 2488|  15.2k|                }
 2489|  15.2k|                break;
 2490|       |
 2491|  20.2k|            case 2:
  ------------------
  |  Branch (2491:13): [True: 20.2k, False: 20.3k]
  ------------------
 2492|  20.2k|                writeBinary(2, 1);
 2493|  20.2k|                writeBinary(QIntC::to_ulonglong(e.getObjStreamNumber()), f1_size);
 2494|  20.2k|                writeBinary(QIntC::to_ulonglong(e.getObjStreamIndex()), f2_size);
 2495|  20.2k|                break;
 2496|       |
 2497|      0|            default:
  ------------------
  |  Branch (2497:13): [True: 0, False: 40.5k]
  ------------------
 2498|      0|                throw std::logic_error("invalid type writing xref stream");
 2499|      0|                break;
 2500|  40.5k|            }
 2501|  40.5k|        }
 2502|  1.09k|    }
 2503|       |
 2504|  1.09k|    openObject(xref_id);
 2505|  1.09k|    writeString("<<");
 2506|  1.09k|    writeStringQDF("\n ");
 2507|  1.09k|    writeString(" /Type /XRef");
 2508|  1.09k|    writeStringQDF("\n ");
 2509|  1.09k|    writeString(" /Length " + std::to_string(xref_data->getSize()));
 2510|  1.09k|    if (compressed) {
  ------------------
  |  Branch (2510:9): [True: 795, False: 299]
  ------------------
 2511|    795|        writeStringQDF("\n ");
 2512|    795|        writeString(" /Filter /FlateDecode");
 2513|    795|        writeStringQDF("\n ");
 2514|    795|        writeString(" /DecodeParms << /Columns " + std::to_string(esize) + " /Predictor 12 >>");
 2515|    795|    }
 2516|  1.09k|    writeStringQDF("\n ");
 2517|  1.09k|    writeString(" /W [ 1 " + std::to_string(f1_size) + " " + std::to_string(f2_size) + " ]");
 2518|  1.09k|    if (!((first == 0) && (last == size - 1))) {
  ------------------
  |  Branch (2518:11): [True: 689, False: 405]
  |  Branch (2518:27): [True: 689, False: 0]
  ------------------
 2519|    405|        writeString(
 2520|    405|            " /Index [ " + std::to_string(first) + " " + std::to_string(last - first + 1) + " ]");
 2521|    405|    }
 2522|  1.09k|    writeTrailer(which, size, true, prev, linearization_pass);
 2523|  1.09k|    writeString("\nstream\n");
 2524|  1.09k|    writeBuffer(xref_data);
 2525|  1.09k|    writeString("\nendstream");
 2526|  1.09k|    closeObject(xref_id);
 2527|  1.09k|    return space_before_zero;
 2528|  1.09k|}
_ZN10QPDFWriter26calculateXrefStreamPaddingEx:
 2532|    405|{
 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|    405|    return QIntC::to_size(16 + (5 * ((xref_bytes + 16383) / 16384)));
 2540|    405|}
_ZN10QPDFWriter15writeLinearizedEv:
 2544|  3.66k|{
 2545|       |    // Optimize file and enqueue objects in order
 2546|       |
 2547|  3.66k|    std::map<int, int> stream_cache;
 2548|       |
 2549|  3.66k|    auto skip_stream_parameters = [this, &stream_cache](QPDFObjectHandle& stream) {
 2550|  3.66k|        auto& result = stream_cache[stream.getObjectID()];
 2551|  3.66k|        if (result == 0) {
 2552|  3.66k|            bool compress_stream;
 2553|  3.66k|            bool is_metadata;
 2554|  3.66k|            if (willFilterStream(stream, compress_stream, is_metadata, nullptr)) {
 2555|  3.66k|                result = 2;
 2556|  3.66k|            } else {
 2557|  3.66k|                result = 1;
 2558|  3.66k|            }
 2559|  3.66k|        }
 2560|  3.66k|        return result;
 2561|  3.66k|    };
 2562|       |
 2563|  3.66k|    QPDF::Writer::optimize(m->pdf, m->obj, skip_stream_parameters);
 2564|       |
 2565|  3.66k|    std::vector<QPDFObjectHandle> part4;
 2566|  3.66k|    std::vector<QPDFObjectHandle> part6;
 2567|  3.66k|    std::vector<QPDFObjectHandle> part7;
 2568|  3.66k|    std::vector<QPDFObjectHandle> part8;
 2569|  3.66k|    std::vector<QPDFObjectHandle> part9;
 2570|  3.66k|    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|  3.66k|    int second_half_uncompressed = QIntC::to_int(part7.size() + part8.size() + part9.size());
 2590|  3.66k|    int second_half_first_obj = 1;
 2591|  3.66k|    int after_second_half = 1 + second_half_uncompressed;
 2592|  3.66k|    m->next_objid = after_second_half;
 2593|  3.66k|    int second_half_xref = 0;
 2594|  3.66k|    bool need_xref_stream = !m->obj.streams_empty;
 2595|  3.66k|    if (need_xref_stream) {
  ------------------
  |  Branch (2595:9): [True: 237, False: 3.42k]
  ------------------
 2596|    237|        second_half_xref = m->next_objid++;
 2597|    237|    }
 2598|       |    // Assign numbers to all compressed objects in the second half.
 2599|  3.66k|    std::vector<QPDFObjectHandle>* vecs2[] = {&part7, &part8, &part9};
 2600|  13.2k|    for (int i = 0; i < 3; ++i) {
  ------------------
  |  Branch (2600:21): [True: 9.62k, False: 3.66k]
  ------------------
 2601|  40.9k|        for (auto const& oh: *vecs2[i]) {
  ------------------
  |  Branch (2601:28): [True: 40.9k, False: 9.62k]
  ------------------
 2602|  40.9k|            assignCompressedObjectNumbers(oh.getObjGen());
 2603|  40.9k|        }
 2604|  9.62k|    }
 2605|  3.66k|    int second_half_end = m->next_objid - 1;
 2606|  3.66k|    int second_trailer_size = m->next_objid;
 2607|       |
 2608|       |    // First half objects
 2609|  3.66k|    int first_half_start = m->next_objid;
 2610|  3.66k|    int lindict_id = m->next_objid++;
 2611|  3.66k|    int first_half_xref = 0;
 2612|  3.66k|    if (need_xref_stream) {
  ------------------
  |  Branch (2612:9): [True: 237, False: 3.42k]
  ------------------
 2613|    237|        first_half_xref = m->next_objid++;
 2614|    237|    }
 2615|  3.66k|    int part4_first_obj = m->next_objid;
 2616|  3.66k|    m->next_objid += QIntC::to_int(part4.size());
 2617|  3.66k|    int after_part4 = m->next_objid;
 2618|  3.66k|    if (m->encrypted) {
  ------------------
  |  Branch (2618:9): [True: 3.20k, False: 458]
  ------------------
 2619|  3.20k|        m->encryption_dict_objid = m->next_objid++;
 2620|  3.20k|    }
 2621|  3.66k|    int hint_id = m->next_objid++;
 2622|  3.66k|    int part6_first_obj = m->next_objid;
 2623|  3.66k|    m->next_objid += QIntC::to_int(part6.size());
 2624|  3.66k|    int after_part6 = m->next_objid;
 2625|       |    // Assign numbers to all compressed objects in the first half
 2626|  3.66k|    std::vector<QPDFObjectHandle>* vecs1[] = {&part4, &part6};
 2627|  10.0k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (2627:21): [True: 6.41k, False: 3.66k]
  ------------------
 2628|  44.0k|        for (auto const& oh: *vecs1[i]) {
  ------------------
  |  Branch (2628:28): [True: 44.0k, False: 6.41k]
  ------------------
 2629|  44.0k|            assignCompressedObjectNumbers(oh.getObjGen());
 2630|  44.0k|        }
 2631|  6.41k|    }
 2632|  3.66k|    int first_half_end = m->next_objid - 1;
 2633|  3.66k|    int first_trailer_size = m->next_objid;
 2634|       |
 2635|  3.66k|    int part4_end_marker = part4.back().getObjectID();
 2636|  3.66k|    int part6_end_marker = part6.back().getObjectID();
 2637|  3.66k|    qpdf_offset_t space_before_zero = 0;
 2638|  3.66k|    qpdf_offset_t file_size = 0;
 2639|  3.66k|    qpdf_offset_t part6_end_offset = 0;
 2640|  3.66k|    qpdf_offset_t first_half_max_obj_offset = 0;
 2641|  3.66k|    qpdf_offset_t second_xref_offset = 0;
 2642|  3.66k|    qpdf_offset_t first_xref_end = 0;
 2643|  3.66k|    qpdf_offset_t second_xref_end = 0;
 2644|       |
 2645|  3.66k|    m->next_objid = part4_first_obj;
 2646|  3.66k|    enqueuePart(part4);
 2647|  3.66k|    if (m->next_objid != after_part4) {
  ------------------
  |  Branch (2647:9): [True: 187, False: 3.47k]
  ------------------
 2648|       |        // This can happen with very botched files as in the fuzzer test. There are likely some
 2649|       |        // faulty assumptions in calculateLinearizationData
 2650|    187|        throw std::runtime_error("error encountered after writing part 4 of linearized data");
 2651|    187|    }
 2652|  3.47k|    m->next_objid = part6_first_obj;
 2653|  3.47k|    enqueuePart(part6);
 2654|  3.47k|    if (m->next_objid != after_part6) {
  ------------------
  |  Branch (2654:9): [True: 25, False: 3.45k]
  ------------------
 2655|     25|        throw std::runtime_error("error encountered after writing part 6 of linearized data");
 2656|     25|    }
 2657|  3.45k|    m->next_objid = second_half_first_obj;
 2658|  3.45k|    enqueuePart(part7);
 2659|  3.45k|    enqueuePart(part8);
 2660|  3.45k|    enqueuePart(part9);
 2661|  3.45k|    if (m->next_objid != after_second_half) {
  ------------------
  |  Branch (2661:9): [True: 37, False: 3.41k]
  ------------------
 2662|     37|        throw std::runtime_error("error encountered after writing part 9 of linearized data");
 2663|     37|    }
 2664|       |
 2665|  3.41k|    qpdf_offset_t hint_length = 0;
 2666|  3.41k|    std::shared_ptr<Buffer> hint_buffer;
 2667|       |
 2668|       |    // Write file in two passes.  Part numbers refer to PDF spec 1.4.
 2669|       |
 2670|  3.41k|    FILE* lin_pass1_file = nullptr;
 2671|  3.41k|    auto pp_pass1 = std::make_shared<PipelinePopper>(this);
 2672|  3.41k|    auto pp_md5 = std::make_shared<PipelinePopper>(this);
 2673|  9.29k|    for (int pass = 1; pass <= 2; ++pass) {
  ------------------
  |  Branch (2673:24): [True: 5.88k, False: 3.41k]
  ------------------
 2674|  5.88k|        if (pass == 1) {
  ------------------
  |  Branch (2674:13): [True: 2.95k, False: 2.92k]
  ------------------
 2675|  2.95k|            if (!m->lin_pass1_filename.empty()) {
  ------------------
  |  Branch (2675:17): [True: 0, False: 2.95k]
  ------------------
 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|  2.95k|            } else {
 2680|  2.95k|                pushDiscardFilter(*pp_pass1);
 2681|  2.95k|            }
 2682|  2.95k|            if (m->deterministic_id) {
  ------------------
  |  Branch (2682:17): [True: 0, False: 2.95k]
  ------------------
 2683|      0|                pushMD5Pipeline(*pp_md5);
 2684|      0|            }
 2685|  2.95k|        }
 2686|       |
 2687|       |        // Part 1: header
 2688|       |
 2689|  5.88k|        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|  5.88k|        qpdf_offset_t pos = m->pipeline->getCount();
 2698|  5.88k|        openObject(lindict_id);
 2699|  5.88k|        writeString("<<");
 2700|  5.88k|        if (pass == 2) {
  ------------------
  |  Branch (2700:13): [True: 2.92k, False: 2.95k]
  ------------------
 2701|  2.92k|            std::vector<QPDFObjectHandle> const& pages = m->pdf.getAllPages();
 2702|  2.92k|            int first_page_object = m->obj[pages.at(0)].renumber;
 2703|  2.92k|            int npages = QIntC::to_int(pages.size());
 2704|       |
 2705|  2.92k|            writeString(" /Linearized 1 /L ");
 2706|  2.92k|            writeString(std::to_string(file_size + hint_length));
 2707|       |            // Implementation note 121 states that a space is mandatory after this open bracket.
 2708|  2.92k|            writeString(" /H [ ");
 2709|  2.92k|            writeString(std::to_string(m->new_obj[hint_id].xref.getOffset()));
 2710|  2.92k|            writeString(" ");
 2711|  2.92k|            writeString(std::to_string(hint_length));
 2712|  2.92k|            writeString(" ] /O ");
 2713|  2.92k|            writeString(std::to_string(first_page_object));
 2714|  2.92k|            writeString(" /E ");
 2715|  2.92k|            writeString(std::to_string(part6_end_offset + hint_length));
 2716|  2.92k|            writeString(" /N ");
 2717|  2.92k|            writeString(std::to_string(npages));
 2718|  2.92k|            writeString(" /T ");
 2719|  2.92k|            writeString(std::to_string(space_before_zero + hint_length));
 2720|  2.92k|        }
 2721|  5.88k|        writeString(" >>");
 2722|  5.88k|        closeObject(lindict_id);
 2723|  5.88k|        static int const pad = 200;
 2724|  5.88k|        writePad(QIntC::to_size(pos - m->pipeline->getCount() + pad));
 2725|  5.88k|        writeString("\n");
 2726|       |
 2727|       |        // If the user supplied any additional header text, write it here after the linearization
 2728|       |        // parameter dictionary.
 2729|  5.88k|        writeString(m->extra_header_text);
 2730|       |
 2731|       |        // Part 3: first page cross reference table and trailer.
 2732|       |
 2733|  5.88k|        qpdf_offset_t first_xref_offset = m->pipeline->getCount();
 2734|  5.88k|        qpdf_offset_t hint_offset = 0;
 2735|  5.88k|        if (pass == 2) {
  ------------------
  |  Branch (2735:13): [True: 2.92k, False: 2.95k]
  ------------------
 2736|  2.92k|            hint_offset = m->new_obj[hint_id].xref.getOffset();
 2737|  2.92k|        }
 2738|  5.88k|        if (need_xref_stream) {
  ------------------
  |  Branch (2738:13): [True: 405, False: 5.47k]
  ------------------
 2739|       |            // Must pad here too.
 2740|    405|            if (pass == 1) {
  ------------------
  |  Branch (2740:17): [True: 210, False: 195]
  ------------------
 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|    210|                first_half_max_obj_offset = 1 << 25;
 2747|    210|            }
 2748|    405|            pos = m->pipeline->getCount();
 2749|    405|            writeXRefStream(
 2750|    405|                first_half_xref,
 2751|    405|                first_half_end,
 2752|    405|                first_half_max_obj_offset,
 2753|    405|                t_lin_first,
 2754|    405|                first_half_start,
 2755|    405|                first_half_end,
 2756|    405|                first_trailer_size,
 2757|    405|                hint_length + second_xref_offset,
 2758|    405|                hint_id,
 2759|    405|                hint_offset,
 2760|    405|                hint_length,
 2761|    405|                (pass == 1),
 2762|    405|                pass);
 2763|    405|            qpdf_offset_t endpos = m->pipeline->getCount();
 2764|    405|            if (pass == 1) {
  ------------------
  |  Branch (2764:17): [True: 210, False: 195]
  ------------------
 2765|       |                // Pad so we have enough room for the real xref stream.
 2766|    210|                writePad(calculateXrefStreamPadding(endpos - pos));
 2767|    210|                first_xref_end = m->pipeline->getCount();
 2768|    210|            } else {
 2769|       |                // Pad so that the next object starts at the same place as in pass 1.
 2770|    195|                writePad(QIntC::to_size(first_xref_end - endpos));
 2771|       |
 2772|    195|                if (m->pipeline->getCount() != first_xref_end) {
  ------------------
  |  Branch (2772:21): [True: 0, False: 195]
  ------------------
 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|    195|            }
 2779|    405|            writeString("\n");
 2780|  5.47k|        } else {
 2781|  5.47k|            writeXRefTable(
 2782|  5.47k|                t_lin_first,
 2783|  5.47k|                first_half_start,
 2784|  5.47k|                first_half_end,
 2785|  5.47k|                first_trailer_size,
 2786|  5.47k|                hint_length + second_xref_offset,
 2787|  5.47k|                (pass == 1),
 2788|  5.47k|                hint_id,
 2789|  5.47k|                hint_offset,
 2790|  5.47k|                hint_length,
 2791|  5.47k|                pass);
 2792|  5.47k|            writeString("startxref\n0\n%%EOF\n");
 2793|  5.47k|        }
 2794|       |
 2795|       |        // Parts 4 through 9
 2796|       |
 2797|   160k|        for (auto const& cur_object: m->object_queue) {
  ------------------
  |  Branch (2797:36): [True: 160k, False: 5.88k]
  ------------------
 2798|   160k|            if (cur_object.getObjectID() == part6_end_marker) {
  ------------------
  |  Branch (2798:17): [True: 5.86k, False: 154k]
  ------------------
 2799|  5.86k|                first_half_max_obj_offset = m->pipeline->getCount();
 2800|  5.86k|            }
 2801|   160k|            writeObject(cur_object);
 2802|   160k|            if (cur_object.getObjectID() == part4_end_marker) {
  ------------------
  |  Branch (2802:17): [True: 5.86k, False: 154k]
  ------------------
 2803|  5.86k|                if (m->encrypted) {
  ------------------
  |  Branch (2803:21): [True: 5.86k, False: 0]
  ------------------
 2804|  5.86k|                    writeEncryptionDictionary();
 2805|  5.86k|                }
 2806|  5.86k|                if (pass == 1) {
  ------------------
  |  Branch (2806:21): [True: 2.94k, False: 2.92k]
  ------------------
 2807|  2.94k|                    m->new_obj[hint_id].xref = QPDFXRefEntry(m->pipeline->getCount());
 2808|  2.94k|                } else {
 2809|       |                    // Part 5: hint stream
 2810|  2.92k|                    writeBuffer(hint_buffer);
 2811|  2.92k|                }
 2812|  5.86k|            }
 2813|   160k|            if (cur_object.getObjectID() == part6_end_marker) {
  ------------------
  |  Branch (2813:17): [True: 5.86k, False: 154k]
  ------------------
 2814|  5.86k|                part6_end_offset = m->pipeline->getCount();
 2815|  5.86k|            }
 2816|   160k|        }
 2817|       |
 2818|       |        // Part 10: overflow hint stream -- not used
 2819|       |
 2820|       |        // Part 11: main cross reference table and trailer
 2821|       |
 2822|  5.88k|        second_xref_offset = m->pipeline->getCount();
 2823|  5.88k|        if (need_xref_stream) {
  ------------------
  |  Branch (2823:13): [True: 390, False: 5.49k]
  ------------------
 2824|    390|            pos = m->pipeline->getCount();
 2825|    390|            space_before_zero = writeXRefStream(
 2826|    390|                second_half_xref,
 2827|    390|                second_half_end,
 2828|    390|                second_xref_offset,
 2829|    390|                t_lin_second,
 2830|    390|                0,
 2831|    390|                second_half_end,
 2832|    390|                second_trailer_size,
 2833|    390|                0,
 2834|    390|                0,
 2835|    390|                0,
 2836|    390|                0,
 2837|    390|                (pass == 1),
 2838|    390|                pass);
 2839|    390|            qpdf_offset_t endpos = m->pipeline->getCount();
 2840|       |
 2841|    390|            if (pass == 1) {
  ------------------
  |  Branch (2841:17): [True: 195, False: 195]
  ------------------
 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|    195|                writePad(calculateXrefStreamPadding(endpos - pos));
 2845|    195|                writeString("\n");
 2846|    195|                second_xref_end = m->pipeline->getCount();
 2847|    195|            } else {
 2848|       |                // Make the file size the same.
 2849|    195|                writePad(
 2850|    195|                    QIntC::to_size(second_xref_end + hint_length - 1 - m->pipeline->getCount()));
 2851|    195|                writeString("\n");
 2852|       |
 2853|       |                // If this assertion fails, maybe we didn't have enough padding above.
 2854|    195|                if (m->pipeline->getCount() != second_xref_end + hint_length) {
  ------------------
  |  Branch (2854:21): [True: 0, False: 195]
  ------------------
 2855|      0|                    throw std::logic_error(
 2856|      0|                        "count mismatch after xref stream; possible insufficient padding?");
 2857|      0|                }
 2858|    195|            }
 2859|  5.49k|        } else {
 2860|  5.49k|            space_before_zero = writeXRefTable(
 2861|  5.49k|                t_lin_second, 0, second_half_end, second_trailer_size, 0, false, 0, 0, 0, pass);
 2862|  5.49k|        }
 2863|  5.88k|        writeString("startxref\n");
 2864|  5.88k|        writeString(std::to_string(first_xref_offset));
 2865|  5.88k|        writeString("\n%%EOF\n");
 2866|       |
 2867|  5.88k|        if (pass == 1) {
  ------------------
  |  Branch (2867:13): [True: 2.92k, False: 2.95k]
  ------------------
 2868|  2.92k|            if (m->deterministic_id) {
  ------------------
  |  Branch (2868:17): [True: 0, False: 2.92k]
  ------------------
 2869|      0|                QTC::TC("qpdf", "QPDFWriter linearized deterministic ID", need_xref_stream ? 0 : 1);
  ------------------
  |  Branch (2869:75): [True: 0, False: 0]
  ------------------
 2870|      0|                computeDeterministicIDData();
 2871|      0|                pp_md5 = nullptr;
 2872|      0|                qpdf_assert_debug(m->md5_pipeline == nullptr);
  ------------------
  |  |   16|      0|# define qpdf_assert_debug assert
  ------------------
 2873|      0|            }
 2874|       |
 2875|       |            // Close first pass pipeline
 2876|  2.92k|            file_size = m->pipeline->getCount();
 2877|  2.92k|            pp_pass1 = nullptr;
 2878|       |
 2879|       |            // Save hint offset since it will be set to zero by calling openObject.
 2880|  2.92k|            qpdf_offset_t hint_offset1 = m->new_obj[hint_id].xref.getOffset();
 2881|       |
 2882|       |            // Write hint stream to a buffer
 2883|  2.92k|            {
 2884|  2.92k|                pushPipeline(new Pl_Buffer("hint buffer"));
 2885|  2.92k|                PipelinePopper pp_hint(this, &hint_buffer);
 2886|  2.92k|                activatePipelineStack(pp_hint);
 2887|  2.92k|                writeHintStream(hint_id);
 2888|  2.92k|            }
 2889|  2.92k|            hint_length = QIntC::to_offset(hint_buffer->getSize());
 2890|       |
 2891|       |            // Restore hint offset
 2892|  2.92k|            m->new_obj[hint_id].xref = QPDFXRefEntry(hint_offset1);
 2893|  2.92k|            if (lin_pass1_file) {
  ------------------
  |  Branch (2893:17): [True: 0, False: 2.92k]
  ------------------
 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|  2.92k|        }
 2910|  5.88k|    }
 2911|  3.41k|}
_ZN10QPDFWriter22enqueueObjectsStandardEv:
 2915|  4.20k|{
 2916|  4.20k|    if (m->preserve_unreferenced_objects) {
  ------------------
  |  Branch (2916:9): [True: 0, False: 4.20k]
  ------------------
 2917|      0|        QTC::TC("qpdf", "QPDFWriter preserve unreferenced standard");
 2918|      0|        for (auto const& oh: m->pdf.getAllObjects()) {
  ------------------
  |  Branch (2918:28): [True: 0, False: 0]
  ------------------
 2919|      0|            enqueueObject(oh);
 2920|      0|        }
 2921|      0|    }
 2922|       |
 2923|       |    // Put root first on queue.
 2924|  4.20k|    QPDFObjectHandle trailer = getTrimmedTrailer();
 2925|  4.20k|    enqueueObject(trailer.getKey("/Root"));
 2926|       |
 2927|       |    // Next place any other objects referenced from the trailer dictionary into the queue, handling
 2928|       |    // direct objects recursively. Root is already there, so enqueuing it a second time is a no-op.
 2929|  21.7k|    for (auto const& key: trailer.getKeys()) {
  ------------------
  |  Branch (2929:25): [True: 21.7k, False: 4.20k]
  ------------------
 2930|  21.7k|        enqueueObject(trailer.getKey(key));
 2931|  21.7k|    }
 2932|  4.20k|}
_ZN10QPDFWriter16indicateProgressEbb:
 2965|   335k|{
 2966|   335k|    if (decrement) {
  ------------------
  |  Branch (2966:9): [True: 21.9k, False: 313k]
  ------------------
 2967|  21.9k|        --m->events_seen;
 2968|  21.9k|        return;
 2969|  21.9k|    }
 2970|       |
 2971|   313k|    ++m->events_seen;
 2972|       |
 2973|   313k|    if (!m->progress_reporter.get()) {
  ------------------
  |  Branch (2973:9): [True: 313k, False: 0]
  ------------------
 2974|   313k|        return;
 2975|   313k|    }
 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|}
_ZN10QPDFWriter13writeStandardEv:
 2999|  4.20k|{
 3000|  4.20k|    auto pp_md5 = std::make_shared<PipelinePopper>(this);
 3001|  4.20k|    if (m->deterministic_id) {
  ------------------
  |  Branch (3001:9): [True: 4.20k, False: 0]
  ------------------
 3002|  4.20k|        pushMD5Pipeline(*pp_md5);
 3003|  4.20k|    }
 3004|       |
 3005|       |    // Start writing
 3006|       |
 3007|  4.20k|    writeHeader();
 3008|  4.20k|    writeString(m->extra_header_text);
 3009|       |
 3010|  4.20k|    if (m->pclm) {
  ------------------
  |  Branch (3010:9): [True: 0, False: 4.20k]
  ------------------
 3011|      0|        enqueueObjectsPCLm();
 3012|  4.20k|    } else {
 3013|  4.20k|        enqueueObjectsStandard();
 3014|  4.20k|    }
 3015|       |
 3016|       |    // Now start walking queue, outputting each object.
 3017|   108k|    while (m->object_queue_front < m->object_queue.size()) {
  ------------------
  |  Branch (3017:12): [True: 104k, False: 4.20k]
  ------------------
 3018|   104k|        QPDFObjectHandle cur_object = m->object_queue.at(m->object_queue_front);
 3019|   104k|        ++m->object_queue_front;
 3020|   104k|        writeObject(cur_object);
 3021|   104k|    }
 3022|       |
 3023|       |    // Write out the encryption dictionary, if any
 3024|  4.20k|    if (m->encrypted) {
  ------------------
  |  Branch (3024:9): [True: 0, False: 4.20k]
  ------------------
 3025|      0|        writeEncryptionDictionary();
 3026|      0|    }
 3027|       |
 3028|       |    // Now write out xref.  next_objid is now the number of objects.
 3029|  4.20k|    qpdf_offset_t xref_offset = m->pipeline->getCount();
 3030|  4.20k|    if (m->object_stream_to_objects.empty()) {
  ------------------
  |  Branch (3030:9): [True: 3.79k, False: 406]
  ------------------
 3031|       |        // Write regular cross-reference table
 3032|  3.79k|        writeXRefTable(t_normal, 0, m->next_objid - 1, m->next_objid);
 3033|  3.79k|    } else {
 3034|       |        // Write cross-reference stream.
 3035|    406|        int xref_id = m->next_objid++;
 3036|    406|        writeXRefStream(
 3037|    406|            xref_id, xref_id, xref_offset, t_normal, 0, m->next_objid - 1, m->next_objid);
 3038|    406|    }
 3039|  4.20k|    writeString("startxref\n");
 3040|  4.20k|    writeString(std::to_string(xref_offset));
 3041|  4.20k|    writeString("\n%%EOF\n");
 3042|       |
 3043|  4.20k|    if (m->deterministic_id) {
  ------------------
  |  Branch (3043:9): [True: 3.67k, False: 530]
  ------------------
 3044|  3.67k|        QTC::TC(
 3045|  3.67k|            "qpdf",
 3046|  3.67k|            "QPDFWriter standard deterministic ID",
 3047|  3.67k|            m->object_stream_to_objects.empty() ? 0 : 1);
  ------------------
  |  Branch (3047:13): [True: 3.40k, False: 261]
  ------------------
 3048|  3.67k|        pp_md5 = nullptr;
 3049|  3.67k|        qpdf_assert_debug(m->md5_pipeline == nullptr);
  ------------------
  |  |   16|  3.67k|# define qpdf_assert_debug assert
  ------------------
 3050|  3.67k|    }
 3051|  4.20k|}
QPDFWriter.cc:_ZZN10QPDFWriter12doWriteSetupEvENK3$_0clIiNS_6ObjectEEEvT_RKT0_:
 2192|   249k|        m->obj.forEach([this](auto id, auto const& item) -> void {
 2193|   249k|            if (item.object_stream > 0) {
  ------------------
  |  Branch (2193:17): [True: 21.6k, False: 227k]
  ------------------
 2194|  21.6k|                auto& vec = m->object_stream_to_objects[item.object_stream];
 2195|  21.6k|                vec.emplace_back(id, item.gen);
 2196|  21.6k|                if (m->max_ostream_index < vec.size()) {
  ------------------
  |  Branch (2196:21): [True: 11.6k, False: 9.98k]
  ------------------
 2197|  11.6k|                    ++m->max_ostream_index;
 2198|  11.6k|                }
 2199|  21.6k|            }
 2200|   249k|        });
QPDFWriter.cc:_ZZN10QPDFWriter15writeLinearizedEvENK3$_0clER16QPDFObjectHandle:
 2549|  95.8k|    auto skip_stream_parameters = [this, &stream_cache](QPDFObjectHandle& stream) {
 2550|  95.8k|        auto& result = stream_cache[stream.getObjectID()];
 2551|  95.8k|        if (result == 0) {
  ------------------
  |  Branch (2551:13): [True: 24.1k, False: 71.7k]
  ------------------
 2552|  24.1k|            bool compress_stream;
 2553|  24.1k|            bool is_metadata;
 2554|  24.1k|            if (willFilterStream(stream, compress_stream, is_metadata, nullptr)) {
  ------------------
  |  Branch (2554:17): [True: 13.1k, False: 11.0k]
  ------------------
 2555|  13.1k|                result = 2;
 2556|  13.1k|            } else {
 2557|  11.0k|                result = 1;
 2558|  11.0k|            }
 2559|  24.1k|        }
 2560|  95.8k|        return result;
 2561|  95.8k|    };

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

_ZN10QPDF_ArrayC2Ev:
   30|     78|{
   31|     78|}
_ZN10QPDF_ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
   41|  15.1k|{
   42|  15.1k|    setFromVector(v);
   43|  15.1k|}
_ZN10QPDF_ArrayC2EONSt3__16vectorINS0_10shared_ptrI10QPDFObjectEENS0_9allocatorIS4_EEEEb:
   47|   326k|{
   48|   326k|    if (sparse) {
  ------------------
  |  Branch (48:9): [True: 576, False: 325k]
  ------------------
   49|    576|        sp = std::make_unique<Sparse>();
   50|   675k|        for (auto&& item: v) {
  ------------------
  |  Branch (50:25): [True: 675k, False: 576]
  ------------------
   51|   675k|            if (item->getTypeCode() != ::ot_null || item->getObjGen().isIndirect()) {
  ------------------
  |  Branch (51:17): [True: 116k, False: 559k]
  |  Branch (51:17): [True: 116k, False: 559k]
  |  Branch (51:53): [True: 85, False: 559k]
  ------------------
   52|   116k|                sp->elements[sp->size] = std::move(item);
   53|   116k|            }
   54|   675k|            ++sp->size;
   55|   675k|        }
   56|   325k|    } else {
   57|   325k|        elements = std::move(v);
   58|   325k|    }
   59|   326k|}
_ZN10QPDF_Array6createERKNSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
   63|  15.1k|{
   64|  15.1k|    return do_create(new QPDF_Array(items));
   65|  15.1k|}
_ZN10QPDF_Array6createEONSt3__16vectorINS0_10shared_ptrI10QPDFObjectEENS0_9allocatorIS4_EEEEb:
   69|   326k|{
   70|   326k|    return do_create(new QPDF_Array(std::move(items), sparse));
   71|   326k|}
_ZN10QPDF_Array4copyEb:
   75|  6.31k|{
   76|  6.31k|    if (shallow) {
  ------------------
  |  Branch (76:9): [True: 0, False: 6.31k]
  ------------------
   77|      0|        return do_create(new QPDF_Array(*this));
   78|  6.31k|    } else {
   79|  6.31k|        QTC::TC("qpdf", "QPDF_Array copy", sp ? 0 : 1);
  ------------------
  |  Branch (79:44): [True: 78, False: 6.23k]
  ------------------
   80|  6.31k|        if (sp) {
  ------------------
  |  Branch (80:13): [True: 78, False: 6.23k]
  ------------------
   81|     78|            auto* result = new QPDF_Array();
   82|     78|            result->sp = std::make_unique<Sparse>();
   83|     78|            result->sp->size = sp->size;
   84|  50.9k|            for (auto const& element: sp->elements) {
  ------------------
  |  Branch (84:37): [True: 50.9k, False: 78]
  ------------------
   85|  50.9k|                auto const& obj = element.second;
   86|  50.9k|                result->sp->elements[element.first] =
   87|  50.9k|                    obj->getObjGen().isIndirect() ? obj : obj->copy();
  ------------------
  |  Branch (87:21): [True: 467, False: 50.4k]
  ------------------
   88|  50.9k|            }
   89|     78|            return do_create(result);
   90|  6.23k|        } else {
   91|  6.23k|            std::vector<std::shared_ptr<QPDFObject>> result;
   92|  6.23k|            result.reserve(elements.size());
   93|  74.0k|            for (auto const& element: elements) {
  ------------------
  |  Branch (93:37): [True: 74.0k, False: 6.23k]
  ------------------
   94|  74.0k|                result.push_back(
   95|  74.0k|                    element ? (element->getObjGen().isIndirect() ? element : element->copy())
  ------------------
  |  Branch (95:21): [True: 74.0k, False: 0]
  |  Branch (95:32): [True: 5.88k, False: 68.1k]
  ------------------
   96|  74.0k|                            : element);
   97|  74.0k|            }
   98|  6.23k|            return create(std::move(result), false);
   99|  6.23k|        }
  100|  6.31k|    }
  101|  6.31k|}
_ZN10QPDF_Array10disconnectEv:
  105|   287k|{
  106|   287k|    if (sp) {
  ------------------
  |  Branch (106:9): [True: 455, False: 287k]
  ------------------
  107|   160k|        for (auto& item: sp->elements) {
  ------------------
  |  Branch (107:24): [True: 160k, False: 455]
  ------------------
  108|   160k|            auto& obj = item.second;
  109|   160k|            if (!obj->getObjGen().isIndirect()) {
  ------------------
  |  Branch (109:17): [True: 156k, False: 3.97k]
  ------------------
  110|   156k|                obj->disconnect();
  111|   156k|            }
  112|   160k|        }
  113|   287k|    } else {
  114|  2.10M|        for (auto& obj: elements) {
  ------------------
  |  Branch (114:23): [True: 2.10M, False: 287k]
  ------------------
  115|  2.10M|            if (!obj->getObjGen().isIndirect()) {
  ------------------
  |  Branch (115:17): [True: 1.98M, False: 128k]
  ------------------
  116|  1.98M|                obj->disconnect();
  117|  1.98M|            }
  118|  2.10M|        }
  119|   287k|    }
  120|   287k|}
_ZNK10QPDF_Array2atEi:
  189|  3.50M|{
  190|  3.50M|    if (n < 0 || n >= size()) {
  ------------------
  |  Branch (190:9): [True: 0, False: 3.50M]
  |  Branch (190:18): [True: 171, False: 3.50M]
  ------------------
  191|    171|        return {};
  192|  3.50M|    } else if (sp) {
  ------------------
  |  Branch (192:16): [True: 352k, False: 3.15M]
  ------------------
  193|   352k|        auto const& iter = sp->elements.find(n);
  194|   352k|        return iter == sp->elements.end() ? null_oh : (*iter).second;
  ------------------
  |  Branch (194:16): [True: 275k, False: 76.5k]
  ------------------
  195|  3.15M|    } else {
  196|  3.15M|        return elements[size_t(n)];
  197|  3.15M|    }
  198|  3.50M|}
_ZNK10QPDF_Array11getAsVectorEv:
  202|   757k|{
  203|   757k|    if (sp) {
  ------------------
  |  Branch (203:9): [True: 1.07k, False: 756k]
  ------------------
  204|  1.07k|        std::vector<QPDFObjectHandle> v;
  205|  1.07k|        v.reserve(size_t(size()));
  206|   274k|        for (auto const& item: sp->elements) {
  ------------------
  |  Branch (206:30): [True: 274k, False: 1.07k]
  ------------------
  207|   274k|            v.resize(size_t(item.first), null_oh);
  208|   274k|            v.emplace_back(item.second);
  209|   274k|        }
  210|  1.07k|        v.resize(size_t(size()), null_oh);
  211|  1.07k|        return v;
  212|   756k|    } else {
  213|   756k|        return {elements.cbegin(), elements.cend()};
  214|   756k|    }
  215|   757k|}
_ZN10QPDF_Array5setAtEiRK16QPDFObjectHandle:
  219|  3.65k|{
  220|  3.65k|    if (at < 0 || at >= size()) {
  ------------------
  |  Branch (220:9): [True: 0, False: 3.65k]
  |  Branch (220:19): [True: 0, False: 3.65k]
  ------------------
  221|      0|        return false;
  222|      0|    }
  223|  3.65k|    checkOwnership(oh);
  224|  3.65k|    if (sp) {
  ------------------
  |  Branch (224:9): [True: 61, False: 3.59k]
  ------------------
  225|     61|        sp->elements[at] = oh.getObj();
  226|  3.59k|    } else {
  227|  3.59k|        elements[size_t(at)] = oh.getObj();
  228|  3.59k|    }
  229|  3.65k|    return true;
  230|  3.65k|}
_ZN10QPDF_Array13setFromVectorERKNSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
  234|  15.1k|{
  235|  15.1k|    elements.resize(0);
  236|  15.1k|    elements.reserve(v.size());
  237|  73.4k|    for (auto const& item: v) {
  ------------------
  |  Branch (237:26): [True: 73.4k, False: 15.1k]
  ------------------
  238|  73.4k|        checkOwnership(item);
  239|  73.4k|        elements.push_back(item.getObj());
  240|  73.4k|    }
  241|  15.1k|}
_ZN10QPDF_Array5eraseEi:
  288|      4|{
  289|      4|    if (at < 0 || at >= size()) {
  ------------------
  |  Branch (289:9): [True: 0, False: 4]
  |  Branch (289:19): [True: 0, False: 4]
  ------------------
  290|      0|        return false;
  291|      0|    }
  292|      4|    if (sp) {
  ------------------
  |  Branch (292:9): [True: 0, False: 4]
  ------------------
  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|      4|    } else {
  308|      4|        elements.erase(elements.cbegin() + at);
  309|      4|    }
  310|      4|    return true;
  311|      4|}
_ZNK10QPDF_Array14checkOwnershipERK16QPDFObjectHandle:
   12|  77.1k|{
   13|  77.1k|    if (auto obj = item.getObjectPtr()) {
  ------------------
  |  Branch (13:14): [True: 77.1k, False: 0]
  ------------------
   14|  77.1k|        if (qpdf) {
  ------------------
  |  Branch (14:13): [True: 3.65k, False: 73.4k]
  ------------------
   15|  3.65k|            if (auto item_qpdf = obj->getQPDF()) {
  ------------------
  |  Branch (15:22): [True: 3.65k, False: 0]
  ------------------
   16|  3.65k|                if (qpdf != item_qpdf) {
  ------------------
  |  Branch (16:21): [True: 0, False: 3.65k]
  ------------------
   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|  3.65k|            }
   22|  3.65k|        }
   23|  77.1k|    } else {
   24|      0|        throw std::logic_error("Attempting to add an uninitialized object to a QPDF_Array.");
   25|      0|    }
   26|  77.1k|}

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

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

_ZN15QPDF_DictionaryC2ERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
   14|  1.15M|{
   15|  1.15M|}
_ZN15QPDF_Dictionary6createERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
   25|   563k|{
   26|   563k|    return do_create(new QPDF_Dictionary(items));
   27|   563k|}
_ZN15QPDF_Dictionary6createEONSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
   31|   591k|{
   32|   591k|    return do_create(new QPDF_Dictionary(items));
   33|   591k|}
_ZN15QPDF_Dictionary4copyEb:
   37|   557k|{
   38|   557k|    if (shallow) {
  ------------------
  |  Branch (38:9): [True: 549k, False: 8.08k]
  ------------------
   39|   549k|        return create(items);
   40|   549k|    } else {
   41|  8.08k|        std::map<std::string, QPDFObjectHandle> new_items;
   42|  39.6k|        for (auto const& item: this->items) {
  ------------------
  |  Branch (42:30): [True: 39.6k, False: 8.08k]
  ------------------
   43|  39.6k|            auto value = item.second;
   44|  39.6k|            new_items[item.first] = value.isIndirect() ? value : value.shallowCopy();
  ------------------
  |  Branch (44:37): [True: 4.71k, False: 34.9k]
  ------------------
   45|  39.6k|        }
   46|  8.08k|        return create(new_items);
   47|  8.08k|    }
   48|   557k|}
_ZN15QPDF_Dictionary10disconnectEv:
   52|   507k|{
   53|  2.30M|    for (auto& iter: this->items) {
  ------------------
  |  Branch (53:20): [True: 2.30M, False: 507k]
  ------------------
   54|  2.30M|        QPDFObjectHandle::DisconnectAccess::disconnect(iter.second);
   55|  2.30M|    }
   56|   507k|}
_ZN15QPDF_Dictionary6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   99|   116k|{
  100|   116k|    return ((this->items.count(key) > 0) && (!this->items[key].isNull()));
  ------------------
  |  Branch (100:13): [True: 26.0k, False: 90.6k]
  |  Branch (100:45): [True: 25.3k, False: 615]
  ------------------
  101|   116k|}
_ZN15QPDF_Dictionary6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  105|  5.83M|{
  106|       |    // PDF spec says fetching a non-existent key from a dictionary returns the null object.
  107|  5.83M|    auto item = this->items.find(key);
  108|  5.83M|    if (item != this->items.end()) {
  ------------------
  |  Branch (108:9): [True: 4.96M, False: 873k]
  ------------------
  109|       |        // May be a null object
  110|  4.96M|        return item->second;
  111|  4.96M|    } else {
  112|   873k|        static auto constexpr msg = " -> dictionary key $VD"sv;
  113|   873k|        return QPDF_Null::create(shared_from_this(), msg, key);
  114|   873k|    }
  115|  5.83M|}
_ZN15QPDF_Dictionary7getKeysEv:
  119|   715k|{
  120|   715k|    std::set<std::string> result;
  121|  3.71M|    for (auto& iter: this->items) {
  ------------------
  |  Branch (121:20): [True: 3.71M, False: 715k]
  ------------------
  122|  3.71M|        if (!iter.second.isNull()) {
  ------------------
  |  Branch (122:13): [True: 3.42M, False: 294k]
  ------------------
  123|  3.42M|            result.insert(iter.first);
  124|  3.42M|        }
  125|  3.71M|    }
  126|   715k|    return result;
  127|   715k|}
_ZNK15QPDF_Dictionary8getAsMapEv:
  131|  1.29M|{
  132|  1.29M|    return this->items;
  133|  1.29M|}
_ZN15QPDF_Dictionary10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandle:
  137|  74.8k|{
  138|  74.8k|    if (value.isNull() && !value.isIndirect()) {
  ------------------
  |  Branch (138:9): [True: 0, False: 74.8k]
  |  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|  74.8k|    } else {
  144|       |        // add or replace value
  145|  74.8k|        this->items[key] = value;
  146|  74.8k|    }
  147|  74.8k|}
_ZN15QPDF_Dictionary9removeKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  151|   365k|{
  152|       |    // no-op if key does not exist
  153|   365k|    this->items.erase(key);
  154|   365k|}

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

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

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

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

_ZN11QPDF_StreamC2EP4QPDFRK10QPDFObjGen16QPDFObjectHandlexm:
  119|  89.8k|{
  120|  89.8k|    if (!stream_dict.isDictionary()) {
  ------------------
  |  Branch (120:9): [True: 0, False: 89.8k]
  ------------------
  121|      0|        throw std::logic_error(
  122|      0|            "stream object instantiated with non-dictionary object for dictionary");
  123|      0|    }
  124|  89.8k|    auto descr = std::make_shared<QPDFValue::Description>(
  125|  89.8k|        qpdf->getFilename() + ", stream object " + og.unparse(' '));
  126|  89.8k|    setDescription(qpdf, descr, offset);
  127|  89.8k|}
_ZN11QPDF_Stream6createEP4QPDFRK10QPDFObjGen16QPDFObjectHandlexm:
  136|  89.8k|{
  137|  89.8k|    return do_create(new QPDF_Stream(qpdf, og, stream_dict, offset, length));
  138|  89.8k|}
_ZN11QPDF_Stream16setFilterOnWriteEb:
  156|  5.39k|{
  157|  5.39k|    this->filter_on_write = val;
  158|  5.39k|}
_ZNK11QPDF_Stream16getFilterOnWriteEv:
  162|  93.4k|{
  163|  93.4k|    return this->filter_on_write;
  164|  93.4k|}
_ZN11QPDF_Stream10disconnectEv:
  168|  86.8k|{
  169|  86.8k|    this->stream_provider = nullptr;
  170|  86.8k|    QPDFObjectHandle::DisconnectAccess::disconnect(this->stream_dict);
  171|  86.8k|}
_ZN11QPDF_Stream14setDescriptionEP4QPDFRNSt3__110shared_ptrINS2_7variantIJNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEN9QPDFValue10JSON_DescrENSB_10ChildDescrEEEEEEx:
  301|  89.8k|{
  302|  89.8k|    this->QPDFValue::setDescription(qpdf, description, offset);
  303|  89.8k|    setDictDescription();
  304|  89.8k|}
_ZN11QPDF_Stream18setDictDescriptionEv:
  308|  89.8k|{
  309|  89.8k|    if (!this->stream_dict.hasObjectDescription()) {
  ------------------
  |  Branch (309:9): [True: 0, False: 89.8k]
  ------------------
  310|      0|        this->stream_dict.setObjectDescription(qpdf, getDescription() + " -> stream dictionary");
  311|      0|    }
  312|  89.8k|}
_ZNK11QPDF_Stream7getDictEv:
  316|   526k|{
  317|   526k|    return this->stream_dict;
  318|   526k|}
_ZNK11QPDF_Stream14isDataModifiedEv:
  322|   156k|{
  323|   156k|    return (!this->token_filters.empty());
  324|   156k|}
_ZN11QPDF_Stream13getStreamDataE26qpdf_stream_decode_level_e:
  346|  4.39k|{
  347|  4.39k|    Pl_Buffer buf("stream data buffer");
  348|  4.39k|    bool filtered;
  349|  4.39k|    pipeStreamData(&buf, &filtered, 0, decode_level, false, false);
  350|  4.39k|    if (!filtered) {
  ------------------
  |  Branch (350:9): [True: 580, False: 3.81k]
  ------------------
  351|    580|        throw QPDFExc(
  352|    580|            qpdf_e_unsupported,
  353|    580|            qpdf->getFilename(),
  354|    580|            "",
  355|    580|            this->parsed_offset,
  356|    580|            "getStreamData called on unfilterable stream");
  357|    580|    }
  358|  3.81k|    QTC::TC("qpdf", "QPDF_Stream getStreamData");
  359|  3.81k|    return buf.getBufferSharedPointer();
  360|  4.39k|}
_ZN11QPDF_Stream10filterableERNSt3__16vectorINS0_10shared_ptrI16QPDFStreamFilterEENS0_9allocatorIS4_EEEERbS9_:
  383|  69.8k|{
  384|       |    // Check filters
  385|       |
  386|  69.8k|    QPDFObjectHandle filter_obj = this->stream_dict.getKey("/Filter");
  387|  69.8k|    bool filters_okay = true;
  388|       |
  389|  69.8k|    std::vector<std::string> filter_names;
  390|       |
  391|  69.8k|    if (filter_obj.isNull()) {
  ------------------
  |  Branch (391:9): [True: 34.7k, False: 35.1k]
  ------------------
  392|       |        // No filters
  393|  35.1k|    } else if (filter_obj.isName()) {
  ------------------
  |  Branch (393:16): [True: 17.9k, False: 17.1k]
  ------------------
  394|       |        // One filter
  395|  17.9k|        filter_names.push_back(filter_obj.getName());
  396|  17.9k|    } else if (filter_obj.isArray()) {
  ------------------
  |  Branch (396:16): [True: 17.1k, False: 20]
  ------------------
  397|       |        // Potentially multiple filters
  398|  17.1k|        int n = filter_obj.getArrayNItems();
  399|  45.7k|        for (int i = 0; i < n; ++i) {
  ------------------
  |  Branch (399:25): [True: 28.5k, False: 17.1k]
  ------------------
  400|  28.5k|            QPDFObjectHandle item = filter_obj.getArrayItem(i);
  401|  28.5k|            if (item.isName()) {
  ------------------
  |  Branch (401:17): [True: 27.0k, False: 1.56k]
  ------------------
  402|  27.0k|                filter_names.push_back(item.getName());
  403|  27.0k|            } else {
  404|  1.56k|                filters_okay = false;
  405|  1.56k|            }
  406|  28.5k|        }
  407|  17.1k|    } else {
  408|     20|        filters_okay = false;
  409|     20|    }
  410|       |
  411|  69.8k|    if (!filters_okay) {
  ------------------
  |  Branch (411:9): [True: 239, False: 69.6k]
  ------------------
  412|    239|        QTC::TC("qpdf", "QPDF_Stream invalid filter");
  413|    239|        warn("stream filter type is not name or array");
  414|    239|        return false;
  415|    239|    }
  416|       |
  417|  69.6k|    bool filterable = true;
  418|       |
  419|  69.6k|    for (auto& filter_name: filter_names) {
  ------------------
  |  Branch (419:27): [True: 43.8k, False: 69.6k]
  ------------------
  420|  43.8k|        if (filter_abbreviations.count(filter_name)) {
  ------------------
  |  Branch (420:13): [True: 338, False: 43.5k]
  ------------------
  421|    338|            QTC::TC("qpdf", "QPDF_Stream expand filter abbreviation");
  422|    338|            filter_name = filter_abbreviations[filter_name];
  423|    338|        }
  424|       |
  425|  43.8k|        auto ff = filter_factories.find(filter_name);
  426|  43.8k|        if (ff == filter_factories.end()) {
  ------------------
  |  Branch (426:13): [True: 1.05k, False: 42.8k]
  ------------------
  427|  1.05k|            filterable = false;
  428|  42.8k|        } else {
  429|  42.8k|            filters.push_back((ff->second)());
  430|  42.8k|        }
  431|  43.8k|    }
  432|       |
  433|  69.6k|    if (!filterable) {
  ------------------
  |  Branch (433:9): [True: 616, False: 69.0k]
  ------------------
  434|    616|        return false;
  435|    616|    }
  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|  69.0k|    QPDFObjectHandle decode_obj = this->stream_dict.getKey("/DecodeParms");
  442|  69.0k|    std::vector<QPDFObjectHandle> decode_parms;
  443|  69.0k|    if (decode_obj.isArray() && (decode_obj.getArrayNItems() == 0)) {
  ------------------
  |  Branch (443:9): [True: 482, False: 68.5k]
  |  Branch (443:33): [True: 0, False: 482]
  ------------------
  444|      0|        decode_obj = QPDFObjectHandle::newNull();
  445|      0|    }
  446|  69.0k|    if (decode_obj.isArray()) {
  ------------------
  |  Branch (446:9): [True: 482, False: 68.5k]
  ------------------
  447|  2.26k|        for (int i = 0; i < decode_obj.getArrayNItems(); ++i) {
  ------------------
  |  Branch (447:25): [True: 1.78k, False: 482]
  ------------------
  448|  1.78k|            decode_parms.push_back(decode_obj.getArrayItem(i));
  449|  1.78k|        }
  450|  68.5k|    } else {
  451|   110k|        for (unsigned int i = 0; i < filter_names.size(); ++i) {
  ------------------
  |  Branch (451:34): [True: 42.1k, False: 68.5k]
  ------------------
  452|  42.1k|            decode_parms.push_back(decode_obj);
  453|  42.1k|        }
  454|  68.5k|    }
  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|  69.0k|    if ((filters.size() != 0) && (decode_parms.size() != filters.size())) {
  ------------------
  |  Branch (458:9): [True: 34.2k, False: 34.7k]
  |  Branch (458:34): [True: 10, False: 34.2k]
  ------------------
  459|     10|        warn("stream /DecodeParms length is inconsistent with filters");
  460|     10|        filterable = false;
  461|     10|    }
  462|       |
  463|  69.0k|    if (!filterable) {
  ------------------
  |  Branch (463:9): [True: 10, False: 68.9k]
  ------------------
  464|     10|        return false;
  465|     10|    }
  466|       |
  467|   111k|    for (size_t i = 0; i < filters.size(); ++i) {
  ------------------
  |  Branch (467:24): [True: 42.6k, False: 68.9k]
  ------------------
  468|  42.6k|        auto filter = filters.at(i);
  469|  42.6k|        auto decode_item = decode_parms.at(i);
  470|       |
  471|  42.6k|        if (filter->setDecodeParms(decode_item)) {
  ------------------
  |  Branch (471:13): [True: 42.6k, False: 47]
  ------------------
  472|  42.6k|            if (filter->isSpecializedCompression()) {
  ------------------
  |  Branch (472:17): [True: 3.38k, False: 39.2k]
  ------------------
  473|  3.38k|                specialized_compression = true;
  474|  3.38k|            }
  475|  42.6k|            if (filter->isLossyCompression()) {
  ------------------
  |  Branch (475:17): [True: 2.59k, False: 40.0k]
  ------------------
  476|  2.59k|                specialized_compression = true;
  477|  2.59k|                lossy_compression = true;
  478|  2.59k|            }
  479|  42.6k|        } else {
  480|     47|            filterable = false;
  481|     47|        }
  482|  42.6k|    }
  483|       |
  484|  68.9k|    return filterable;
  485|  69.0k|}
_ZN11QPDF_Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebb:
  495|   103k|{
  496|   103k|    std::vector<std::shared_ptr<QPDFStreamFilter>> filters;
  497|   103k|    bool specialized_compression = false;
  498|   103k|    bool lossy_compression = false;
  499|   103k|    bool ignored;
  500|   103k|    if (filterp == nullptr) {
  ------------------
  |  Branch (500:9): [True: 0, False: 103k]
  ------------------
  501|      0|        filterp = &ignored;
  502|      0|    }
  503|   103k|    bool& filter = *filterp;
  504|   103k|    filter = (!((encode_flags == 0) && (decode_level == qpdf_dl_none)));
  ------------------
  |  Branch (504:17): [True: 56.9k, False: 46.2k]
  |  Branch (504:40): [True: 33.3k, False: 23.5k]
  ------------------
  505|   103k|    bool success = true;
  506|   103k|    if (filter) {
  ------------------
  |  Branch (506:9): [True: 69.8k, False: 33.3k]
  ------------------
  507|  69.8k|        filter = filterable(filters, specialized_compression, lossy_compression);
  508|  69.8k|        if ((decode_level < qpdf_dl_all) && lossy_compression) {
  ------------------
  |  Branch (508:13): [True: 4.39k, False: 65.4k]
  |  Branch (508:45): [True: 2, False: 4.39k]
  ------------------
  509|      2|            filter = false;
  510|      2|        }
  511|  69.8k|        if ((decode_level < qpdf_dl_specialized) && specialized_compression) {
  ------------------
  |  Branch (511:13): [True: 0, False: 69.8k]
  |  Branch (511:53): [True: 0, False: 0]
  ------------------
  512|      0|            filter = false;
  513|      0|        }
  514|  69.8k|        QTC::TC(
  515|  69.8k|            "qpdf",
  516|  69.8k|            "QPDF_Stream special filters",
  517|  69.8k|            (!filter)                     ? 0
  ------------------
  |  Branch (517:13): [True: 904, False: 68.9k]
  ------------------
  518|  69.8k|                : lossy_compression       ? 1
  ------------------
  |  Branch (518:19): [True: 2.59k, False: 66.3k]
  ------------------
  519|  68.9k|                : specialized_compression ? 2
  ------------------
  |  Branch (519:19): [True: 788, False: 65.5k]
  ------------------
  520|  66.3k|                                          : 3);
  521|  69.8k|    }
  522|       |
  523|   103k|    if (pipeline == nullptr) {
  ------------------
  |  Branch (523:9): [True: 0, False: 103k]
  ------------------
  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|   103k|    std::vector<std::shared_ptr<Pipeline>> to_delete;
  533|       |
  534|   103k|    std::shared_ptr<ContentNormalizer> normalizer;
  535|   103k|    std::shared_ptr<Pipeline> new_pipeline;
  536|   103k|    if (filter) {
  ------------------
  |  Branch (536:9): [True: 68.9k, False: 34.3k]
  ------------------
  537|  68.9k|        if (encode_flags & qpdf_ef_compress) {
  ------------------
  |  Branch (537:13): [True: 37.9k, False: 30.9k]
  ------------------
  538|  37.9k|            new_pipeline =
  539|  37.9k|                std::make_shared<Pl_Flate>("compress stream", pipeline, Pl_Flate::a_deflate);
  540|  37.9k|            to_delete.push_back(new_pipeline);
  541|  37.9k|            pipeline = new_pipeline.get();
  542|  37.9k|        }
  543|       |
  544|  68.9k|        if (encode_flags & qpdf_ef_normalize) {
  ------------------
  |  Branch (544:13): [True: 7.78k, False: 61.1k]
  ------------------
  545|  7.78k|            normalizer = std::make_shared<ContentNormalizer>();
  546|  7.78k|            new_pipeline =
  547|  7.78k|                std::make_shared<Pl_QPDFTokenizer>("normalizer", normalizer.get(), pipeline);
  548|  7.78k|            to_delete.push_back(new_pipeline);
  549|  7.78k|            pipeline = new_pipeline.get();
  550|  7.78k|        }
  551|       |
  552|  68.9k|        for (auto iter = this->token_filters.rbegin(); iter != this->token_filters.rend(); ++iter) {
  ------------------
  |  Branch (552:56): [True: 0, False: 68.9k]
  ------------------
  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|   111k|        for (auto f_iter = filters.rbegin(); f_iter != filters.rend(); ++f_iter) {
  ------------------
  |  Branch (559:46): [True: 42.6k, False: 68.9k]
  ------------------
  560|  42.6k|            auto decode_pipeline = (*f_iter)->getDecodePipeline(pipeline);
  561|  42.6k|            if (decode_pipeline) {
  ------------------
  |  Branch (561:17): [True: 42.5k, False: 28]
  ------------------
  562|  42.5k|                pipeline = decode_pipeline;
  563|  42.5k|            }
  564|  42.6k|            auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
  565|  42.6k|            if (flate != nullptr) {
  ------------------
  |  Branch (565:17): [True: 30.0k, False: 12.5k]
  ------------------
  566|  30.0k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });
  567|  30.0k|            }
  568|  42.6k|        }
  569|  68.9k|    }
  570|       |
  571|   103k|    if (this->stream_data.get()) {
  ------------------
  |  Branch (571:9): [True: 0, False: 103k]
  ------------------
  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|   103k|    } else if (this->stream_provider.get()) {
  ------------------
  |  Branch (575:16): [True: 0, False: 103k]
  ------------------
  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|   103k|    } else if (this->parsed_offset == 0) {
  ------------------
  |  Branch (605:16): [True: 0, False: 103k]
  ------------------
  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|   103k|    } else {
  609|   103k|        QTC::TC("qpdf", "QPDF_Stream pipe original stream data");
  610|   103k|        if (!QPDF::Pipe::pipeStreamData(
  ------------------
  |  Branch (610:13): [True: 5.07k, False: 98.1k]
  ------------------
  611|   103k|                this->qpdf,
  612|   103k|                og,
  613|   103k|                this->parsed_offset,
  614|   103k|                this->length,
  615|   103k|                this->stream_dict,
  616|   103k|                pipeline,
  617|   103k|                suppress_warnings,
  618|   103k|                will_retry)) {
  619|  5.07k|            filter = false;
  620|  5.07k|            success = false;
  621|  5.07k|        }
  622|   103k|    }
  623|       |
  624|   103k|    if (filter && (!suppress_warnings) && normalizer.get() && normalizer->anyBadTokens()) {
  ------------------
  |  Branch (624:9): [True: 63.7k, False: 39.4k]
  |  Branch (624:19): [True: 63.7k, False: 0]
  |  Branch (624:43): [True: 7.24k, False: 56.5k]
  |  Branch (624:63): [True: 660, False: 6.58k]
  ------------------
  625|    660|        warn("content normalization encountered bad tokens");
  626|    660|        if (normalizer->lastTokenWasBad()) {
  ------------------
  |  Branch (626:13): [True: 335, False: 325]
  ------------------
  627|    335|            QTC::TC("qpdf", "QPDF_Stream bad token at end during normalize");
  628|    335|            warn("normalized content ended with a bad token; you may be able to resolve this by "
  629|    335|                 "coalescing content streams in combination with normalizing content. From the "
  630|    335|                 "command line, specify --coalesce-contents");
  631|    335|        }
  632|    660|        warn("Resulting stream data may be corrupted but is may still useful for manual "
  633|    660|             "inspection. For more information on this warning, search for content normalization "
  634|    660|             "in the manual.");
  635|    660|    }
  636|       |
  637|   103k|    return success;
  638|   103k|}
_ZN11QPDF_Stream4warnERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  696|  3.28k|{
  697|  3.28k|    this->qpdf->warn(qpdf_e_damaged_pdf, "", this->parsed_offset, message);
  698|  3.28k|}
QPDF_Stream.cc:_ZNK11QPDF_Stream3$_0clEv:
   87|     34|        {"/Crypt", []() { return std::make_shared<SF_Crypt>(); }},
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_CryptC2Ev:
   30|     34|        SF_Crypt() = default;
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt14setDecodeParmsE16QPDFObjectHandle:
   35|     30|        {
   36|     30|            if (decode_parms.isNull()) {
  ------------------
  |  Branch (36:17): [True: 10, False: 20]
  ------------------
   37|     10|                return true;
   38|     10|            }
   39|     20|            bool filterable = true;
   40|     77|            for (auto const& key: decode_parms.getKeys()) {
  ------------------
  |  Branch (40:33): [True: 77, False: 20]
  ------------------
   41|     77|                if (((key == "/Type") || (key == "/Name")) &&
  ------------------
  |  Branch (41:21): [True: 0, False: 77]
  |  Branch (41:22): [True: 2, False: 75]
  |  Branch (41:42): [True: 0, False: 75]
  ------------------
   42|     77|                    ((!decode_parms.hasKey("/Type")) ||
  ------------------
  |  Branch (42:22): [True: 0, False: 2]
  ------------------
   43|      2|                     decode_parms.isDictionaryOfType("/CryptFilterDecodeParms"))) {
  ------------------
  |  Branch (43:22): [True: 0, False: 2]
  ------------------
   44|       |                    // we handle this in decryptStream
   45|     77|                } else {
   46|     77|                    filterable = false;
   47|     77|                }
   48|     77|            }
   49|     20|            return filterable;
   50|     30|        }
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt17getDecodePipelineEP8Pipeline:
   54|     19|        {
   55|       |            // Not used -- handled by pipeStreamData
   56|     19|            return nullptr;
   57|     19|        }
QPDF_Stream.cc:_ZZN11QPDF_Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebbENK3$_0clEPKci:
  566|  1.38k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });

_ZN11QPDF_StringC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   18|   885k|{
   19|   885k|}
_ZN11QPDF_String6createERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   23|   678k|{
   24|   678k|    return do_create(new QPDF_String(val));
   25|   678k|}
_ZN11QPDF_String4copyEb:
   39|  15.1k|{
   40|  15.1k|    return create(val);
   41|  15.1k|}
_ZN11QPDF_String7unparseEv:
   45|   299k|{
   46|   299k|    return unparse(false);
   47|   299k|}
_ZNK11QPDF_String12useHexStringEv:
   74|   299k|{
   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|   299k|    unsigned int non_ascii = 0;
   79|  9.54M|    for (auto const ch: this->val) {
  ------------------
  |  Branch (79:23): [True: 9.54M, False: 233k]
  ------------------
   80|  9.54M|        if (ch > 126) {
  ------------------
  |  Branch (80:13): [True: 150k, False: 9.39M]
  ------------------
   81|   150k|            ++non_ascii;
   82|  9.39M|        } else if (ch >= 32) {
  ------------------
  |  Branch (82:20): [True: 6.22M, False: 3.17M]
  ------------------
   83|  6.22M|            continue;
   84|  6.22M|        } else if (ch < 0 || ch >= 24) {
  ------------------
  |  Branch (84:20): [True: 2.93M, False: 234k]
  |  Branch (84:30): [True: 134k, False: 99.3k]
  ------------------
   85|  3.07M|            ++non_ascii;
   86|  3.07M|        } else if (!(ch == '\n' || ch == '\r' || ch == '\t' || ch == '\b' || ch == '\f')) {
  ------------------
  |  Branch (86:22): [True: 17.5k, False: 81.8k]
  |  Branch (86:36): [True: 3.78k, False: 78.0k]
  |  Branch (86:50): [True: 3.02k, False: 75.0k]
  |  Branch (86:64): [True: 5.56k, False: 69.4k]
  |  Branch (86:78): [True: 3.51k, False: 65.9k]
  ------------------
   87|  65.9k|            return true;
   88|  65.9k|        }
   89|  9.54M|    }
   90|   233k|    return 5 * non_ascii > val.length();
   91|   299k|}
_ZN11QPDF_String7unparseEb:
   95|   506k|{
   96|   506k|    bool use_hexstring = force_binary || useHexString();
  ------------------
  |  Branch (96:26): [True: 207k, False: 299k]
  |  Branch (96:42): [True: 85.5k, False: 213k]
  ------------------
   97|   506k|    std::string result;
   98|   506k|    if (use_hexstring) {
  ------------------
  |  Branch (98:9): [True: 292k, False: 213k]
  ------------------
   99|   292k|        static auto constexpr hexchars = "0123456789abcdef";
  100|   292k|        result.reserve(2 * this->val.length() + 2);
  101|   292k|        result += '<';
  102|  63.3M|        for (const char c: this->val) {
  ------------------
  |  Branch (102:26): [True: 63.3M, False: 292k]
  ------------------
  103|  63.3M|            result += hexchars[static_cast<unsigned char>(c) >> 4];
  104|  63.3M|            result += hexchars[c & 0x0f];
  105|  63.3M|        }
  106|   292k|        result += '>';
  107|   292k|    } else {
  108|   213k|        result += "(";
  109|  6.16M|        for (unsigned int i = 0; i < this->val.length(); ++i) {
  ------------------
  |  Branch (109:34): [True: 5.94M, False: 213k]
  ------------------
  110|  5.94M|            char ch = this->val.at(i);
  111|  5.94M|            switch (ch) {
  112|  10.9k|            case '\n':
  ------------------
  |  Branch (112:13): [True: 10.9k, False: 5.93M]
  ------------------
  113|  10.9k|                result += "\\n";
  114|  10.9k|                break;
  115|       |
  116|  3.58k|            case '\r':
  ------------------
  |  Branch (116:13): [True: 3.58k, False: 5.94M]
  ------------------
  117|  3.58k|                result += "\\r";
  118|  3.58k|                break;
  119|       |
  120|  2.14k|            case '\t':
  ------------------
  |  Branch (120:13): [True: 2.14k, False: 5.94M]
  ------------------
  121|  2.14k|                result += "\\t";
  122|  2.14k|                break;
  123|       |
  124|  5.28k|            case '\b':
  ------------------
  |  Branch (124:13): [True: 5.28k, False: 5.94M]
  ------------------
  125|  5.28k|                result += "\\b";
  126|  5.28k|                break;
  127|       |
  128|  2.87k|            case '\f':
  ------------------
  |  Branch (128:13): [True: 2.87k, False: 5.94M]
  ------------------
  129|  2.87k|                result += "\\f";
  130|  2.87k|                break;
  131|       |
  132|  3.54k|            case '(':
  ------------------
  |  Branch (132:13): [True: 3.54k, False: 5.94M]
  ------------------
  133|  3.54k|                result += "\\(";
  134|  3.54k|                break;
  135|       |
  136|  3.48k|            case ')':
  ------------------
  |  Branch (136:13): [True: 3.48k, False: 5.94M]
  ------------------
  137|  3.48k|                result += "\\)";
  138|  3.48k|                break;
  139|       |
  140|    553|            case '\\':
  ------------------
  |  Branch (140:13): [True: 553, False: 5.94M]
  ------------------
  141|    553|                result += "\\\\";
  142|    553|                break;
  143|       |
  144|  5.91M|            default:
  ------------------
  |  Branch (144:13): [True: 5.91M, False: 32.3k]
  ------------------
  145|  5.91M|                if (is_iso_latin1_printable(ch)) {
  ------------------
  |  Branch (145:21): [True: 5.91M, False: 1.74k]
  ------------------
  146|  5.91M|                    result += this->val.at(i);
  147|  5.91M|                } else {
  148|  1.74k|                    result += "\\" +
  149|  1.74k|                        QUtil::int_to_string_base(
  150|  1.74k|                                  static_cast<int>(static_cast<unsigned char>(ch)), 8, 3);
  151|  1.74k|                }
  152|  5.91M|                break;
  153|  5.94M|            }
  154|  5.94M|        }
  155|   213k|        result += ")";
  156|   213k|    }
  157|       |
  158|   506k|    return result;
  159|   506k|}
QPDF_String.cc:_ZL23is_iso_latin1_printablec:
   11|  5.91M|{
   12|  5.91M|    return (((ch >= 32) && (ch <= 126)) || (static_cast<unsigned char>(ch) >= 160));
  ------------------
  |  Branch (12:14): [True: 5.74M, False: 174k]
  |  Branch (12:28): [True: 5.74M, False: 88]
  |  Branch (12:44): [True: 172k, False: 1.74k]
  ------------------
   13|  5.91M|}

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

_ZNK4QPDF14EncryptionData4getVEv:
   37|  1.86k|{
   38|  1.86k|    return this->V;
   39|  1.86k|}
_ZNK4QPDF14EncryptionData4getREv:
   43|  19.2k|{
   44|  19.2k|    return this->R;
   45|  19.2k|}
_ZNK4QPDF14EncryptionData14getLengthBytesEv:
   49|  2.23k|{
   50|  2.23k|    return this->Length_bytes;
   51|  2.23k|}
_ZNK4QPDF14EncryptionData4getPEv:
   55|  4.75k|{
   56|  4.75k|    return this->P;
   57|  4.75k|}
_ZNK4QPDF14EncryptionData4getOEv:
   61|  1.47k|{
   62|  1.47k|    return this->O;
   63|  1.47k|}
_ZNK4QPDF14EncryptionData4getUEv:
   67|  1.46k|{
   68|  1.46k|    return this->U;
   69|  1.46k|}
_ZNK4QPDF14EncryptionData5getUEEv:
   79|    143|{
   80|    143|    return this->UE;
   81|    143|}
_ZNK4QPDF14EncryptionData8getPermsEv:
   85|    143|{
   86|    143|    return this->Perms;
   87|    143|}
_ZNK4QPDF14EncryptionData6getId1Ev:
   91|  2.22k|{
   92|  2.22k|    return this->id1;
   93|  2.22k|}
_ZNK4QPDF14EncryptionData18getEncryptMetadataEv:
   97|  4.75k|{
   98|  4.75k|    return this->encrypt_metadata;
   99|  4.75k|}
_ZN4QPDF14EncryptionData25setV5EncryptionParametersERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_S9_S9_S9_:
  120|  3.95k|{
  121|  3.95k|    this->O = O;
  122|  3.95k|    this->OE = OE;
  123|  3.95k|    this->U = U;
  124|  3.95k|    this->UE = UE;
  125|  3.95k|    this->Perms = Perms;
  126|  3.95k|}
_ZN4QPDF16compute_data_keyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEiibii:
  332|   271k|{
  333|       |    // Algorithm 3.1 from the PDF 1.7 Reference Manual
  334|       |
  335|   271k|    std::string result = encryption_key;
  336|       |
  337|   271k|    if (encryption_V >= 5) {
  ------------------
  |  Branch (337:9): [True: 163k, False: 108k]
  ------------------
  338|       |        // Algorithm 3.1a (PDF 1.7 extension level 3): just use encryption key straight.
  339|   163k|        return result;
  340|   163k|    }
  341|       |
  342|       |    // Append low three bytes of object ID and low two bytes of generation
  343|   108k|    result.append(1, static_cast<char>(objid & 0xff));
  344|   108k|    result.append(1, static_cast<char>((objid >> 8) & 0xff));
  345|   108k|    result.append(1, static_cast<char>((objid >> 16) & 0xff));
  346|   108k|    result.append(1, static_cast<char>(generation & 0xff));
  347|   108k|    result.append(1, static_cast<char>((generation >> 8) & 0xff));
  348|   108k|    if (use_aes) {
  ------------------
  |  Branch (348:9): [True: 2.58k, False: 105k]
  ------------------
  349|  2.58k|        result += "sAlT";
  350|  2.58k|    }
  351|       |
  352|   108k|    MD5 md5;
  353|   108k|    md5.encodeDataIncrementally(result.c_str(), result.length());
  354|   108k|    MD5::Digest digest;
  355|   108k|    md5.digest(digest);
  356|   108k|    return {reinterpret_cast<char*>(digest), std::min(result.length(), toS(16))};
  357|   271k|}
_ZN4QPDF22compute_encryption_keyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKNS_14EncryptionDataE:
  361|    664|{
  362|    664|    if (data.getV() >= 5) {
  ------------------
  |  Branch (362:9): [True: 0, False: 664]
  ------------------
  363|       |        // For V >= 5, the encryption key is generated and stored in the file, encrypted separately
  364|       |        // with both user and owner passwords.
  365|      0|        return recover_encryption_key_with_password(password, data);
  366|    664|    } else {
  367|       |        // For V < 5, the encryption key is derived from the user
  368|       |        // password.
  369|    664|        return compute_encryption_key_from_password(password, data);
  370|    664|    }
  371|    664|}
_ZN4QPDF36compute_encryption_key_from_passwordERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKNS_14EncryptionDataE:
  375|    664|{
  376|       |    // Algorithm 3.2 from the PDF 1.7 Reference Manual
  377|       |
  378|       |    // This code does not properly handle Unicode passwords. Passwords are supposed to be converted
  379|       |    // from OS codepage characters to PDFDocEncoding.  Unicode passwords are supposed to be
  380|       |    // converted to OS codepage before converting to PDFDocEncoding.  We instead require the
  381|       |    // password to be presented in its final form.
  382|       |
  383|    664|    MD5 md5;
  384|    664|    md5.encodeDataIncrementally(pad_or_truncate_password_V4(password).c_str(), key_bytes);
  385|    664|    md5.encodeDataIncrementally(data.getO().c_str(), key_bytes);
  386|    664|    char pbytes[4];
  387|    664|    int P = data.getP();
  388|    664|    pbytes[0] = static_cast<char>(P & 0xff);
  389|    664|    pbytes[1] = static_cast<char>((P >> 8) & 0xff);
  390|    664|    pbytes[2] = static_cast<char>((P >> 16) & 0xff);
  391|    664|    pbytes[3] = static_cast<char>((P >> 24) & 0xff);
  392|    664|    md5.encodeDataIncrementally(pbytes, 4);
  393|    664|    md5.encodeDataIncrementally(data.getId1().c_str(), data.getId1().length());
  394|    664|    if ((data.getR() >= 4) && (!data.getEncryptMetadata())) {
  ------------------
  |  Branch (394:9): [True: 664, False: 0]
  |  Branch (394:31): [True: 0, False: 664]
  ------------------
  395|      0|        char bytes[4];
  396|      0|        memset(bytes, 0xff, 4);
  397|      0|        md5.encodeDataIncrementally(bytes, 4);
  398|      0|    }
  399|    664|    MD5::Digest digest;
  400|    664|    int key_len = std::min(toI(sizeof(digest)), data.getLengthBytes());
  401|    664|    iterate_md5_digest(md5, digest, ((data.getR() >= 3) ? 50 : 0), key_len);
  ------------------
  |  Branch (401:38): [True: 664, False: 0]
  ------------------
  402|    664|    return {reinterpret_cast<char*>(digest), toS(key_len)};
  403|    664|}
_Z28compute_Perms_value_V5_clearRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKN4QPDF14EncryptionDataEPh:
  640|  4.09k|{
  641|       |    // From algorithm 3.10 from the PDF 1.7 extension level 3
  642|  4.09k|    unsigned long long extended_perms =
  643|  4.09k|        0xffffffff00000000LL | static_cast<unsigned long long>(data.getP());
  644|  36.8k|    for (int i = 0; i < 8; ++i) {
  ------------------
  |  Branch (644:21): [True: 32.7k, False: 4.09k]
  ------------------
  645|  32.7k|        k[i] = static_cast<unsigned char>(extended_perms & 0xff);
  646|  32.7k|        extended_perms >>= 8;
  647|  32.7k|    }
  648|  4.09k|    k[8] = data.getEncryptMetadata() ? 'T' : 'F';
  ------------------
  |  Branch (648:12): [True: 4.09k, False: 0]
  ------------------
  649|  4.09k|    k[9] = 'a';
  650|  4.09k|    k[10] = 'd';
  651|  4.09k|    k[11] = 'b';
  652|  4.09k|    QUtil::initializeWithRandomBytes(k + 12, 4);
  653|  4.09k|}
_ZN4QPDF36recover_encryption_key_with_passwordERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKNS_14EncryptionDataERb:
  668|    143|{
  669|       |    // Algorithm 3.2a from the PDF 1.7 extension level 3
  670|       |
  671|       |    // This code does not handle Unicode passwords correctly. Empirical evidence suggests that most
  672|       |    // viewers don't.  We are supposed to process the input string with the SASLprep (RFC 4013)
  673|       |    // profile of stringprep (RFC 3454) and then convert the result to UTF-8.
  674|       |
  675|    143|    perms_valid = false;
  676|    143|    std::string key_password = truncate_password_V5(password);
  677|    143|    std::string key_salt;
  678|    143|    std::string user_data;
  679|    143|    std::string encrypted_file_key;
  680|    143|    if (check_owner_password_V5(key_password, data)) {
  ------------------
  |  Branch (680:9): [True: 0, False: 143]
  ------------------
  681|      0|        key_salt = data.getO().substr(40, 8);
  682|      0|        user_data = data.getU().substr(0, 48);
  683|      0|        encrypted_file_key = data.getOE().substr(0, 32);
  684|    143|    } else if (check_user_password_V5(key_password, data)) {
  ------------------
  |  Branch (684:16): [True: 143, False: 0]
  ------------------
  685|    143|        key_salt = data.getU().substr(40, 8);
  686|    143|        encrypted_file_key = data.getUE().substr(0, 32);
  687|    143|    }
  688|    143|    std::string intermediate_key = hash_V5(key_password, key_salt, user_data, data);
  689|    143|    std::string file_key = process_with_aes(intermediate_key, false, encrypted_file_key);
  690|       |
  691|       |    // Decrypt Perms and check against expected value
  692|    143|    std::string perms_check = process_with_aes(file_key, false, data.getPerms(), 12);
  693|    143|    unsigned char k[16];
  694|    143|    compute_Perms_value_V5_clear(file_key, data, k);
  695|    143|    perms_valid = (memcmp(perms_check.c_str(), k, 12) == 0);
  696|       |
  697|    143|    return file_key;
  698|    143|}
_ZN4QPDF11interpretCFENSt3__110shared_ptrINS_20EncryptionParametersEEE16QPDFObjectHandle:
  702|    694|{
  703|    694|    if (cf.isName()) {
  ------------------
  |  Branch (703:9): [True: 518, False: 176]
  ------------------
  704|    518|        std::string filter = cf.getName();
  705|    518|        if (encp->crypt_filters.count(filter) != 0) {
  ------------------
  |  Branch (705:13): [True: 278, False: 240]
  ------------------
  706|    278|            return encp->crypt_filters[filter];
  707|    278|        } else if (filter == "/Identity") {
  ------------------
  |  Branch (707:20): [True: 0, False: 240]
  ------------------
  708|      0|            return e_none;
  709|    240|        } else {
  710|    240|            return e_unknown;
  711|    240|        }
  712|    518|    } else {
  713|       |        // Default: /Identity
  714|    176|        return e_none;
  715|    176|    }
  716|    694|}
_ZN4QPDF20initializeEncryptionEv:
  720|  8.89k|{
  721|  8.89k|    if (m->encp->encryption_initialized) {
  ------------------
  |  Branch (721:9): [True: 0, False: 8.89k]
  ------------------
  722|      0|        return;
  723|      0|    }
  724|  8.89k|    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|  8.89k|    if (!m->trailer.hasKey("/Encrypt")) {
  ------------------
  |  Branch (730:9): [True: 8.50k, False: 395]
  ------------------
  731|  8.50k|        return;
  732|  8.50k|    }
  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|    395|    m->encp->encrypted = true;
  737|       |
  738|    395|    std::string id1;
  739|    395|    QPDFObjectHandle id_obj = m->trailer.getKey("/ID");
  740|    395|    if ((id_obj.isArray() && (id_obj.getArrayNItems() == 2) && id_obj.getArrayItem(0).isString())) {
  ------------------
  |  Branch (740:9): [True: 348, False: 47]
  |  Branch (740:10): [True: 372, False: 23]
  |  Branch (740:30): [True: 348, False: 24]
  |  Branch (740:64): [True: 348, False: 0]
  ------------------
  741|    348|        id1 = id_obj.getArrayItem(0).getStringValue();
  742|    348|    } 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|     47|        warn(damagedPDF("trailer", "invalid /ID in trailer dictionary"));
  746|     47|    }
  747|       |
  748|    395|    QPDFObjectHandle encryption_dict = m->trailer.getKey("/Encrypt");
  749|    395|    if (!encryption_dict.isDictionary()) {
  ------------------
  |  Branch (749:9): [True: 4, False: 391]
  ------------------
  750|      4|        throw damagedPDF("/Encrypt in trailer dictionary is not a dictionary");
  751|      4|    }
  752|       |
  753|    391|    if (!(encryption_dict.getKey("/Filter").isName() &&
  ------------------
  |  Branch (753:9): [True: 3, False: 388]
  |  Branch (753:11): [True: 389, False: 2]
  ------------------
  754|    391|          (encryption_dict.getKey("/Filter").getName() == "/Standard"))) {
  ------------------
  |  Branch (754:11): [True: 387, False: 2]
  ------------------
  755|      3|        throw QPDFExc(
  756|      3|            qpdf_e_unsupported,
  757|      3|            m->file->getName(),
  758|      3|            "encryption dictionary",
  759|      3|            m->file->getLastOffset(),
  760|      3|            "unsupported encryption filter");
  761|      3|    }
  762|    388|    if (!encryption_dict.getKey("/SubFilter").isNull()) {
  ------------------
  |  Branch (762:9): [True: 0, False: 388]
  ------------------
  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|    388|    if (!(encryption_dict.getKey("/V").isInteger() && encryption_dict.getKey("/R").isInteger() &&
  ------------------
  |  Branch (770:9): [True: 6, False: 382]
  |  Branch (770:11): [True: 386, False: 2]
  |  Branch (770:55): [True: 385, False: 1]
  ------------------
  771|    388|          encryption_dict.getKey("/O").isString() && encryption_dict.getKey("/U").isString() &&
  ------------------
  |  Branch (771:11): [True: 383, False: 2]
  |  Branch (771:54): [True: 382, False: 1]
  ------------------
  772|    388|          encryption_dict.getKey("/P").isInteger())) {
  ------------------
  |  Branch (772:11): [True: 381, False: 1]
  ------------------
  773|      6|        throw damagedPDF(
  774|      6|            "encryption dictionary",
  775|      6|            "some encryption dictionary parameters are missing or the wrong "
  776|      6|            "type");
  777|      6|    }
  778|       |
  779|    382|    int V = encryption_dict.getKey("/V").getIntValueAsInt();
  780|    382|    int R = encryption_dict.getKey("/R").getIntValueAsInt();
  781|    382|    std::string O = encryption_dict.getKey("/O").getStringValue();
  782|    382|    std::string U = encryption_dict.getKey("/U").getStringValue();
  783|    382|    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|    382|    if (!(((R >= 2) && (R <= 6)) && ((V == 1) || (V == 2) || (V == 4) || (V == 5)))) {
  ------------------
  |  Branch (787:12): [True: 381, False: 1]
  |  Branch (787:24): [True: 380, False: 1]
  |  Branch (787:38): [True: 0, False: 380]
  |  Branch (787:50): [True: 27, False: 353]
  |  Branch (787:62): [True: 200, False: 153]
  |  Branch (787:74): [True: 152, False: 1]
  ------------------
  788|      2|        throw QPDFExc(
  789|      2|            qpdf_e_unsupported,
  790|      2|            m->file->getName(),
  791|      2|            "encryption dictionary",
  792|      2|            m->file->getLastOffset(),
  793|      2|            "Unsupported /R or /V in encryption dictionary; R = " + std::to_string(R) +
  794|      2|                " (max 6), V = " + std::to_string(V) + " (max 5)");
  795|      2|    }
  796|       |
  797|    380|    m->encp->encryption_V = V;
  798|    380|    m->encp->encryption_R = R;
  799|       |
  800|       |    // OE, UE, and Perms are only present if V >= 5.
  801|    380|    std::string OE;
  802|    380|    std::string UE;
  803|    380|    std::string Perms;
  804|       |
  805|    380|    if (V < 5) {
  ------------------
  |  Branch (805:9): [True: 227, False: 153]
  ------------------
  806|       |        // These must be exactly the right number of bytes.
  807|    227|        pad_short_parameter(O, key_bytes);
  808|    227|        pad_short_parameter(U, key_bytes);
  809|    227|        if (!((O.length() == key_bytes) && (U.length() == key_bytes))) {
  ------------------
  |  Branch (809:15): [True: 226, False: 1]
  |  Branch (809:44): [True: 225, False: 1]
  ------------------
  810|      2|            throw damagedPDF(
  811|      2|                "encryption dictionary",
  812|      2|                "incorrect length for /O and/or /U in encryption dictionary");
  813|      2|        }
  814|    227|    } else {
  815|    153|        if (!(encryption_dict.getKey("/OE").isString() &&
  ------------------
  |  Branch (815:13): [True: 3, False: 150]
  |  Branch (815:15): [True: 151, False: 2]
  ------------------
  816|    153|              encryption_dict.getKey("/UE").isString() &&
  ------------------
  |  Branch (816:15): [True: 150, False: 1]
  ------------------
  817|    153|              encryption_dict.getKey("/Perms").isString())) {
  ------------------
  |  Branch (817:15): [True: 149, False: 1]
  ------------------
  818|      3|            throw damagedPDF(
  819|      3|                "encryption dictionary",
  820|      3|                "some V=5 encryption dictionary parameters are missing or the "
  821|      3|                "wrong type");
  822|      3|        }
  823|    150|        OE = encryption_dict.getKey("/OE").getStringValue();
  824|    150|        UE = encryption_dict.getKey("/UE").getStringValue();
  825|    150|        Perms = encryption_dict.getKey("/Perms").getStringValue();
  826|       |
  827|       |        // These may be longer than the minimum number of bytes.
  828|    150|        pad_short_parameter(O, OU_key_bytes_V5);
  829|    150|        pad_short_parameter(U, OU_key_bytes_V5);
  830|    150|        pad_short_parameter(OE, OUE_key_bytes_V5);
  831|    150|        pad_short_parameter(UE, OUE_key_bytes_V5);
  832|    150|        pad_short_parameter(Perms, Perms_key_bytes_V5);
  833|    150|    }
  834|       |
  835|    375|    int Length = 0;
  836|    375|    if (V <= 1) {
  ------------------
  |  Branch (836:9): [True: 0, False: 375]
  ------------------
  837|      0|        Length = 40;
  838|    375|    } else if (V == 4) {
  ------------------
  |  Branch (838:16): [True: 198, False: 177]
  ------------------
  839|    198|        Length = 128;
  840|    198|    } else if (V == 5) {
  ------------------
  |  Branch (840:16): [True: 149, False: 28]
  ------------------
  841|    149|        Length = 256;
  842|    149|    } else {
  843|     28|        if (encryption_dict.getKey("/Length").isInteger()) {
  ------------------
  |  Branch (843:13): [True: 0, False: 28]
  ------------------
  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|     28|    }
  850|    375|    if (Length == 0) {
  ------------------
  |  Branch (850:9): [True: 27, False: 348]
  ------------------
  851|       |        // Still no Length? Just take a guess.
  852|     27|        Length = 128;
  853|     27|    }
  854|       |
  855|    375|    m->encp->encrypt_metadata = true;
  856|    375|    if ((V >= 4) && (encryption_dict.getKey("/EncryptMetadata").isBool())) {
  ------------------
  |  Branch (856:9): [True: 347, False: 28]
  |  Branch (856:9): [True: 0, False: 375]
  |  Branch (856:21): [True: 0, False: 347]
  ------------------
  857|      0|        m->encp->encrypt_metadata = encryption_dict.getKey("/EncryptMetadata").getBoolValue();
  858|      0|    }
  859|       |
  860|    375|    if ((V == 4) || (V == 5)) {
  ------------------
  |  Branch (860:9): [True: 199, False: 176]
  |  Branch (860:21): [True: 149, False: 27]
  ------------------
  861|    347|        QPDFObjectHandle CF = encryption_dict.getKey("/CF");
  862|    781|        for (auto const& filter: CF.getKeys()) {
  ------------------
  |  Branch (862:32): [True: 781, False: 347]
  ------------------
  863|    781|            QPDFObjectHandle cdict = CF.getKey(filter);
  864|    781|            if (cdict.isDictionary()) {
  ------------------
  |  Branch (864:17): [True: 243, False: 538]
  ------------------
  865|    243|                encryption_method_e method = e_none;
  866|    243|                if (cdict.getKey("/CFM").isName()) {
  ------------------
  |  Branch (866:21): [True: 214, False: 29]
  ------------------
  867|    214|                    std::string method_name = cdict.getKey("/CFM").getName();
  868|    214|                    if (method_name == "/V2") {
  ------------------
  |  Branch (868:25): [True: 0, False: 214]
  ------------------
  869|      0|                        QTC::TC("qpdf", "QPDF_encryption CFM V2");
  870|      0|                        method = e_rc4;
  871|    214|                    } else if (method_name == "/AESV2") {
  ------------------
  |  Branch (871:32): [True: 67, False: 147]
  ------------------
  872|     67|                        QTC::TC("qpdf", "QPDF_encryption CFM AESV2");
  873|     67|                        method = e_aes;
  874|    147|                    } else if (method_name == "/AESV3") {
  ------------------
  |  Branch (874:32): [True: 121, False: 26]
  ------------------
  875|    121|                        QTC::TC("qpdf", "QPDF_encryption CFM AESV3");
  876|    121|                        method = e_aesv3;
  877|    121|                    } else {
  878|       |                        // Don't complain now -- maybe we won't need to reference this type.
  879|     26|                        method = e_unknown;
  880|     26|                    }
  881|    214|                }
  882|    243|                m->encp->crypt_filters[filter] = method;
  883|    243|            }
  884|    781|        }
  885|       |
  886|    347|        QPDFObjectHandle StmF = encryption_dict.getKey("/StmF");
  887|    347|        QPDFObjectHandle StrF = encryption_dict.getKey("/StrF");
  888|    347|        QPDFObjectHandle EFF = encryption_dict.getKey("/EFF");
  889|    347|        m->encp->cf_stream = interpretCF(m->encp, StmF);
  890|    347|        m->encp->cf_string = interpretCF(m->encp, StrF);
  891|    347|        if (EFF.isName()) {
  ------------------
  |  Branch (891:13): [True: 0, False: 347]
  ------------------
  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|    347|        } else {
  903|    347|            m->encp->cf_file = m->encp->cf_stream;
  904|    347|        }
  905|    347|    }
  906|       |
  907|    375|    EncryptionData data(V, R, Length / 8, P, O, U, OE, UE, Perms, id1, m->encp->encrypt_metadata);
  908|    375|    if (m->provided_password_is_hex_key) {
  ------------------
  |  Branch (908:9): [True: 0, False: 375]
  ------------------
  909|       |        // ignore passwords in file
  910|    375|    } else {
  911|    375|        m->encp->owner_password_matched =
  912|    375|            check_owner_password(m->encp->user_password, m->encp->provided_password, data);
  913|    375|        if (m->encp->owner_password_matched && (V < 5)) {
  ------------------
  |  Branch (913:13): [True: 0, False: 375]
  |  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|    375|        } else {
  920|    375|            m->encp->user_password_matched = check_user_password(m->encp->provided_password, data);
  921|    375|            if (m->encp->user_password_matched) {
  ------------------
  |  Branch (921:17): [True: 357, False: 18]
  ------------------
  922|    357|                m->encp->user_password = m->encp->provided_password;
  923|    357|            }
  924|    375|        }
  925|    375|        if (m->encp->user_password_matched && m->encp->owner_password_matched) {
  ------------------
  |  Branch (925:13): [True: 357, False: 18]
  |  Branch (925:47): [True: 0, False: 357]
  ------------------
  926|      0|            QTC::TC("qpdf", "QPDF_encryption same password", (V < 5) ? 0 : 1);
  ------------------
  |  Branch (926:62): [True: 0, False: 0]
  ------------------
  927|      0|        }
  928|    375|        if (!(m->encp->owner_password_matched || m->encp->user_password_matched)) {
  ------------------
  |  Branch (928:15): [True: 1, False: 374]
  |  Branch (928:50): [True: 357, False: 17]
  ------------------
  929|     17|            throw QPDFExc(qpdf_e_password, m->file->getName(), "", 0, "invalid password");
  930|     17|        }
  931|    375|    }
  932|       |
  933|    358|    if (m->provided_password_is_hex_key) {
  ------------------
  |  Branch (933:9): [True: 0, False: 358]
  ------------------
  934|      0|        m->encp->encryption_key = QUtil::hex_decode(m->encp->provided_password);
  935|    358|    } else if (V < 5) {
  ------------------
  |  Branch (935:16): [True: 214, False: 144]
  ------------------
  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|    214|        m->encp->encryption_key = compute_encryption_key(m->encp->user_password, data);
  939|    214|    } 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|    144|        bool perms_valid;
  943|    144|        m->encp->encryption_key =
  944|    144|            recover_encryption_key_with_password(m->encp->provided_password, data, perms_valid);
  945|    144|        if (!perms_valid) {
  ------------------
  |  Branch (945:13): [True: 15, False: 129]
  ------------------
  946|     15|            warn(damagedPDF(
  947|     15|                "encryption dictionary",
  948|     15|                "/Perms field in encryption dictionary doesn't match expected "
  949|     15|                "value"));
  950|     15|        }
  951|    144|    }
  952|    358|}
_ZN4QPDF15getKeyForObjectENSt3__110shared_ptrINS_20EncryptionParametersEEERK10QPDFObjGenb:
  957|  7.86k|{
  958|  7.86k|    if (!encp->encrypted) {
  ------------------
  |  Branch (958:9): [True: 0, False: 7.86k]
  ------------------
  959|      0|        throw std::logic_error("request for encryption key in non-encrypted PDF");
  960|      0|    }
  961|       |
  962|  7.86k|    if (og != encp->cached_key_og) {
  ------------------
  |  Branch (962:9): [True: 3.88k, False: 3.97k]
  ------------------
  963|  3.88k|        encp->cached_object_encryption_key = compute_data_key(
  964|  3.88k|            encp->encryption_key,
  965|  3.88k|            og.getObj(),
  966|  3.88k|            og.getGen(),
  967|  3.88k|            use_aes,
  968|  3.88k|            encp->encryption_V,
  969|  3.88k|            encp->encryption_R);
  970|  3.88k|        encp->cached_key_og = og;
  971|  3.88k|    }
  972|       |
  973|  7.86k|    return encp->cached_object_encryption_key;
  974|  7.86k|}
_ZN4QPDF13decryptStringERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERK10QPDFObjGen:
  978|  8.14k|{
  979|  8.14k|    if (!og.isIndirect()) {
  ------------------
  |  Branch (979:9): [True: 0, False: 8.14k]
  ------------------
  980|      0|        return;
  981|      0|    }
  982|  8.14k|    bool use_aes = false;
  983|  8.14k|    if (m->encp->encryption_V >= 4) {
  ------------------
  |  Branch (983:9): [True: 6.63k, False: 1.50k]
  ------------------
  984|  6.63k|        switch (m->encp->cf_string) {
  985|  1.94k|        case e_none:
  ------------------
  |  Branch (985:9): [True: 1.94k, False: 4.69k]
  ------------------
  986|  1.94k|            return;
  987|       |
  988|  4.53k|        case e_aes:
  ------------------
  |  Branch (988:9): [True: 4.53k, False: 2.10k]
  ------------------
  989|  4.53k|            use_aes = true;
  990|  4.53k|            break;
  991|       |
  992|     69|        case e_aesv3:
  ------------------
  |  Branch (992:9): [True: 69, False: 6.56k]
  ------------------
  993|     69|            use_aes = true;
  994|     69|            break;
  995|       |
  996|      0|        case e_rc4:
  ------------------
  |  Branch (996:9): [True: 0, False: 6.63k]
  ------------------
  997|      0|            break;
  998|       |
  999|     89|        default:
  ------------------
  |  Branch (999:9): [True: 89, False: 6.54k]
  ------------------
 1000|     89|            warn(damagedPDF("unknown encryption filter for strings (check /StrF in "
 1001|     89|                            "/Encrypt dictionary); strings may be decrypted improperly"));
 1002|       |            // To avoid repeated warnings, reset cf_string.  Assume we'd want to use AES if V == 4.
 1003|     89|            m->encp->cf_string = e_aes;
 1004|     89|            use_aes = true;
 1005|     89|            break;
 1006|  6.63k|        }
 1007|  6.63k|    }
 1008|       |
 1009|  6.20k|    std::string key = getKeyForObject(m->encp, og, use_aes);
 1010|  6.20k|    try {
 1011|  6.20k|        if (use_aes) {
  ------------------
  |  Branch (1011:13): [True: 4.69k, False: 1.50k]
  ------------------
 1012|  4.69k|            QTC::TC("qpdf", "QPDF_encryption aes decode string");
 1013|  4.69k|            Pl_Buffer bufpl("decrypted string");
 1014|  4.69k|            Pl_AES_PDF pl(
 1015|  4.69k|                "aes decrypt string",
 1016|  4.69k|                &bufpl,
 1017|  4.69k|                false,
 1018|  4.69k|                QUtil::unsigned_char_pointer(key),
 1019|  4.69k|                key.length());
 1020|  4.69k|            pl.writeString(str);
 1021|  4.69k|            pl.finish();
 1022|  4.69k|            str = bufpl.getString();
 1023|  4.69k|        } else {
 1024|  1.50k|            QTC::TC("qpdf", "QPDF_encryption rc4 decode string");
 1025|  1.50k|            size_t vlen = str.length();
 1026|       |            // Using std::shared_ptr guarantees that tmp will be freed even if rc4.process throws an
 1027|       |            // exception.
 1028|  1.50k|            auto tmp = QUtil::make_unique_cstr(str);
 1029|  1.50k|            RC4 rc4(QUtil::unsigned_char_pointer(key), toI(key.length()));
 1030|  1.50k|            auto data = QUtil::unsigned_char_pointer(tmp.get());
 1031|  1.50k|            rc4.process(data, vlen, data);
 1032|  1.50k|            str = std::string(tmp.get(), vlen);
 1033|  1.50k|        }
 1034|  6.20k|    } catch (QPDFExc&) {
 1035|      0|        throw;
 1036|      0|    } catch (std::runtime_error& e) {
 1037|      0|        throw damagedPDF("error decrypting string for object " + og.unparse() + ": " + e.what());
 1038|      0|    }
 1039|  6.20k|}
_ZN4QPDF13decryptStreamENSt3__110shared_ptrINS_20EncryptionParametersEEENS1_I11InputSourceEERS_RP8PipelineRK10QPDFObjGenR16QPDFObjectHandleRNS0_10unique_ptrIS7_NS0_14default_deleteIS7_EEEE:
 1053|  1.79k|{
 1054|  1.79k|    std::string type;
 1055|  1.79k|    if (stream_dict.getKey("/Type").isName()) {
  ------------------
  |  Branch (1055:9): [True: 830, False: 967]
  ------------------
 1056|    830|        type = stream_dict.getKey("/Type").getName();
 1057|    830|    }
 1058|  1.79k|    if (type == "/XRef") {
  ------------------
  |  Branch (1058:9): [True: 49, False: 1.74k]
  ------------------
 1059|     49|        QTC::TC("qpdf", "QPDF_encryption xref stream from encrypted file");
 1060|     49|        return;
 1061|     49|    }
 1062|  1.74k|    bool use_aes = false;
 1063|  1.74k|    if (encp->encryption_V >= 4) {
  ------------------
  |  Branch (1063:9): [True: 1.58k, False: 163]
  ------------------
 1064|  1.58k|        encryption_method_e method = e_unknown;
 1065|  1.58k|        std::string method_source = "/StmF from /Encrypt dictionary";
 1066|       |
 1067|  1.58k|        if (stream_dict.getKey("/Filter").isOrHasName("/Crypt")) {
  ------------------
  |  Branch (1067:13): [True: 4, False: 1.58k]
  ------------------
 1068|      4|            if (stream_dict.getKey("/DecodeParms").isDictionary()) {
  ------------------
  |  Branch (1068:17): [True: 0, False: 4]
  ------------------
 1069|      0|                QPDFObjectHandle decode_parms = stream_dict.getKey("/DecodeParms");
 1070|      0|                if (decode_parms.isDictionaryOfType("/CryptFilterDecodeParms")) {
  ------------------
  |  Branch (1070:21): [True: 0, False: 0]
  ------------------
 1071|      0|                    QTC::TC("qpdf", "QPDF_encryption stream crypt filter");
 1072|      0|                    method = interpretCF(encp, decode_parms.getKey("/Name"));
 1073|      0|                    method_source = "stream's Crypt decode parameters";
 1074|      0|                }
 1075|      4|            } else if (
 1076|      4|                stream_dict.getKey("/DecodeParms").isArray() &&
  ------------------
  |  Branch (1076:17): [True: 0, False: 4]
  |  Branch (1076:17): [True: 0, False: 4]
  ------------------
 1077|      4|                stream_dict.getKey("/Filter").isArray()) {
  ------------------
  |  Branch (1077:17): [True: 0, False: 0]
  ------------------
 1078|      0|                QPDFObjectHandle filter = stream_dict.getKey("/Filter");
 1079|      0|                QPDFObjectHandle decode = stream_dict.getKey("/DecodeParms");
 1080|      0|                if (filter.getArrayNItems() == decode.getArrayNItems()) {
  ------------------
  |  Branch (1080:21): [True: 0, False: 0]
  ------------------
 1081|      0|                    for (int i = 0; i < filter.getArrayNItems(); ++i) {
  ------------------
  |  Branch (1081:37): [True: 0, False: 0]
  ------------------
 1082|      0|                        if (filter.getArrayItem(i).isNameAndEquals("/Crypt")) {
  ------------------
  |  Branch (1082:29): [True: 0, False: 0]
  ------------------
 1083|      0|                            QPDFObjectHandle crypt_params = decode.getArrayItem(i);
 1084|      0|                            if (crypt_params.isDictionary() &&
  ------------------
  |  Branch (1084:33): [True: 0, False: 0]
  |  Branch (1084:33): [True: 0, False: 0]
  ------------------
 1085|      0|                                crypt_params.getKey("/Name").isName()) {
  ------------------
  |  Branch (1085:33): [True: 0, False: 0]
  ------------------
 1086|      0|                                QTC::TC("qpdf", "QPDF_encrypt crypt array");
 1087|      0|                                method = interpretCF(encp, crypt_params.getKey("/Name"));
 1088|      0|                                method_source = "stream's Crypt decode parameters (array)";
 1089|      0|                            }
 1090|      0|                        }
 1091|      0|                    }
 1092|      0|                }
 1093|      0|            }
 1094|      4|        }
 1095|       |
 1096|  1.58k|        if (method == e_unknown) {
  ------------------
  |  Branch (1096:13): [True: 1.58k, False: 0]
  ------------------
 1097|  1.58k|            if ((!encp->encrypt_metadata) && (type == "/Metadata")) {
  ------------------
  |  Branch (1097:17): [True: 0, False: 1.58k]
  |  Branch (1097:46): [True: 0, False: 0]
  ------------------
 1098|      0|                QTC::TC("qpdf", "QPDF_encryption cleartext metadata");
 1099|      0|                method = e_none;
 1100|  1.58k|            } else {
 1101|  1.58k|                method = encp->cf_stream;
 1102|  1.58k|            }
 1103|  1.58k|        }
 1104|  1.58k|        use_aes = false;
 1105|  1.58k|        switch (method) {
 1106|     84|        case e_none:
  ------------------
  |  Branch (1106:9): [True: 84, False: 1.50k]
  ------------------
 1107|     84|            return;
 1108|      0|            break;
 1109|       |
 1110|    959|        case e_aes:
  ------------------
  |  Branch (1110:9): [True: 959, False: 626]
  ------------------
 1111|    959|            use_aes = true;
 1112|    959|            break;
 1113|       |
 1114|    497|        case e_aesv3:
  ------------------
  |  Branch (1114:9): [True: 497, False: 1.08k]
  ------------------
 1115|    497|            use_aes = true;
 1116|    497|            break;
 1117|       |
 1118|      0|        case e_rc4:
  ------------------
  |  Branch (1118:9): [True: 0, False: 1.58k]
  ------------------
 1119|      0|            break;
 1120|       |
 1121|     45|        default:
  ------------------
  |  Branch (1121:9): [True: 45, False: 1.54k]
  ------------------
 1122|       |            // filter local to this stream.
 1123|     45|            qpdf_for_warning.warn(QPDFExc(
 1124|     45|                qpdf_e_damaged_pdf,
 1125|     45|                file->getName(),
 1126|     45|                "",
 1127|     45|                file->getLastOffset(),
 1128|     45|                "unknown encryption filter for streams (check " + method_source +
 1129|     45|                    "); streams may be decrypted improperly"));
 1130|       |            // To avoid repeated warnings, reset cf_stream.  Assume we'd want to use AES if V == 4.
 1131|     45|            encp->cf_stream = e_aes;
 1132|     45|            use_aes = true;
 1133|     45|            break;
 1134|  1.58k|        }
 1135|  1.58k|    }
 1136|  1.66k|    std::string key = getKeyForObject(encp, og, use_aes);
 1137|  1.66k|    if (use_aes) {
  ------------------
  |  Branch (1137:9): [True: 1.50k, False: 163]
  ------------------
 1138|  1.50k|        QTC::TC("qpdf", "QPDF_encryption aes decode stream");
 1139|  1.50k|        decrypt_pipeline = std::make_unique<Pl_AES_PDF>(
 1140|  1.50k|            "AES stream decryption",
 1141|  1.50k|            pipeline,
 1142|  1.50k|            false,
 1143|  1.50k|            QUtil::unsigned_char_pointer(key),
 1144|  1.50k|            key.length());
 1145|  1.50k|    } else {
 1146|    163|        QTC::TC("qpdf", "QPDF_encryption rc4 decode stream");
 1147|    163|        decrypt_pipeline = std::make_unique<Pl_RC4>(
 1148|    163|            "RC4 stream decryption",
 1149|    163|            pipeline,
 1150|    163|            QUtil::unsigned_char_pointer(key),
 1151|    163|            toI(key.length()));
 1152|    163|    }
 1153|  1.66k|    pipeline = decrypt_pipeline.get();
 1154|  1.66k|}
_ZN4QPDF32compute_encryption_parameters_V5EPKcS1_iiiibRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERS8_SB_SB_SB_SB_SB_:
 1195|  3.95k|{
 1196|  3.95k|    EncryptionData data(V, R, key_len, P, "", "", "", "", "", id1, encrypt_metadata);
 1197|  3.95k|    unsigned char k[key_bytes];
 1198|  3.95k|    QUtil::initializeWithRandomBytes(k, key_bytes);
 1199|  3.95k|    encryption_key = std::string(reinterpret_cast<char*>(k), key_bytes);
 1200|  3.95k|    compute_U_UE_value_V5(user_password, encryption_key, data, U, UE);
 1201|  3.95k|    compute_O_OE_value_V5(owner_password, encryption_key, data, U, O, OE);
 1202|  3.95k|    Perms = compute_Perms_value_V5(encryption_key, data);
 1203|  3.95k|    data.setV5EncryptionParameters(O, OE, U, UE, Perms);
 1204|  3.95k|}
QPDF_encryption.cc:_ZL27pad_or_truncate_password_V4RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE:
  164|  1.33k|{
  165|  1.33k|    char k1[key_bytes];
  166|  1.33k|    pad_or_truncate_password_V4(password, k1);
  167|  1.33k|    return {k1, key_bytes};
  168|  1.33k|}
QPDF_encryption.cc:_ZL27pad_or_truncate_password_V4RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPc:
  130|  1.33k|{
  131|  1.33k|    size_t password_bytes = std::min(QIntC::to_size(key_bytes), password.length());
  132|  1.33k|    size_t pad_bytes = key_bytes - password_bytes;
  133|  1.33k|    memcpy(k1, password.c_str(), password_bytes);
  134|  1.33k|    memcpy(k1 + password_bytes, padding_string, pad_bytes);
  135|  1.33k|}
QPDF_encryption.cc:_ZL18iterate_md5_digestR3MD5RA16_hii:
  178|    889|{
  179|    889|    md5.digest(digest);
  180|       |
  181|  45.3k|    for (int i = 0; i < iterations; ++i) {
  ------------------
  |  Branch (181:21): [True: 44.4k, False: 889]
  ------------------
  182|  44.4k|        MD5 m;
  183|  44.4k|        m.encodeDataIncrementally(reinterpret_cast<char*>(digest), QIntC::to_size(key_len));
  184|  44.4k|        m.digest(digest);
  185|  44.4k|    }
  186|    889|}
QPDF_encryption.cc:_ZL20truncate_password_V5RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE:
  172|    727|{
  173|    727|    return password.substr(0, std::min(static_cast<size_t>(127), password.length()));
  174|    727|}
QPDF_encryption.cc:_ZL23check_owner_password_V5RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKN4QPDF14EncryptionDataE:
  571|    292|{
  572|       |    // Algorithm 3.12 from the PDF 1.7 extension level 3
  573|       |
  574|    292|    std::string user_data = data.getU().substr(0, 48);
  575|    292|    std::string owner_data = data.getO().substr(0, 32);
  576|    292|    std::string validation_salt = data.getO().substr(32, 8);
  577|    292|    std::string password = truncate_password_V5(owner_password);
  578|    292|    return (hash_V5(password, validation_salt, user_data, data) == owner_data);
  579|    292|}
QPDF_encryption.cc:_ZL22check_user_password_V5RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKN4QPDF14EncryptionDataE:
  522|    292|{
  523|       |    // Algorithm 3.11 from the PDF 1.7 extension level 3
  524|       |
  525|    292|    std::string user_data = data.getU().substr(0, 32);
  526|    292|    std::string validation_salt = data.getU().substr(32, 8);
  527|    292|    std::string password = truncate_password_V5(user_password);
  528|    292|    return (hash_V5(password, validation_salt, "", data) == user_data);
  529|    292|}
QPDF_encryption.cc:_ZL7hash_V5RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES7_S7_RKN4QPDF14EncryptionDataE:
  245|  16.5k|{
  246|  16.5k|    Pl_SHA2 hash(256);
  247|  16.5k|    hash.writeString(password);
  248|  16.5k|    hash.writeString(salt);
  249|  16.5k|    hash.writeString(udata);
  250|  16.5k|    hash.finish();
  251|  16.5k|    std::string K = hash.getRawDigest();
  252|       |
  253|  16.5k|    std::string result;
  254|  16.5k|    if (data.getR() < 6) {
  ------------------
  |  Branch (254:9): [True: 0, False: 16.5k]
  ------------------
  255|      0|        result = K;
  256|  16.5k|    } else {
  257|       |        // Algorithm 2.B from ISO 32000-1 chapter 7: Computing a hash
  258|       |
  259|  16.5k|        int round_number = 0;
  260|  16.5k|        bool done = false;
  261|  1.16M|        while (!done) {
  ------------------
  |  Branch (261:16): [True: 1.15M, False: 16.5k]
  ------------------
  262|       |            // The hash algorithm has us setting K initially to the R5 value and then repeating a
  263|       |            // series of steps 64 times before starting with the termination case testing.  The
  264|       |            // wording of the specification is very unclear as to the exact number of times it
  265|       |            // should be run since the wording about whether the initial setup counts as round 0 or
  266|       |            // not is ambiguous.  This code counts the initial setup (R5) value as round 0, which
  267|       |            // appears to be correct.  This was determined to be correct by increasing or decreasing
  268|       |            // the number of rounds by 1 or 2 from this value and generating 20 test files.  In this
  269|       |            // interpretation, all the test files worked with Adobe Reader X.  In the other
  270|       |            // configurations, many of the files did not work, and we were accurately able to
  271|       |            // predict which files didn't work by looking at the conditions under which we
  272|       |            // terminated repetition.
  273|       |
  274|  1.15M|            ++round_number;
  275|  1.15M|            std::string K1 = password + K + udata;
  276|  1.15M|            qpdf_assert_debug(K.length() >= 32);
  ------------------
  |  |   16|  1.15M|# define qpdf_assert_debug assert
  ------------------
  277|  1.15M|            std::string E = process_with_aes(
  278|  1.15M|                K.substr(0, 16),
  279|  1.15M|                true,
  280|  1.15M|                K1,
  281|  1.15M|                0,
  282|  1.15M|                64,
  283|  1.15M|                QUtil::unsigned_char_pointer(K.substr(16, 16)),
  284|  1.15M|                16);
  285|       |
  286|       |            // E_mod_3 is supposed to be mod 3 of the first 16 bytes of E taken as as a (128-bit)
  287|       |            // big-endian number.  Since (xy mod n) is equal to ((x mod n) + (y mod n)) mod n and
  288|       |            // since 256 mod n is 1, we can just take the sums of the the mod 3s of each byte to get
  289|       |            // the same result.
  290|  1.15M|            int E_mod_3 = 0;
  291|  19.5M|            for (unsigned int i = 0; i < 16; ++i) {
  ------------------
  |  Branch (291:38): [True: 18.4M, False: 1.15M]
  ------------------
  292|  18.4M|                E_mod_3 += static_cast<unsigned char>(E.at(i));
  293|  18.4M|            }
  294|  1.15M|            E_mod_3 %= 3;
  295|  1.15M|            int next_hash = ((E_mod_3 == 0) ? 256 : (E_mod_3 == 1) ? 384 : 512);
  ------------------
  |  Branch (295:30): [True: 385k, False: 765k]
  |  Branch (295:53): [True: 378k, False: 386k]
  ------------------
  296|  1.15M|            Pl_SHA2 sha2(next_hash);
  297|  1.15M|            sha2.writeString(E);
  298|  1.15M|            sha2.finish();
  299|  1.15M|            K = sha2.getRawDigest();
  300|       |
  301|  1.15M|            if (round_number >= 64) {
  ------------------
  |  Branch (301:17): [True: 109k, False: 1.04M]
  ------------------
  302|   109k|                unsigned int ch = static_cast<unsigned char>(*(E.rbegin()));
  303|       |
  304|   109k|                if (ch <= QIntC::to_uint(round_number - 32)) {
  ------------------
  |  Branch (304:21): [True: 16.5k, False: 93.2k]
  ------------------
  305|  16.5k|                    done = true;
  306|  16.5k|                }
  307|   109k|            }
  308|  1.15M|        }
  309|  16.5k|        result = K.substr(0, 32);
  310|  16.5k|    }
  311|       |
  312|  16.5k|    return result;
  313|  16.5k|}
QPDF_encryption.cc:_ZL16process_with_aesRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEbS7_mjPKhm:
  218|  1.16M|{
  219|  1.16M|    Pl_Buffer buffer("buffer");
  220|  1.16M|    Pl_AES_PDF aes(
  221|  1.16M|        "aes", &buffer, encrypt, QUtil::unsigned_char_pointer(key), QIntC::to_uint(key.length()));
  222|  1.16M|    if (iv) {
  ------------------
  |  Branch (222:9): [True: 1.15M, False: 12.1k]
  ------------------
  223|  1.15M|        aes.setIV(iv, iv_length);
  224|  1.15M|    } else {
  225|  12.1k|        aes.useZeroIV();
  226|  12.1k|    }
  227|  1.16M|    aes.disablePadding();
  228|  74.8M|    for (unsigned int i = 0; i < repetitions; ++i) {
  ------------------
  |  Branch (228:30): [True: 73.6M, False: 1.16M]
  ------------------
  229|  73.6M|        aes.writeString(data);
  230|  73.6M|    }
  231|  1.16M|    aes.finish();
  232|  1.16M|    if (outlength == 0) {
  ------------------
  |  Branch (232:9): [True: 1.16M, False: 143]
  ------------------
  233|  1.16M|        return buffer.getString();
  234|  1.16M|    } else {
  235|    143|        return buffer.getString().substr(0, outlength);
  236|    143|    }
  237|  1.16M|}
QPDF_encryption.cc:_ZL19pad_short_parameterRNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEm:
  317|  1.87k|{
  318|  1.87k|    if (param.length() < max_len) {
  ------------------
  |  Branch (318:9): [True: 10, False: 1.86k]
  ------------------
  319|     10|        QTC::TC("qpdf", "QPDF_encryption pad short parameter");
  320|     10|        param.append(max_len - param.length(), '\0');
  321|     10|    }
  322|  1.87k|}
QPDF_encryption.cc:_ZL20check_owner_passwordRNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKS5_RKN4QPDF14EncryptionDataE:
  584|    374|{
  585|    374|    if (data.getV() < 5) {
  ------------------
  |  Branch (585:9): [True: 225, False: 149]
  ------------------
  586|    225|        return check_owner_password_V4(user_password, owner_password, data);
  587|    225|    } else {
  588|    149|        return check_owner_password_V5(owner_password, data);
  589|    149|    }
  590|    374|}
QPDF_encryption.cc:_ZL23check_owner_password_V4RNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKS5_RKN4QPDF14EncryptionDataE:
  544|    225|{
  545|       |    // Algorithm 3.7 from the PDF 1.7 Reference Manual
  546|       |
  547|    225|    unsigned char key[OU_key_bytes_V4];
  548|    225|    compute_O_rc4_key(user_password, owner_password, data, key);
  549|    225|    unsigned char O_data[key_bytes];
  550|    225|    memcpy(O_data, QUtil::unsigned_char_pointer(data.getO()), key_bytes);
  551|    225|    std::string k1(reinterpret_cast<char*>(key), OU_key_bytes_V4);
  552|    225|    pad_short_parameter(k1, QIntC::to_size(data.getLengthBytes()));
  553|    225|    iterate_rc4(
  554|    225|        O_data,
  555|    225|        key_bytes,
  556|    225|        QUtil::unsigned_char_pointer(k1),
  557|    225|        data.getLengthBytes(),
  558|    225|        (data.getR() >= 3) ? 20 : 1,
  ------------------
  |  Branch (558:9): [True: 225, False: 0]
  ------------------
  559|    225|        true);
  560|    225|    std::string new_user_password = std::string(reinterpret_cast<char*>(O_data), key_bytes);
  561|    225|    bool result = false;
  562|    225|    if (check_user_password(new_user_password, data)) {
  ------------------
  |  Branch (562:9): [True: 0, False: 225]
  ------------------
  563|      0|        result = true;
  564|      0|        user_password = new_user_password;
  565|      0|    }
  566|    225|    return result;
  567|    225|}
QPDF_encryption.cc:_ZL17compute_O_rc4_keyRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES7_RKN4QPDF14EncryptionDataEPh:
  411|    225|{
  412|    225|    if (data.getV() >= 5) {
  ------------------
  |  Branch (412:9): [True: 0, False: 225]
  ------------------
  413|      0|        throw std::logic_error("compute_O_rc4_key called for file with V >= 5");
  414|      0|    }
  415|    225|    std::string password = owner_password;
  416|    225|    if (password.empty()) {
  ------------------
  |  Branch (416:9): [True: 225, False: 0]
  ------------------
  417|    225|        password = user_password;
  418|    225|    }
  419|    225|    MD5 md5;
  420|    225|    md5.encodeDataIncrementally(pad_or_truncate_password_V4(password).c_str(), key_bytes);
  421|    225|    MD5::Digest digest;
  422|    225|    int key_len = std::min(QIntC::to_int(sizeof(digest)), data.getLengthBytes());
  423|    225|    iterate_md5_digest(md5, digest, ((data.getR() >= 3) ? 50 : 0), key_len);
  ------------------
  |  Branch (423:38): [True: 225, False: 0]
  ------------------
  424|    225|    memcpy(key, digest, OU_key_bytes_V4);
  425|    225|}
QPDF_encryption.cc:_ZL11iterate_rc4PhmS_iib:
  196|    675|{
  197|    675|    auto key_ph = std::make_unique<unsigned char[]>(QIntC::to_size(key_len));
  198|    675|    unsigned char* key = key_ph.get();
  199|  14.1k|    for (int i = 0; i < iterations; ++i) {
  ------------------
  |  Branch (199:21): [True: 13.5k, False: 675]
  ------------------
  200|  13.5k|        int const xor_value = (reverse ? iterations - 1 - i : i);
  ------------------
  |  Branch (200:32): [True: 4.50k, False: 9.00k]
  ------------------
  201|   229k|        for (int j = 0; j < key_len; ++j) {
  ------------------
  |  Branch (201:25): [True: 216k, False: 13.5k]
  ------------------
  202|   216k|            key[j] = static_cast<unsigned char>(okey[j] ^ xor_value);
  203|   216k|        }
  204|  13.5k|        RC4 rc4(key, QIntC::to_int(key_len));
  205|  13.5k|        rc4.process(data, data_len, data);
  206|  13.5k|    }
  207|    675|}
QPDF_encryption.cc:_ZL19check_user_passwordRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKN4QPDF14EncryptionDataE:
  533|    599|{
  534|    599|    if (data.getV() < 5) {
  ------------------
  |  Branch (534:9): [True: 450, False: 149]
  ------------------
  535|    450|        return check_user_password_V4(user_password, data);
  536|    450|    } else {
  537|    149|        return check_user_password_V5(user_password, data);
  538|    149|    }
  539|    599|}
QPDF_encryption.cc:_ZL22check_user_password_V4RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKN4QPDF14EncryptionDataE:
  512|    450|{
  513|       |    // Algorithm 3.6 from the PDF 1.7 Reference Manual
  514|       |
  515|    450|    std::string u_value = compute_U_value(user_password, data);
  516|    450|    size_t to_compare = ((data.getR() >= 3) ? sizeof(MD5::Digest) : key_bytes);
  ------------------
  |  Branch (516:26): [True: 450, False: 0]
  ------------------
  517|    450|    return (memcmp(data.getU().c_str(), u_value.c_str(), to_compare) == 0);
  518|    450|}
QPDF_encryption.cc:_ZL15compute_U_valueRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKN4QPDF14EncryptionDataE:
  502|    450|{
  503|    450|    if (data.getR() >= 3) {
  ------------------
  |  Branch (503:9): [True: 450, False: 0]
  ------------------
  504|    450|        return compute_U_value_R3(user_password, data);
  505|    450|    }
  506|       |
  507|      0|    return compute_U_value_R2(user_password, data);
  508|    450|}
QPDF_encryption.cc:_ZL18compute_U_value_R3RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKN4QPDF14EncryptionDataE:
  473|    450|{
  474|       |    // Algorithm 3.5 from the PDF 1.7 Reference Manual
  475|       |
  476|    450|    std::string k1 = QPDF::compute_encryption_key(user_password, data);
  477|    450|    MD5 md5;
  478|    450|    md5.encodeDataIncrementally(pad_or_truncate_password_V4("").c_str(), key_bytes);
  479|    450|    md5.encodeDataIncrementally(data.getId1().c_str(), data.getId1().length());
  480|    450|    MD5::Digest digest;
  481|    450|    md5.digest(digest);
  482|    450|    pad_short_parameter(k1, QIntC::to_size(data.getLengthBytes()));
  483|    450|    iterate_rc4(
  484|    450|        digest,
  485|    450|        sizeof(MD5::Digest),
  486|    450|        QUtil::unsigned_char_pointer(k1),
  487|    450|        data.getLengthBytes(),
  488|    450|        20,
  489|    450|        false);
  490|    450|    char result[key_bytes];
  491|    450|    memcpy(result, digest, sizeof(MD5::Digest));
  492|       |    // pad with arbitrary data -- make it consistent for the sake of
  493|       |    // testing
  494|  7.65k|    for (unsigned int i = sizeof(MD5::Digest); i < key_bytes; ++i) {
  ------------------
  |  Branch (494:48): [True: 7.20k, False: 450]
  ------------------
  495|  7.20k|        result[i] = static_cast<char>((i * i) % 0xff);
  496|  7.20k|    }
  497|    450|    return {result, key_bytes};
  498|    450|}
QPDF_encryption.cc:_ZL21compute_U_UE_value_V5RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES7_RKN4QPDF14EncryptionDataERS5_SC_:
  607|  3.95k|{
  608|       |    // Algorithm 3.8 from the PDF 1.7 extension level 3
  609|  3.95k|    char k[16];
  610|  3.95k|    QUtil::initializeWithRandomBytes(reinterpret_cast<unsigned char*>(k), sizeof(k));
  611|  3.95k|    std::string validation_salt(k, 8);
  612|  3.95k|    std::string key_salt(k + 8, 8);
  613|  3.95k|    U = hash_V5(user_password, validation_salt, "", data) + validation_salt + key_salt;
  614|  3.95k|    std::string intermediate_key = hash_V5(user_password, key_salt, "", data);
  615|  3.95k|    UE = process_with_aes(intermediate_key, true, encryption_key);
  616|  3.95k|}
QPDF_encryption.cc:_ZL21compute_O_OE_value_V5RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES7_RKN4QPDF14EncryptionDataES7_RS5_SC_:
  626|  3.95k|{
  627|       |    // Algorithm 3.9 from the PDF 1.7 extension level 3
  628|  3.95k|    char k[16];
  629|  3.95k|    QUtil::initializeWithRandomBytes(reinterpret_cast<unsigned char*>(k), sizeof(k));
  630|  3.95k|    std::string validation_salt(k, 8);
  631|  3.95k|    std::string key_salt(k + 8, 8);
  632|  3.95k|    O = hash_V5(owner_password, validation_salt, U, data) + validation_salt + key_salt;
  633|  3.95k|    std::string intermediate_key = hash_V5(owner_password, key_salt, U, data);
  634|  3.95k|    OE = process_with_aes(intermediate_key, true, encryption_key);
  635|  3.95k|}
QPDF_encryption.cc:_ZL22compute_Perms_value_V5RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKN4QPDF14EncryptionDataE:
  657|  3.95k|{
  658|       |    // Algorithm 3.10 from the PDF 1.7 extension level 3
  659|  3.95k|    unsigned char k[16];
  660|  3.95k|    compute_Perms_value_V5_clear(encryption_key, data, k);
  661|  3.95k|    return process_with_aes(
  662|  3.95k|        encryption_key, true, std::string(reinterpret_cast<char*>(k), sizeof(k)));
  663|  3.95k|}

_ZN4QPDF21getUncompressedObjectER16QPDFObjectHandleRKN10QPDFWriter8ObjTableE:
  591|  29.5k|{
  592|  29.5k|    if (obj.contains(oh)) {
  ------------------
  |  Branch (592:9): [True: 29.3k, False: 183]
  ------------------
  593|  29.3k|        if (auto id = obj[oh].object_stream; id > 0) {
  ------------------
  |  Branch (593:46): [True: 20, False: 29.3k]
  ------------------
  594|     20|            return oh.isNull() ? oh : getObject(id, 0);
  ------------------
  |  Branch (594:20): [True: 0, False: 20]
  ------------------
  595|     20|        }
  596|  29.3k|    }
  597|  29.5k|    return oh;
  598|  29.5k|}
_ZN4QPDF18getLinearizedPartsERKN10QPDFWriter8ObjTableERNSt3__16vectorI16QPDFObjectHandleNS4_9allocatorIS6_EEEESA_SA_SA_SA_:
 1456|  3.62k|{
 1457|  3.62k|    calculateLinearizationData(obj);
 1458|  3.62k|    part4 = m->part4;
 1459|  3.62k|    part6 = m->part6;
 1460|  3.62k|    part7 = m->part7;
 1461|  3.62k|    part8 = m->part8;
 1462|  3.62k|    part9 = m->part9;
 1463|  3.62k|}
_ZN4QPDF17outputLengthNextNEiiRKN10QPDFWriter11NewObjTableERKNS0_8ObjTableE:
 1474|  49.8k|{
 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|  49.8k|    int first = obj[in_object].renumber;
 1479|  49.8k|    int last = first + n;
 1480|  49.8k|    if (first <= 0) {
  ------------------
  |  Branch (1480:9): [True: 0, False: 49.8k]
  ------------------
 1481|      0|        stopOnError("found object that is not renumbered while writing linearization data");
 1482|      0|    }
 1483|  49.8k|    qpdf_offset_t length = 0;
 1484|   159k|    for (int i = first; i < last; ++i) {
  ------------------
  |  Branch (1484:25): [True: 110k, False: 49.8k]
  ------------------
 1485|   110k|        auto l = new_obj[i].length;
 1486|   110k|        if (l == 0) {
  ------------------
  |  Branch (1486:13): [True: 0, False: 110k]
  ------------------
 1487|      0|            stopOnError("found item with unknown length while writing linearization data");
 1488|      0|        }
 1489|   110k|        length += l;
 1490|   110k|    }
 1491|  49.8k|    return toI(length);
 1492|  49.8k|}
_ZN4QPDF20calculateHPageOffsetERKN10QPDFWriter11NewObjTableERKNS0_8ObjTableE:
 1496|  2.92k|{
 1497|       |    // Page Offset Hint Table
 1498|       |
 1499|       |    // We are purposely leaving some values set to their initial zero values.
 1500|       |
 1501|  2.92k|    std::vector<QPDFObjectHandle> const& pages = getAllPages();
 1502|  2.92k|    size_t npages = pages.size();
 1503|  2.92k|    CHPageOffset& cph = m->c_page_offset_data;
 1504|  2.92k|    std::vector<CHPageOffsetEntry>& cphe = cph.entries;
 1505|       |
 1506|       |    // Calculate minimum and maximum values for number of objects per page and page length.
 1507|       |
 1508|  2.92k|    int min_nobjects = cphe.at(0).nobjects;
 1509|  2.92k|    int max_nobjects = min_nobjects;
 1510|  2.92k|    int min_length = outputLengthNextN(pages.at(0).getObjectID(), min_nobjects, new_obj, obj);
 1511|  2.92k|    int max_length = min_length;
 1512|  2.92k|    int max_shared = cphe.at(0).nshared_objects;
 1513|       |
 1514|  2.92k|    HPageOffset& ph = m->page_offset_hints;
 1515|  2.92k|    std::vector<HPageOffsetEntry>& phe = ph.entries;
 1516|       |    // npages is the size of the existing pages array.
 1517|  2.92k|    phe = std::vector<HPageOffsetEntry>(npages);
 1518|       |
 1519|  15.8k|    for (unsigned int i = 0; i < npages; ++i) {
  ------------------
  |  Branch (1519:30): [True: 12.9k, False: 2.92k]
  ------------------
 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|  12.9k|        int nobjects = cphe.at(i).nobjects;
 1527|  12.9k|        int length = outputLengthNextN(pages.at(i).getObjectID(), nobjects, new_obj, obj);
 1528|  12.9k|        int nshared = cphe.at(i).nshared_objects;
 1529|       |
 1530|  12.9k|        min_nobjects = std::min(min_nobjects, nobjects);
 1531|  12.9k|        max_nobjects = std::max(max_nobjects, nobjects);
 1532|  12.9k|        min_length = std::min(min_length, length);
 1533|  12.9k|        max_length = std::max(max_length, length);
 1534|  12.9k|        max_shared = std::max(max_shared, nshared);
 1535|       |
 1536|  12.9k|        phe.at(i).delta_nobjects = nobjects;
 1537|  12.9k|        phe.at(i).delta_page_length = length;
 1538|  12.9k|        phe.at(i).nshared_objects = nshared;
 1539|  12.9k|    }
 1540|       |
 1541|  2.92k|    ph.min_nobjects = min_nobjects;
 1542|  2.92k|    ph.first_page_offset = new_obj[obj[pages.at(0)].renumber].xref.getOffset();
 1543|  2.92k|    ph.nbits_delta_nobjects = nbits(max_nobjects - min_nobjects);
 1544|  2.92k|    ph.min_page_length = min_length;
 1545|  2.92k|    ph.nbits_delta_page_length = nbits(max_length - min_length);
 1546|  2.92k|    ph.nbits_nshared_objects = nbits(max_shared);
 1547|  2.92k|    ph.nbits_shared_identifier = nbits(m->c_shared_object_data.nshared_total);
 1548|  2.92k|    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|  2.92k|    ph.nbits_delta_content_length = ph.nbits_delta_page_length;
 1555|  2.92k|    ph.min_content_length = ph.min_page_length;
 1556|       |
 1557|  15.8k|    for (size_t i = 0; i < npages; ++i) {
  ------------------
  |  Branch (1557:24): [True: 12.9k, False: 2.92k]
  ------------------
 1558|       |        // Adjust delta entries
 1559|  12.9k|        if ((phe.at(i).delta_nobjects < min_nobjects) ||
  ------------------
  |  Branch (1559:13): [True: 0, False: 12.9k]
  ------------------
 1560|  12.9k|            (phe.at(i).delta_page_length < min_length)) {
  ------------------
  |  Branch (1560:13): [True: 0, False: 12.9k]
  ------------------
 1561|      0|            stopOnError("found too small delta nobjects or delta page length while writing "
 1562|      0|                        "linearization data");
 1563|      0|        }
 1564|  12.9k|        phe.at(i).delta_nobjects -= min_nobjects;
 1565|  12.9k|        phe.at(i).delta_page_length -= min_length;
 1566|  12.9k|        phe.at(i).delta_content_length = phe.at(i).delta_page_length;
 1567|       |
 1568|  62.9k|        for (size_t j = 0; j < toS(cphe.at(i).nshared_objects); ++j) {
  ------------------
  |  Branch (1568:28): [True: 50.0k, False: 12.9k]
  ------------------
 1569|  50.0k|            phe.at(i).shared_identifiers.push_back(cphe.at(i).shared_identifiers.at(j));
 1570|  50.0k|            phe.at(i).shared_numerators.push_back(0);
 1571|  50.0k|        }
 1572|  12.9k|    }
 1573|  2.92k|}
_ZN4QPDF22calculateHSharedObjectERKN10QPDFWriter11NewObjTableERKNS0_8ObjTableE:
 1578|  2.92k|{
 1579|  2.92k|    CHSharedObject& cso = m->c_shared_object_data;
 1580|  2.92k|    std::vector<CHSharedObjectEntry>& csoe = cso.entries;
 1581|  2.92k|    HSharedObject& so = m->shared_object_hints;
 1582|  2.92k|    std::vector<HSharedObjectEntry>& soe = so.entries;
 1583|  2.92k|    soe.clear();
 1584|       |
 1585|  2.92k|    int min_length = outputLengthNextN(csoe.at(0).object, 1, new_obj, obj);
 1586|  2.92k|    int max_length = min_length;
 1587|       |
 1588|  33.5k|    for (size_t i = 0; i < toS(cso.nshared_total); ++i) {
  ------------------
  |  Branch (1588:24): [True: 30.6k, False: 2.92k]
  ------------------
 1589|       |        // Assign absolute numbers to deltas; adjust later
 1590|  30.6k|        int length = outputLengthNextN(csoe.at(i).object, 1, new_obj, obj);
 1591|  30.6k|        min_length = std::min(min_length, length);
 1592|  30.6k|        max_length = std::max(max_length, length);
 1593|  30.6k|        soe.emplace_back();
 1594|  30.6k|        soe.at(i).delta_group_length = length;
 1595|  30.6k|    }
 1596|  2.92k|    if (soe.size() != toS(cso.nshared_total)) {
  ------------------
  |  Branch (1596:9): [True: 0, False: 2.92k]
  ------------------
 1597|      0|        stopOnError("soe has wrong size after initialization");
 1598|      0|    }
 1599|       |
 1600|  2.92k|    so.nshared_total = cso.nshared_total;
 1601|  2.92k|    so.nshared_first_page = cso.nshared_first_page;
 1602|  2.92k|    if (so.nshared_total > so.nshared_first_page) {
  ------------------
  |  Branch (1602:9): [True: 292, False: 2.62k]
  ------------------
 1603|    292|        so.first_shared_obj = obj[cso.first_shared_obj].renumber;
 1604|    292|        so.min_group_length = min_length;
 1605|    292|        so.first_shared_offset = new_obj[so.first_shared_obj].xref.getOffset();
 1606|    292|    }
 1607|  2.92k|    so.min_group_length = min_length;
 1608|  2.92k|    so.nbits_delta_group_length = nbits(max_length - min_length);
 1609|       |
 1610|  33.5k|    for (size_t i = 0; i < toS(cso.nshared_total); ++i) {
  ------------------
  |  Branch (1610:24): [True: 30.6k, False: 2.92k]
  ------------------
 1611|       |        // Adjust deltas
 1612|  30.6k|        if (soe.at(i).delta_group_length < min_length) {
  ------------------
  |  Branch (1612:13): [True: 0, False: 30.6k]
  ------------------
 1613|      0|            stopOnError("found too small group length while writing linearization data");
 1614|      0|        }
 1615|  30.6k|        soe.at(i).delta_group_length -= min_length;
 1616|  30.6k|    }
 1617|  2.92k|}
_ZN4QPDF17calculateHOutlineERKN10QPDFWriter11NewObjTableERKNS0_8ObjTableE:
 1621|  2.92k|{
 1622|  2.92k|    HGeneric& cho = m->c_outline_data;
 1623|       |
 1624|  2.92k|    if (cho.nobjects == 0) {
  ------------------
  |  Branch (1624:9): [True: 2.45k, False: 471]
  ------------------
 1625|  2.45k|        return;
 1626|  2.45k|    }
 1627|       |
 1628|    471|    HGeneric& ho = m->outline_hints;
 1629|       |
 1630|    471|    ho.first_object = obj[cho.first_object].renumber;
 1631|    471|    ho.first_object_offset = new_obj[ho.first_object].xref.getOffset();
 1632|    471|    ho.nobjects = cho.nobjects;
 1633|    471|    ho.group_length = outputLengthNextN(cho.first_object, ho.nobjects, new_obj, obj);
 1634|    471|}
_ZN4QPDF16writeHPageOffsetER9BitWriter:
 1672|  2.92k|{
 1673|  2.92k|    HPageOffset& t = m->page_offset_hints;
 1674|       |
 1675|  2.92k|    w.writeBitsInt(t.min_nobjects, 32);               // 1
 1676|  2.92k|    w.writeBits(toULL(t.first_page_offset), 32);      // 2
 1677|  2.92k|    w.writeBitsInt(t.nbits_delta_nobjects, 16);       // 3
 1678|  2.92k|    w.writeBitsInt(t.min_page_length, 32);            // 4
 1679|  2.92k|    w.writeBitsInt(t.nbits_delta_page_length, 16);    // 5
 1680|  2.92k|    w.writeBits(toULL(t.min_content_offset), 32);     // 6
 1681|  2.92k|    w.writeBitsInt(t.nbits_delta_content_offset, 16); // 7
 1682|  2.92k|    w.writeBitsInt(t.min_content_length, 32);         // 8
 1683|  2.92k|    w.writeBitsInt(t.nbits_delta_content_length, 16); // 9
 1684|  2.92k|    w.writeBitsInt(t.nbits_nshared_objects, 16);      // 10
 1685|  2.92k|    w.writeBitsInt(t.nbits_shared_identifier, 16);    // 11
 1686|  2.92k|    w.writeBitsInt(t.nbits_shared_numerator, 16);     // 12
 1687|  2.92k|    w.writeBitsInt(t.shared_denominator, 16);         // 13
 1688|       |
 1689|  2.92k|    int nitems = toI(getAllPages().size());
 1690|  2.92k|    std::vector<HPageOffsetEntry>& entries = t.entries;
 1691|       |
 1692|  2.92k|    write_vector_int(w, nitems, entries, t.nbits_delta_nobjects, &HPageOffsetEntry::delta_nobjects);
 1693|  2.92k|    write_vector_int(
 1694|  2.92k|        w, nitems, entries, t.nbits_delta_page_length, &HPageOffsetEntry::delta_page_length);
 1695|  2.92k|    write_vector_int(
 1696|  2.92k|        w, nitems, entries, t.nbits_nshared_objects, &HPageOffsetEntry::nshared_objects);
 1697|  2.92k|    write_vector_vector(
 1698|  2.92k|        w,
 1699|  2.92k|        nitems,
 1700|  2.92k|        entries,
 1701|  2.92k|        &HPageOffsetEntry::nshared_objects,
 1702|  2.92k|        t.nbits_shared_identifier,
 1703|  2.92k|        &HPageOffsetEntry::shared_identifiers);
 1704|  2.92k|    write_vector_vector(
 1705|  2.92k|        w,
 1706|  2.92k|        nitems,
 1707|  2.92k|        entries,
 1708|  2.92k|        &HPageOffsetEntry::nshared_objects,
 1709|  2.92k|        t.nbits_shared_numerator,
 1710|  2.92k|        &HPageOffsetEntry::shared_numerators);
 1711|  2.92k|    write_vector_int(
 1712|  2.92k|        w, nitems, entries, t.nbits_delta_content_offset, &HPageOffsetEntry::delta_content_offset);
 1713|  2.92k|    write_vector_int(
 1714|  2.92k|        w, nitems, entries, t.nbits_delta_content_length, &HPageOffsetEntry::delta_content_length);
 1715|  2.92k|}
_ZN4QPDF18writeHSharedObjectER9BitWriter:
 1719|  2.92k|{
 1720|  2.92k|    HSharedObject& t = m->shared_object_hints;
 1721|       |
 1722|  2.92k|    w.writeBitsInt(t.first_shared_obj, 32);         // 1
 1723|  2.92k|    w.writeBits(toULL(t.first_shared_offset), 32);  // 2
 1724|  2.92k|    w.writeBitsInt(t.nshared_first_page, 32);       // 3
 1725|  2.92k|    w.writeBitsInt(t.nshared_total, 32);            // 4
 1726|  2.92k|    w.writeBitsInt(t.nbits_nobjects, 16);           // 5
 1727|  2.92k|    w.writeBitsInt(t.min_group_length, 32);         // 6
 1728|  2.92k|    w.writeBitsInt(t.nbits_delta_group_length, 16); // 7
 1729|       |
 1730|  2.92k|    QTC::TC(
 1731|  2.92k|        "qpdf",
 1732|  2.92k|        "QPDF lin write nshared_total > nshared_first_page",
 1733|  2.92k|        (t.nshared_total > t.nshared_first_page) ? 1 : 0);
  ------------------
  |  Branch (1733:9): [True: 292, False: 2.62k]
  ------------------
 1734|       |
 1735|  2.92k|    int nitems = t.nshared_total;
 1736|  2.92k|    std::vector<HSharedObjectEntry>& entries = t.entries;
 1737|       |
 1738|  2.92k|    write_vector_int(
 1739|  2.92k|        w, nitems, entries, t.nbits_delta_group_length, &HSharedObjectEntry::delta_group_length);
 1740|  2.92k|    write_vector_int(w, nitems, entries, 1, &HSharedObjectEntry::signature_present);
 1741|  33.5k|    for (size_t i = 0; i < toS(nitems); ++i) {
  ------------------
  |  Branch (1741:24): [True: 30.6k, False: 2.92k]
  ------------------
 1742|       |        // If signature were present, we'd have to write a 128-bit hash.
 1743|  30.6k|        if (entries.at(i).signature_present != 0) {
  ------------------
  |  Branch (1743:13): [True: 0, False: 30.6k]
  ------------------
 1744|      0|            stopOnError("found unexpected signature present"
 1745|      0|                        " while writing linearization data");
 1746|      0|        }
 1747|  30.6k|    }
 1748|  2.92k|    write_vector_int(w, nitems, entries, t.nbits_nobjects, &HSharedObjectEntry::nobjects_minus_one);
 1749|  2.92k|}
_ZN4QPDF13writeHGenericER9BitWriterRNS_8HGenericE:
 1753|    471|{
 1754|    471|    w.writeBitsInt(t.first_object, 32);            // 1
 1755|    471|    w.writeBits(toULL(t.first_object_offset), 32); // 2
 1756|    471|    w.writeBitsInt(t.nobjects, 32);                // 3
 1757|    471|    w.writeBitsInt(t.group_length, 32);            // 4
 1758|    471|}
_ZN4QPDF18generateHintStreamERKN10QPDFWriter11NewObjTableERKNS0_8ObjTableERNSt3__110shared_ptrI6BufferEERiSC_b:
 1768|  2.92k|{
 1769|       |    // Populate actual hint table values
 1770|  2.92k|    calculateHPageOffset(new_obj, obj);
 1771|  2.92k|    calculateHSharedObject(new_obj, obj);
 1772|  2.92k|    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|  2.92k|    Pl_Buffer hint_stream("hint stream");
 1777|  2.92k|    Pipeline* next = &hint_stream;
 1778|  2.92k|    std::shared_ptr<Pipeline> flate;
 1779|  2.92k|    if (compressed) {
  ------------------
  |  Branch (1779:9): [True: 2.92k, False: 0]
  ------------------
 1780|  2.92k|        flate =
 1781|  2.92k|            std::make_shared<Pl_Flate>("compress hint stream", &hint_stream, Pl_Flate::a_deflate);
 1782|  2.92k|        next = flate.get();
 1783|  2.92k|    }
 1784|  2.92k|    Pl_Count c("count", next);
 1785|  2.92k|    BitWriter w(&c);
 1786|       |
 1787|  2.92k|    writeHPageOffset(w);
 1788|  2.92k|    S = toI(c.getCount());
 1789|  2.92k|    writeHSharedObject(w);
 1790|  2.92k|    O = 0;
 1791|  2.92k|    if (m->outline_hints.nobjects > 0) {
  ------------------
  |  Branch (1791:9): [True: 471, False: 2.45k]
  ------------------
 1792|    471|        O = toI(c.getCount());
 1793|    471|        writeHGeneric(w, m->outline_hints);
 1794|    471|    }
 1795|  2.92k|    c.finish();
 1796|       |
 1797|  2.92k|    hint_buffer = hint_stream.getBufferSharedPointer();
 1798|  2.92k|}
QPDF_linearization.cc:_ZL5nbitsi:
 1467|  62.8k|{
 1468|  62.8k|    return (val == 0 ? 0 : (1 + nbits(val >> 1)));
  ------------------
  |  Branch (1468:13): [True: 14.6k, False: 48.2k]
  ------------------
 1469|  62.8k|}
_ZN4QPDF26calculateLinearizationDataIN10QPDFWriter8ObjTableEEEvRKT_:
  977|  3.62k|{
  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|  3.62k|    if (m->object_to_obj_users.empty()) {
  ------------------
  |  Branch (983:9): [True: 0, False: 3.62k]
  ------------------
  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|  3.62k|    m->part4.clear();
 1034|  3.62k|    m->part6.clear();
 1035|  3.62k|    m->part7.clear();
 1036|  3.62k|    m->part8.clear();
 1037|  3.62k|    m->part9.clear();
 1038|  3.62k|    m->c_linp = LinParameters();
 1039|  3.62k|    m->c_page_offset_data = CHPageOffset();
 1040|  3.62k|    m->c_shared_object_data = CHSharedObject();
 1041|  3.62k|    m->c_outline_data = HGeneric();
 1042|       |
 1043|  3.62k|    QPDFObjectHandle root = getRoot();
 1044|  3.62k|    bool outlines_in_first_page = false;
 1045|  3.62k|    QPDFObjectHandle pagemode = root.getKey("/PageMode");
 1046|  3.62k|    QTC::TC("qpdf", "QPDF categorize pagemode present", pagemode.isName() ? 1 : 0);
  ------------------
  |  Branch (1046:57): [True: 682, False: 2.94k]
  ------------------
 1047|  3.62k|    if (pagemode.isName()) {
  ------------------
  |  Branch (1047:9): [True: 682, False: 2.94k]
  ------------------
 1048|    682|        if (pagemode.getName() == "/UseOutlines") {
  ------------------
  |  Branch (1048:13): [True: 518, False: 164]
  ------------------
 1049|    518|            if (root.hasKey("/Outlines")) {
  ------------------
  |  Branch (1049:17): [True: 375, False: 143]
  ------------------
 1050|    375|                outlines_in_first_page = true;
 1051|    375|            } else {
 1052|    143|                QTC::TC("qpdf", "QPDF UseOutlines but no Outlines");
 1053|    143|            }
 1054|    518|        }
 1055|    682|        QTC::TC("qpdf", "QPDF categorize pagemode outlines", outlines_in_first_page ? 1 : 0);
  ------------------
  |  Branch (1055:62): [True: 375, False: 307]
  ------------------
 1056|    682|    }
 1057|       |
 1058|  3.62k|    std::set<std::string> open_document_keys;
 1059|  3.62k|    open_document_keys.insert("/ViewerPreferences");
 1060|  3.62k|    open_document_keys.insert("/PageMode");
 1061|  3.62k|    open_document_keys.insert("/Threads");
 1062|  3.62k|    open_document_keys.insert("/OpenAction");
 1063|  3.62k|    open_document_keys.insert("/AcroForm");
 1064|       |
 1065|  3.62k|    std::set<QPDFObjGen> lc_open_document;
 1066|  3.62k|    std::set<QPDFObjGen> lc_first_page_private;
 1067|  3.62k|    std::set<QPDFObjGen> lc_first_page_shared;
 1068|  3.62k|    std::set<QPDFObjGen> lc_other_page_private;
 1069|  3.62k|    std::set<QPDFObjGen> lc_other_page_shared;
 1070|  3.62k|    std::set<QPDFObjGen> lc_thumbnail_private;
 1071|  3.62k|    std::set<QPDFObjGen> lc_thumbnail_shared;
 1072|  3.62k|    std::set<QPDFObjGen> lc_other;
 1073|  3.62k|    std::set<QPDFObjGen> lc_outlines;
 1074|  3.62k|    std::set<QPDFObjGen> lc_root;
 1075|       |
 1076|  91.5k|    for (auto& oiter: m->object_to_obj_users) {
  ------------------
  |  Branch (1076:21): [True: 91.5k, False: 3.62k]
  ------------------
 1077|  91.5k|        QPDFObjGen const& og = oiter.first;
 1078|  91.5k|        std::set<ObjUser>& ous = oiter.second;
 1079|       |
 1080|  91.5k|        bool in_open_document = false;
 1081|  91.5k|        bool in_first_page = false;
 1082|  91.5k|        int other_pages = 0;
 1083|  91.5k|        int thumbs = 0;
 1084|  91.5k|        int others = 0;
 1085|  91.5k|        bool in_outlines = false;
 1086|  91.5k|        bool is_root = false;
 1087|       |
 1088|   374k|        for (auto const& ou: ous) {
  ------------------
  |  Branch (1088:28): [True: 374k, False: 91.5k]
  ------------------
 1089|   374k|            switch (ou.ou_type) {
  ------------------
  |  Branch (1089:21): [True: 0, False: 374k]
  ------------------
 1090|   180k|            case ObjUser::ou_trailer_key:
  ------------------
  |  Branch (1090:13): [True: 180k, False: 193k]
  ------------------
 1091|   180k|                if (ou.key == "/Encrypt") {
  ------------------
  |  Branch (1091:21): [True: 170, False: 180k]
  ------------------
 1092|    170|                    in_open_document = true;
 1093|   180k|                } else {
 1094|   180k|                    ++others;
 1095|   180k|                }
 1096|   180k|                break;
 1097|       |
 1098|  9.30k|            case ObjUser::ou_thumb:
  ------------------
  |  Branch (1098:13): [True: 9.30k, False: 364k]
  ------------------
 1099|  9.30k|                ++thumbs;
 1100|  9.30k|                break;
 1101|       |
 1102|  46.4k|            case ObjUser::ou_root_key:
  ------------------
  |  Branch (1102:13): [True: 46.4k, False: 327k]
  ------------------
 1103|  46.4k|                if (open_document_keys.count(ou.key) > 0) {
  ------------------
  |  Branch (1103:21): [True: 15.2k, False: 31.1k]
  ------------------
 1104|  15.2k|                    in_open_document = true;
 1105|  31.1k|                } else if (ou.key == "/Outlines") {
  ------------------
  |  Branch (1105:28): [True: 4.54k, False: 26.6k]
  ------------------
 1106|  4.54k|                    in_outlines = true;
 1107|  26.6k|                } else {
 1108|  26.6k|                    ++others;
 1109|  26.6k|                }
 1110|  46.4k|                break;
 1111|       |
 1112|   134k|            case ObjUser::ou_page:
  ------------------
  |  Branch (1112:13): [True: 134k, False: 239k]
  ------------------
 1113|   134k|                if (ou.pageno == 0) {
  ------------------
  |  Branch (1113:21): [True: 41.0k, False: 93.2k]
  ------------------
 1114|  41.0k|                    in_first_page = true;
 1115|  93.2k|                } else {
 1116|  93.2k|                    ++other_pages;
 1117|  93.2k|                }
 1118|   134k|                break;
 1119|       |
 1120|  3.62k|            case ObjUser::ou_root:
  ------------------
  |  Branch (1120:13): [True: 3.62k, False: 370k]
  ------------------
 1121|  3.62k|                is_root = true;
 1122|  3.62k|                break;
 1123|       |
 1124|      0|            case ObjUser::ou_bad:
  ------------------
  |  Branch (1124:13): [True: 0, False: 374k]
  ------------------
 1125|      0|                stopOnError("INTERNAL ERROR: QPDF::calculateLinearizationData: "
 1126|      0|                            "invalid user type");
 1127|      0|                break;
 1128|   374k|            }
 1129|   374k|        }
 1130|       |
 1131|  91.5k|        if (is_root) {
  ------------------
  |  Branch (1131:13): [True: 3.62k, False: 87.9k]
  ------------------
 1132|  3.62k|            lc_root.insert(og);
 1133|  87.9k|        } else if (in_outlines) {
  ------------------
  |  Branch (1133:20): [True: 4.51k, False: 83.4k]
  ------------------
 1134|  4.51k|            lc_outlines.insert(og);
 1135|  83.4k|        } else if (in_open_document) {
  ------------------
  |  Branch (1135:20): [True: 15.3k, False: 68.0k]
  ------------------
 1136|  15.3k|            lc_open_document.insert(og);
 1137|  68.0k|        } else if ((in_first_page) && (others == 0) && (other_pages == 0) && (thumbs == 0)) {
  ------------------
  |  Branch (1137:20): [True: 25.1k, False: 42.9k]
  |  Branch (1137:39): [True: 17.1k, False: 8.04k]
  |  Branch (1137:56): [True: 15.2k, False: 1.82k]
  |  Branch (1137:78): [True: 15.2k, False: 33]
  ------------------
 1138|  15.2k|            lc_first_page_private.insert(og);
 1139|  52.8k|        } else if (in_first_page) {
  ------------------
  |  Branch (1139:20): [True: 9.90k, False: 42.9k]
  ------------------
 1140|  9.90k|            lc_first_page_shared.insert(og);
 1141|  42.9k|        } else if ((other_pages == 1) && (others == 0) && (thumbs == 0)) {
  ------------------
  |  Branch (1141:20): [True: 25.1k, False: 17.7k]
  |  Branch (1141:42): [True: 23.9k, False: 1.24k]
  |  Branch (1141:59): [True: 23.6k, False: 313]
  ------------------
 1142|  23.6k|            lc_other_page_private.insert(og);
 1143|  23.6k|        } else if (other_pages > 1) {
  ------------------
  |  Branch (1143:20): [True: 5.83k, False: 13.5k]
  ------------------
 1144|  5.83k|            lc_other_page_shared.insert(og);
 1145|  13.5k|        } else if ((thumbs == 1) && (others == 0)) {
  ------------------
  |  Branch (1145:20): [True: 2.08k, False: 11.4k]
  |  Branch (1145:37): [True: 2.06k, False: 16]
  ------------------
 1146|  2.06k|            lc_thumbnail_private.insert(og);
 1147|  11.4k|        } else if (thumbs > 1) {
  ------------------
  |  Branch (1147:20): [True: 830, False: 10.6k]
  ------------------
 1148|    830|            lc_thumbnail_shared.insert(og);
 1149|  10.6k|        } else {
 1150|  10.6k|            lc_other.insert(og);
 1151|  10.6k|        }
 1152|  91.5k|    }
 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|  3.62k|    std::vector<QPDFObjectHandle> pages;
 1166|  3.62k|    { // 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|  15.2k|        for (auto oh: getAllPages()) {
  ------------------
  |  Branch (1169:21): [True: 15.2k, False: 3.62k]
  ------------------
 1170|  15.2k|            pages.push_back(getUncompressedObject(oh, object_stream_data));
 1171|  15.2k|        }
 1172|  3.62k|    }
 1173|  3.62k|    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|  3.62k|    m->c_linp.npages = npages;
 1184|  3.62k|    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|  3.62k|    if (lc_root.size() != 1) {
  ------------------
  |  Branch (1188:9): [True: 0, False: 3.62k]
  ------------------
 1189|      0|        stopOnError("found other than one root while"
 1190|      0|                    " calculating linearization data");
 1191|      0|    }
 1192|  3.62k|    m->part4.push_back(getObject(*(lc_root.begin())));
 1193|  15.3k|    for (auto const& og: lc_open_document) {
  ------------------
  |  Branch (1193:24): [True: 15.3k, False: 3.62k]
  ------------------
 1194|  15.3k|        m->part4.push_back(getObject(og));
 1195|  15.3k|    }
 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|  3.62k|    if (pages.empty()) {
  ------------------
  |  Branch (1202:9): [True: 20, False: 3.60k]
  ------------------
 1203|     20|        stopOnError("no pages found while calculating linearization data");
 1204|     20|    }
 1205|  3.62k|    QPDFObjGen first_page_og(pages.at(0).getObjGen());
 1206|  3.62k|    if (!lc_first_page_private.count(first_page_og)) {
  ------------------
  |  Branch (1206:9): [True: 221, False: 3.40k]
  ------------------
 1207|    221|        stopOnError("INTERNAL ERROR: QPDF::calculateLinearizationData: first page "
 1208|    221|                    "object not in lc_first_page_private");
 1209|    221|    }
 1210|  3.62k|    lc_first_page_private.erase(first_page_og);
 1211|  3.62k|    m->c_linp.first_page_object = pages.at(0).getObjectID();
 1212|  3.62k|    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|  11.8k|    for (auto const& og: lc_first_page_private) {
  ------------------
  |  Branch (1218:24): [True: 11.8k, False: 3.62k]
  ------------------
 1219|  11.8k|        m->part6.push_back(getObject(og));
 1220|  11.8k|    }
 1221|       |
 1222|  9.15k|    for (auto const& og: lc_first_page_shared) {
  ------------------
  |  Branch (1222:24): [True: 9.15k, False: 3.62k]
  ------------------
 1223|  9.15k|        m->part6.push_back(getObject(og));
 1224|  9.15k|    }
 1225|       |
 1226|       |    // Place the outline dictionary if it goes in the first page section.
 1227|  3.62k|    if (outlines_in_first_page) {
  ------------------
  |  Branch (1227:9): [True: 370, False: 3.25k]
  ------------------
 1228|    370|        pushOutlinesToPart(m->part6, lc_outlines, object_stream_data);
 1229|    370|    }
 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|  3.62k|    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|  14.3k|    for (size_t i = 1; i < toS(npages); ++i) {
  ------------------
  |  Branch (1240:24): [True: 10.7k, False: 3.62k]
  ------------------
 1241|       |        // Place this page's page object
 1242|       |
 1243|  10.7k|        QPDFObjGen page_og(pages.at(i).getObjGen());
 1244|  10.7k|        if (!lc_other_page_private.count(page_og)) {
  ------------------
  |  Branch (1244:13): [True: 111, False: 10.6k]
  ------------------
 1245|    111|            stopOnError(
 1246|    111|                "INTERNAL ERROR: "
 1247|    111|                "QPDF::calculateLinearizationData: page object for page " +
 1248|    111|                std::to_string(i) + " not in lc_other_page_private");
 1249|    111|        }
 1250|  10.7k|        lc_other_page_private.erase(page_og);
 1251|  10.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|  10.7k|        m->c_page_offset_data.entries.at(i).nobjects = 1;
 1257|       |
 1258|  10.7k|        ObjUser ou(ObjUser::ou_page, toI(i));
 1259|  10.7k|        if (m->obj_user_to_objects.count(ou) == 0) {
  ------------------
  |  Branch (1259:13): [True: 0, False: 10.7k]
  ------------------
 1260|      0|            stopOnError("found unreferenced page while"
 1261|      0|                        " calculating linearization data");
 1262|      0|        }
 1263|  88.1k|        for (auto const& og: m->obj_user_to_objects[ou]) {
  ------------------
  |  Branch (1263:28): [True: 88.1k, False: 10.7k]
  ------------------
 1264|  88.1k|            if (lc_other_page_private.count(og)) {
  ------------------
  |  Branch (1264:17): [True: 11.8k, False: 76.3k]
  ------------------
 1265|  11.8k|                lc_other_page_private.erase(og);
 1266|  11.8k|                m->part7.push_back(getObject(og));
 1267|  11.8k|                ++m->c_page_offset_data.entries.at(i).nobjects;
 1268|  11.8k|            }
 1269|  88.1k|        }
 1270|  10.7k|    }
 1271|       |    // That should have covered all part7 objects.
 1272|  3.62k|    if (!lc_other_page_private.empty()) {
  ------------------
  |  Branch (1272:9): [True: 0, False: 3.62k]
  ------------------
 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|  5.35k|    for (auto const& og: lc_other_page_shared) {
  ------------------
  |  Branch (1281:24): [True: 5.35k, False: 3.62k]
  ------------------
 1282|  5.35k|        m->part8.push_back(getObject(og));
 1283|  5.35k|    }
 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|  3.62k|    std::set<QPDFObjGen> pages_ogs =
 1294|  3.62k|        m->obj_user_to_objects[ObjUser(ObjUser::ou_root_key, "/Pages")];
 1295|  3.62k|    if (pages_ogs.empty()) {
  ------------------
  |  Branch (1295:9): [True: 12, False: 3.61k]
  ------------------
 1296|     12|        stopOnError("found empty pages tree while"
 1297|     12|                    " calculating linearization data");
 1298|     12|    }
 1299|  5.45k|    for (auto const& og: pages_ogs) {
  ------------------
  |  Branch (1299:24): [True: 5.45k, False: 3.62k]
  ------------------
 1300|  5.45k|        if (lc_other.count(og)) {
  ------------------
  |  Branch (1300:13): [True: 2.51k, False: 2.94k]
  ------------------
 1301|  2.51k|            lc_other.erase(og);
 1302|  2.51k|            m->part9.push_back(getObject(og));
 1303|  2.51k|        }
 1304|  5.45k|    }
 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|  17.3k|    for (size_t i = 0; i < toS(npages); ++i) {
  ------------------
  |  Branch (1308:24): [True: 13.7k, False: 3.62k]
  ------------------
 1309|  13.7k|        QPDFObjectHandle thumb = pages.at(i).getKey("/Thumb");
 1310|  13.7k|        thumb = getUncompressedObject(thumb, object_stream_data);
 1311|  13.7k|        if (!thumb.isNull()) {
  ------------------
  |  Branch (1311:13): [True: 1.66k, False: 12.0k]
  ------------------
 1312|       |            // Output the thumbnail itself
 1313|  1.66k|            QPDFObjGen thumb_og(thumb.getObjGen());
 1314|  1.66k|            if (lc_thumbnail_private.count(thumb_og)) {
  ------------------
  |  Branch (1314:17): [True: 1.47k, False: 190]
  ------------------
 1315|  1.47k|                lc_thumbnail_private.erase(thumb_og);
 1316|  1.47k|                m->part9.push_back(thumb);
 1317|  1.47k|            } 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|    190|            }
 1323|  1.66k|            std::set<QPDFObjGen>& ogs = m->obj_user_to_objects[ObjUser(ObjUser::ou_thumb, toI(i))];
 1324|  8.62k|            for (auto const& og: ogs) {
  ------------------
  |  Branch (1324:32): [True: 8.62k, False: 1.66k]
  ------------------
 1325|  8.62k|                if (lc_thumbnail_private.count(og)) {
  ------------------
  |  Branch (1325:21): [True: 437, False: 8.19k]
  ------------------
 1326|    437|                    lc_thumbnail_private.erase(og);
 1327|    437|                    m->part9.push_back(getObject(og));
 1328|    437|                }
 1329|  8.62k|            }
 1330|  1.66k|        }
 1331|  13.7k|    }
 1332|  3.62k|    if (!lc_thumbnail_private.empty()) {
  ------------------
  |  Branch (1332:9): [True: 7, False: 3.61k]
  ------------------
 1333|      7|        stopOnError("INTERNAL ERROR: QPDF::calculateLinearizationData: lc_thumbnail_private not "
 1334|      7|                    "empty after placing thumbnails");
 1335|      7|    }
 1336|       |
 1337|       |    // Place shared thumbnail objects
 1338|  3.62k|    for (auto const& og: lc_thumbnail_shared) {
  ------------------
  |  Branch (1338:24): [True: 794, False: 3.62k]
  ------------------
 1339|    794|        m->part9.push_back(getObject(og));
 1340|    794|    }
 1341|       |
 1342|       |    // Place outlines unless in first page
 1343|  3.62k|    if (!outlines_in_first_page) {
  ------------------
  |  Branch (1343:9): [True: 2.89k, False: 732]
  ------------------
 1344|  2.89k|        pushOutlinesToPart(m->part9, lc_outlines, object_stream_data);
 1345|  2.89k|    }
 1346|       |
 1347|       |    // Place all remaining objects
 1348|  7.22k|    for (auto const& og: lc_other) {
  ------------------
  |  Branch (1348:24): [True: 7.22k, False: 3.62k]
  ------------------
 1349|  7.22k|        m->part9.push_back(getObject(og));
 1350|  7.22k|    }
 1351|       |
 1352|       |    // Make sure we got everything exactly once.
 1353|       |
 1354|  3.62k|    size_t num_placed =
 1355|  3.62k|        m->part4.size() + m->part6.size() + m->part7.size() + m->part8.size() + m->part9.size();
 1356|  3.62k|    size_t num_wanted = m->object_to_obj_users.size();
 1357|  3.62k|    if (num_placed != num_wanted) {
  ------------------
  |  Branch (1357:9): [True: 47, False: 3.57k]
  ------------------
 1358|     47|        stopOnError(
 1359|     47|            "INTERNAL ERROR: QPDF::calculateLinearizationData: wrong "
 1360|     47|            "number of objects placed (num_placed = " +
 1361|     47|            std::to_string(num_placed) + "; number of objects: " + std::to_string(num_wanted));
 1362|     47|    }
 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|  3.62k|    std::map<int, int> obj_to_index;
 1374|       |
 1375|  3.62k|    m->c_shared_object_data.nshared_first_page = toI(m->part6.size());
 1376|  3.62k|    m->c_shared_object_data.nshared_total =
 1377|  3.62k|        m->c_shared_object_data.nshared_first_page + toI(m->part8.size());
 1378|       |
 1379|  3.62k|    std::vector<CHSharedObjectEntry>& shared = m->c_shared_object_data.entries;
 1380|  26.6k|    for (auto& oh: m->part6) {
  ------------------
  |  Branch (1380:18): [True: 26.6k, False: 3.62k]
  ------------------
 1381|  26.6k|        int obj = oh.getObjectID();
 1382|  26.6k|        obj_to_index[obj] = toI(shared.size());
 1383|  26.6k|        shared.emplace_back(obj);
 1384|  26.6k|    }
 1385|  3.62k|    QTC::TC("qpdf", "QPDF lin part 8 empty", m->part8.empty() ? 1 : 0);
  ------------------
  |  Branch (1385:46): [True: 2.89k, False: 731]
  ------------------
 1386|  3.62k|    if (!m->part8.empty()) {
  ------------------
  |  Branch (1386:9): [True: 313, False: 3.31k]
  ------------------
 1387|    313|        m->c_shared_object_data.first_shared_obj = m->part8.at(0).getObjectID();
 1388|  5.34k|        for (auto& oh: m->part8) {
  ------------------
  |  Branch (1388:22): [True: 5.34k, False: 313]
  ------------------
 1389|  5.34k|            int obj = oh.getObjectID();
 1390|  5.34k|            obj_to_index[obj] = toI(shared.size());
 1391|  5.34k|            shared.emplace_back(obj);
 1392|  5.34k|        }
 1393|    313|    }
 1394|  3.62k|    if (static_cast<size_t>(m->c_shared_object_data.nshared_total) !=
  ------------------
  |  Branch (1394:9): [True: 0, False: 3.62k]
  ------------------
 1395|  3.62k|        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|  14.0k|    for (size_t i = 1; i < toS(npages); ++i) {
  ------------------
  |  Branch (1401:24): [True: 10.4k, False: 3.62k]
  ------------------
 1402|  10.4k|        CHPageOffsetEntry& pe = m->c_page_offset_data.entries.at(i);
 1403|  10.4k|        ObjUser ou(ObjUser::ou_page, toI(i));
 1404|  10.4k|        if (m->obj_user_to_objects.count(ou) == 0) {
  ------------------
  |  Branch (1404:13): [True: 0, False: 10.4k]
  ------------------
 1405|      0|            stopOnError("found unreferenced page while"
 1406|      0|                        " calculating linearization data");
 1407|      0|        }
 1408|  87.6k|        for (auto const& og: m->obj_user_to_objects[ou]) {
  ------------------
  |  Branch (1408:28): [True: 87.6k, False: 10.4k]
  ------------------
 1409|  87.6k|            if ((m->object_to_obj_users[og].size() > 1) && (obj_to_index.count(og.getObj()) > 0)) {
  ------------------
  |  Branch (1409:17): [True: 65.4k, False: 22.1k]
  |  Branch (1409:17): [True: 50.7k, False: 36.8k]
  |  Branch (1409:60): [True: 50.7k, False: 14.7k]
  ------------------
 1410|  50.7k|                int idx = obj_to_index[og.getObj()];
 1411|  50.7k|                ++pe.nshared_objects;
 1412|  50.7k|                pe.shared_identifiers.push_back(idx);
 1413|  50.7k|            }
 1414|  87.6k|        }
 1415|  10.4k|    }
 1416|  3.62k|}
_ZN4QPDF18pushOutlinesToPartIN10QPDFWriter8ObjTableEEEvRNSt3__16vectorI16QPDFObjectHandleNS3_9allocatorIS5_EEEERNS3_3setI10QPDFObjGenNS3_4lessISB_EENS6_ISB_EEEERKT_:
 1424|  3.26k|{
 1425|  3.26k|    QPDFObjectHandle root = getRoot();
 1426|  3.26k|    QPDFObjectHandle outlines = root.getKey("/Outlines");
 1427|  3.26k|    if (outlines.isNull()) {
  ------------------
  |  Branch (1427:9): [True: 2.72k, False: 536]
  ------------------
 1428|  2.72k|        return;
 1429|  2.72k|    }
 1430|    536|    outlines = getUncompressedObject(outlines, object_stream_data);
 1431|    536|    QPDFObjGen outlines_og(outlines.getObjGen());
 1432|    536|    QTC::TC(
 1433|    536|        "qpdf",
 1434|    536|        "QPDF lin outlines in part",
 1435|    536|        ((&part == (&m->part6))       ? 0
  ------------------
  |  Branch (1435:10): [True: 370, False: 166]
  ------------------
 1436|    536|             : (&part == (&m->part9)) ? 1
  ------------------
  |  Branch (1436:16): [True: 166, False: 0]
  ------------------
 1437|    166|                                      : 9999)); // can't happen
 1438|    536|    m->c_outline_data.first_object = outlines_og.getObj();
 1439|    536|    m->c_outline_data.nobjects = 1;
 1440|    536|    lc_outlines.erase(outlines_og);
 1441|    536|    part.push_back(outlines);
 1442|  3.86k|    for (auto const& og: lc_outlines) {
  ------------------
  |  Branch (1442:24): [True: 3.86k, False: 536]
  ------------------
 1443|  3.86k|        part.push_back(getObject(og));
 1444|  3.86k|        ++m->c_outline_data.nobjects;
 1445|  3.86k|    }
 1446|    536|}
QPDF_linearization.cc:_ZL16write_vector_intIN4QPDF16HPageOffsetEntryEiEvR9BitWriteriRNSt3__16vectorIT_NS4_9allocatorIS6_EEEEiMS6_T0_:
 1639|  5.84k|{
 1640|       |    // nitems times, write bits bits from the given field of the ith vector to the given bit writer.
 1641|       |
 1642|  31.6k|    for (size_t i = 0; i < QIntC::to_size(nitems); ++i) {
  ------------------
  |  Branch (1642:24): [True: 25.8k, False: 5.84k]
  ------------------
 1643|  25.8k|        w.writeBits(QIntC::to_ulonglong(vec.at(i).*field), QIntC::to_size(bits));
 1644|  25.8k|    }
 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|  5.84k|    w.flush();
 1648|  5.84k|}
QPDF_linearization.cc:_ZL16write_vector_intIN4QPDF16HPageOffsetEntryExEvR9BitWriteriRNSt3__16vectorIT_NS4_9allocatorIS6_EEEEiMS6_T0_:
 1639|  8.76k|{
 1640|       |    // nitems times, write bits bits from the given field of the ith vector to the given bit writer.
 1641|       |
 1642|  47.4k|    for (size_t i = 0; i < QIntC::to_size(nitems); ++i) {
  ------------------
  |  Branch (1642:24): [True: 38.7k, False: 8.76k]
  ------------------
 1643|  38.7k|        w.writeBits(QIntC::to_ulonglong(vec.at(i).*field), QIntC::to_size(bits));
 1644|  38.7k|    }
 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|  8.76k|    w.flush();
 1648|  8.76k|}
QPDF_linearization.cc:_ZL19write_vector_vectorIN4QPDF16HPageOffsetEntryEEvR9BitWriteriRNSt3__16vectorIT_NS4_9allocatorIS6_EEEEMS6_iiMS6_NS5_IiNS7_IiEEEE:
 1659|  5.84k|{
 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|  31.6k|    for (size_t i1 = 0; i1 < QIntC::to_size(nitems1); ++i1) {
  ------------------
  |  Branch (1662:25): [True: 25.8k, False: 5.84k]
  ------------------
 1663|   125k|        for (size_t i2 = 0; i2 < QIntC::to_size(vec1.at(i1).*nitems2); ++i2) {
  ------------------
  |  Branch (1663:29): [True: 100k, False: 25.8k]
  ------------------
 1664|   100k|            w.writeBits(QIntC::to_ulonglong((vec1.at(i1).*vec2).at(i2)), QIntC::to_size(bits));
 1665|   100k|        }
 1666|  25.8k|    }
 1667|  5.84k|    w.flush();
 1668|  5.84k|}
QPDF_linearization.cc:_ZL16write_vector_intIN4QPDF18HSharedObjectEntryEiEvR9BitWriteriRNSt3__16vectorIT_NS4_9allocatorIS6_EEEEiMS6_T0_:
 1639|  8.76k|{
 1640|       |    // nitems times, write bits bits from the given field of the ith vector to the given bit writer.
 1641|       |
 1642|   100k|    for (size_t i = 0; i < QIntC::to_size(nitems); ++i) {
  ------------------
  |  Branch (1642:24): [True: 92.0k, False: 8.76k]
  ------------------
 1643|  92.0k|        w.writeBits(QIntC::to_ulonglong(vec.at(i).*field), QIntC::to_size(bits));
 1644|  92.0k|    }
 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|  8.76k|    w.flush();
 1648|  8.76k|}

_ZN4QPDF7ObjUserC2ENS0_6user_eE:
   22|  3.62k|{
   23|  3.62k|    qpdf_assert_debug(type == ou_root);
  ------------------
  |  |   16|  3.62k|# define qpdf_assert_debug assert
  ------------------
   24|  3.62k|}
_ZN4QPDF7ObjUserC2ENS0_6user_eEi:
   29|  40.2k|{
   30|  40.2k|    qpdf_assert_debug((type == ou_page) || (type == ou_thumb));
  ------------------
  |  |   16|  40.2k|# define qpdf_assert_debug assert
  ------------------
   31|  40.2k|}
_ZN4QPDF7ObjUserC2ENS0_6user_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
   37|  42.5k|{
   38|  42.5k|    qpdf_assert_debug((type == ou_trailer_key) || (type == ou_root_key));
  ------------------
  |  |   16|  42.5k|# define qpdf_assert_debug assert
  ------------------
   39|  42.5k|}
_ZNK4QPDF7ObjUserltERKS0_:
   43|  9.05M|{
   44|  9.05M|    if (this->ou_type < rhs.ou_type) {
  ------------------
  |  Branch (44:9): [True: 326k, False: 8.72M]
  ------------------
   45|   326k|        return true;
   46|  8.72M|    } else if (this->ou_type == rhs.ou_type) {
  ------------------
  |  Branch (46:16): [True: 8.42M, False: 298k]
  ------------------
   47|  8.42M|        if (this->pageno < rhs.pageno) {
  ------------------
  |  Branch (47:13): [True: 671k, False: 7.75M]
  ------------------
   48|   671k|            return true;
   49|  7.75M|        } else if (this->pageno == rhs.pageno) {
  ------------------
  |  Branch (49:20): [True: 7.10M, False: 647k]
  ------------------
   50|  7.10M|            return (this->key < rhs.key);
   51|  7.10M|        }
   52|  8.42M|    }
   53|       |
   54|   945k|    return false;
   55|  9.05M|}
_ZN4QPDF21UpdateObjectMapsFrameC2ERKNS_7ObjUserE16QPDFObjectHandleb:
   62|  5.76M|{
   63|  5.76M|}
_ZN4QPDF8optimizeERKN10QPDFWriter8ObjTableENSt3__18functionIFiR16QPDFObjectHandleEEE:
   77|  3.66k|{
   78|  3.66k|    optimize_internal(obj, true, skip_stream_parameters);
   79|  3.66k|}
_ZN4QPDF29pushInheritedAttributesToPageEbb:
  155|  7.55k|{
  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|  7.55k|    if (m->pushed_inherited_attributes_to_pages && (!warn_skipped_keys)) {
  ------------------
  |  Branch (160:9): [True: 1.53k, False: 6.02k]
  |  Branch (160:52): [True: 1.53k, False: 0]
  ------------------
  161|  1.53k|        return;
  162|  1.53k|    }
  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|  6.02k|    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|  6.02k|    std::map<std::string, std::vector<QPDFObjectHandle>> key_ancestors;
  171|  6.02k|    pushInheritedAttributesToPageInternal(
  172|  6.02k|        m->trailer.getKey("/Root").getKey("/Pages"),
  173|  6.02k|        key_ancestors,
  174|  6.02k|        allow_changes,
  175|  6.02k|        warn_skipped_keys);
  176|  6.02k|    if (!key_ancestors.empty()) {
  ------------------
  |  Branch (176:9): [True: 0, False: 6.02k]
  ------------------
  177|      0|        throw std::logic_error("key_ancestors not empty after"
  178|      0|                               " pushing inherited attributes to pages");
  179|      0|    }
  180|  6.02k|    m->pushed_inherited_attributes_to_pages = true;
  181|  6.02k|    m->ever_pushed_inherited_attributes_to_pages = true;
  182|  6.02k|}
_ZN4QPDF37pushInheritedAttributesToPageInternalE16QPDFObjectHandleRNSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_6vectorIS0_NS6_IS0_EEEENS1_4lessIS8_EENS6_INS1_4pairIKS8_SB_EEEEEEbb:
  190|  7.50k|{
  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|  7.50k|    std::set<std::string> inheritable_keys;
  196|  34.6k|    for (auto const& key: cur_pages.getKeys()) {
  ------------------
  |  Branch (196:25): [True: 34.6k, False: 7.50k]
  ------------------
  197|  34.6k|        if ((key == "/MediaBox") || (key == "/CropBox") || (key == "/Resources") ||
  ------------------
  |  Branch (197:13): [True: 1.28k, False: 33.3k]
  |  Branch (197:37): [True: 34, False: 33.3k]
  |  Branch (197:60): [True: 975, False: 32.3k]
  ------------------
  198|  34.6k|            (key == "/Rotate")) {
  ------------------
  |  Branch (198:13): [True: 131, False: 32.2k]
  ------------------
  199|  2.42k|            if (!allow_changes) {
  ------------------
  |  Branch (199:17): [True: 0, False: 2.42k]
  ------------------
  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|  2.42k|            inheritable_keys.insert(key);
  210|  2.42k|            QPDFObjectHandle oh = cur_pages.getKey(key);
  211|  2.42k|            QTC::TC("qpdf", "QPDF opt direct pages resource", oh.isIndirect() ? 0 : 1);
  ------------------
  |  Branch (211:63): [True: 727, False: 1.69k]
  ------------------
  212|  2.42k|            if (!oh.isIndirect()) {
  ------------------
  |  Branch (212:17): [True: 1.69k, False: 727]
  ------------------
  213|  1.69k|                if (!oh.isScalar()) {
  ------------------
  |  Branch (213:21): [True: 1.29k, False: 400]
  ------------------
  214|       |                    // Replace shared direct object non-scalar resources with indirect objects to
  215|       |                    // avoid copying large structures around.
  216|  1.29k|                    cur_pages.replaceKey(key, makeIndirectObject(oh));
  217|  1.29k|                    oh = cur_pages.getKey(key);
  218|  1.29k|                } else {
  219|       |                    // It's okay to copy scalars.
  220|    400|                    QTC::TC("qpdf", "QPDF opt inherited scalar");
  221|    400|                }
  222|  1.69k|            }
  223|  2.42k|            key_ancestors[key].push_back(oh);
  224|  2.42k|            if (key_ancestors[key].size() > 1) {
  ------------------
  |  Branch (224:17): [True: 79, False: 2.34k]
  ------------------
  225|     79|                QTC::TC("qpdf", "QPDF opt key ancestors depth > 1");
  226|     79|            }
  227|       |            // Remove this resource from this node.  It will be reattached at the page level.
  228|  2.42k|            cur_pages.removeKey(key);
  229|  32.2k|        } else if (!((key == "/Type") || (key == "/Parent") || (key == "/Kids") ||
  ------------------
  |  Branch (229:22): [True: 7.49k, False: 24.7k]
  |  Branch (229:42): [True: 260, False: 24.4k]
  |  Branch (229:64): [True: 7.50k, False: 16.9k]
  ------------------
  230|  32.2k|                     (key == "/Count"))) {
  ------------------
  |  Branch (230:22): [True: 6.26k, False: 10.7k]
  ------------------
  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|  10.7k|            if ((warn_skipped_keys) && (cur_pages.hasKey("/Parent"))) {
  ------------------
  |  Branch (233:17): [True: 6.65k, False: 4.05k]
  |  Branch (233:17): [True: 759, False: 9.95k]
  |  Branch (233:40): [True: 759, False: 5.89k]
  ------------------
  234|    759|                QTC::TC("qpdf", "QPDF unknown key not inherited");
  235|    759|                setLastObjectDescription("Pages object", cur_pages.getObjGen());
  236|    759|                warn(
  237|    759|                    qpdf_e_pages,
  238|    759|                    m->last_object_description,
  239|    759|                    0,
  240|    759|                    ("Unknown key " + key +
  241|    759|                     " in /Pages object is being discarded as a result of flattening the /Pages "
  242|    759|                     "tree"));
  243|    759|            }
  244|  10.7k|        }
  245|  34.6k|    }
  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|  99.1k|    for (auto& kid: cur_pages.getKey("/Kids").aitems()) {
  ------------------
  |  Branch (250:19): [True: 99.1k, False: 7.50k]
  ------------------
  251|  99.1k|        if (kid.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (251:13): [True: 1.48k, False: 97.6k]
  ------------------
  252|  1.48k|            pushInheritedAttributesToPageInternal(
  253|  1.48k|                kid, key_ancestors, allow_changes, warn_skipped_keys);
  254|  97.6k|        } else {
  255|       |            // Add all available inheritable attributes not present in this object to this object.
  256|  97.6k|            for (auto const& iter: key_ancestors) {
  ------------------
  |  Branch (256:34): [True: 5.28k, False: 97.6k]
  ------------------
  257|  5.28k|                std::string const& key = iter.first;
  258|  5.28k|                if (!kid.hasKey(key)) {
  ------------------
  |  Branch (258:21): [True: 2.88k, False: 2.39k]
  ------------------
  259|  2.88k|                    QTC::TC("qpdf", "QPDF opt resource inherited");
  260|  2.88k|                    kid.replaceKey(key, iter.second.back());
  261|  2.88k|                } else {
  262|  2.39k|                    QTC::TC("qpdf", "QPDF opt page resource hides ancestor");
  263|  2.39k|                }
  264|  5.28k|            }
  265|  97.6k|        }
  266|  99.1k|    }
  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|  7.50k|    if (!inheritable_keys.empty()) {
  ------------------
  |  Branch (272:9): [True: 1.52k, False: 5.98k]
  ------------------
  273|  1.52k|        QTC::TC("qpdf", "QPDF opt inheritable keys");
  274|  2.37k|        for (auto const& key: inheritable_keys) {
  ------------------
  |  Branch (274:29): [True: 2.37k, False: 1.52k]
  ------------------
  275|  2.37k|            key_ancestors[key].pop_back();
  276|  2.37k|            if (key_ancestors[key].empty()) {
  ------------------
  |  Branch (276:17): [True: 2.29k, False: 79]
  ------------------
  277|  2.29k|                QTC::TC("qpdf", "QPDF opt erase empty key ancestor");
  278|  2.29k|                key_ancestors.erase(key);
  279|  2.29k|            }
  280|  2.37k|        }
  281|  5.98k|    } else {
  282|  5.98k|        QTC::TC("qpdf", "QPDF opt no inheritable keys");
  283|  5.98k|    }
  284|  7.50k|}
_ZN4QPDF16updateObjectMapsERKNS_7ObjUserE16QPDFObjectHandleNSt3__18functionIFiRS3_EEE:
  291|  54.8k|{
  292|  54.8k|    QPDFObjGen::set visited;
  293|  54.8k|    std::vector<UpdateObjectMapsFrame> pending;
  294|  54.8k|    pending.emplace_back(first_ou, first_oh, true);
  295|       |    // Traverse the object tree from this point taking care to avoid crossing page boundaries.
  296|  54.8k|    std::unique_ptr<ObjUser> thumb_ou;
  297|  5.82M|    while (!pending.empty()) {
  ------------------
  |  Branch (297:12): [True: 5.76M, False: 54.8k]
  ------------------
  298|  5.76M|        auto cur = pending.back();
  299|  5.76M|        pending.pop_back();
  300|       |
  301|  5.76M|        bool is_page_node = false;
  302|       |
  303|  5.76M|        if (cur.oh.isDictionaryOfType("/Page")) {
  ------------------
  |  Branch (303:13): [True: 172k, False: 5.59M]
  ------------------
  304|   172k|            is_page_node = true;
  305|   172k|            if (!cur.top) {
  ------------------
  |  Branch (305:17): [True: 156k, False: 16.4k]
  ------------------
  306|   156k|                continue;
  307|   156k|            }
  308|   172k|        }
  309|       |
  310|  5.61M|        if (cur.oh.isIndirect()) {
  ------------------
  |  Branch (310:13): [True: 1.19M, False: 4.41M]
  ------------------
  311|  1.19M|            QPDFObjGen og(cur.oh.getObjGen());
  312|  1.19M|            if (!visited.add(og)) {
  ------------------
  |  Branch (312:17): [True: 804k, False: 388k]
  ------------------
  313|   804k|                QTC::TC("qpdf", "QPDF opt loop detected");
  314|   804k|                continue;
  315|   804k|            }
  316|   388k|            m->obj_user_to_objects[cur.ou].insert(og);
  317|   388k|            m->object_to_obj_users[og].insert(cur.ou);
  318|   388k|        }
  319|       |
  320|  4.80M|        if (cur.oh.isArray()) {
  ------------------
  |  Branch (320:13): [True: 368k, False: 4.43M]
  ------------------
  321|   368k|            int n = cur.oh.getArrayNItems();
  322|  3.13M|            for (int i = 0; i < n; ++i) {
  ------------------
  |  Branch (322:29): [True: 2.76M, False: 368k]
  ------------------
  323|  2.76M|                pending.emplace_back(cur.ou, cur.oh.getArrayItem(i), false);
  324|  2.76M|            }
  325|  4.43M|        } else if (cur.oh.isDictionary() || cur.oh.isStream()) {
  ------------------
  |  Branch (325:20): [True: 537k, False: 3.90M]
  |  Branch (325:45): [True: 95.8k, False: 3.80M]
  ------------------
  326|   633k|            QPDFObjectHandle dict = cur.oh;
  327|   633k|            bool is_stream = cur.oh.isStream();
  328|   633k|            int ssp = 0;
  329|   633k|            if (is_stream) {
  ------------------
  |  Branch (329:17): [True: 95.8k, False: 537k]
  ------------------
  330|  95.8k|                dict = cur.oh.getDict();
  331|  95.8k|                if (skip_stream_parameters) {
  ------------------
  |  Branch (331:21): [True: 95.8k, False: 0]
  ------------------
  332|  95.8k|                    ssp = skip_stream_parameters(cur.oh);
  333|  95.8k|                }
  334|  95.8k|            }
  335|       |
  336|  3.07M|            for (auto const& key: dict.getKeys()) {
  ------------------
  |  Branch (336:33): [True: 3.07M, False: 633k]
  ------------------
  337|  3.07M|                if (is_page_node && (key == "/Thumb")) {
  ------------------
  |  Branch (337:21): [True: 114k, False: 2.95M]
  |  Branch (337:37): [True: 1.94k, False: 112k]
  ------------------
  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|  1.94k|                    thumb_ou = std::make_unique<ObjUser>(ObjUser::ou_thumb, cur.ou.pageno);
  341|  1.94k|                    pending.emplace_back(*thumb_ou, dict.getKey(key), false);
  342|  3.06M|                } else if (is_page_node && (key == "/Parent")) {
  ------------------
  |  Branch (342:28): [True: 112k, False: 2.95M]
  |  Branch (342:44): [True: 14.8k, False: 97.5k]
  ------------------
  343|       |                    // Don't traverse back up the page tree
  344|  3.05M|                } else if (
  345|  3.05M|                    ((ssp >= 1) && (key == "/Length")) ||
  ------------------
  |  Branch (345:22): [True: 522k, False: 2.53M]
  |  Branch (345:36): [True: 92.9k, False: 429k]
  ------------------
  346|  3.05M|                    ((ssp >= 2) && ((key == "/Filter") || (key == "/DecodeParms")))) {
  ------------------
  |  Branch (346:22): [True: 320k, False: 2.63M]
  |  Branch (346:37): [True: 18.1k, False: 302k]
  |  Branch (346:59): [True: 254, False: 302k]
  ------------------
  347|       |                    // Don't traverse into stream parameters that we are not going to write.
  348|  2.94M|                } else {
  349|  2.94M|                    pending.emplace_back(cur.ou, dict.getKey(key), false);
  350|  2.94M|                }
  351|  3.07M|            }
  352|   633k|        }
  353|  4.80M|    }
  354|  54.8k|}
_ZN4QPDF23filterCompressedObjectsERKN10QPDFWriter8ObjTableE:
  402|  3.62k|{
  403|  3.62k|    if (obj.getStreamsEmpty()) {
  ------------------
  |  Branch (403:9): [True: 3.35k, False: 269]
  ------------------
  404|  3.35k|        return;
  405|  3.35k|    }
  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|    269|    std::map<ObjUser, std::set<QPDFObjGen>> t_obj_user_to_objects;
  412|    269|    std::map<QPDFObjGen, std::set<ObjUser>> t_object_to_obj_users;
  413|       |
  414|  1.80k|    for (auto const& i1: m->obj_user_to_objects) {
  ------------------
  |  Branch (414:24): [True: 1.80k, False: 269]
  ------------------
  415|  1.80k|        ObjUser const& ou = i1.first;
  416|       |        // Loop over objects.
  417|  31.6k|        for (auto const& og: i1.second) {
  ------------------
  |  Branch (417:28): [True: 31.6k, False: 1.80k]
  ------------------
  418|  31.6k|            if (obj.contains(og)) {
  ------------------
  |  Branch (418:17): [True: 30.8k, False: 785]
  ------------------
  419|  30.8k|                if (auto const& i2 = obj[og].object_stream; i2 <= 0) {
  ------------------
  |  Branch (419:61): [True: 15.5k, False: 15.2k]
  ------------------
  420|  15.5k|                    t_obj_user_to_objects[ou].insert(og);
  421|  15.5k|                } else {
  422|  15.2k|                    t_obj_user_to_objects[ou].insert(QPDFObjGen(i2, 0));
  423|  15.2k|                }
  424|  30.8k|            }
  425|  31.6k|        }
  426|  1.80k|    }
  427|       |
  428|  15.9k|    for (auto const& i1: m->object_to_obj_users) {
  ------------------
  |  Branch (428:24): [True: 15.9k, False: 269]
  ------------------
  429|  15.9k|        QPDFObjGen const& og = i1.first;
  430|  15.9k|        if (obj.contains(og)) {
  ------------------
  |  Branch (430:13): [True: 15.4k, False: 533]
  ------------------
  431|       |            // Loop over obj_users.
  432|  30.8k|            for (auto const& ou: i1.second) {
  ------------------
  |  Branch (432:32): [True: 30.8k, False: 15.4k]
  ------------------
  433|  30.8k|                if (auto i2 = obj[og].object_stream; i2 <= 0) {
  ------------------
  |  Branch (433:54): [True: 15.5k, False: 15.2k]
  ------------------
  434|  15.5k|                    t_object_to_obj_users[og].insert(ou);
  435|  15.5k|                } else {
  436|  15.2k|                    t_object_to_obj_users[QPDFObjGen(i2, 0)].insert(ou);
  437|  15.2k|                }
  438|  30.8k|            }
  439|  15.4k|        }
  440|  15.9k|    }
  441|       |
  442|    269|    m->obj_user_to_objects = t_obj_user_to_objects;
  443|    269|    m->object_to_obj_users = t_object_to_obj_users;
  444|    269|}
_ZN4QPDF17optimize_internalIN10QPDFWriter8ObjTableEEEvRKT_bNSt3__18functionIFiR16QPDFObjectHandleEEE:
   87|  3.66k|{
   88|  3.66k|    if (!m->obj_user_to_objects.empty()) {
  ------------------
  |  Branch (88:9): [True: 0, False: 3.66k]
  ------------------
   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|  3.66k|    QPDFObjectHandle root = getRoot();
   96|  3.66k|    if (root.getKey("/Outlines").isDictionary()) {
  ------------------
  |  Branch (96:9): [True: 516, False: 3.15k]
  ------------------
   97|    516|        QPDFObjectHandle outlines = root.getKey("/Outlines");
   98|    516|        if (!outlines.isIndirect()) {
  ------------------
  |  Branch (98:13): [True: 7, False: 509]
  ------------------
   99|      7|            QTC::TC("qpdf", "QPDF_optimization indirect outlines");
  100|      7|            root.replaceKey("/Outlines", makeIndirectObject(outlines));
  101|      7|        }
  102|    516|    }
  103|       |
  104|       |    // Traverse pages tree pushing all inherited resources down to the page level.  This also
  105|       |    // initializes m->all_pages.
  106|  3.66k|    pushInheritedAttributesToPage(allow_changes, false);
  107|       |
  108|       |    // Traverse pages
  109|  3.66k|    int n = toI(m->all_pages.size());
  110|  19.2k|    for (int pageno = 0; pageno < n; ++pageno) {
  ------------------
  |  Branch (110:26): [True: 15.5k, False: 3.66k]
  ------------------
  111|  15.5k|        updateObjectMaps(
  112|  15.5k|            ObjUser(ObjUser::ou_page, pageno),
  113|  15.5k|            m->all_pages.at(toS(pageno)),
  114|  15.5k|            skip_stream_parameters);
  115|  15.5k|    }
  116|       |
  117|       |    // Traverse document-level items
  118|  24.3k|    for (auto const& key: m->trailer.getKeys()) {
  ------------------
  |  Branch (118:25): [True: 24.3k, False: 3.66k]
  ------------------
  119|  24.3k|        if (key == "/Root") {
  ------------------
  |  Branch (119:13): [True: 3.63k, False: 20.6k]
  ------------------
  120|       |            // handled separately
  121|  20.6k|        } else {
  122|  20.6k|            updateObjectMaps(
  123|  20.6k|                ObjUser(ObjUser::ou_trailer_key, key),
  124|  20.6k|                m->trailer.getKey(key),
  125|  20.6k|                skip_stream_parameters);
  126|  20.6k|        }
  127|  24.3k|    }
  128|       |
  129|  18.5k|    for (auto const& key: root.getKeys()) {
  ------------------
  |  Branch (129:25): [True: 18.5k, False: 3.66k]
  ------------------
  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|  18.5k|        updateObjectMaps(
  135|  18.5k|            ObjUser(ObjUser::ou_root_key, key), root.getKey(key), skip_stream_parameters);
  136|  18.5k|    }
  137|       |
  138|  3.66k|    ObjUser root_ou = ObjUser(ObjUser::ou_root);
  139|  3.66k|    auto root_og = QPDFObjGen(root.getObjGen());
  140|  3.66k|    m->obj_user_to_objects[root_ou].insert(root_og);
  141|  3.66k|    m->object_to_obj_users[root_og].insert(root_ou);
  142|       |
  143|  3.66k|    filterCompressedObjects(object_stream_data);
  144|  3.66k|}

_ZN4QPDF11getAllPagesEv:
   41|  36.2k|{
   42|       |    // Note that pushInheritedAttributesToPage may also be used to initialize m->all_pages.
   43|  36.2k|    if (m->all_pages.empty() && !m->invalid_page_found) {
  ------------------
  |  Branch (43:9): [True: 9.42k, False: 26.7k]
  |  Branch (43:33): [True: 9.30k, False: 117]
  ------------------
   44|  9.30k|        m->ever_called_get_all_pages = true;
   45|  9.30k|        QPDFObjGen::set visited;
   46|  9.30k|        QPDFObjGen::set seen;
   47|  9.30k|        QPDFObjectHandle pages = getRoot().getKey("/Pages");
   48|  9.30k|        bool warned = false;
   49|  9.30k|        bool changed_pages = false;
   50|  9.83k|        while (pages.isDictionary() && pages.hasKey("/Parent")) {
  ------------------
  |  Branch (50:16): [True: 9.53k, False: 297]
  |  Branch (50:16): [True: 637, False: 9.19k]
  |  Branch (50:40): [True: 637, False: 8.89k]
  ------------------
   51|    637|            if (!seen.add(pages)) {
  ------------------
  |  Branch (51:17): [True: 109, False: 528]
  ------------------
   52|       |                // loop -- will be detected again and reported later
   53|    109|                break;
   54|    109|            }
   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|    528|            if (!warned) {
  ------------------
  |  Branch (57:17): [True: 491, False: 37]
  ------------------
   58|    491|                getRoot().warnIfPossible("document page tree root (root -> /Pages) doesn't point"
   59|    491|                                         " to the root of the page tree; attempting to correct");
   60|    491|                warned = true;
   61|    491|            }
   62|    528|            changed_pages = true;
   63|    528|            pages = pages.getKey("/Parent");
   64|    528|        }
   65|  9.30k|        if (changed_pages) {
  ------------------
  |  Branch (65:13): [True: 490, False: 8.81k]
  ------------------
   66|    490|            getRoot().replaceKey("/Pages", pages);
   67|    490|        }
   68|  9.30k|        seen.clear();
   69|  9.30k|        if (!pages.hasKey("/Kids")) {
  ------------------
  |  Branch (69:13): [True: 96, False: 9.20k]
  ------------------
   70|       |            // Ensure we actually found a /Pages object.
   71|     96|            throw QPDFExc(
   72|     96|                qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array");
   73|     96|        }
   74|  9.20k|        getAllPagesInternal(pages, visited, seen, false);
   75|  9.20k|        if (m->invalid_page_found) {
  ------------------
  |  Branch (75:13): [True: 3.89k, False: 5.31k]
  ------------------
   76|  3.89k|            flattenPagesTree();
   77|  3.89k|            m->invalid_page_found = false;
   78|  3.89k|        }
   79|  9.20k|    }
   80|  36.1k|    return m->all_pages;
   81|  36.2k|}
_ZN4QPDF19getAllPagesInternalE16QPDFObjectHandleRN10QPDFObjGen3setES3_b:
   86|  10.6k|{
   87|  10.6k|    if (!visited.add(cur_node)) {
  ------------------
  |  Branch (87:9): [True: 10, False: 10.6k]
  ------------------
   88|     10|        throw QPDFExc(
   89|     10|            qpdf_e_pages,
   90|     10|            m->file->getName(),
   91|     10|            m->last_object_description,
   92|     10|            0,
   93|     10|            "Loop detected in /Pages structure (getAllPages)");
   94|     10|    }
   95|  10.6k|    if (!cur_node.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (95:9): [True: 3.94k, False: 6.66k]
  ------------------
   96|  3.94k|        cur_node.warnIfPossible("/Type key should be /Pages but is not; overriding");
   97|  3.94k|        cur_node.replaceKey("/Type", "/Pages"_qpdf);
   98|  3.94k|    }
   99|  10.6k|    if (!media_box) {
  ------------------
  |  Branch (99:9): [True: 10.5k, False: 102]
  ------------------
  100|  10.5k|        media_box = cur_node.getKey("/MediaBox").isRectangle();
  101|  10.5k|        QTC::TC("qpdf", "QPDF inherit mediabox", media_box ? 0 : 1);
  ------------------
  |  Branch (101:50): [True: 1.58k, False: 8.92k]
  ------------------
  102|  10.5k|    }
  103|  10.6k|    auto kids = cur_node.getKey("/Kids");
  104|  10.6k|    int n = kids.getArrayNItems();
  105|   119k|    for (int i = 0; i < n; ++i) {
  ------------------
  |  Branch (105:21): [True: 108k, False: 10.6k]
  ------------------
  106|   108k|        auto kid = kids.getArrayItem(i);
  107|   108k|        if (!kid.isDictionary()) {
  ------------------
  |  Branch (107:13): [True: 69.7k, False: 39.1k]
  ------------------
  108|  69.7k|            kid.warnIfPossible("Pages tree includes non-dictionary object; ignoring");
  109|  69.7k|            m->invalid_page_found = true;
  110|  69.7k|            continue;
  111|  69.7k|        }
  112|  39.1k|        if (kid.hasKey("/Kids")) {
  ------------------
  |  Branch (112:13): [True: 1.62k, False: 37.4k]
  ------------------
  113|  1.62k|            getAllPagesInternal(kid, visited, seen, media_box);
  114|  37.4k|        } else {
  115|  37.4k|            if (!media_box && !kid.getKey("/MediaBox").isRectangle()) {
  ------------------
  |  Branch (115:17): [True: 35.0k, False: 2.41k]
  |  Branch (115:17): [True: 10.9k, False: 26.5k]
  |  Branch (115:31): [True: 10.9k, False: 24.1k]
  ------------------
  116|  10.9k|                QTC::TC("qpdf", "QPDF missing mediabox");
  117|  10.9k|                kid.warnIfPossible(
  118|  10.9k|                    "kid " + std::to_string(i) +
  119|  10.9k|                    " (from 0) MediaBox is undefined; setting to letter / ANSI A");
  120|  10.9k|                kid.replaceKey(
  121|  10.9k|                    "/MediaBox",
  122|  10.9k|                    QPDFObjectHandle::newArray(QPDFObjectHandle::Rectangle(0, 0, 612, 792)));
  123|  10.9k|            }
  124|  37.4k|            if (!kid.isIndirect()) {
  ------------------
  |  Branch (124:17): [True: 1.42k, False: 36.0k]
  ------------------
  125|  1.42k|                QTC::TC("qpdf", "QPDF handle direct page object");
  126|  1.42k|                cur_node.warnIfPossible(
  127|  1.42k|                    "kid " + std::to_string(i) + " (from 0) is direct; converting to indirect");
  128|  1.42k|                kid = makeIndirectObject(kid);
  129|  1.42k|                kids.setArrayItem(i, kid);
  130|  36.0k|            } else if (!seen.add(kid)) {
  ------------------
  |  Branch (130:24): [True: 2.24k, False: 33.8k]
  ------------------
  131|       |                // Make a copy of the page. This does the same as shallowCopyPage in
  132|       |                // QPDFPageObjectHelper.
  133|  2.24k|                QTC::TC("qpdf", "QPDF resolve duplicated page object");
  134|  2.24k|                cur_node.warnIfPossible(
  135|  2.24k|                    "kid " + std::to_string(i) +
  136|  2.24k|                    " (from 0) appears more than once in the pages tree;"
  137|  2.24k|                    " creating a new page object as a copy");
  138|  2.24k|                kid = makeIndirectObject(QPDFObjectHandle(kid).shallowCopy());
  139|  2.24k|                seen.add(kid);
  140|  2.24k|                kids.setArrayItem(i, kid);
  141|  2.24k|            }
  142|  37.4k|            if (!kid.isDictionaryOfType("/Page")) {
  ------------------
  |  Branch (142:17): [True: 11.2k, False: 26.2k]
  ------------------
  143|  11.2k|                kid.warnIfPossible("/Type key should be /Page but is not; overriding");
  144|  11.2k|                kid.replaceKey("/Type", "/Page"_qpdf);
  145|  11.2k|            }
  146|  37.4k|            m->all_pages.push_back(kid);
  147|  37.4k|        }
  148|  39.1k|    }
  149|  10.6k|}
_ZN4QPDF16flattenPagesTreeEv:
  166|  3.89k|{
  167|       |    // If not already done, flatten the /Pages structure and initialize pageobj_to_pages_pos.
  168|       |
  169|  3.89k|    if (!m->pageobj_to_pages_pos.empty()) {
  ------------------
  |  Branch (169:9): [True: 0, False: 3.89k]
  ------------------
  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|  3.89k|    pushInheritedAttributesToPage(true, true);
  176|       |
  177|  3.89k|    QPDFObjectHandle pages = getRoot().getKey("/Pages");
  178|       |
  179|  3.89k|    size_t const len = m->all_pages.size();
  180|  30.8k|    for (size_t pos = 0; pos < len; ++pos) {
  ------------------
  |  Branch (180:26): [True: 26.9k, False: 3.89k]
  ------------------
  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|  26.9k|        insertPageobjToPage(m->all_pages.at(pos), toI(pos), true);
  185|  26.9k|        m->all_pages.at(pos).replaceKey("/Parent", pages);
  186|  26.9k|    }
  187|       |
  188|  3.89k|    pages.replaceKey("/Kids", QPDFObjectHandle::newArray(m->all_pages));
  189|       |    // /Count has not changed
  190|  3.89k|    if (pages.getKey("/Count").getUIntValue() != len) {
  ------------------
  |  Branch (190:9): [True: 3.73k, False: 156]
  ------------------
  191|  3.73k|        if (m->invalid_page_found && pages.getKey("/Count").getUIntValue() > len) {
  ------------------
  |  Branch (191:13): [True: 3.73k, False: 0]
  |  Branch (191:13): [True: 3.68k, False: 50]
  |  Branch (191:38): [True: 3.68k, False: 50]
  ------------------
  192|  3.68k|            pages.replaceKey("/Count", QPDFObjectHandle::newInteger(toI(len)));
  193|  3.68k|        } else {
  194|     50|            throw std::runtime_error("/Count is wrong after flattening pages tree");
  195|     50|        }
  196|  3.73k|    }
  197|  3.89k|}
_ZN4QPDF19insertPageobjToPageERK16QPDFObjectHandleib:
  201|  26.9k|{
  202|  26.9k|    QPDFObjGen og(obj.getObjGen());
  203|  26.9k|    if (check_duplicate) {
  ------------------
  |  Branch (203:9): [True: 26.9k, False: 0]
  ------------------
  204|  26.9k|        if (!m->pageobj_to_pages_pos.insert(std::make_pair(og, pos)).second) {
  ------------------
  |  Branch (204:13): [True: 0, False: 26.9k]
  ------------------
  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|  26.9k|    } else {
  215|      0|        m->pageobj_to_pages_pos[og] = pos;
  216|      0|    }
  217|  26.9k|}

_ZN5QUtil13int_to_stringExi:
  326|   286k|{
  327|   286k|    return int_to_string_base(num, 10, length);
  328|   286k|}
_ZN5QUtil18int_to_string_baseExii:
  338|   288k|{
  339|   288k|    return int_to_string_base_internal(num, base, length);
  340|   288k|}
_ZN5QUtil16double_to_stringEdib:
  350|  43.7k|{
  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|  43.7k|    if (decimal_places <= 0) {
  ------------------
  |  Branch (354:9): [True: 43.7k, False: 0]
  ------------------
  355|  43.7k|        decimal_places = 6;
  356|  43.7k|    }
  357|  43.7k|    std::ostringstream buf;
  358|  43.7k|    buf.imbue(std::locale::classic());
  359|  43.7k|    buf << std::setprecision(decimal_places) << std::fixed << num;
  360|  43.7k|    std::string result = buf.str();
  361|  43.7k|    if (trim_trailing_zeroes) {
  ------------------
  |  Branch (361:9): [True: 43.7k, False: 0]
  ------------------
  362|   306k|        while ((result.length() > 1) && (result.back() == '0')) {
  ------------------
  |  Branch (362:16): [True: 306k, False: 0]
  |  Branch (362:41): [True: 262k, False: 43.7k]
  ------------------
  363|   262k|            result.pop_back();
  364|   262k|        }
  365|  43.7k|        if ((result.length() > 1) && (result.back() == '.')) {
  ------------------
  |  Branch (365:13): [True: 43.7k, False: 0]
  |  Branch (365:38): [True: 43.7k, False: 0]
  ------------------
  366|  43.7k|            result.pop_back();
  367|  43.7k|        }
  368|  43.7k|    }
  369|  43.7k|    return result;
  370|  43.7k|}
_ZN5QUtil12string_to_llEPKc:
  374|  6.07M|{
  375|  6.07M|    errno = 0;
  376|       |#ifdef _MSC_VER
  377|       |    long long result = _strtoi64(str, 0, 10);
  378|       |#else
  379|  6.07M|    long long result = strtoll(str, nullptr, 10);
  380|  6.07M|#endif
  381|  6.07M|    if (errno == ERANGE) {
  ------------------
  |  Branch (381:9): [True: 459, False: 6.07M]
  ------------------
  382|    459|        throw std::range_error(
  383|    459|            std::string("overflow/underflow converting ") + str + " to 64-bit integer");
  384|    459|    }
  385|  6.07M|    return result;
  386|  6.07M|}
_ZN5QUtil13string_to_intEPKc:
  390|  1.67M|{
  391|       |    // QIntC::to_int does range checking
  392|  1.67M|    return QIntC::to_int(string_to_ll(str));
  393|  1.67M|}
_ZN5QUtil21unsigned_char_pointerERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  442|  2.53M|{
  443|  2.53M|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str.c_str()));
  444|  2.53M|}
_ZN5QUtil21unsigned_char_pointerEPKc:
  448|  9.08M|{
  449|  9.08M|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str));
  450|  9.08M|}
_ZN5QUtil16make_unique_cstrERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  712|  1.50k|{
  713|  1.50k|    auto result = std::make_unique<char[]>(str.length() + 1);
  714|       |    // Use memcpy in case string contains nulls
  715|  1.50k|    result.get()[str.length()] = '\0';
  716|  1.50k|    memcpy(result.get(), str.c_str(), str.length());
  717|  1.50k|    return result;
  718|  1.50k|}
_ZN5QUtil10hex_encodeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  722|  4.09k|{
  723|  4.09k|    static auto constexpr hexchars = "0123456789abcdef";
  724|  4.09k|    std::string result;
  725|  4.09k|    result.reserve(2 * input.length());
  726|  65.4k|    for (const char c: input) {
  ------------------
  |  Branch (726:22): [True: 65.4k, False: 4.09k]
  ------------------
  727|  65.4k|        result += hexchars[static_cast<unsigned char>(c) >> 4];
  728|  65.4k|        result += hexchars[c & 0x0f];
  729|  65.4k|    }
  730|  4.09k|    return result;
  731|  4.09k|}
_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|}
_ZN5QUtil21getRandomDataProviderEv:
 1120|   227k|{
 1121|   227k|    return getRandomDataProviderProvider()->getProvider();
 1122|   227k|}
_ZN5QUtil25initializeWithRandomBytesEPhm:
 1126|   227k|{
 1127|   227k|    getRandomDataProvider()->provideRandomData(data, len);
 1128|   227k|}
QUtil.cc:_ZL29getRandomDataProviderProviderv:
 1106|   227k|{
 1107|       |    // Thread-safe static initializer
 1108|   227k|    static RandomDataProviderProvider rdpp;
 1109|   227k|    return &rdpp;
 1110|   227k|}
QUtil.cc:_ZN12_GLOBAL__N_126RandomDataProviderProviderC2Ev:
 1088|      1|{
 1089|      1|    this->current_provider = default_provider;
 1090|      1|}
QUtil.cc:_ZN12_GLOBAL__N_126RandomDataProviderProvider11getProviderEv:
 1094|   227k|{
 1095|   227k|    return this->current_provider;
 1096|   227k|}
QUtil.cc:_ZL27int_to_string_base_internalIxENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEET_ii:
  295|   288k|{
  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|   288k|    if (!((base == 8) || (base == 10) || (base == 16))) {
  ------------------
  |  Branch (299:11): [True: 1.74k, False: 286k]
  |  Branch (299:26): [True: 286k, 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|   288k|    std::string cvt;
  303|   288k|    if (base == 10) {
  ------------------
  |  Branch (303:9): [True: 286k, False: 1.74k]
  ------------------
  304|       |        // Use the more efficient std::to_string when possible
  305|   286k|        cvt = std::to_string(num);
  306|   286k|    } else {
  307|  1.74k|        std::ostringstream buf;
  308|  1.74k|        buf.imbue(std::locale::classic());
  309|  1.74k|        buf << std::setbase(base) << std::nouppercase << num;
  310|  1.74k|        cvt = buf.str();
  311|  1.74k|    }
  312|   288k|    std::string result;
  313|   288k|    int str_length = QIntC::to_int(cvt.length());
  314|   288k|    if ((length > 0) && (str_length < length)) {
  ------------------
  |  Branch (314:9): [True: 288k, False: 0]
  |  Branch (314:25): [True: 287k, False: 1.41k]
  ------------------
  315|   287k|        result.append(QIntC::to_size(length - str_length), '0');
  316|   287k|    }
  317|   288k|    result += cvt;
  318|   288k|    if ((length < 0) && (str_length < -length)) {
  ------------------
  |  Branch (318:9): [True: 0, False: 288k]
  |  Branch (318:25): [True: 0, False: 0]
  ------------------
  319|      0|        result.append(QIntC::to_size(-length - str_length), ' ');
  320|      0|    }
  321|   288k|    return result;
  322|   288k|}

_ZN3RC4C2EPKhi:
    7|  15.1k|{
    8|  15.1k|    this->crypto->RC4_init(key_data, key_len);
    9|  15.1k|}
_ZN3RC47processEPKhmPh:
   13|  15.1k|{
   14|  15.1k|    this->crypto->RC4_process(in_data, len, out_data);
   15|  15.1k|}

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

_ZN17SF_FlateLzwDecodeC2Eb:
   18|  30.7k|{
   19|  30.7k|}
_ZN17SF_FlateLzwDecode14setDecodeParmsE16QPDFObjectHandle:
   23|  30.6k|{
   24|  30.6k|    if (decode_parms.isNull()) {
  ------------------
  |  Branch (24:9): [True: 28.6k, False: 1.98k]
  ------------------
   25|  28.6k|        return true;
   26|  28.6k|    }
   27|       |
   28|  1.98k|    bool filterable = true;
   29|  1.98k|    std::set<std::string> keys = decode_parms.getKeys();
   30|  6.00k|    for (auto const& key: keys) {
  ------------------
  |  Branch (30:25): [True: 6.00k, False: 1.98k]
  ------------------
   31|  6.00k|        QPDFObjectHandle value = decode_parms.getKey(key);
   32|  6.00k|        if (key == "/Predictor") {
  ------------------
  |  Branch (32:13): [True: 1.89k, False: 4.11k]
  ------------------
   33|  1.89k|            if (value.isInteger()) {
  ------------------
  |  Branch (33:17): [True: 1.88k, False: 5]
  ------------------
   34|  1.88k|                this->predictor = value.getIntValueAsInt();
   35|  1.88k|                if (!((this->predictor == 1) || (this->predictor == 2) ||
  ------------------
  |  Branch (35:23): [True: 3, False: 1.88k]
  |  Branch (35:49): [True: 27, False: 1.85k]
  ------------------
   36|  1.88k|                      ((this->predictor >= 10) && (this->predictor <= 15)))) {
  ------------------
  |  Branch (36:24): [True: 1.85k, False: 1]
  |  Branch (36:51): [True: 1.85k, False: 5]
  ------------------
   37|      6|                    filterable = false;
   38|      6|                }
   39|  1.88k|            } else {
   40|      5|                filterable = false;
   41|      5|            }
   42|  4.11k|        } else if ((key == "/Columns") || (key == "/Colors") || (key == "/BitsPerComponent")) {
  ------------------
  |  Branch (42:20): [True: 1.88k, False: 2.22k]
  |  Branch (42:43): [True: 595, False: 1.63k]
  |  Branch (42:65): [True: 456, False: 1.17k]
  ------------------
   43|  2.93k|            if (value.isInteger()) {
  ------------------
  |  Branch (43:17): [True: 2.93k, False: 6]
  ------------------
   44|  2.93k|                int val = value.getIntValueAsInt();
   45|  2.93k|                if (key == "/Columns") {
  ------------------
  |  Branch (45:21): [True: 1.88k, False: 1.05k]
  ------------------
   46|  1.88k|                    this->columns = val;
   47|  1.88k|                } else if (key == "/Colors") {
  ------------------
  |  Branch (47:28): [True: 595, False: 455]
  ------------------
   48|    595|                    this->colors = val;
   49|    595|                } else if (key == "/BitsPerComponent") {
  ------------------
  |  Branch (49:28): [True: 455, False: 0]
  ------------------
   50|    455|                    this->bits_per_component = val;
   51|    455|                }
   52|  2.93k|            } else {
   53|      6|                filterable = false;
   54|      6|            }
   55|  2.93k|        } else if (lzw && (key == "/EarlyChange")) {
  ------------------
  |  Branch (55:20): [True: 113, False: 1.06k]
  |  Branch (55:27): [True: 0, False: 113]
  ------------------
   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|  6.00k|    }
   67|       |
   68|  1.98k|    if ((this->predictor > 1) && (this->columns == 0)) {
  ------------------
  |  Branch (68:9): [True: 1.88k, False: 102]
  |  Branch (68:34): [True: 1, False: 1.88k]
  ------------------
   69|      1|        filterable = false;
   70|      1|    }
   71|       |
   72|  1.98k|    return filterable;
   73|  30.6k|}
_ZN17SF_FlateLzwDecode17getDecodePipelineEP8Pipeline:
   77|  30.6k|{
   78|  30.6k|    std::shared_ptr<Pipeline> pipeline;
   79|  30.6k|    if ((this->predictor >= 10) && (this->predictor <= 15)) {
  ------------------
  |  Branch (79:9): [True: 1.84k, False: 28.7k]
  |  Branch (79:36): [True: 1.84k, False: 0]
  ------------------
   80|  1.84k|        QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter");
   81|  1.84k|        pipeline = std::make_shared<Pl_PNGFilter>(
   82|  1.84k|            "png decode",
   83|  1.84k|            next,
   84|  1.84k|            Pl_PNGFilter::a_decode,
   85|  1.84k|            QIntC::to_uint(this->columns),
   86|  1.84k|            QIntC::to_uint(this->colors),
   87|  1.84k|            QIntC::to_uint(this->bits_per_component));
   88|  1.84k|        this->pipelines.push_back(pipeline);
   89|  1.84k|        next = pipeline.get();
   90|  28.7k|    } else if (this->predictor == 2) {
  ------------------
  |  Branch (90:16): [True: 27, False: 28.7k]
  ------------------
   91|     27|        QTC::TC("qpdf", "SF_FlateLzwDecode TIFF predictor");
   92|     27|        pipeline = std::make_shared<Pl_TIFFPredictor>(
   93|     27|            "tiff decode",
   94|     27|            next,
   95|     27|            Pl_TIFFPredictor::a_decode,
   96|     27|            QIntC::to_uint(this->columns),
   97|     27|            QIntC::to_uint(this->colors),
   98|     27|            QIntC::to_uint(this->bits_per_component));
   99|     27|        this->pipelines.push_back(pipeline);
  100|     27|        next = pipeline.get();
  101|     27|    }
  102|       |
  103|  30.6k|    if (lzw) {
  ------------------
  |  Branch (103:9): [True: 604, False: 30.0k]
  ------------------
  104|    604|        pipeline = std::make_shared<Pl_LZWDecoder>("lzw decode", next, early_code_change);
  105|  30.0k|    } else {
  106|  30.0k|        pipeline = std::make_shared<Pl_Flate>("stream inflate", next, Pl_Flate::a_inflate);
  107|  30.0k|    }
  108|  30.6k|    this->pipelines.push_back(pipeline);
  109|  30.6k|    return pipeline.get();
  110|  30.6k|}
_ZN17SF_FlateLzwDecode13flate_factoryEv:
  114|  30.1k|{
  115|  30.1k|    return std::make_shared<SF_FlateLzwDecode>(false);
  116|  30.1k|}
_ZN17SF_FlateLzwDecode11lzw_factoryEv:
  120|    604|{
  121|    604|    return std::make_shared<SF_FlateLzwDecode>(true);
  122|    604|}

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

_ZN24SecureRandomDataProvider17provideRandomDataEPhm:
   80|   227k|{
   81|       |# if defined(_WIN32)
   82|       |
   83|       |    // Optimization: make the WindowsCryptProvider static as long as
   84|       |    // it can be done in a thread-safe fashion.
   85|       |    WindowsCryptProvider c;
   86|       |    if (!CryptGenRandom(c.crypt_prov, static_cast<DWORD>(len), reinterpret_cast<BYTE*>(data))) {
   87|       |        throw std::runtime_error("unable to generate secure random data");
   88|       |    }
   89|       |
   90|       |# else
   91|   227k|    static std::unique_ptr<QUtil::FileCloser> random_device = []() {
   92|   227k|        FILE* f = fopen("/dev/urandom", "rb");
   93|   227k|        if (f == nullptr) {
   94|   227k|            f = fopen("/dev/arandom", "rb");
   95|   227k|        }
   96|   227k|        if (f == nullptr) {
   97|   227k|            f = fopen("/dev/random", "rb");
   98|   227k|        }
   99|   227k|        if (f == nullptr) {
  100|   227k|            throw std::runtime_error("unable to find device in /dev for generating random numbers");
  101|   227k|        }
  102|   227k|        return std::make_unique<QUtil::FileCloser>(f);
  103|   227k|    }();
  104|       |
  105|   227k|    size_t fr = fread(data, 1, len, random_device->f);
  106|   227k|    if (fr != len) {
  ------------------
  |  Branch (106:9): [True: 0, False: 227k]
  ------------------
  107|      0|        throw std::runtime_error(
  108|      0|            "unable to read " + std::to_string(len) + " bytes from random number device");
  109|      0|    }
  110|       |
  111|   227k|# endif
  112|   227k|}
_ZN24SecureRandomDataProvider11getInstanceEv:
  116|      1|{
  117|      1|    static SecureRandomDataProvider instance;
  118|      1|    return &instance;
  119|      1|}
SecureRandomDataProvider.cc:_ZZN24SecureRandomDataProvider17provideRandomDataEPhmENK3$_0clEv:
   91|      1|    static std::unique_ptr<QUtil::FileCloser> random_device = []() {
   92|      1|        FILE* f = fopen("/dev/urandom", "rb");
   93|      1|        if (f == nullptr) {
  ------------------
  |  Branch (93:13): [True: 0, False: 1]
  ------------------
   94|      0|            f = fopen("/dev/arandom", "rb");
   95|      0|        }
   96|      1|        if (f == nullptr) {
  ------------------
  |  Branch (96:13): [True: 0, False: 1]
  ------------------
   97|      0|            f = fopen("/dev/random", "rb");
   98|      0|        }
   99|      1|        if (f == nullptr) {
  ------------------
  |  Branch (99:13): [True: 0, False: 1]
  ------------------
  100|      0|            throw std::runtime_error("unable to find device in /dev for generating random numbers");
  101|      0|        }
  102|      1|        return std::make_unique<QUtil::FileCloser>(f);
  103|      1|    }();

_ZN14AES_PDF_nativeD2Ev:
   18|  1.38M|    ~AES_PDF_native() = default;

_ZN8ObjTableIN10QPDFWriter6ObjectEEC2Ev:
   32|  8.75k|    ObjTable() = default;
_ZN8ObjTableIN10QPDFWriter9NewObjectEEC2Ev:
   32|  8.75k|    ObjTable() = default;
_ZN8ObjTableIN10QPDFWriter9NewObjectEEixEi:
   81|   955k|    {
   82|   955k|        return element(static_cast<size_t>(id));
   83|   955k|    }
_ZN8ObjTableIN10QPDFWriter9NewObjectEE7elementEm:
  149|   955k|    {
  150|   955k|        if (idx < std::vector<T>::size()) {
  ------------------
  |  Branch (150:13): [True: 925k, False: 29.8k]
  ------------------
  151|   925k|            return std::vector<T>::operator[](idx);
  152|   925k|        }
  153|  29.8k|        return large_element(idx);
  154|   955k|    }
_ZN8ObjTableIN10QPDFWriter9NewObjectEE13large_elementEm:
  159|  29.8k|    {
  160|  29.8k|        static const size_t max_size = std::vector<T>::max_size();
  161|  29.8k|        if (idx < min_sparse) {
  ------------------
  |  Branch (161:13): [True: 124, False: 29.7k]
  ------------------
  162|    124|            min_sparse = idx;
  163|    124|        }
  164|  29.8k|        if (idx < max_size) {
  ------------------
  |  Branch (164:13): [True: 29.8k, False: 0]
  ------------------
  165|  29.8k|            return sparse_elements[idx];
  166|  29.8k|        }
  167|      0|        throw std::runtime_error("Impossibly large object id encountered accessing ObjTable");
  168|      0|        return element(0); // doesn't return
  169|  29.8k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEEixE10QPDFObjGen:
   87|  1.72M|    {
   88|  1.72M|        return element(static_cast<size_t>(og.getObj()));
   89|  1.72M|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEE7elementEm:
  149|  2.74M|    {
  150|  2.74M|        if (idx < std::vector<T>::size()) {
  ------------------
  |  Branch (150:13): [True: 2.66M, False: 85.1k]
  ------------------
  151|  2.66M|            return std::vector<T>::operator[](idx);
  152|  2.66M|        }
  153|  85.1k|        return large_element(idx);
  154|  2.74M|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEE13large_elementEm:
  159|  85.1k|    {
  160|  85.1k|        static const size_t max_size = std::vector<T>::max_size();
  161|  85.1k|        if (idx < min_sparse) {
  ------------------
  |  Branch (161:13): [True: 988, False: 84.1k]
  ------------------
  162|    988|            min_sparse = idx;
  163|    988|        }
  164|  85.1k|        if (idx < max_size) {
  ------------------
  |  Branch (164:13): [True: 85.1k, False: 0]
  ------------------
  165|  85.1k|            return sparse_elements[idx];
  166|  85.1k|        }
  167|      0|        throw std::runtime_error("Impossibly large object id encountered accessing ObjTable");
  168|      0|        return element(0); // doesn't return
  169|  85.1k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEEixE16QPDFObjectHandle:
   93|  1.01M|    {
   94|  1.01M|        return element(static_cast<size_t>(oh.getObjectID()));
   95|  1.01M|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEE6resizeEm:
  117|  8.26k|    {
  118|  8.26k|        std::vector<T>::resize(a_size);
  119|  8.26k|        if (a_size > min_sparse) {
  ------------------
  |  Branch (119:13): [True: 0, False: 8.26k]
  ------------------
  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|  8.26k|    }
_ZN8ObjTableIN10QPDFWriter9NewObjectEE6resizeEm:
  117|  8.26k|    {
  118|  8.26k|        std::vector<T>::resize(a_size);
  119|  8.26k|        if (a_size > min_sparse) {
  ------------------
  |  Branch (119:13): [True: 0, False: 8.26k]
  ------------------
  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|  8.26k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEE7forEachENSt3__18functionIFviRKS1_EEE:
  132|    776|    {
  133|    776|        int i = 0;
  134|   249k|        for (auto const& item: *this) {
  ------------------
  |  Branch (134:30): [True: 249k, False: 776]
  ------------------
  135|   249k|            fn(i++, item);
  136|   249k|        }
  137|    776|        for (auto const& [id, item]: sparse_elements) {
  ------------------
  |  Branch (137:36): [True: 18, False: 776]
  ------------------
  138|     18|            fn(QIntC::to_int(id), item);
  139|     18|        }
  140|    776|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEE8containsE16QPDFObjectHandle:
   74|  29.5k|    {
   75|  29.5k|        return contains(static_cast<size_t>(oh.getObjectID()));
   76|  29.5k|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEE8containsEm:
   62|  77.1k|    {
   63|  77.1k|        return idx < std::vector<T>::size() || sparse_elements.count(idx);
  ------------------
  |  Branch (63:16): [True: 75.6k, False: 1.53k]
  |  Branch (63:48): [True: 30, False: 1.50k]
  ------------------
   64|  77.1k|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEEixE16QPDFObjectHandle:
   56|  32.3k|    {
   57|  32.3k|        return element(static_cast<size_t>(oh.getObjectID()));
   58|  32.3k|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEE7elementEm:
  173|   144k|    {
  174|   144k|        static const size_t max_size = std::vector<T>::max_size();
  175|   144k|        if (idx < std::vector<T>::size()) {
  ------------------
  |  Branch (175:13): [True: 142k, False: 2.41k]
  ------------------
  176|   142k|            return std::vector<T>::operator[](idx);
  177|   142k|        }
  178|  2.41k|        if (idx < max_size) {
  ------------------
  |  Branch (178:13): [True: 2.41k, False: 0]
  ------------------
  179|  2.41k|            return sparse_elements.at(idx);
  180|  2.41k|        }
  181|      0|        throw std::runtime_error("Impossibly large object id encountered accessing ObjTable");
  182|      0|        return element(0); // doesn't return
  183|  2.41k|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEEixEi:
   44|  50.6k|    {
   45|  50.6k|        return element(static_cast<size_t>(idx));
   46|  50.6k|    }
_ZNK8ObjTableIN10QPDFWriter9NewObjectEEixEi:
   44|   113k|    {
   45|   113k|        return element(static_cast<size_t>(idx));
   46|   113k|    }
_ZNK8ObjTableIN10QPDFWriter9NewObjectEE7elementEm:
  173|   113k|    {
  174|   113k|        static const size_t max_size = std::vector<T>::max_size();
  175|   113k|        if (idx < std::vector<T>::size()) {
  ------------------
  |  Branch (175:13): [True: 110k, False: 2.76k]
  ------------------
  176|   110k|            return std::vector<T>::operator[](idx);
  177|   110k|        }
  178|  2.76k|        if (idx < max_size) {
  ------------------
  |  Branch (178:13): [True: 2.76k, False: 0]
  ------------------
  179|  2.76k|            return sparse_elements.at(idx);
  180|  2.76k|        }
  181|      0|        throw std::runtime_error("Impossibly large object id encountered accessing ObjTable");
  182|      0|        return element(0); // doesn't return
  183|  2.76k|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEE8containsE10QPDFObjGen:
   68|  47.6k|    {
   69|  47.6k|        return contains(static_cast<size_t>(og.getObj()));
   70|  47.6k|    }
_ZNK8ObjTableIN10QPDFWriter6ObjectEEixE10QPDFObjGen:
   50|  61.6k|    {
   51|  61.6k|        return element(static_cast<size_t>(og.getObj()));
   52|  61.6k|    }

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

_ZN10Pl_AES_PDFD2Ev:
   21|  1.38M|    ~Pl_AES_PDF() override = default;

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

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

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

_ZN6Pl_RC4D2Ev:
   20|    163|    ~Pl_RC4() override = default;

_ZN7Pl_SHA2D2Ev:
   21|  1.16M|    ~Pl_SHA2() override = default;

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

_ZN17QPDFCrypto_nativeC2Ev:
   14|  2.95M|    QPDFCrypto_native() = default;
_ZN17QPDFCrypto_nativeD2Ev:
   16|  2.95M|    virtual ~QPDFCrypto_native() = default;

_ZN10QPDFObject10disconnectEv:
  148|  4.56M|    {
  149|       |        // Disconnect an object from its owning QPDF. This is called by QPDF's destructor.
  150|  4.56M|        value->disconnect();
  151|  4.56M|        value->qpdf = nullptr;
  152|  4.56M|        value->og = QPDFObjGen();
  153|  4.56M|    }
_ZNK10QPDFObject11getTypeCodeEv:
   58|  1.29M|    {
   59|  1.29M|        return value->type_code;
   60|  1.29M|    }
_ZN10QPDFObject21setDefaultDescriptionEP4QPDFRK10QPDFObjGen:
  136|   460k|    {
  137|       |        // Intended for use by the QPDF class
  138|   460k|        value->setDefaultDescription(qpdf, og);
  139|   460k|    }
_ZN10QPDFObject9setObjGenEP4QPDFRK10QPDFObjGen:
  142|   395k|    {
  143|   395k|        value->qpdf = qpdf;
  144|   395k|        value->og = og;
  145|   395k|    }
_ZN10QPDFObject6assignENSt3__110shared_ptrIS_EE:
  120|   295k|    {
  121|   295k|        value = o->value;
  122|   295k|    }
_ZNK10QPDFObject12isUnresolvedEv:
  159|  1.17M|    {
  160|  1.17M|        return value->type_code == ::ot_unresolved;
  161|  1.17M|    }
_ZNK10QPDFObject2asI11QPDF_StreamEEPT_v:
  171|   885k|    {
  172|   885k|        if (auto result = dynamic_cast<T*>(value.get())) {
  ------------------
  |  Branch (172:18): [True: 885k, False: 40]
  ------------------
  173|   885k|            return result;
  174|   885k|        } else {
  175|     40|            return isUnresolved()
  ------------------
  |  Branch (175:20): [True: 0, False: 40]
  ------------------
  176|     40|                ? dynamic_cast<T*>(QPDF::Resolver::resolved(value->qpdf, value->og)->value.get())
  177|     40|                : nullptr;
  178|     40|        }
  179|   885k|    }
_ZN10QPDFObject4copyEb:
   28|   709k|    {
   29|   709k|        return value->copy(shallow);
   30|   709k|    }
_ZN10QPDFObject7unparseEv:
   33|  3.33M|    {
   34|  3.33M|        return value->unparse();
   35|  3.33M|    }
_ZNK10QPDFObject14getStringValueEv:
   43|  1.56M|    {
   44|  1.56M|        return value->getStringValue();
   45|  1.56M|    }
_ZNK10QPDFObject19getResolvedTypeCodeEv:
   49|  57.7M|    {
   50|  57.7M|        auto tc = value->type_code;
   51|  57.7M|        return tc == ::ot_unresolved
  ------------------
  |  Branch (51:16): [True: 147k, False: 57.5M]
  ------------------
   52|  57.7M|            ? QPDF::Resolver::resolved(value->qpdf, value->og)->value->type_code
   53|  57.7M|            : tc;
   54|  57.7M|    }
_ZNK10QPDFObject7getQPDFEv:
   64|  1.45M|    {
   65|  1.45M|        return value->qpdf;
   66|  1.45M|    }
_ZNK10QPDFObject9getObjGenEv:
   69|  34.8M|    {
   70|  34.8M|        return value->og;
   71|  34.8M|    }
_ZN10QPDFObject14setDescriptionEP4QPDFRNSt3__110shared_ptrINS2_7variantIJNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEN9QPDFValue10JSON_DescrENSB_10ChildDescrEEEEEEx:
   75|  4.45M|    {
   76|  4.45M|        return value->setDescription(qpdf, description, offset);
   77|  4.45M|    }
_ZN10QPDFObject19setChildDescriptionENSt3__110shared_ptrIS_EERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS5_NS0_9allocatorIcEEEE:
   83|    783|    {
   84|    783|        auto qpdf = parent ? parent->value->qpdf : nullptr;
  ------------------
  |  Branch (84:21): [True: 783, False: 0]
  ------------------
   85|    783|        value->setChildDescription(qpdf, parent->value, static_descr, var_descr);
   86|    783|    }
_ZN10QPDFObject19setChildDescriptionENSt3__110shared_ptrI9QPDFValueEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
   92|   873k|    {
   93|   873k|        auto qpdf = parent ? parent->qpdf : nullptr;
  ------------------
  |  Branch (93:21): [True: 873k, False: 0]
  ------------------
   94|   873k|        value->setChildDescription(qpdf, parent, static_descr, var_descr);
   95|   873k|    }
_ZN10QPDFObject14getDescriptionERP4QPDFRNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   98|   106k|    {
   99|   106k|        qpdf = value->qpdf;
  100|   106k|        description = value->getDescription();
  101|   106k|        return qpdf != nullptr;
  102|   106k|    }
_ZN10QPDFObject14hasDescriptionEv:
  105|  89.8k|    {
  106|  89.8k|        return value->hasDescription();
  107|  89.8k|    }
_ZNK10QPDFObject2asI10QPDF_ArrayEEPT_v:
  171|  4.85M|    {
  172|  4.85M|        if (auto result = dynamic_cast<T*>(value.get())) {
  ------------------
  |  Branch (172:18): [True: 4.83M, False: 19.6k]
  ------------------
  173|  4.83M|            return result;
  174|  4.83M|        } else {
  175|  19.6k|            return isUnresolved()
  ------------------
  |  Branch (175:20): [True: 5, False: 19.6k]
  ------------------
  176|  19.6k|                ? dynamic_cast<T*>(QPDF::Resolver::resolved(value->qpdf, value->og)->value.get())
  177|  19.6k|                : nullptr;
  178|  19.6k|        }
  179|  4.85M|    }
_ZNK10QPDFObject2asI15QPDF_DictionaryEEPT_v:
  171|  8.40M|    {
  172|  8.40M|        if (auto result = dynamic_cast<T*>(value.get())) {
  ------------------
  |  Branch (172:18): [True: 8.39M, False: 4.05k]
  ------------------
  173|  8.39M|            return result;
  174|  8.39M|        } else {
  175|  4.05k|            return isUnresolved()
  ------------------
  |  Branch (175:20): [True: 0, False: 4.05k]
  ------------------
  176|  4.05k|                ? dynamic_cast<T*>(QPDF::Resolver::resolved(value->qpdf, value->og)->value.get())
  177|  4.05k|                : nullptr;
  178|  4.05k|        }
  179|  8.40M|    }
_ZNK10QPDFObject2asI12QPDF_IntegerEEPT_v:
  171|   116k|    {
  172|   116k|        if (auto result = dynamic_cast<T*>(value.get())) {
  ------------------
  |  Branch (172:18): [True: 116k, False: 148]
  ------------------
  173|   116k|            return result;
  174|   116k|        } else {
  175|    148|            return isUnresolved()
  ------------------
  |  Branch (175:20): [True: 1, False: 147]
  ------------------
  176|    148|                ? dynamic_cast<T*>(QPDF::Resolver::resolved(value->qpdf, value->og)->value.get())
  177|    148|                : nullptr;
  178|    148|        }
  179|   116k|    }
_ZN10QPDFObjectC2Ev:
   24|  7.07M|    QPDFObject() = default;

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

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

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

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

_ZN15QPDF_DictionaryD2Ev:
   14|  1.15M|    ~QPDF_Dictionary() override = default;

_ZNK9QPDF_Name14getStringValueEv:
   24|  1.39M|    {
   25|  1.39M|        return name;
   26|  1.39M|    }
_ZN9QPDF_NameD2Ev:
    9|  1.19M|    ~QPDF_Name() override = default;

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

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

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

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

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

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

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

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

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

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

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

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

sph_sha224:
  173|   426k|{
  174|   426k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|   426k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|   426k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|   426k|        unsigned current;
  176|   426k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|   426k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   95|   426k|#define SPH_BLEN     64U
  ------------------
  |  Branch (181:13): [True: 40.5k, False: 385k]
  ------------------
  182|  40.5k|                SPH_XCAT(HASH, _short)(cc, data, len);
  ------------------
  |  |   85|  40.5k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  40.5k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  183|  40.5k|                return;
  184|  40.5k|        }
  185|   385k|        sc = cc;
  186|   385k|#if SPH_64
  187|   385k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|   385k|#define SPH_BLEN     64U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|   385k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 385k]
  ------------------
  192|      0|                unsigned t;
  193|       |
  194|      0|                t = SPH_BLEN - current;
  ------------------
  |  |   95|      0|#define SPH_BLEN     64U
  ------------------
  195|      0|                SPH_XCAT(HASH, _short)(cc, data, t);
  ------------------
  |  |   85|      0|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|      0|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  196|      0|                data = (const unsigned char *)data + t;
  197|      0|                len -= t;
  198|      0|        }
  199|       |#if !SPH_UNALIGNED
  200|       |        if (((SPH_UPTR)data & (SPH_WLEN - 1U)) != 0) {
  201|       |                SPH_XCAT(HASH, _short)(cc, data, len);
  202|       |                return;
  203|       |        }
  204|       |#endif
  205|   385k|        orig_len = len;
  206|  28.3M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   95|  28.3M|#define SPH_BLEN     64U
  ------------------
  |  Branch (206:16): [True: 27.9M, False: 385k]
  ------------------
  207|  27.9M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  647|  27.9M|#define RFUN   sha2_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  27.9M|#define SPH_VAL   sc->val
  ------------------
  208|  27.9M|                len -= SPH_BLEN;
  ------------------
  |  |   95|  27.9M|#define SPH_BLEN     64U
  ------------------
  209|  27.9M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   95|  27.9M|#define SPH_BLEN     64U
  ------------------
  210|  27.9M|        }
  211|   385k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 385k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|   385k|#if SPH_64
  214|   385k|        sc->count += (sph_u64)orig_len;
  215|       |#else
  216|       |        clow = sc->count_low;
  217|       |        clow2 = SPH_T32(clow + orig_len);
  218|       |        sc->count_low = clow2;
  219|       |        if (clow2 < clow)
  220|       |                sc->count_high ++;
  221|       |        /*
  222|       |         * This code handles the improbable situation where "size_t" is
  223|       |         * greater than 32 bits, and yet we do not have a 64-bit type.
  224|       |         */
  225|       |        orig_len >>= 12;
  226|       |        orig_len >>= 10;
  227|       |        orig_len >>= 10;
  228|       |        sc->count_high += orig_len;
  229|       |#endif
  230|   385k|}
sha2.c:sha224_short:
  131|  40.5k|{
  132|  40.5k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  40.5k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  40.5k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  133|  40.5k|        unsigned current;
  134|       |
  135|  40.5k|        sc = cc;
  136|  40.5k|#if SPH_64
  137|  40.5k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  40.5k|#define SPH_BLEN     64U
  ------------------
  138|       |#else
  139|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  140|       |#endif
  141|  81.0k|        while (len > 0) {
  ------------------
  |  Branch (141:16): [True: 40.5k, False: 40.5k]
  ------------------
  142|  40.5k|                unsigned clen;
  143|       |#if !SPH_64
  144|       |                sph_u32 clow, clow2;
  145|       |#endif
  146|       |
  147|  40.5k|                clen = SPH_BLEN - current;
  ------------------
  |  |   95|  40.5k|#define SPH_BLEN     64U
  ------------------
  148|  40.5k|                if (clen > len)
  ------------------
  |  Branch (148:21): [True: 40.5k, False: 0]
  ------------------
  149|  40.5k|                        clen = (unsigned)len;
  150|  40.5k|                memcpy(sc->buf + current, data, clen);
  151|  40.5k|                data = (const unsigned char *)data + clen;
  152|  40.5k|                current += clen;
  153|  40.5k|                len -= clen;
  154|  40.5k|                if (current == SPH_BLEN) {
  ------------------
  |  |   95|  40.5k|#define SPH_BLEN     64U
  ------------------
  |  Branch (154:21): [True: 0, False: 40.5k]
  ------------------
  155|      0|                        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|      0|#define RFUN   sha2_round
  ------------------
                                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|      0|#define SPH_VAL   sc->val
  ------------------
  156|      0|                        current = 0;
  157|      0|                }
  158|  40.5k|#if SPH_64
  159|  40.5k|                sc->count += clen;
  160|       |#else
  161|       |                clow = sc->count_low;
  162|       |                clow2 = SPH_T32(clow + clen);
  163|       |                sc->count_low = clow2;
  164|       |                if (clow2 < clow)
  165|       |                        sc->count_high ++;
  166|       |#endif
  167|  40.5k|        }
  168|  40.5k|}
sha2.c:sha224_close:
  345|   402k|{
  346|   402k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|   402k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|   402k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|   402k|}
sha2.c:sha224_addbits_and_close:
  242|   402k|{
  243|   402k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|   402k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|   402k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|   402k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|   402k|        sc = cc;
  250|   402k|#if SPH_64
  251|   402k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|   402k|#define SPH_BLEN     64U
  ------------------
  252|       |#else
  253|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  254|       |#endif
  255|       |#ifdef PW01
  256|       |        sc->buf[current ++] = (0x100 | (ub & 0xFF)) >> (8 - n);
  257|       |#else
  258|   402k|        {
  259|   402k|                unsigned z;
  260|       |
  261|   402k|                z = 0x80U >> n;
  262|   402k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|   402k|        }
  264|   402k|#endif
  265|   402k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|   402k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|   402k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|   402k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 8.19k, False: 394k]
  ------------------
  266|  8.19k|                memset(sc->buf + current, 0, SPH_BLEN - current);
  ------------------
  |  |   95|  8.19k|#define SPH_BLEN     64U
  ------------------
  267|  8.19k|                RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|  8.19k|#define RFUN   sha2_round
  ------------------
                              RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  8.19k|#define SPH_VAL   sc->val
  ------------------
  268|  8.19k|                memset(sc->buf, 0, SPH_MAXPAD);
  ------------------
  |  |  110|  8.19k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  8.19k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  8.19k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  269|   394k|        } else {
  270|   394k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|   394k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|   394k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|   394k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  271|   394k|        }
  272|       |#if defined BE64
  273|       |#if defined PLW1
  274|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  275|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  276|       |#elif defined PLW4
  277|       |        memset(sc->buf + SPH_MAXPAD, 0, 2 * SPH_WLEN);
  278|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN,
  279|       |                sc->count >> 61);
  280|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 3 * SPH_WLEN,
  281|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  282|       |#else
  283|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD, sc->count >> 61);
  284|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  285|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  286|       |#endif
  287|       |#elif defined LE64
  288|       |#if defined PLW1
  289|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  290|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  291|       |#elif defined PLW1
  292|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  293|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  294|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61);
  295|       |        memset(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN, 0, 2 * SPH_WLEN);
  296|       |#else
  297|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  298|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  299|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61);
  300|       |#endif
  301|       |#else
  302|   402k|#if SPH_64
  303|   402k|#ifdef BE32
  304|   402k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  ------------------
  |  |  110|   402k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|   402k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|   402k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  305|   402k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|   402k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|   402k|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  ------------------
  ------------------
  306|       |#else
  307|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  308|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  309|       |#endif
  310|       |#else
  311|       |        low = sc->count_low;
  312|       |        high = SPH_T32((sc->count_high << 3) | (low >> 29));
  313|       |        low = SPH_T32(low << 3) + (sph_u32)n;
  314|       |#ifdef BE32
  315|       |        sph_enc32be(sc->buf + SPH_MAXPAD, high);
  316|       |        sph_enc32be(sc->buf + SPH_MAXPAD + SPH_WLEN, low);
  317|       |#else
  318|       |        sph_enc32le(sc->buf + SPH_MAXPAD, low);
  319|       |        sph_enc32le(sc->buf + SPH_MAXPAD + SPH_WLEN, high);
  320|       |#endif
  321|       |#endif
  322|   402k|#endif
  323|   402k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|   402k|#define RFUN   sha2_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|   402k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|  3.62M|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 3.21M, False: 402k]
  ------------------
  330|       |#if defined BE64
  331|       |                sph_enc64be((unsigned char *)dst + 8 * u, sc->val[u]);
  332|       |#elif defined LE64
  333|       |                sph_enc64le((unsigned char *)dst + 8 * u, sc->val[u]);
  334|       |#elif defined BE32
  335|       |                sph_enc32be((unsigned char *)dst + 4 * u, sc->val[u]);
  336|       |#else
  337|       |                sph_enc32le((unsigned char *)dst + 4 * u, sc->val[u]);
  338|       |#endif
  339|  3.21M|        }
  340|   402k|#endif
  341|   402k|}
sph_sha384:
  173|   765k|{
  174|   765k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|   765k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|   765k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|   765k|        unsigned current;
  176|   765k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|   765k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   92|   765k|#define SPH_BLEN    128U
  ------------------
  |  Branch (181:13): [True: 0, False: 765k]
  ------------------
  182|      0|                SPH_XCAT(HASH, _short)(cc, data, len);
  ------------------
  |  |   85|      0|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|      0|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  183|      0|                return;
  184|      0|        }
  185|   765k|        sc = cc;
  186|   765k|#if SPH_64
  187|   765k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|   765k|#define SPH_BLEN    128U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|   765k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 765k]
  ------------------
  192|      0|                unsigned t;
  193|       |
  194|      0|                t = SPH_BLEN - current;
  ------------------
  |  |   92|      0|#define SPH_BLEN    128U
  ------------------
  195|      0|                SPH_XCAT(HASH, _short)(cc, data, t);
  ------------------
  |  |   85|      0|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|      0|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  196|      0|                data = (const unsigned char *)data + t;
  197|      0|                len -= t;
  198|      0|        }
  199|       |#if !SPH_UNALIGNED
  200|       |        if (((SPH_UPTR)data & (SPH_WLEN - 1U)) != 0) {
  201|       |                SPH_XCAT(HASH, _short)(cc, data, len);
  202|       |                return;
  203|       |        }
  204|       |#endif
  205|   765k|        orig_len = len;
  206|  28.1M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   92|  28.1M|#define SPH_BLEN    128U
  ------------------
  |  Branch (206:16): [True: 27.4M, False: 765k]
  ------------------
  207|  27.4M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  202|  27.4M|#define RFUN   sha3_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  27.4M|#define SPH_VAL   sc->val
  ------------------
  208|  27.4M|                len -= SPH_BLEN;
  ------------------
  |  |   92|  27.4M|#define SPH_BLEN    128U
  ------------------
  209|  27.4M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   92|  27.4M|#define SPH_BLEN    128U
  ------------------
  210|  27.4M|        }
  211|   765k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 733k, False: 31.5k]
  ------------------
  212|   733k|                memcpy(sc->buf, data, len);
  213|   765k|#if SPH_64
  214|   765k|        sc->count += (sph_u64)orig_len;
  215|       |#else
  216|       |        clow = sc->count_low;
  217|       |        clow2 = SPH_T32(clow + orig_len);
  218|       |        sc->count_low = clow2;
  219|       |        if (clow2 < clow)
  220|       |                sc->count_high ++;
  221|       |        /*
  222|       |         * This code handles the improbable situation where "size_t" is
  223|       |         * greater than 32 bits, and yet we do not have a 64-bit type.
  224|       |         */
  225|       |        orig_len >>= 12;
  226|       |        orig_len >>= 10;
  227|       |        orig_len >>= 10;
  228|       |        sc->count_high += orig_len;
  229|       |#endif
  230|   765k|}
sha2big.c:sha384_close:
  345|   765k|{
  346|   765k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|   765k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|   765k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|   765k|}
sha2big.c:sha384_addbits_and_close:
  242|   765k|{
  243|   765k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|   765k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|   765k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|   765k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|   765k|        sc = cc;
  250|   765k|#if SPH_64
  251|   765k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|   765k|#define SPH_BLEN    128U
  ------------------
  252|       |#else
  253|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  254|       |#endif
  255|       |#ifdef PW01
  256|       |        sc->buf[current ++] = (0x100 | (ub & 0xFF)) >> (8 - n);
  257|       |#else
  258|   765k|        {
  259|   765k|                unsigned z;
  260|       |
  261|   765k|                z = 0x80U >> n;
  262|   765k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|   765k|        }
  264|   765k|#endif
  265|   765k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|   765k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|   765k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|   765k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 0, False: 765k]
  ------------------
  266|      0|                memset(sc->buf + current, 0, SPH_BLEN - current);
  ------------------
  |  |   92|      0|#define SPH_BLEN    128U
  ------------------
  267|      0|                RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  202|      0|#define RFUN   sha3_round
  ------------------
                              RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|      0|#define SPH_VAL   sc->val
  ------------------
  268|      0|                memset(sc->buf, 0, SPH_MAXPAD);
  ------------------
  |  |  110|      0|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|      0|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|      0|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  269|   765k|        } else {
  270|   765k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|   765k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|   765k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|   765k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  271|   765k|        }
  272|   765k|#if defined BE64
  273|       |#if defined PLW1
  274|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  275|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  276|       |#elif defined PLW4
  277|       |        memset(sc->buf + SPH_MAXPAD, 0, 2 * SPH_WLEN);
  278|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN,
  279|       |                sc->count >> 61);
  280|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 3 * SPH_WLEN,
  281|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  282|       |#else
  283|   765k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD, sc->count >> 61);
  ------------------
  |  |  110|   765k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|   765k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|   765k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  284|   765k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |  110|   765k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|   765k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|   765k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
                      sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |   93|   765k|#define SPH_WLEN      8U
  ------------------
  285|   765k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|   765k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|   765k|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  ------------------
  ------------------
  286|   765k|#endif
  287|       |#elif defined LE64
  288|       |#if defined PLW1
  289|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  290|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  291|       |#elif defined PLW1
  292|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  293|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  294|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61);
  295|       |        memset(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN, 0, 2 * SPH_WLEN);
  296|       |#else
  297|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  298|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  299|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61);
  300|       |#endif
  301|       |#else
  302|       |#if SPH_64
  303|       |#ifdef BE32
  304|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  305|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  306|       |#else
  307|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  308|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  309|       |#endif
  310|       |#else
  311|       |        low = sc->count_low;
  312|       |        high = SPH_T32((sc->count_high << 3) | (low >> 29));
  313|       |        low = SPH_T32(low << 3) + (sph_u32)n;
  314|       |#ifdef BE32
  315|       |        sph_enc32be(sc->buf + SPH_MAXPAD, high);
  316|       |        sph_enc32be(sc->buf + SPH_MAXPAD + SPH_WLEN, low);
  317|       |#else
  318|       |        sph_enc32le(sc->buf + SPH_MAXPAD, low);
  319|       |        sph_enc32le(sc->buf + SPH_MAXPAD + SPH_WLEN, high);
  320|       |#endif
  321|       |#endif
  322|       |#endif
  323|   765k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  202|   765k|#define RFUN   sha3_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|   765k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|  6.12M|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 5.36M, False: 765k]
  ------------------
  330|  5.36M|#if defined BE64
  331|  5.36M|                sph_enc64be((unsigned char *)dst + 8 * u, sc->val[u]);
  332|       |#elif defined LE64
  333|       |                sph_enc64le((unsigned char *)dst + 8 * u, sc->val[u]);
  334|       |#elif defined BE32
  335|       |                sph_enc32be((unsigned char *)dst + 4 * u, sc->val[u]);
  336|       |#else
  337|       |                sph_enc32le((unsigned char *)dst + 4 * u, sc->val[u]);
  338|       |#endif
  339|  5.36M|        }
  340|   765k|#endif
  341|   765k|}

sha2.c:sph_dec32be_aligned:
 1471|   454M|{
 1472|   454M|#if SPH_LITTLE_ENDIAN
 1473|   454M|        return sph_bswap32(*(const sph_u32 *)src);
 1474|       |#elif SPH_BIG_ENDIAN
 1475|       |        return *(const sph_u32 *)src;
 1476|       |#else
 1477|       |        return ((sph_u32)(((const unsigned char *)src)[0]) << 24)
 1478|       |                | ((sph_u32)(((const unsigned char *)src)[1]) << 16)
 1479|       |                | ((sph_u32)(((const unsigned char *)src)[2]) << 8)
 1480|       |                | (sph_u32)(((const unsigned char *)src)[3]);
 1481|       |#endif
 1482|   454M|}
sha2.c:sph_bswap32:
 1220|   457M|{
 1221|   457M|        __asm__ __volatile__ ("bswapl %0" : "=r" (x) : "0" (x));
 1222|   457M|        return x;
 1223|   457M|}
sha2.c:sph_enc64be_aligned:
 1706|   402k|{
 1707|   402k|#if SPH_LITTLE_ENDIAN
 1708|   402k|        *(sph_u64 *)dst = sph_bswap64(val);
 1709|       |#elif SPH_BIG_ENDIAN
 1710|       |        *(sph_u64 *)dst = val;
 1711|       |#else
 1712|       |        ((unsigned char *)dst)[0] = (unsigned char)(val >> 56);
 1713|       |        ((unsigned char *)dst)[1] = (unsigned char)(val >> 48);
 1714|       |        ((unsigned char *)dst)[2] = (unsigned char)(val >> 40);
 1715|       |        ((unsigned char *)dst)[3] = (unsigned char)(val >> 32);
 1716|       |        ((unsigned char *)dst)[4] = (unsigned char)(val >> 24);
 1717|       |        ((unsigned char *)dst)[5] = (unsigned char)(val >> 16);
 1718|       |        ((unsigned char *)dst)[6] = (unsigned char)(val >> 8);
 1719|       |        ((unsigned char *)dst)[7] = (unsigned char)(val);
 1720|       |#endif
 1721|   402k|}
sha2.c:sph_bswap64:
 1229|   402k|{
 1230|   402k|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|   402k|        return x;
 1232|   402k|}
sha2.c:sph_enc32be:
 1374|  3.21M|{
 1375|  3.21M|#if defined SPH_UPTR
 1376|  3.21M|#if SPH_UNALIGNED
 1377|  3.21M|#if SPH_LITTLE_ENDIAN
 1378|  3.21M|        val = sph_bswap32(val);
 1379|  3.21M|#endif
 1380|  3.21M|        *(sph_u32 *)dst = val;
 1381|       |#else
 1382|       |        if (((SPH_UPTR)dst & 3) == 0) {
 1383|       |#if SPH_LITTLE_ENDIAN
 1384|       |                val = sph_bswap32(val);
 1385|       |#endif
 1386|       |                *(sph_u32 *)dst = val;
 1387|       |        } else {
 1388|       |                ((unsigned char *)dst)[0] = (unsigned char)(val >> 24);
 1389|       |                ((unsigned char *)dst)[1] = (unsigned char)(val >> 16);
 1390|       |                ((unsigned char *)dst)[2] = (unsigned char)(val >> 8);
 1391|       |                ((unsigned char *)dst)[3] = (unsigned char)(val);
 1392|       |        }
 1393|       |#endif
 1394|       |#else
 1395|       |        ((unsigned char *)dst)[0] = (unsigned char)(val >> 24);
 1396|       |        ((unsigned char *)dst)[1] = (unsigned char)(val >> 16);
 1397|       |        ((unsigned char *)dst)[2] = (unsigned char)(val >> 8);
 1398|       |        ((unsigned char *)dst)[3] = (unsigned char)(val);
 1399|       |#endif
 1400|  3.21M|}
sha2big.c:sph_dec64be_aligned:
 1778|   451M|{
 1779|   451M|#if SPH_LITTLE_ENDIAN
 1780|   451M|        return sph_bswap64(*(const sph_u64 *)src);
 1781|       |#elif SPH_BIG_ENDIAN
 1782|       |        return *(const sph_u64 *)src;
 1783|       |#else
 1784|       |        return ((sph_u64)(((const unsigned char *)src)[0]) << 56)
 1785|       |                | ((sph_u64)(((const unsigned char *)src)[1]) << 48)
 1786|       |                | ((sph_u64)(((const unsigned char *)src)[2]) << 40)
 1787|       |                | ((sph_u64)(((const unsigned char *)src)[3]) << 32)
 1788|       |                | ((sph_u64)(((const unsigned char *)src)[4]) << 24)
 1789|       |                | ((sph_u64)(((const unsigned char *)src)[5]) << 16)
 1790|       |                | ((sph_u64)(((const unsigned char *)src)[6]) << 8)
 1791|       |                | (sph_u64)(((const unsigned char *)src)[7]);
 1792|       |#endif
 1793|   451M|}
sha2big.c:sph_bswap64:
 1229|   458M|{
 1230|   458M|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|   458M|        return x;
 1232|   458M|}
sha2big.c:sph_enc64be_aligned:
 1706|  1.53M|{
 1707|  1.53M|#if SPH_LITTLE_ENDIAN
 1708|  1.53M|        *(sph_u64 *)dst = sph_bswap64(val);
 1709|       |#elif SPH_BIG_ENDIAN
 1710|       |        *(sph_u64 *)dst = val;
 1711|       |#else
 1712|       |        ((unsigned char *)dst)[0] = (unsigned char)(val >> 56);
 1713|       |        ((unsigned char *)dst)[1] = (unsigned char)(val >> 48);
 1714|       |        ((unsigned char *)dst)[2] = (unsigned char)(val >> 40);
 1715|       |        ((unsigned char *)dst)[3] = (unsigned char)(val >> 32);
 1716|       |        ((unsigned char *)dst)[4] = (unsigned char)(val >> 24);
 1717|       |        ((unsigned char *)dst)[5] = (unsigned char)(val >> 16);
 1718|       |        ((unsigned char *)dst)[6] = (unsigned char)(val >> 8);
 1719|       |        ((unsigned char *)dst)[7] = (unsigned char)(val);
 1720|       |#endif
 1721|  1.53M|}
sha2big.c:sph_enc64be:
 1661|  5.36M|{
 1662|  5.36M|#if defined SPH_UPTR
 1663|  5.36M|#if SPH_UNALIGNED
 1664|  5.36M|#if SPH_LITTLE_ENDIAN
 1665|  5.36M|        val = sph_bswap64(val);
 1666|  5.36M|#endif
 1667|  5.36M|        *(sph_u64 *)dst = val;
 1668|       |#else
 1669|       |        if (((SPH_UPTR)dst & 7) == 0) {
 1670|       |#if SPH_LITTLE_ENDIAN
 1671|       |                val = sph_bswap64(val);
 1672|       |#endif
 1673|       |                *(sph_u64 *)dst = val;
 1674|       |        } else {
 1675|       |                ((unsigned char *)dst)[0] = (val >> 56);
 1676|       |                ((unsigned char *)dst)[1] = (val >> 48);
 1677|       |                ((unsigned char *)dst)[2] = (val >> 40);
 1678|       |                ((unsigned char *)dst)[3] = (val >> 32);
 1679|       |                ((unsigned char *)dst)[4] = (val >> 24);
 1680|       |                ((unsigned char *)dst)[5] = (val >> 16);
 1681|       |                ((unsigned char *)dst)[6] = (val >> 8);
 1682|       |                ((unsigned char *)dst)[7] = val;
 1683|       |        }
 1684|       |#endif
 1685|       |#else
 1686|       |        ((unsigned char *)dst)[0] = (unsigned char)(val >> 56);
 1687|       |        ((unsigned char *)dst)[1] = (unsigned char)(val >> 48);
 1688|       |        ((unsigned char *)dst)[2] = (unsigned char)(val >> 40);
 1689|       |        ((unsigned char *)dst)[3] = (unsigned char)(val >> 32);
 1690|       |        ((unsigned char *)dst)[4] = (unsigned char)(val >> 24);
 1691|       |        ((unsigned char *)dst)[5] = (unsigned char)(val >> 16);
 1692|       |        ((unsigned char *)dst)[6] = (unsigned char)(val >> 8);
 1693|       |        ((unsigned char *)dst)[7] = (unsigned char)(val);
 1694|       |#endif
 1695|  5.36M|}

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

deflateInit_:
  372|  41.2k|                         int stream_size) {
  373|  41.2k|    return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
  ------------------
  |  |  209|  41.2k|#define Z_DEFLATED   8
  ------------------
                  return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
  ------------------
  |  |  278|  41.2k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
                  return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
  ------------------
  |  |   75|  41.2k|#  define DEF_MEM_LEVEL 8
  ------------------
  374|  41.2k|                         Z_DEFAULT_STRATEGY, version, stream_size);
  ------------------
  |  |  200|  41.2k|#define Z_DEFAULT_STRATEGY    0
  ------------------
  375|       |    /* To do: ignore strm->next_in if we use it as window */
  376|  41.2k|}
deflateInit2_:
  381|  41.2k|                          const char *version, int stream_size) {
  382|  41.2k|    deflate_state *s;
  383|  41.2k|    int wrap = 1;
  384|  41.2k|    static const char my_version[] = ZLIB_VERSION;
  ------------------
  |  |   40|  41.2k|#define ZLIB_VERSION "1.3.1.1-motley"
  ------------------
  385|       |
  386|  41.2k|    if (version == Z_NULL || version[0] != my_version[0] ||
  ------------------
  |  |  212|  82.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (386:9): [True: 0, False: 41.2k]
  |  Branch (386:30): [True: 0, False: 41.2k]
  ------------------
  387|  41.2k|        stream_size != sizeof(z_stream)) {
  ------------------
  |  Branch (387:9): [True: 0, False: 41.2k]
  ------------------
  388|      0|        return Z_VERSION_ERROR;
  ------------------
  |  |  185|      0|#define Z_VERSION_ERROR (-6)
  ------------------
  389|      0|    }
  390|  41.2k|    if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  212|  41.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: 41.2k]
  ------------------
  391|       |
  392|  41.2k|    strm->msg = Z_NULL;
  ------------------
  |  |  212|  41.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  393|  41.2k|    if (strm->zalloc == (alloc_func)0) {
  ------------------
  |  Branch (393:9): [True: 41.2k, False: 0]
  ------------------
  394|       |#ifdef Z_SOLO
  395|       |        return Z_STREAM_ERROR;
  396|       |#else
  397|  41.2k|        strm->zalloc = zcalloc;
  398|  41.2k|        strm->opaque = (voidpf)0;
  399|  41.2k|#endif
  400|  41.2k|    }
  401|  41.2k|    if (strm->zfree == (free_func)0)
  ------------------
  |  Branch (401:9): [True: 41.2k, False: 0]
  ------------------
  402|       |#ifdef Z_SOLO
  403|       |        return Z_STREAM_ERROR;
  404|       |#else
  405|  41.2k|        strm->zfree = zcfree;
  406|  41.2k|#endif
  407|       |
  408|       |#ifdef FASTEST
  409|       |    if (level != 0) level = 1;
  410|       |#else
  411|  41.2k|    if (level == Z_DEFAULT_COMPRESSION) level = 6;
  ------------------
  |  |  193|  41.2k|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
  |  Branch (411:9): [True: 41.2k, False: 0]
  ------------------
  412|  41.2k|#endif
  413|       |
  414|  41.2k|    if (windowBits < 0) { /* suppress zlib wrapper */
  ------------------
  |  Branch (414:9): [True: 0, False: 41.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|  41.2k|#ifdef GZIP
  421|  41.2k|    else if (windowBits > 15) {
  ------------------
  |  Branch (421:14): [True: 0, False: 41.2k]
  ------------------
  422|      0|        wrap = 2;       /* write gzip wrapper instead */
  423|      0|        windowBits -= 16;
  424|      0|    }
  425|  41.2k|#endif
  426|  41.2k|    if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
  ------------------
  |  |  268|  82.5k|#    define MAX_MEM_LEVEL 9
  ------------------
                  if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
  ------------------
  |  |  209|  82.5k|#define Z_DEFLATED   8
  ------------------
  |  Branch (426:9): [True: 0, False: 41.2k]
  |  Branch (426:25): [True: 0, False: 41.2k]
  |  Branch (426:53): [True: 0, False: 41.2k]
  ------------------
  427|  41.2k|        windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
  ------------------
  |  Branch (427:9): [True: 0, False: 41.2k]
  |  Branch (427:27): [True: 0, False: 41.2k]
  |  Branch (427:46): [True: 0, False: 41.2k]
  |  Branch (427:59): [True: 0, False: 41.2k]
  ------------------
  428|  41.2k|        strategy < 0 || strategy > Z_FIXED || (windowBits == 8 && wrap != 1)) {
  ------------------
  |  |  199|  82.5k|#define Z_FIXED               4
  ------------------
  |  Branch (428:9): [True: 0, False: 41.2k]
  |  Branch (428:25): [True: 0, False: 41.2k]
  |  Branch (428:48): [True: 0, False: 41.2k]
  |  Branch (428:67): [True: 0, False: 0]
  ------------------
  429|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  430|      0|    }
  431|  41.2k|    if (windowBits == 8) windowBits = 9;  /* until 256-byte window bug fixed */
  ------------------
  |  Branch (431:9): [True: 0, False: 41.2k]
  ------------------
  432|  41.2k|    s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
  ------------------
  |  |  247|  41.2k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  433|  41.2k|    if (s == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  212|  41.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: 41.2k]
  ------------------
  434|  41.2k|    strm->state = (struct internal_state FAR *)s;
  435|  41.2k|    s->strm = strm;
  436|  41.2k|    s->status = INIT_STATE;     /* to pass state test in deflateReset() */
  ------------------
  |  |   58|  41.2k|#define INIT_STATE    42    /* zlib header -> BUSY_STATE */
  ------------------
  437|       |
  438|  41.2k|    s->wrap = wrap;
  439|  41.2k|    s->gzhead = Z_NULL;
  ------------------
  |  |  212|  41.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  440|  41.2k|    s->w_bits = (uInt)windowBits;
  441|  41.2k|    s->w_size = 1 << s->w_bits;
  442|  41.2k|    s->w_mask = s->w_size - 1;
  443|       |
  444|  41.2k|    s->hash_bits = (uInt)memLevel + 7;
  445|  41.2k|    s->hash_size = 1 << s->hash_bits;
  446|  41.2k|    s->hash_mask = s->hash_size - 1;
  447|  41.2k|    s->hash_shift =  ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH);
  ------------------
  |  |   86|  41.2k|#define MIN_MATCH  3
  ------------------
                  s->hash_shift =  ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH);
  ------------------
  |  |   86|  41.2k|#define MIN_MATCH  3
  ------------------
  448|       |
  449|  41.2k|    s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
  ------------------
  |  |  247|  41.2k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  450|  41.2k|    s->prev   = (Posf *)  ZALLOC(strm, s->w_size, sizeof(Pos));
  ------------------
  |  |  247|  41.2k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  451|  41.2k|    s->head   = (Posf *)  ZALLOC(strm, s->hash_size, sizeof(Pos));
  ------------------
  |  |  247|  41.2k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  452|       |
  453|  41.2k|    s->high_water = 0;      /* nothing written to s->window yet */
  454|       |
  455|  41.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|  41.2k|    s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS);
  ------------------
  |  |  247|  41.2k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  497|  41.2k|    s->pending_buf_size = (ulg)s->lit_bufsize * 4;
  498|       |
  499|  41.2k|    if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
  ------------------
  |  |  212|  82.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
  ------------------
  |  |  212|  82.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
  ------------------
  |  |  212|  82.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (499:9): [True: 0, False: 41.2k]
  |  Branch (499:32): [True: 0, False: 41.2k]
  |  Branch (499:53): [True: 0, False: 41.2k]
  ------------------
  500|  41.2k|        s->pending_buf == Z_NULL) {
  ------------------
  |  |  212|  41.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (500:9): [True: 0, False: 41.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|  41.2k|    s->sym_buf = s->pending_buf + s->lit_bufsize;
  512|  41.2k|    s->sym_end = (s->lit_bufsize - 1) * 3;
  513|  41.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|  41.2k|    s->level = level;
  520|  41.2k|    s->strategy = strategy;
  521|  41.2k|    s->method = (Byte)method;
  522|       |
  523|  41.2k|    return deflateReset(strm);
  524|  41.2k|}
deflateResetKeep:
  635|  41.2k|int ZEXPORT deflateResetKeep(z_streamp strm) {
  636|  41.2k|    deflate_state *s;
  637|       |
  638|  41.2k|    if (deflateStateCheck(strm)) {
  ------------------
  |  Branch (638:9): [True: 0, False: 41.2k]
  ------------------
  639|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  640|      0|    }
  641|       |
  642|  41.2k|    strm->total_in = strm->total_out = 0;
  643|  41.2k|    strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
  ------------------
  |  |  212|  41.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  644|  41.2k|    strm->data_type = Z_UNKNOWN;
  ------------------
  |  |  206|  41.2k|#define Z_UNKNOWN  2
  ------------------
  645|       |
  646|  41.2k|    s = (deflate_state *)strm->state;
  647|  41.2k|    s->pending = 0;
  648|  41.2k|    s->pending_out = s->pending_buf;
  649|       |
  650|  41.2k|    if (s->wrap < 0) {
  ------------------
  |  Branch (650:9): [True: 0, False: 41.2k]
  ------------------
  651|      0|        s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
  652|      0|    }
  653|  41.2k|    s->status =
  654|  41.2k|#ifdef GZIP
  655|  41.2k|        s->wrap == 2 ? GZIP_STATE :
  ------------------
  |  |   60|      0|#  define GZIP_STATE  57    /* gzip header -> BUSY_STATE | EXTRA_STATE */
  ------------------
  |  Branch (655:9): [True: 0, False: 41.2k]
  ------------------
  656|  41.2k|#endif
  657|  41.2k|        INIT_STATE;
  ------------------
  |  |   58|  82.5k|#define INIT_STATE    42    /* zlib header -> BUSY_STATE */
  ------------------
  658|  41.2k|    strm->adler =
  659|  41.2k|#ifdef GZIP
  660|  41.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: 41.2k]
  ------------------
  661|  41.2k|#endif
  662|  41.2k|        adler32(0L, Z_NULL, 0);
  ------------------
  |  |  212|  41.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  663|  41.2k|    s->last_flush = -2;
  664|       |
  665|  41.2k|    _tr_init(s);
  666|       |
  667|  41.2k|    return Z_OK;
  ------------------
  |  |  177|  41.2k|#define Z_OK            0
  ------------------
  668|  41.2k|}
deflateReset:
  695|  41.2k|int ZEXPORT deflateReset(z_streamp strm) {
  696|  41.2k|    int ret;
  697|       |
  698|  41.2k|    ret = deflateResetKeep(strm);
  699|  41.2k|    if (ret == Z_OK)
  ------------------
  |  |  177|  41.2k|#define Z_OK            0
  ------------------
  |  Branch (699:9): [True: 41.2k, False: 0]
  ------------------
  700|  41.2k|        lm_init(strm->state);
  701|  41.2k|    return ret;
  702|  41.2k|}
deflate:
  954|  1.15M|int ZEXPORT deflate(z_streamp strm, int flush) {
  955|  1.15M|    int old_flush; /* value of flush param for previous deflate call */
  956|  1.15M|    deflate_state *s;
  957|       |
  958|  1.15M|    if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0) {
  ------------------
  |  |  173|  2.31M|#define Z_BLOCK         5
  ------------------
  |  Branch (958:9): [True: 0, False: 1.15M]
  |  Branch (958:36): [True: 0, False: 1.15M]
  |  Branch (958:55): [True: 0, False: 1.15M]
  ------------------
  959|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  960|      0|    }
  961|  1.15M|    s = strm->state;
  962|       |
  963|  1.15M|    if (strm->next_out == Z_NULL ||
  ------------------
  |  |  212|  2.31M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (963:9): [True: 0, False: 1.15M]
  ------------------
  964|  1.15M|        (strm->avail_in != 0 && strm->next_in == Z_NULL) ||
  ------------------
  |  |  212|  1.11M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (964:10): [True: 1.11M, False: 40.9k]
  |  Branch (964:33): [True: 0, False: 1.11M]
  ------------------
  965|  1.15M|        (s->status == FINISH_STATE && flush != Z_FINISH)) {
  ------------------
  |  |   67|  2.31M|#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: 1.15M]
  |  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|  1.15M|    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: 1.15M]
  ------------------
  969|       |
  970|  1.15M|    old_flush = s->last_flush;
  971|  1.15M|    s->last_flush = flush;
  972|       |
  973|       |    /* Flush as much pending output as possible */
  974|  1.15M|    if (s->pending != 0) {
  ------------------
  |  Branch (974:9): [True: 909, False: 1.15M]
  ------------------
  975|    909|        flush_pending(strm);
  976|    909|        if (strm->avail_out == 0) {
  ------------------
  |  Branch (976:13): [True: 0, False: 909]
  ------------------
  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|  1.15M|    } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
  ------------------
  |  |  133|  40.9k|#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
  |  |  ------------------
  |  |  |  Branch (133:31): [True: 0, False: 40.9k]
  |  |  ------------------
  ------------------
                  } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
  ------------------
  |  |  133|  1.20M|#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
  |  |  ------------------
  |  |  |  Branch (133:31): [True: 0, False: 40.9k]
  |  |  ------------------
  ------------------
  |  Branch (991:16): [True: 40.9k, False: 1.11M]
  |  Branch (991:39): [True: 0, False: 40.9k]
  ------------------
  992|  1.15M|               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|  1.15M|    if (s->status == FINISH_STATE && strm->avail_in != 0) {
  ------------------
  |  |   67|  2.31M|#define FINISH_STATE 666    /* stream complete */
  ------------------
  |  Branch (997:9): [True: 0, False: 1.15M]
  |  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|  1.15M|    if (s->status == INIT_STATE && s->wrap == 0)
  ------------------
  |  |   58|  2.31M|#define INIT_STATE    42    /* zlib header -> BUSY_STATE */
  ------------------
  |  Branch (1002:9): [True: 41.2k, False: 1.11M]
  |  Branch (1002:36): [True: 0, False: 41.2k]
  ------------------
 1003|      0|        s->status = BUSY_STATE;
  ------------------
  |  |   66|      0|#define BUSY_STATE   113    /* deflate -> FINISH_STATE */
  ------------------
 1004|  1.15M|    if (s->status == INIT_STATE) {
  ------------------
  |  |   58|  1.15M|#define INIT_STATE    42    /* zlib header -> BUSY_STATE */
  ------------------
  |  Branch (1004:9): [True: 41.2k, False: 1.11M]
  ------------------
 1005|       |        /* zlib header */
 1006|  41.2k|        uInt header = (Z_DEFLATED + ((s->w_bits - 8) << 4)) << 8;
  ------------------
  |  |  209|  41.2k|#define Z_DEFLATED   8
  ------------------
 1007|  41.2k|        uInt level_flags;
 1008|       |
 1009|  41.2k|        if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
  ------------------
  |  |  197|  82.5k|#define Z_HUFFMAN_ONLY        2
  ------------------
  |  Branch (1009:13): [True: 0, False: 41.2k]
  |  Branch (1009:46): [True: 0, False: 41.2k]
  ------------------
 1010|      0|            level_flags = 0;
 1011|  41.2k|        else if (s->level < 6)
  ------------------
  |  Branch (1011:18): [True: 0, False: 41.2k]
  ------------------
 1012|      0|            level_flags = 1;
 1013|  41.2k|        else if (s->level == 6)
  ------------------
  |  Branch (1013:18): [True: 41.2k, False: 0]
  ------------------
 1014|  41.2k|            level_flags = 2;
 1015|      0|        else
 1016|      0|            level_flags = 3;
 1017|  41.2k|        header |= (level_flags << 6);
 1018|  41.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: 41.2k]
  ------------------
 1019|  41.2k|        header += 31 - (header % 31);
 1020|       |
 1021|  41.2k|        putShortMSB(s, header);
 1022|       |
 1023|       |        /* Save the adler32 of the preset dictionary: */
 1024|  41.2k|        if (s->strstart != 0) {
  ------------------
  |  Branch (1024:13): [True: 0, False: 41.2k]
  ------------------
 1025|      0|            putShortMSB(s, (uInt)(strm->adler >> 16));
 1026|      0|            putShortMSB(s, (uInt)(strm->adler & 0xffff));
 1027|      0|        }
 1028|  41.2k|        strm->adler = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  212|  41.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1029|  41.2k|        s->status = BUSY_STATE;
  ------------------
  |  |   66|  41.2k|#define BUSY_STATE   113    /* deflate -> FINISH_STATE */
  ------------------
 1030|       |
 1031|       |        /* Compression must start with an empty pending buffer */
 1032|  41.2k|        flush_pending(strm);
 1033|  41.2k|        if (s->pending != 0) {
  ------------------
  |  Branch (1033:13): [True: 0, False: 41.2k]
  ------------------
 1034|      0|            s->last_flush = -1;
 1035|      0|            return Z_OK;
  ------------------
  |  |  177|      0|#define Z_OK            0
  ------------------
 1036|      0|        }
 1037|  41.2k|    }
 1038|  1.15M|#ifdef GZIP
 1039|  1.15M|    if (s->status == GZIP_STATE) {
  ------------------
  |  |   60|  1.15M|#  define GZIP_STATE  57    /* gzip header -> BUSY_STATE | EXTRA_STATE */
  ------------------
  |  Branch (1039:9): [True: 0, False: 1.15M]
  ------------------
 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|  1.15M|    if (s->status == EXTRA_STATE) {
  ------------------
  |  |   62|  1.15M|#define EXTRA_STATE   69    /* gzip extra block -> NAME_STATE */
  ------------------
  |  Branch (1090:9): [True: 0, False: 1.15M]
  ------------------
 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|  1.15M|    if (s->status == NAME_STATE) {
  ------------------
  |  |   63|  1.15M|#define NAME_STATE    73    /* gzip file name -> COMMENT_STATE */
  ------------------
  |  Branch (1117:9): [True: 0, False: 1.15M]
  ------------------
 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|  1.15M|    if (s->status == COMMENT_STATE) {
  ------------------
  |  |   64|  1.15M|#define COMMENT_STATE 91    /* gzip comment -> HCRC_STATE */
  ------------------
  |  Branch (1139:9): [True: 0, False: 1.15M]
  ------------------
 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|  1.15M|    if (s->status == HCRC_STATE) {
  ------------------
  |  |   65|  1.15M|#define HCRC_STATE   103    /* gzip header CRC -> BUSY_STATE */
  ------------------
  |  Branch (1160:9): [True: 0, False: 1.15M]
  ------------------
 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|  1.15M|#endif
 1183|       |
 1184|       |    /* Start a new block or continue the current one.
 1185|       |     */
 1186|  1.15M|    if (strm->avail_in != 0 || s->lookahead != 0 ||
  ------------------
  |  Branch (1186:9): [True: 1.11M, False: 40.9k]
  |  Branch (1186:32): [True: 40.9k, False: 0]
  ------------------
 1187|  1.15M|        (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|  1.15M|        block_state bstate;
 1189|       |
 1190|  1.15M|        bstate = s->level == 0 ? deflate_stored(s, flush) :
  ------------------
  |  Branch (1190:18): [True: 0, False: 1.15M]
  ------------------
 1191|  1.15M|                 s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
  ------------------
  |  |  197|  1.15M|#define Z_HUFFMAN_ONLY        2
  ------------------
  |  Branch (1191:18): [True: 0, False: 1.15M]
  ------------------
 1192|  1.15M|                 s->strategy == Z_RLE ? deflate_rle(s, flush) :
  ------------------
  |  |  198|  1.15M|#define Z_RLE                 3
  ------------------
  |  Branch (1192:18): [True: 0, False: 1.15M]
  ------------------
 1193|  1.15M|                 (*(configuration_table[s->level].func))(s, flush);
 1194|       |
 1195|  1.15M|        if (bstate == finish_started || bstate == finish_done) {
  ------------------
  |  Branch (1195:13): [True: 0, False: 1.15M]
  |  Branch (1195:41): [True: 40.9k, False: 1.11M]
  ------------------
 1196|  40.9k|            s->status = FINISH_STATE;
  ------------------
  |  |   67|  40.9k|#define FINISH_STATE 666    /* stream complete */
  ------------------
 1197|  40.9k|        }
 1198|  1.15M|        if (bstate == need_more || bstate == finish_started) {
  ------------------
  |  Branch (1198:13): [True: 1.11M, False: 40.9k]
  |  Branch (1198:36): [True: 0, False: 40.9k]
  ------------------
 1199|  1.11M|            if (strm->avail_out == 0) {
  ------------------
  |  Branch (1199:17): [True: 909, False: 1.11M]
  ------------------
 1200|    909|                s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
 1201|    909|            }
 1202|  1.11M|            return Z_OK;
  ------------------
  |  |  177|  1.11M|#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|  1.11M|        }
 1211|  40.9k|        if (bstate == block_done) {
  ------------------
  |  Branch (1211:13): [True: 0, False: 40.9k]
  ------------------
 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.9k|    }
 1235|       |
 1236|  40.9k|    if (flush != Z_FINISH) return Z_OK;
  ------------------
  |  |  172|  40.9k|#define Z_FINISH        4
  ------------------
                  if (flush != Z_FINISH) return Z_OK;
  ------------------
  |  |  177|      0|#define Z_OK            0
  ------------------
  |  Branch (1236:9): [True: 0, False: 40.9k]
  ------------------
 1237|  40.9k|    if (s->wrap <= 0) return Z_STREAM_END;
  ------------------
  |  |  178|      0|#define Z_STREAM_END    1
  ------------------
  |  Branch (1237:9): [True: 0, False: 40.9k]
  ------------------
 1238|       |
 1239|       |    /* Write the trailer */
 1240|  40.9k|#ifdef GZIP
 1241|  40.9k|    if (s->wrap == 2) {
  ------------------
  |  Branch (1241:9): [True: 0, False: 40.9k]
  ------------------
 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.9k|    else
 1252|  40.9k|#endif
 1253|  40.9k|    {
 1254|  40.9k|        putShortMSB(s, (uInt)(strm->adler >> 16));
 1255|  40.9k|        putShortMSB(s, (uInt)(strm->adler & 0xffff));
 1256|  40.9k|    }
 1257|  40.9k|    flush_pending(strm);
 1258|       |    /* If avail_out is zero, the application will call deflate again
 1259|       |     * to flush the rest.
 1260|       |     */
 1261|  40.9k|    if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
  ------------------
  |  Branch (1261:9): [True: 40.9k, False: 0]
  ------------------
 1262|  40.9k|    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.9k|#define Z_STREAM_END    1
  ------------------
  |  Branch (1262:12): [True: 0, False: 40.9k]
  ------------------
 1263|  40.9k|}
deflateEnd:
 1266|  41.2k|int ZEXPORT deflateEnd(z_streamp strm) {
 1267|  41.2k|    int status;
 1268|       |
 1269|  41.2k|    if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (1269:9): [True: 0, False: 41.2k]
  ------------------
 1270|       |
 1271|  41.2k|    status = strm->state->status;
 1272|       |
 1273|       |    /* Deallocate in reverse order of allocations: */
 1274|  41.2k|    TRY_FREE(strm, strm->state->pending_buf);
  ------------------
  |  |  249|  41.2k|#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
  |  |  ------------------
  |  |  |  |  248|  41.2k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  |  |  ------------------
  |  |  |  Branch (249:29): [True: 41.2k, False: 0]
  |  |  ------------------
  ------------------
 1275|  41.2k|    TRY_FREE(strm, strm->state->head);
  ------------------
  |  |  249|  41.2k|#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
  |  |  ------------------
  |  |  |  |  248|  41.2k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  |  |  ------------------
  |  |  |  Branch (249:29): [True: 41.2k, False: 0]
  |  |  ------------------
  ------------------
 1276|  41.2k|    TRY_FREE(strm, strm->state->prev);
  ------------------
  |  |  249|  41.2k|#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
  |  |  ------------------
  |  |  |  |  248|  41.2k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  |  |  ------------------
  |  |  |  Branch (249:29): [True: 41.2k, False: 0]
  |  |  ------------------
  ------------------
 1277|  41.2k|    TRY_FREE(strm, strm->state->window);
  ------------------
  |  |  249|  41.2k|#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
  |  |  ------------------
  |  |  |  |  248|  41.2k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  |  |  ------------------
  |  |  |  Branch (249:29): [True: 41.2k, False: 0]
  |  |  ------------------
  ------------------
 1278|       |
 1279|  41.2k|    ZFREE(strm, strm->state);
  ------------------
  |  |  248|  41.2k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
 1280|  41.2k|    strm->state = Z_NULL;
  ------------------
  |  |  212|  41.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1281|       |
 1282|  41.2k|    return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
  ------------------
  |  |   66|  41.2k|#define BUSY_STATE   113    /* deflate -> FINISH_STATE */
  ------------------
                  return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
  ------------------
  |  |  182|    320|#define Z_DATA_ERROR   (-3)
  ------------------
                  return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
  ------------------
  |  |  177|  40.9k|#define Z_OK            0
  ------------------
  |  Branch (1282:12): [True: 320, False: 40.9k]
  ------------------
 1283|  41.2k|}
deflate.c:deflateStateCheck:
  529|  1.24M|local int deflateStateCheck(z_streamp strm) {
  530|  1.24M|    deflate_state *s;
  531|  1.24M|    if (strm == Z_NULL ||
  ------------------
  |  |  212|  2.48M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (531:9): [True: 0, False: 1.24M]
  ------------------
  532|  1.24M|        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (532:9): [True: 0, False: 1.24M]
  |  Branch (532:42): [True: 0, False: 1.24M]
  ------------------
  533|      0|        return 1;
  534|  1.24M|    s = strm->state;
  535|  1.24M|    if (s == Z_NULL || s->strm != strm || (s->status != INIT_STATE &&
  ------------------
  |  |  212|  2.48M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (s == Z_NULL || s->strm != strm || (s->status != INIT_STATE &&
  ------------------
  |  |   58|  2.48M|#define INIT_STATE    42    /* zlib header -> BUSY_STATE */
  ------------------
  |  Branch (535:9): [True: 0, False: 1.24M]
  |  Branch (535:24): [True: 0, False: 1.24M]
  |  Branch (535:44): [True: 1.15M, False: 82.5k]
  ------------------
  536|  1.24M|#ifdef GZIP
  537|  1.24M|                                           s->status != GZIP_STATE &&
  ------------------
  |  |   60|  2.40M|#  define GZIP_STATE  57    /* gzip header -> BUSY_STATE | EXTRA_STATE */
  ------------------
  |  Branch (537:44): [True: 1.15M, False: 0]
  ------------------
  538|  1.24M|#endif
  539|  1.24M|                                           s->status != EXTRA_STATE &&
  ------------------
  |  |   62|  2.40M|#define EXTRA_STATE   69    /* gzip extra block -> NAME_STATE */
  ------------------
  |  Branch (539:44): [True: 1.15M, False: 0]
  ------------------
  540|  1.24M|                                           s->status != NAME_STATE &&
  ------------------
  |  |   63|  2.40M|#define NAME_STATE    73    /* gzip file name -> COMMENT_STATE */
  ------------------
  |  Branch (540:44): [True: 1.15M, False: 0]
  ------------------
  541|  1.24M|                                           s->status != COMMENT_STATE &&
  ------------------
  |  |   64|  2.40M|#define COMMENT_STATE 91    /* gzip comment -> HCRC_STATE */
  ------------------
  |  Branch (541:44): [True: 1.15M, False: 0]
  ------------------
  542|  1.24M|                                           s->status != HCRC_STATE &&
  ------------------
  |  |   65|  2.40M|#define HCRC_STATE   103    /* gzip header CRC -> BUSY_STATE */
  ------------------
  |  Branch (542:44): [True: 1.15M, False: 0]
  ------------------
  543|  1.24M|                                           s->status != BUSY_STATE &&
  ------------------
  |  |   66|  2.40M|#define BUSY_STATE   113    /* deflate -> FINISH_STATE */
  ------------------
  |  Branch (543:44): [True: 40.9k, False: 1.11M]
  ------------------
  544|  1.24M|                                           s->status != FINISH_STATE))
  ------------------
  |  |   67|  40.9k|#define FINISH_STATE 666    /* stream complete */
  ------------------
  |  Branch (544:44): [True: 0, False: 40.9k]
  ------------------
  545|      0|        return 1;
  546|  1.24M|    return 0;
  547|  1.24M|}
deflate.c:fill_window:
  251|  3.48M|local void fill_window(deflate_state *s) {
  252|  3.48M|    unsigned n;
  253|  3.48M|    unsigned more;    /* Amount of free space at the end of the window. */
  254|  3.48M|    uInt wsize = s->w_size;
  255|       |
  256|  3.48M|    Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
  257|       |
  258|  3.48M|    do {
  259|  3.48M|        more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
  260|       |
  261|       |        /* Deal with !@#$% 64K limit: */
  262|  3.48M|        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|  3.48M|        if (s->strstart >= wsize + MAX_DIST(s)) {
  ------------------
  |  |  298|  3.48M|#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  293|  3.48M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  3.48M|#define MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|  3.48M|#define MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (277:13): [True: 50.2k, False: 3.43M]
  ------------------
  278|       |
  279|  50.2k|            zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more);
  ------------------
  |  |  210|  50.2k|#    define zmemcpy memcpy
  ------------------
  280|  50.2k|            s->match_start -= wsize;
  281|  50.2k|            s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */
  282|  50.2k|            s->block_start -= (long) wsize;
  283|  50.2k|            if (s->insert > s->strstart)
  ------------------
  |  Branch (283:17): [True: 0, False: 50.2k]
  ------------------
  284|      0|                s->insert = s->strstart;
  285|  50.2k|            slide_hash(s);
  286|  50.2k|            more += wsize;
  287|  50.2k|        }
  288|  3.48M|        if (s->strm->avail_in == 0) break;
  ------------------
  |  Branch (288:13): [True: 2.32M, False: 1.16M]
  ------------------
  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|  1.16M|        Assert(more >= 2, "more < 2");
  302|       |
  303|  1.16M|        n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
  304|  1.16M|        s->lookahead += n;
  305|       |
  306|       |        /* Initialize the hash value now that we have some input: */
  307|  1.16M|        if (s->lookahead + s->insert >= MIN_MATCH) {
  ------------------
  |  |   86|  1.16M|#define MIN_MATCH  3
  ------------------
  |  Branch (307:13): [True: 1.15M, False: 9.16k]
  ------------------
  308|  1.15M|            uInt str = s->strstart - s->insert;
  309|  1.15M|            s->ins_h = s->window[str];
  310|  1.15M|            UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
  ------------------
  |  |  141|  1.15M|#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|  1.15M|            while (s->insert) {
  ------------------
  |  Branch (314:20): [True: 0, False: 1.15M]
  ------------------
  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|  1.15M|        }
  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|  1.16M|    } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
  ------------------
  |  |  293|  2.33M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  ------------------
  |  |  |  |   87|  1.16M|#define MAX_MATCH  258
  |  |  ------------------
  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  ------------------
  |  |  |  |   86|  1.16M|#define MIN_MATCH  3
  |  |  ------------------
  ------------------
  |  Branch (330:14): [True: 813k, False: 353k]
  |  Branch (330:46): [True: 0, False: 813k]
  ------------------
  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|  3.48M|    if (s->high_water < s->window_size) {
  ------------------
  |  Branch (339:9): [True: 3.31M, False: 175k]
  ------------------
  340|  3.31M|        ulg curr = s->strstart + (ulg)(s->lookahead);
  341|  3.31M|        ulg init;
  342|       |
  343|  3.31M|        if (s->high_water < curr) {
  ------------------
  |  Branch (343:13): [True: 104k, False: 3.20M]
  ------------------
  344|       |            /* Previous high water mark below current data -- zero WIN_INIT
  345|       |             * bytes or up to end of window, whichever is less.
  346|       |             */
  347|   104k|            init = s->window_size - curr;
  348|   104k|            if (init > WIN_INIT)
  ------------------
  |  |  303|   104k|#define WIN_INIT MAX_MATCH
  |  |  ------------------
  |  |  |  |   87|   104k|#define MAX_MATCH  258
  |  |  ------------------
  ------------------
  |  Branch (348:17): [True: 103k, False: 908]
  ------------------
  349|   103k|                init = WIN_INIT;
  ------------------
  |  |  303|   103k|#define WIN_INIT MAX_MATCH
  |  |  ------------------
  |  |  |  |   87|   103k|#define MAX_MATCH  258
  |  |  ------------------
  ------------------
  350|   104k|            zmemzero(s->window + curr, (unsigned)init);
  ------------------
  |  |  212|   104k|#    define zmemzero(dest, len) memset(dest, 0, len)
  ------------------
  351|   104k|            s->high_water = curr + init;
  352|   104k|        }
  353|  3.20M|        else if (s->high_water < (ulg)curr + WIN_INIT) {
  ------------------
  |  |  303|  3.20M|#define WIN_INIT MAX_MATCH
  |  |  ------------------
  |  |  |  |   87|  3.20M|#define MAX_MATCH  258
  |  |  ------------------
  ------------------
  |  Branch (353:18): [True: 972k, False: 2.23M]
  ------------------
  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|   972k|            init = (ulg)curr + WIN_INIT - s->high_water;
  ------------------
  |  |  303|   972k|#define WIN_INIT MAX_MATCH
  |  |  ------------------
  |  |  |  |   87|   972k|#define MAX_MATCH  258
  |  |  ------------------
  ------------------
  359|   972k|            if (init > s->window_size - s->high_water)
  ------------------
  |  Branch (359:17): [True: 0, False: 972k]
  ------------------
  360|      0|                init = s->window_size - s->high_water;
  361|   972k|            zmemzero(s->window + s->high_water, (unsigned)init);
  ------------------
  |  |  212|   972k|#    define zmemzero(dest, len) memset(dest, 0, len)
  ------------------
  362|   972k|            s->high_water += init;
  363|   972k|        }
  364|  3.31M|    }
  365|       |
  366|  3.48M|    Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
  367|  3.48M|           "not enough room for search");
  368|  3.48M|}
deflate.c:read_buf:
  218|  1.16M|local unsigned read_buf(z_streamp strm, Bytef *buf, unsigned size) {
  219|  1.16M|    unsigned len = strm->avail_in;
  220|       |
  221|  1.16M|    if (len > size) len = size;
  ------------------
  |  Branch (221:9): [True: 49.5k, False: 1.11M]
  ------------------
  222|  1.16M|    if (len == 0) return 0;
  ------------------
  |  Branch (222:9): [True: 0, False: 1.16M]
  ------------------
  223|       |
  224|  1.16M|    strm->avail_in  -= len;
  225|       |
  226|  1.16M|    zmemcpy(buf, strm->next_in, len);
  ------------------
  |  |  210|  1.16M|#    define zmemcpy memcpy
  ------------------
  227|  1.16M|    if (strm->state->wrap == 1) {
  ------------------
  |  Branch (227:9): [True: 1.16M, False: 0]
  ------------------
  228|  1.16M|        strm->adler = adler32(strm->adler, buf, len);
  229|  1.16M|    }
  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|  1.16M|#endif
  235|  1.16M|    strm->next_in  += len;
  236|  1.16M|    strm->total_in += len;
  237|       |
  238|  1.16M|    return len;
  239|  1.16M|}
deflate.c:lm_init:
  673|  41.2k|local void lm_init(deflate_state *s) {
  674|  41.2k|    s->window_size = (ulg)2L*s->w_size;
  675|       |
  676|  41.2k|    CLEAR_HASH(s);
  ------------------
  |  |  171|  41.2k|    do { \
  |  |  172|  41.2k|        s->head[s->hash_size - 1] = NIL; \
  |  |  ------------------
  |  |  |  |   85|  41.2k|#define NIL 0
  |  |  ------------------
  |  |  173|  41.2k|        zmemzero((Bytef *)s->head, \
  |  |  ------------------
  |  |  |  |  212|  41.2k|#    define zmemzero(dest, len) memset(dest, 0, len)
  |  |  ------------------
  |  |  174|  41.2k|                 (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \
  |  |  175|  41.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (175:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  677|       |
  678|       |    /* Set the default configuration parameters:
  679|       |     */
  680|  41.2k|    s->max_lazy_match   = configuration_table[s->level].max_lazy;
  681|  41.2k|    s->good_match       = configuration_table[s->level].good_length;
  682|  41.2k|    s->nice_match       = configuration_table[s->level].nice_length;
  683|  41.2k|    s->max_chain_length = configuration_table[s->level].max_chain;
  684|       |
  685|  41.2k|    s->strstart = 0;
  686|  41.2k|    s->block_start = 0L;
  687|  41.2k|    s->lookahead = 0;
  688|  41.2k|    s->insert = 0;
  689|  41.2k|    s->match_length = s->prev_length = MIN_MATCH-1;
  ------------------
  |  |   86|  41.2k|#define MIN_MATCH  3
  ------------------
  690|  41.2k|    s->match_available = 0;
  691|  41.2k|    s->ins_h = 0;
  692|  41.2k|}
deflate.c:longest_match:
 1356|  41.1M|local uInt longest_match(deflate_state *s, IPos cur_match) {
 1357|  41.1M|    unsigned chain_length = s->max_chain_length;/* max hash chain length */
 1358|  41.1M|    register Bytef *scan = s->window + s->strstart; /* current string */
 1359|  41.1M|    register Bytef *match;                      /* matched string */
 1360|  41.1M|    register int len;                           /* length of current match */
 1361|  41.1M|    int best_len = (int)s->prev_length;         /* best match length so far */
 1362|  41.1M|    int nice_match = s->nice_match;             /* stop if match long enough */
 1363|  41.1M|    IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
  ------------------
  |  |  298|  41.1M|#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  293|  41.1M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  41.1M|#define MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|  41.1M|#define MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1363:18): [True: 36.3M, False: 4.84M]
  ------------------
 1364|  36.3M|        s->strstart - (IPos)MAX_DIST(s) : NIL;
  ------------------
  |  |  298|  36.3M|#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  293|  36.3M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  36.3M|#define MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|  36.3M|#define MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      s->strstart - (IPos)MAX_DIST(s) : NIL;
  ------------------
  |  |   85|  4.84M|#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|  41.1M|    Posf *prev = s->prev;
 1369|  41.1M|    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|  41.1M|    register Bytef *strend = s->window + s->strstart + MAX_MATCH;
  ------------------
  |  |   87|  41.1M|#define MAX_MATCH  258
  ------------------
 1380|  41.1M|    register Byte scan_end1  = scan[best_len - 1];
 1381|  41.1M|    register Byte scan_end   = scan[best_len];
 1382|  41.1M|#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|  41.1M|    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|  41.1M|    if (s->prev_length >= s->good_match) {
  ------------------
  |  Branch (1390:9): [True: 625k, False: 40.5M]
  ------------------
 1391|   625k|        chain_length >>= 2;
 1392|   625k|    }
 1393|       |    /* Do not look for matches beyond the end of the input. This is necessary
 1394|       |     * to make deflate deterministic.
 1395|       |     */
 1396|  41.1M|    if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead;
  ------------------
  |  Branch (1396:9): [True: 236k, False: 40.9M]
  ------------------
 1397|       |
 1398|  41.1M|    Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
 1399|  41.1M|           "need lookahead");
 1400|       |
 1401|   276M|    do {
 1402|   276M|        Assert(cur_match < s->strstart, "no future");
 1403|   276M|        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|   276M|        if (match[best_len]     != scan_end  ||
  ------------------
  |  Branch (1449:13): [True: 210M, False: 65.6M]
  ------------------
 1450|   276M|            match[best_len - 1] != scan_end1 ||
  ------------------
  |  Branch (1450:13): [True: 17.6M, False: 48.0M]
  ------------------
 1451|   276M|            *match              != *scan     ||
  ------------------
  |  Branch (1451:13): [True: 4.86M, False: 43.1M]
  ------------------
 1452|   276M|            *++match            != scan[1])      continue;
  ------------------
  |  Branch (1452:13): [True: 4.11k, False: 43.1M]
  ------------------
 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|  43.1M|        scan += 2, match++;
 1461|  43.1M|        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|   341M|        do {
 1467|   341M|        } while (*++scan == *++match && *++scan == *++match &&
  ------------------
  |  Branch (1467:18): [True: 333M, False: 8.60M]
  |  Branch (1467:41): [True: 328M, False: 5.08M]
  ------------------
 1468|   341M|                 *++scan == *++match && *++scan == *++match &&
  ------------------
  |  Branch (1468:18): [True: 323M, False: 4.59M]
  |  Branch (1468:41): [True: 318M, False: 4.52M]
  ------------------
 1469|   341M|                 *++scan == *++match && *++scan == *++match &&
  ------------------
  |  Branch (1469:18): [True: 315M, False: 3.70M]
  |  Branch (1469:41): [True: 311M, False: 3.61M]
  ------------------
 1470|   341M|                 *++scan == *++match && *++scan == *++match &&
  ------------------
  |  Branch (1470:18): [True: 307M, False: 3.68M]
  |  Branch (1470:41): [True: 304M, False: 3.27M]
  ------------------
 1471|   341M|                 scan < strend);
  ------------------
  |  Branch (1471:18): [True: 298M, False: 6.09M]
  ------------------
 1472|       |
 1473|  43.1M|        Assert(scan <= s->window + (unsigned)(s->window_size - 1),
 1474|  43.1M|               "wild scan");
 1475|       |
 1476|  43.1M|        len = MAX_MATCH - (int)(strend - scan);
  ------------------
  |  |   87|  43.1M|#define MAX_MATCH  258
  ------------------
 1477|  43.1M|        scan = strend - MAX_MATCH;
  ------------------
  |  |   87|  43.1M|#define MAX_MATCH  258
  ------------------
 1478|       |
 1479|  43.1M|#endif /* UNALIGNED_OK */
 1480|       |
 1481|  43.1M|        if (len > best_len) {
  ------------------
  |  Branch (1481:13): [True: 38.2M, False: 4.94M]
  ------------------
 1482|  38.2M|            s->match_start = cur_match;
 1483|  38.2M|            best_len = len;
 1484|  38.2M|            if (len >= nice_match) break;
  ------------------
  |  Branch (1484:17): [True: 6.23M, False: 32.0M]
  ------------------
 1485|       |#ifdef UNALIGNED_OK
 1486|       |            scan_end = *(ushf*)(scan + best_len - 1);
 1487|       |#else
 1488|  32.0M|            scan_end1  = scan[best_len - 1];
 1489|  32.0M|            scan_end   = scan[best_len];
 1490|  32.0M|#endif
 1491|  32.0M|        }
 1492|   270M|    } while ((cur_match = prev[cur_match & wmask]) > limit
  ------------------
  |  Branch (1492:14): [True: 236M, False: 33.6M]
  ------------------
 1493|   270M|             && --chain_length != 0);
  ------------------
  |  Branch (1493:17): [True: 235M, False: 1.23M]
  ------------------
 1494|       |
 1495|  41.1M|    if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
  ------------------
  |  Branch (1495:9): [True: 41.1M, False: 3.13k]
  ------------------
 1496|  3.13k|    return s->lookahead;
 1497|  41.1M|}
deflate.c:deflate_slow:
 1923|  1.15M|local block_state deflate_slow(deflate_state *s, int flush) {
 1924|  1.15M|    IPos hash_head;          /* head of hash chain */
 1925|  1.15M|    int bflush;              /* set if current block must be flushed */
 1926|       |
 1927|       |    /* Process the input block. */
 1928|  98.4M|    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|  98.4M|        if (s->lookahead < MIN_LOOKAHEAD) {
  ------------------
  |  |  293|  98.4M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  ------------------
  |  |  |  |   87|  98.4M|#define MAX_MATCH  258
  |  |  ------------------
  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  ------------------
  |  |  |  |   86|  98.4M|#define MIN_MATCH  3
  |  |  ------------------
  ------------------
  |  Branch (1934:13): [True: 3.48M, False: 94.9M]
  ------------------
 1935|  3.48M|            fill_window(s);
 1936|  3.48M|            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
  ------------------
  |  |  293|  6.97M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  ------------------
  |  |  |  |   87|  3.48M|#define MAX_MATCH  258
  |  |  ------------------
  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  ------------------
  |  |  |  |   86|  3.48M|#define MIN_MATCH  3
  |  |  ------------------
  ------------------
                          if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
  ------------------
  |  |  168|  3.13M|#define Z_NO_FLUSH      0
  ------------------
  |  Branch (1936:17): [True: 3.13M, False: 353k]
  |  Branch (1936:49): [True: 1.11M, False: 2.01M]
  ------------------
 1937|  1.11M|                return need_more;
 1938|  1.11M|            }
 1939|  2.36M|            if (s->lookahead == 0) break; /* flush the current block */
  ------------------
  |  Branch (1939:17): [True: 40.9k, False: 2.32M]
  ------------------
 1940|  2.36M|        }
 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|  97.2M|        hash_head = NIL;
  ------------------
  |  |   85|  97.2M|#define NIL 0
  ------------------
 1946|  97.2M|        if (s->lookahead >= MIN_MATCH) {
  ------------------
  |  |   86|  97.2M|#define MIN_MATCH  3
  ------------------
  |  Branch (1946:13): [True: 97.1M, False: 57.1k]
  ------------------
 1947|  97.1M|            INSERT_STRING(s, s->strstart, hash_head);
  ------------------
  |  |  161|  97.1M|   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
  |  |  ------------------
  |  |  |  |  141|  97.1M|#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask)
  |  |  ------------------
  |  |  162|  97.1M|    match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
  |  |  163|  97.1M|    s->head[s->ins_h] = (Pos)(str))
  ------------------
 1948|  97.1M|        }
 1949|       |
 1950|       |        /* Find the longest match, discarding those <= prev_length.
 1951|       |         */
 1952|  97.2M|        s->prev_length = s->match_length, s->prev_match = s->match_start;
 1953|  97.2M|        s->match_length = MIN_MATCH-1;
  ------------------
  |  |   86|  97.2M|#define MIN_MATCH  3
  ------------------
 1954|       |
 1955|  97.2M|        if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
  ------------------
  |  |   85|   194M|#define NIL 0
  ------------------
  |  Branch (1955:13): [True: 55.8M, False: 41.4M]
  |  Branch (1955:33): [True: 48.3M, False: 7.47M]
  ------------------
 1956|  97.2M|            s->strstart - hash_head <= MAX_DIST(s)) {
  ------------------
  |  |  298|  48.3M|#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  293|  48.3M|#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  48.3M|#define MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|  48.3M|#define MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1956:13): [True: 41.1M, False: 7.16M]
  ------------------
 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|  41.1M|            s->match_length = longest_match (s, hash_head);
 1962|       |            /* longest_match() sets match_start */
 1963|       |
 1964|  41.1M|            if (s->match_length <= 5 && (s->strategy == Z_FILTERED
  ------------------
  |  |  196|  63.0M|#define Z_FILTERED            1
  ------------------
  |  Branch (1964:17): [True: 31.5M, False: 9.64M]
  |  Branch (1964:42): [True: 0, False: 31.5M]
  ------------------
 1965|  31.5M|#if TOO_FAR <= 32767
 1966|  31.5M|                || (s->match_length == MIN_MATCH &&
  ------------------
  |  |   86|  63.0M|#define MIN_MATCH  3
  ------------------
  |  Branch (1966:21): [True: 2.43M, False: 29.0M]
  ------------------
 1967|  31.5M|                    s->strstart - s->match_start > TOO_FAR)
  ------------------
  |  |   89|  2.43M|#  define TOO_FAR 4096
  ------------------
  |  Branch (1967:21): [True: 853k, False: 1.57M]
  ------------------
 1968|  31.5M|#endif
 1969|  31.5M|                )) {
 1970|       |
 1971|       |                /* If prev_match is also MIN_MATCH, match_start is garbage
 1972|       |                 * but we will ignore the current match anyway.
 1973|       |                 */
 1974|   853k|                s->match_length = MIN_MATCH-1;
  ------------------
  |  |   86|   853k|#define MIN_MATCH  3
  ------------------
 1975|   853k|            }
 1976|  41.1M|        }
 1977|       |        /* If there was a match at the previous step and the current
 1978|       |         * match is not better, output the previous match:
 1979|       |         */
 1980|  97.2M|        if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
  ------------------
  |  |   86|   194M|#define MIN_MATCH  3
  ------------------
  |  Branch (1980:13): [True: 10.5M, False: 86.6M]
  |  Branch (1980:44): [True: 10.2M, False: 334k]
  ------------------
 1981|  10.2M|            uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
  ------------------
  |  |   86|  10.2M|#define MIN_MATCH  3
  ------------------
 1982|       |            /* Do not insert strings in hash table beyond this. */
 1983|       |
 1984|  10.2M|            check_match(s, s->strstart - 1, s->prev_match, s->prev_length);
 1985|       |
 1986|  10.2M|            _tr_tally_dist(s, s->strstart - 1 - s->prev_match,
  ------------------
  |  |  363|  10.2M|  { uch len = (uch)(length); \
  |  |  364|  10.2M|    ush dist = (ush)(distance); \
  |  |  365|  10.2M|    s->sym_buf[s->sym_next++] = (uch)dist; \
  |  |  366|  10.2M|    s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \
  |  |  367|  10.2M|    s->sym_buf[s->sym_next++] = len; \
  |  |  368|  10.2M|    dist--; \
  |  |  369|  10.2M|    s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
  |  |  ------------------
  |  |  |  |   37|  10.2M|#define LITERALS  256
  |  |  ------------------
  |  |                   s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
  |  |  ------------------
  |  |  |  |   83|  10.2M|#define Freq fc.freq
  |  |  ------------------
  |  |  370|  10.2M|    s->dyn_dtree[d_code(dist)].Freq++; \
  |  |  ------------------
  |  |  |  |  318|  10.2M|   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (318:5): [True: 7.77M, False: 2.46M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   s->dyn_dtree[d_code(dist)].Freq++; \
  |  |  ------------------
  |  |  |  |   83|  10.2M|#define Freq fc.freq
  |  |  ------------------
  |  |  371|  10.2M|    flush = (s->sym_next == s->sym_end); \
  |  |  372|  10.2M|  }
  ------------------
 1987|  10.2M|                           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.2M|            s->lookahead -= s->prev_length - 1;
 1995|  10.2M|            s->prev_length -= 2;
 1996|  1.65G|            do {
 1997|  1.65G|                if (++s->strstart <= max_insert) {
  ------------------
  |  Branch (1997:21): [True: 1.65G, False: 24.6k]
  ------------------
 1998|  1.65G|                    INSERT_STRING(s, s->strstart, hash_head);
  ------------------
  |  |  161|  1.65G|   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
  |  |  ------------------
  |  |  |  |  141|  1.65G|#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask)
  |  |  ------------------
  |  |  162|  1.65G|    match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
  |  |  163|  1.65G|    s->head[s->ins_h] = (Pos)(str))
  ------------------
 1999|  1.65G|                }
 2000|  1.65G|            } while (--s->prev_length != 0);
  ------------------
  |  Branch (2000:22): [True: 1.64G, False: 10.2M]
  ------------------
 2001|  10.2M|            s->match_available = 0;
 2002|  10.2M|            s->match_length = MIN_MATCH-1;
  ------------------
  |  |   86|  10.2M|#define MIN_MATCH  3
  ------------------
 2003|  10.2M|            s->strstart++;
 2004|       |
 2005|  10.2M|            if (bflush) FLUSH_BLOCK(s, 0);
  ------------------
  |  | 1609|    497|#define FLUSH_BLOCK(s, last) { \
  |  | 1610|    497|   FLUSH_BLOCK_ONLY(s, last); \
  |  |  ------------------
  |  |  |  | 1597|    497|#define FLUSH_BLOCK_ONLY(s, last) { \
  |  |  |  | 1598|    497|   _tr_flush_block(s, (s->block_start >= 0L ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1598:24): [True: 103, False: 394]
  |  |  |  |  ------------------
  |  |  |  | 1599|    497|                   (charf *)&s->window[(unsigned)s->block_start] : \
  |  |  |  | 1600|    497|                   (charf *)Z_NULL), \
  |  |  |  |  ------------------
  |  |  |  |  |  |  212|    394|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  |  |  |  |  ------------------
  |  |  |  | 1601|    497|                (ulg)((long)s->strstart - s->block_start), \
  |  |  |  | 1602|    497|                (last)); \
  |  |  |  | 1603|    497|   s->block_start = s->strstart; \
  |  |  |  | 1604|    497|   flush_pending(s->strm); \
  |  |  |  | 1605|    497|   Tracev((stderr,"[FLUSH]")); \
  |  |  |  | 1606|    497|}
  |  |  ------------------
  |  | 1611|    497|   if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (1611:8): [True: 46, False: 451]
  |  |  |  Branch (1611:40): [Folded - Ignored]
  |  |  ------------------
  |  | 1612|    497|}
  ------------------
  |  Branch (2005:17): [True: 497, False: 10.2M]
  ------------------
 2006|       |
 2007|  87.0M|        } else if (s->match_available) {
  ------------------
  |  Branch (2007:20): [True: 76.7M, False: 10.2M]
  ------------------
 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|  76.7M|            Tracevv((stderr,"%c", s->window[s->strstart - 1]));
 2013|  76.7M|            _tr_tally_lit(s, s->window[s->strstart - 1], bflush);
  ------------------
  |  |  355|  76.7M|  { uch cc = (c); \
  |  |  356|  76.7M|    s->sym_buf[s->sym_next++] = 0; \
  |  |  357|  76.7M|    s->sym_buf[s->sym_next++] = 0; \
  |  |  358|  76.7M|    s->sym_buf[s->sym_next++] = cc; \
  |  |  359|  76.7M|    s->dyn_ltree[cc].Freq++; \
  |  |  ------------------
  |  |  |  |   83|  76.7M|#define Freq fc.freq
  |  |  ------------------
  |  |  360|  76.7M|    flush = (s->sym_next == s->sym_end); \
  |  |  361|  76.7M|   }
  ------------------
 2014|  76.7M|            if (bflush) {
  ------------------
  |  Branch (2014:17): [True: 4.09k, False: 76.7M]
  ------------------
 2015|  4.09k|                FLUSH_BLOCK_ONLY(s, 0);
  ------------------
  |  | 1597|  4.09k|#define FLUSH_BLOCK_ONLY(s, last) { \
  |  | 1598|  4.09k|   _tr_flush_block(s, (s->block_start >= 0L ? \
  |  |  ------------------
  |  |  |  Branch (1598:24): [True: 3.48k, False: 607]
  |  |  ------------------
  |  | 1599|  4.09k|                   (charf *)&s->window[(unsigned)s->block_start] : \
  |  | 1600|  4.09k|                   (charf *)Z_NULL), \
  |  |  ------------------
  |  |  |  |  212|    607|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  |  |  ------------------
  |  | 1601|  4.09k|                (ulg)((long)s->strstart - s->block_start), \
  |  | 1602|  4.09k|                (last)); \
  |  | 1603|  4.09k|   s->block_start = s->strstart; \
  |  | 1604|  4.09k|   flush_pending(s->strm); \
  |  | 1605|  4.09k|   Tracev((stderr,"[FLUSH]")); \
  |  | 1606|  4.09k|}
  ------------------
 2016|  4.09k|            }
 2017|  76.7M|            s->strstart++;
 2018|  76.7M|            s->lookahead--;
 2019|  76.7M|            if (s->strm->avail_out == 0) return need_more;
  ------------------
  |  Branch (2019:17): [True: 863, False: 76.7M]
  ------------------
 2020|  76.7M|        } else {
 2021|       |            /* There is no previous match to compare with, wait for
 2022|       |             * the next step to decide.
 2023|       |             */
 2024|  10.2M|            s->match_available = 1;
 2025|  10.2M|            s->strstart++;
 2026|  10.2M|            s->lookahead--;
 2027|  10.2M|        }
 2028|  97.2M|    }
 2029|  40.9k|    Assert (flush != Z_NO_FLUSH, "no flush?");
 2030|  40.9k|    if (s->match_available) {
  ------------------
  |  Branch (2030:9): [True: 25.7k, False: 15.2k]
  ------------------
 2031|  25.7k|        Tracevv((stderr,"%c", s->window[s->strstart - 1]));
 2032|  25.7k|        _tr_tally_lit(s, s->window[s->strstart - 1], bflush);
  ------------------
  |  |  355|  25.7k|  { uch cc = (c); \
  |  |  356|  25.7k|    s->sym_buf[s->sym_next++] = 0; \
  |  |  357|  25.7k|    s->sym_buf[s->sym_next++] = 0; \
  |  |  358|  25.7k|    s->sym_buf[s->sym_next++] = cc; \
  |  |  359|  25.7k|    s->dyn_ltree[cc].Freq++; \
  |  |  ------------------
  |  |  |  |   83|  25.7k|#define Freq fc.freq
  |  |  ------------------
  |  |  360|  25.7k|    flush = (s->sym_next == s->sym_end); \
  |  |  361|  25.7k|   }
  ------------------
 2033|  25.7k|        s->match_available = 0;
 2034|  25.7k|    }
 2035|  40.9k|    s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
  ------------------
  |  |   86|  40.9k|#define MIN_MATCH  3
  ------------------
                  s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
  ------------------
  |  |   86|  40.9k|#define MIN_MATCH  3
  ------------------
  |  Branch (2035:17): [True: 40, False: 40.9k]
  ------------------
 2036|  40.9k|    if (flush == Z_FINISH) {
  ------------------
  |  |  172|  40.9k|#define Z_FINISH        4
  ------------------
  |  Branch (2036:9): [True: 40.9k, False: 0]
  ------------------
 2037|  40.9k|        FLUSH_BLOCK(s, 1);
  ------------------
  |  | 1609|  40.9k|#define FLUSH_BLOCK(s, last) { \
  |  | 1610|  40.9k|   FLUSH_BLOCK_ONLY(s, last); \
  |  |  ------------------
  |  |  |  | 1597|  40.9k|#define FLUSH_BLOCK_ONLY(s, last) { \
  |  |  |  | 1598|  40.9k|   _tr_flush_block(s, (s->block_start >= 0L ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1598:24): [True: 40.4k, False: 491]
  |  |  |  |  ------------------
  |  |  |  | 1599|  40.9k|                   (charf *)&s->window[(unsigned)s->block_start] : \
  |  |  |  | 1600|  40.9k|                   (charf *)Z_NULL), \
  |  |  |  |  ------------------
  |  |  |  |  |  |  212|    491|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  |  |  |  |  ------------------
  |  |  |  | 1601|  40.9k|                (ulg)((long)s->strstart - s->block_start), \
  |  |  |  | 1602|  40.9k|                (last)); \
  |  |  |  | 1603|  40.9k|   s->block_start = s->strstart; \
  |  |  |  | 1604|  40.9k|   flush_pending(s->strm); \
  |  |  |  | 1605|  40.9k|   Tracev((stderr,"[FLUSH]")); \
  |  |  |  | 1606|  40.9k|}
  |  |  ------------------
  |  | 1611|  40.9k|   if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (1611:8): [True: 0, False: 40.9k]
  |  |  |  Branch (1611:40): [Folded - Ignored]
  |  |  ------------------
  |  | 1612|  40.9k|}
  ------------------
 2038|  40.9k|        return finish_done;
 2039|  40.9k|    }
 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|  50.2k|local void slide_hash(deflate_state *s) {
  188|  50.2k|    unsigned n, m;
  189|  50.2k|    Posf *p;
  190|  50.2k|    uInt wsize = s->w_size;
  191|       |
  192|  50.2k|    n = s->hash_size;
  193|  50.2k|    p = &s->head[n];
  194|  1.64G|    do {
  195|  1.64G|        m = *--p;
  196|  1.64G|        *p = (Pos)(m >= wsize ? m - wsize : NIL);
  ------------------
  |  |   85|  1.59G|#define NIL 0
  ------------------
  |  Branch (196:20): [True: 51.2M, False: 1.59G]
  ------------------
  197|  1.64G|    } while (--n);
  ------------------
  |  Branch (197:14): [True: 1.64G, False: 50.2k]
  ------------------
  198|  50.2k|    n = wsize;
  199|  50.2k|#ifndef FASTEST
  200|  50.2k|    p = &s->prev[n];
  201|  1.64G|    do {
  202|  1.64G|        m = *--p;
  203|  1.64G|        *p = (Pos)(m >= wsize ? m - wsize : NIL);
  ------------------
  |  |   85|  58.4M|#define NIL 0
  ------------------
  |  Branch (203:20): [True: 1.58G, False: 58.4M]
  ------------------
  204|       |        /* If n is not on any hash chain, prev[n] is garbage but
  205|       |         * its value will never be used.
  206|       |         */
  207|  1.64G|    } while (--n);
  ------------------
  |  Branch (207:14): [True: 1.64G, False: 50.2k]
  ------------------
  208|  50.2k|#endif
  209|  50.2k|}
deflate.c:flush_pending:
  923|   128k|local void flush_pending(z_streamp strm) {
  924|   128k|    unsigned len;
  925|   128k|    deflate_state *s = strm->state;
  926|       |
  927|   128k|    _tr_flush_bits(s);
  928|   128k|    len = s->pending;
  929|   128k|    if (len > strm->avail_out) len = strm->avail_out;
  ------------------
  |  Branch (929:9): [True: 909, False: 127k]
  ------------------
  930|   128k|    if (len == 0) return;
  ------------------
  |  Branch (930:9): [True: 0, False: 128k]
  ------------------
  931|       |
  932|   128k|    zmemcpy(strm->next_out, s->pending_out, len);
  ------------------
  |  |  210|   128k|#    define zmemcpy memcpy
  ------------------
  933|   128k|    strm->next_out  += len;
  934|   128k|    s->pending_out  += len;
  935|   128k|    strm->total_out += len;
  936|   128k|    strm->avail_out -= len;
  937|   128k|    s->pending      -= len;
  938|   128k|    if (s->pending == 0) {
  ------------------
  |  Branch (938:9): [True: 127k, False: 909]
  ------------------
  939|   127k|        s->pending_out = s->pending_buf;
  940|   127k|    }
  941|   128k|}
deflate.c:putShortMSB:
  912|   123k|local void putShortMSB(deflate_state *s, uInt b) {
  913|   123k|    put_byte(s, (Byte)(b >> 8));
  ------------------
  |  |  290|   123k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
  914|   123k|    put_byte(s, (Byte)(b & 0xff));
  ------------------
  |  |  290|   123k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
  915|   123k|}

inflate_fast:
   50|  1.74M|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
   51|  1.74M|    struct inflate_state FAR *state;
   52|  1.74M|    z_const unsigned char FAR *in;      /* local strm->next_in */
   53|  1.74M|    z_const unsigned char FAR *last;    /* have enough input while in < last */
   54|  1.74M|    unsigned char FAR *out;     /* local strm->next_out */
   55|  1.74M|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
   56|  1.74M|    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|  1.74M|    unsigned wsize;             /* window size or zero if not using window */
   61|  1.74M|    unsigned whave;             /* valid bytes in the window */
   62|  1.74M|    unsigned wnext;             /* window write index */
   63|  1.74M|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
   64|  1.74M|    unsigned long hold;         /* local strm->hold */
   65|  1.74M|    unsigned bits;              /* local strm->bits */
   66|  1.74M|    code const FAR *lcode;      /* local strm->lencode */
   67|  1.74M|    code const FAR *dcode;      /* local strm->distcode */
   68|  1.74M|    unsigned lmask;             /* mask for first level of length codes */
   69|  1.74M|    unsigned dmask;             /* mask for first level of distance codes */
   70|  1.74M|    code const *here;           /* retrieved table entry */
   71|  1.74M|    unsigned op;                /* code bits, operation, extra bits, or */
   72|       |                                /*  window position, window bytes to copy */
   73|  1.74M|    unsigned len;               /* match length, unused bytes */
   74|  1.74M|    unsigned dist;              /* match distance */
   75|  1.74M|    unsigned char FAR *from;    /* where to copy match from */
   76|       |
   77|       |    /* copy state to local variables */
   78|  1.74M|    state = (struct inflate_state FAR *)strm->state;
   79|  1.74M|    in = strm->next_in;
   80|  1.74M|    last = in + (strm->avail_in - 5);
   81|  1.74M|    out = strm->next_out;
   82|  1.74M|    beg = out - (start - strm->avail_out);
   83|  1.74M|    end = out + (strm->avail_out - 257);
   84|       |#ifdef INFLATE_STRICT
   85|       |    dmax = state->dmax;
   86|       |#endif
   87|  1.74M|    wsize = state->wsize;
   88|  1.74M|    whave = state->whave;
   89|  1.74M|    wnext = state->wnext;
   90|  1.74M|    window = state->window;
   91|  1.74M|    hold = state->hold;
   92|  1.74M|    bits = state->bits;
   93|  1.74M|    lcode = state->lencode;
   94|  1.74M|    dcode = state->distcode;
   95|  1.74M|    lmask = (1U << state->lenbits) - 1;
   96|  1.74M|    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|  36.9M|    do {
  101|  36.9M|        if (bits < 15) {
  ------------------
  |  Branch (101:13): [True: 16.9M, False: 20.0M]
  ------------------
  102|  16.9M|            hold += (unsigned long)(*in++) << bits;
  103|  16.9M|            bits += 8;
  104|  16.9M|            hold += (unsigned long)(*in++) << bits;
  105|  16.9M|            bits += 8;
  106|  16.9M|        }
  107|  36.9M|        here = lcode + (hold & lmask);
  108|  37.7M|      dolen:
  109|  37.7M|        op = (unsigned)(here->bits);
  110|  37.7M|        hold >>= op;
  111|  37.7M|        bits -= op;
  112|  37.7M|        op = (unsigned)(here->op);
  113|  37.7M|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (113:13): [True: 29.5M, False: 8.20M]
  ------------------
  114|  29.5M|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  115|  29.5M|                    "inflate:         literal '%c'\n" :
  116|  29.5M|                    "inflate:         literal 0x%02x\n", here->val));
  117|  29.5M|            *out++ = (unsigned char)(here->val);
  118|  29.5M|        }
  119|  8.20M|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (119:18): [True: 7.40M, False: 800k]
  ------------------
  120|  7.40M|            len = (unsigned)(here->val);
  121|  7.40M|            op &= 15;                           /* number of extra bits */
  122|  7.40M|            if (op) {
  ------------------
  |  Branch (122:17): [True: 1.28M, False: 6.12M]
  ------------------
  123|  1.28M|                if (bits < op) {
  ------------------
  |  Branch (123:21): [True: 17.0k, False: 1.26M]
  ------------------
  124|  17.0k|                    hold += (unsigned long)(*in++) << bits;
  125|  17.0k|                    bits += 8;
  126|  17.0k|                }
  127|  1.28M|                len += (unsigned)hold & ((1U << op) - 1);
  128|  1.28M|                hold >>= op;
  129|  1.28M|                bits -= op;
  130|  1.28M|            }
  131|  7.40M|            Tracevv((stderr, "inflate:         length %u\n", len));
  132|  7.40M|            if (bits < 15) {
  ------------------
  |  Branch (132:17): [True: 2.77M, False: 4.62M]
  ------------------
  133|  2.77M|                hold += (unsigned long)(*in++) << bits;
  134|  2.77M|                bits += 8;
  135|  2.77M|                hold += (unsigned long)(*in++) << bits;
  136|  2.77M|                bits += 8;
  137|  2.77M|            }
  138|  7.40M|            here = dcode + (hold & dmask);
  139|  7.51M|          dodist:
  140|  7.51M|            op = (unsigned)(here->bits);
  141|  7.51M|            hold >>= op;
  142|  7.51M|            bits -= op;
  143|  7.51M|            op = (unsigned)(here->op);
  144|  7.51M|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (144:17): [True: 7.40M, False: 112k]
  ------------------
  145|  7.40M|                dist = (unsigned)(here->val);
  146|  7.40M|                op &= 15;                       /* number of extra bits */
  147|  7.40M|                if (bits < op) {
  ------------------
  |  Branch (147:21): [True: 88.5k, False: 7.31M]
  ------------------
  148|  88.5k|                    hold += (unsigned long)(*in++) << bits;
  149|  88.5k|                    bits += 8;
  150|  88.5k|                    if (bits < op) {
  ------------------
  |  Branch (150:25): [True: 0, False: 88.5k]
  ------------------
  151|      0|                        hold += (unsigned long)(*in++) << bits;
  152|      0|                        bits += 8;
  153|      0|                    }
  154|  88.5k|                }
  155|  7.40M|                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|  7.40M|                hold >>= op;
  164|  7.40M|                bits -= op;
  165|  7.40M|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  166|  7.40M|                op = (unsigned)(out - beg);     /* max distance in output */
  167|  7.40M|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (167:21): [True: 1.22M, False: 6.17M]
  ------------------
  168|  1.22M|                    op = dist - op;             /* distance back in window */
  169|  1.22M|                    if (op > whave) {
  ------------------
  |  Branch (169:25): [True: 632, False: 1.22M]
  ------------------
  170|    632|                        if (state->sane) {
  ------------------
  |  Branch (170:29): [True: 632, False: 0]
  ------------------
  171|    632|                            strm->msg =
  172|    632|                                (z_const char *)"invalid distance too far back";
  173|    632|                            state->mode = BAD;
  174|    632|                            break;
  175|    632|                        }
  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|    632|                    }
  196|  1.22M|                    from = window;
  197|  1.22M|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (197:25): [True: 53.2k, False: 1.17M]
  ------------------
  198|  53.2k|                        from += wsize - op;
  199|  53.2k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (199:29): [True: 621, False: 52.6k]
  ------------------
  200|    621|                            len -= op;
  201|  30.7k|                            do {
  202|  30.7k|                                *out++ = *from++;
  203|  30.7k|                            } while (--op);
  ------------------
  |  Branch (203:38): [True: 30.1k, False: 621]
  ------------------
  204|    621|                            from = out - dist;  /* rest from output */
  205|    621|                        }
  206|  53.2k|                    }
  207|  1.17M|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (207:30): [True: 2.85k, False: 1.17M]
  ------------------
  208|  2.85k|                        from += wsize + wnext - op;
  209|  2.85k|                        op -= wnext;
  210|  2.85k|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (210:29): [True: 244, False: 2.61k]
  ------------------
  211|    244|                            len -= op;
  212|    987|                            do {
  213|    987|                                *out++ = *from++;
  214|    987|                            } while (--op);
  ------------------
  |  Branch (214:38): [True: 743, False: 244]
  ------------------
  215|    244|                            from = window;
  216|    244|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (216:33): [True: 74, False: 170]
  ------------------
  217|     74|                                op = wnext;
  218|     74|                                len -= op;
  219|    354|                                do {
  220|    354|                                    *out++ = *from++;
  221|    354|                                } while (--op);
  ------------------
  |  Branch (221:42): [True: 280, False: 74]
  ------------------
  222|     74|                                from = out - dist;      /* rest from output */
  223|     74|                            }
  224|    244|                        }
  225|  2.85k|                    }
  226|  1.17M|                    else {                      /* contiguous in window */
  227|  1.17M|                        from += wnext - op;
  228|  1.17M|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (228:29): [True: 184k, False: 987k]
  ------------------
  229|   184k|                            len -= op;
  230|  1.93M|                            do {
  231|  1.93M|                                *out++ = *from++;
  232|  1.93M|                            } while (--op);
  ------------------
  |  Branch (232:38): [True: 1.75M, False: 184k]
  ------------------
  233|   184k|                            from = out - dist;  /* rest from output */
  234|   184k|                        }
  235|  1.17M|                    }
  236|  3.51M|                    while (len > 2) {
  ------------------
  |  Branch (236:28): [True: 2.28M, False: 1.22M]
  ------------------
  237|  2.28M|                        *out++ = *from++;
  238|  2.28M|                        *out++ = *from++;
  239|  2.28M|                        *out++ = *from++;
  240|  2.28M|                        len -= 3;
  241|  2.28M|                    }
  242|  1.22M|                    if (len) {
  ------------------
  |  Branch (242:25): [True: 295k, False: 932k]
  ------------------
  243|   295k|                        *out++ = *from++;
  244|   295k|                        if (len > 1)
  ------------------
  |  Branch (244:29): [True: 96.1k, False: 199k]
  ------------------
  245|  96.1k|                            *out++ = *from++;
  246|   295k|                    }
  247|  1.22M|                }
  248|  6.17M|                else {
  249|  6.17M|                    from = out - dist;          /* copy direct from output */
  250|  37.4M|                    do {                        /* minimum length is three */
  251|  37.4M|                        *out++ = *from++;
  252|  37.4M|                        *out++ = *from++;
  253|  37.4M|                        *out++ = *from++;
  254|  37.4M|                        len -= 3;
  255|  37.4M|                    } while (len > 2);
  ------------------
  |  Branch (255:30): [True: 31.2M, False: 6.17M]
  ------------------
  256|  6.17M|                    if (len) {
  ------------------
  |  Branch (256:25): [True: 2.36M, False: 3.81M]
  ------------------
  257|  2.36M|                        *out++ = *from++;
  258|  2.36M|                        if (len > 1)
  ------------------
  |  Branch (258:29): [True: 807k, False: 1.55M]
  ------------------
  259|   807k|                            *out++ = *from++;
  260|  2.36M|                    }
  261|  6.17M|                }
  262|  7.40M|            }
  263|   112k|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (263:22): [True: 112k, False: 15]
  ------------------
  264|   112k|                here = dcode + here->val + (hold & ((1U << op) - 1));
  265|   112k|                goto dodist;
  266|   112k|            }
  267|     15|            else {
  268|     15|                strm->msg = (z_const char *)"invalid distance code";
  269|     15|                state->mode = BAD;
  270|     15|                break;
  271|     15|            }
  272|  7.51M|        }
  273|   800k|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (273:18): [True: 769k, False: 31.4k]
  ------------------
  274|   769k|            here = lcode + here->val + (hold & ((1U << op) - 1));
  275|   769k|            goto dolen;
  276|   769k|        }
  277|  31.4k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (277:18): [True: 31.4k, False: 14]
  ------------------
  278|  31.4k|            Tracevv((stderr, "inflate:         end of block\n"));
  279|  31.4k|            state->mode = TYPE;
  280|  31.4k|            break;
  281|  31.4k|        }
  282|     14|        else {
  283|     14|            strm->msg = (z_const char *)"invalid literal/length code";
  284|     14|            state->mode = BAD;
  285|     14|            break;
  286|     14|        }
  287|  37.7M|    } while (in < last && out < end);
  ------------------
  |  Branch (287:14): [True: 35.1M, False: 1.71M]
  |  Branch (287:27): [True: 35.1M, False: 1.18k]
  ------------------
  288|       |
  289|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  290|  1.74M|    len = bits >> 3;
  291|  1.74M|    in -= len;
  292|  1.74M|    bits -= len << 3;
  293|  1.74M|    hold &= (1U << bits) - 1;
  294|       |
  295|       |    /* update state and return */
  296|  1.74M|    strm->next_in = in;
  297|  1.74M|    strm->next_out = out;
  298|  1.74M|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (298:33): [True: 1.23M, False: 516k]
  ------------------
  299|  1.74M|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (299:34): [True: 1.74M, False: 1.18k]
  ------------------
  300|  1.74M|                                 257 + (end - out) : 257 - (out - end));
  301|  1.74M|    state->hold = hold;
  302|  1.74M|    state->bits = bits;
  303|  1.74M|    return;
  304|  1.74M|}

inflateResetKeep:
  106|  29.8k|int ZEXPORT inflateResetKeep(z_streamp strm) {
  107|  29.8k|    struct inflate_state FAR *state;
  108|       |
  109|  29.8k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (109:9): [True: 0, False: 29.8k]
  ------------------
  110|  29.8k|    state = (struct inflate_state FAR *)strm->state;
  111|  29.8k|    strm->total_in = strm->total_out = state->total = 0;
  112|  29.8k|    strm->msg = Z_NULL;
  ------------------
  |  |  212|  29.8k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  113|  29.8k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (113:9): [True: 29.8k, False: 0]
  ------------------
  114|  29.8k|        strm->adler = state->wrap & 1;
  115|  29.8k|    state->mode = HEAD;
  116|  29.8k|    state->last = 0;
  117|  29.8k|    state->havedict = 0;
  118|  29.8k|    state->flags = -1;
  119|  29.8k|    state->dmax = 32768U;
  120|  29.8k|    state->head = Z_NULL;
  ------------------
  |  |  212|  29.8k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  121|  29.8k|    state->hold = 0;
  122|  29.8k|    state->bits = 0;
  123|  29.8k|    state->lencode = state->distcode = state->next = state->codes;
  124|  29.8k|    state->sane = 1;
  125|  29.8k|    state->back = -1;
  126|  29.8k|    Tracev((stderr, "inflate: reset\n"));
  127|  29.8k|    return Z_OK;
  ------------------
  |  |  177|  29.8k|#define Z_OK            0
  ------------------
  128|  29.8k|}
inflateReset:
  130|  29.8k|int ZEXPORT inflateReset(z_streamp strm) {
  131|  29.8k|    struct inflate_state FAR *state;
  132|       |
  133|  29.8k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (133:9): [True: 0, False: 29.8k]
  ------------------
  134|  29.8k|    state = (struct inflate_state FAR *)strm->state;
  135|  29.8k|    state->wsize = 0;
  136|  29.8k|    state->whave = 0;
  137|  29.8k|    state->wnext = 0;
  138|  29.8k|    return inflateResetKeep(strm);
  139|  29.8k|}
inflateReset2:
  141|  29.8k|int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
  142|  29.8k|    int wrap;
  143|  29.8k|    struct inflate_state FAR *state;
  144|       |
  145|       |    /* get the state */
  146|  29.8k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (146:9): [True: 0, False: 29.8k]
  ------------------
  147|  29.8k|    state = (struct inflate_state FAR *)strm->state;
  148|       |
  149|       |    /* extract wrap request from windowBits parameter */
  150|  29.8k|    if (windowBits < 0) {
  ------------------
  |  Branch (150:9): [True: 0, False: 29.8k]
  ------------------
  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|  29.8k|    else {
  157|  29.8k|        wrap = (windowBits >> 4) + 5;
  158|  29.8k|#ifdef GUNZIP
  159|  29.8k|        if (windowBits < 48)
  ------------------
  |  Branch (159:13): [True: 29.8k, False: 0]
  ------------------
  160|  29.8k|            windowBits &= 15;
  161|  29.8k|#endif
  162|  29.8k|    }
  163|       |
  164|       |    /* set number of window bits, free window if different */
  165|  29.8k|    if (windowBits && (windowBits < 8 || windowBits > 15))
  ------------------
  |  Branch (165:9): [True: 29.8k, False: 0]
  |  Branch (165:24): [True: 0, False: 29.8k]
  |  Branch (165:42): [True: 0, False: 29.8k]
  ------------------
  166|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  167|  29.8k|    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
  ------------------
  |  |  212|  59.7k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (167:9): [True: 0, False: 29.8k]
  |  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|  29.8k|    state->wrap = wrap;
  174|  29.8k|    state->wbits = (unsigned)windowBits;
  175|  29.8k|    return inflateReset(strm);
  176|  29.8k|}
inflateInit2_:
  179|  29.8k|                          const char *version, int stream_size) {
  180|  29.8k|    int ret;
  181|  29.8k|    struct inflate_state FAR *state;
  182|       |
  183|  29.8k|    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |  212|  59.7k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |   40|  29.8k|#define ZLIB_VERSION "1.3.1.1-motley"
  ------------------
  |  Branch (183:9): [True: 0, False: 29.8k]
  |  Branch (183:30): [True: 0, False: 29.8k]
  ------------------
  184|  29.8k|        stream_size != (int)(sizeof(z_stream)))
  ------------------
  |  Branch (184:9): [True: 0, False: 29.8k]
  ------------------
  185|      0|        return Z_VERSION_ERROR;
  ------------------
  |  |  185|      0|#define Z_VERSION_ERROR (-6)
  ------------------
  186|  29.8k|    if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  212|  29.8k|#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: 29.8k]
  ------------------
  187|  29.8k|    strm->msg = Z_NULL;                 /* in case we return an error */
  ------------------
  |  |  212|  29.8k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  188|  29.8k|    if (strm->zalloc == (alloc_func)0) {
  ------------------
  |  Branch (188:9): [True: 29.8k, False: 0]
  ------------------
  189|       |#ifdef Z_SOLO
  190|       |        return Z_STREAM_ERROR;
  191|       |#else
  192|  29.8k|        strm->zalloc = zcalloc;
  193|  29.8k|        strm->opaque = (voidpf)0;
  194|  29.8k|#endif
  195|  29.8k|    }
  196|  29.8k|    if (strm->zfree == (free_func)0)
  ------------------
  |  Branch (196:9): [True: 29.8k, False: 0]
  ------------------
  197|       |#ifdef Z_SOLO
  198|       |        return Z_STREAM_ERROR;
  199|       |#else
  200|  29.8k|        strm->zfree = zcfree;
  201|  29.8k|#endif
  202|  29.8k|    state = (struct inflate_state FAR *)
  203|  29.8k|            ZALLOC(strm, 1, sizeof(struct inflate_state));
  ------------------
  |  |  247|  29.8k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  204|  29.8k|    if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  212|  29.8k|#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: 29.8k]
  ------------------
  205|  29.8k|    Tracev((stderr, "inflate: allocated\n"));
  206|  29.8k|    strm->state = (struct internal_state FAR *)state;
  207|  29.8k|    state->strm = strm;
  208|  29.8k|    state->window = Z_NULL;
  ------------------
  |  |  212|  29.8k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  209|  29.8k|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  210|  29.8k|    ret = inflateReset2(strm, windowBits);
  211|  29.8k|    if (ret != Z_OK) {
  ------------------
  |  |  177|  29.8k|#define Z_OK            0
  ------------------
  |  Branch (211:9): [True: 0, False: 29.8k]
  ------------------
  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|  29.8k|    return ret;
  216|  29.8k|}
inflateInit_:
  219|  29.8k|                         int stream_size) {
  220|  29.8k|    return inflateInit2_(strm, DEF_WBITS, version, stream_size);
  ------------------
  |  |   70|  29.8k|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |  278|  29.8k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  221|  29.8k|}
inflate:
  590|   710k|int ZEXPORT inflate(z_streamp strm, int flush) {
  591|   710k|    struct inflate_state FAR *state;
  592|   710k|    z_const unsigned char FAR *next;    /* next input */
  593|   710k|    unsigned char FAR *put;     /* next output */
  594|   710k|    unsigned have, left;        /* available input and output */
  595|   710k|    unsigned long hold;         /* bit buffer */
  596|   710k|    unsigned bits;              /* bits in bit buffer */
  597|   710k|    unsigned in, out;           /* save starting available input and output */
  598|   710k|    unsigned copy;              /* number of stored or match bytes to copy */
  599|   710k|    unsigned char FAR *from;    /* where to copy match bytes from */
  600|   710k|    code here;                  /* current decoding table entry */
  601|   710k|    code last;                  /* parent table entry */
  602|   710k|    unsigned len;               /* length to copy for repeats, bits to drop */
  603|   710k|    int ret;                    /* return code */
  604|   710k|#ifdef GUNZIP
  605|   710k|    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
  606|   710k|#endif
  607|   710k|    static const unsigned short order[19] = /* permutation of code lengths */
  608|   710k|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  609|       |
  610|   710k|    if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
  ------------------
  |  |  212|  1.42M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (610:9): [True: 0, False: 710k]
  |  Branch (610:36): [True: 0, False: 710k]
  ------------------
  611|   710k|        (strm->next_in == Z_NULL && strm->avail_in != 0))
  ------------------
  |  |  212|  1.42M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (611:10): [True: 0, False: 710k]
  |  Branch (611:37): [True: 0, False: 0]
  ------------------
  612|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  613|       |
  614|   710k|    state = (struct inflate_state FAR *)strm->state;
  615|   710k|    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
  ------------------
  |  Branch (615:9): [True: 1.63k, False: 709k]
  ------------------
  616|   710k|    LOAD();
  ------------------
  |  |  445|   710k|    do { \
  |  |  446|   710k|        put = strm->next_out; \
  |  |  447|   710k|        left = strm->avail_out; \
  |  |  448|   710k|        next = strm->next_in; \
  |  |  449|   710k|        have = strm->avail_in; \
  |  |  450|   710k|        hold = state->hold; \
  |  |  451|   710k|        bits = state->bits; \
  |  |  452|   710k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (452:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  617|   710k|    in = have;
  618|   710k|    out = left;
  619|   710k|    ret = Z_OK;
  ------------------
  |  |  177|   710k|#define Z_OK            0
  ------------------
  620|   710k|    for (;;)
  621|  7.97M|        switch (state->mode) {
  622|  29.8k|        case HEAD:
  ------------------
  |  Branch (622:9): [True: 29.8k, False: 7.94M]
  ------------------
  623|  29.8k|            if (state->wrap == 0) {
  ------------------
  |  Branch (623:17): [True: 0, False: 29.8k]
  ------------------
  624|      0|                state->mode = TYPEDO;
  625|      0|                break;
  626|      0|            }
  627|  29.8k|            NEEDBITS(16);
  ------------------
  |  |  485|  29.8k|    do { \
  |  |  486|  89.6k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 59.7k, False: 29.8k]
  |  |  ------------------
  |  |  487|  59.7k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  59.7k|    do { \
  |  |  |  |  476|  59.7k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 8, False: 59.7k]
  |  |  |  |  ------------------
  |  |  |  |  477|  59.7k|        have--; \
  |  |  |  |  478|  59.7k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  59.7k|        bits += 8; \
  |  |  |  |  480|  59.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  29.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  628|  29.8k|#ifdef GUNZIP
  629|  29.8k|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (629:17): [True: 0, False: 29.8k]
  |  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|  29.8k|            if (state->head != Z_NULL)
  ------------------
  |  |  212|  29.8k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (638:17): [True: 0, False: 29.8k]
  ------------------
  639|      0|                state->head->done = -1;
  640|  29.8k|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (640:17): [True: 0, False: 29.8k]
  ------------------
  641|       |#else
  642|       |            if (
  643|       |#endif
  644|  29.8k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  492|  29.8k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  |  Branch (644:17): [True: 502, False: 29.3k]
  ------------------
  645|    502|                strm->msg = (z_const char *)"incorrect header check";
  646|    502|                state->mode = BAD;
  647|    502|                break;
  648|    502|            }
  649|  29.3k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  492|  29.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  209|  29.3k|#define Z_DEFLATED   8
  ------------------
  |  Branch (649:17): [True: 20, False: 29.3k]
  ------------------
  650|     20|                strm->msg = (z_const char *)"unknown compression method";
  651|     20|                state->mode = BAD;
  652|     20|                break;
  653|     20|            }
  654|  29.3k|            DROPBITS(4);
  ------------------
  |  |  496|  29.3k|    do { \
  |  |  497|  29.3k|        hold >>= (n); \
  |  |  498|  29.3k|        bits -= (unsigned)(n); \
  |  |  499|  29.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  655|  29.3k|            len = BITS(4) + 8;
  ------------------
  |  |  492|  29.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  656|  29.3k|            if (state->wbits == 0)
  ------------------
  |  Branch (656:17): [True: 0, False: 29.3k]
  ------------------
  657|      0|                state->wbits = len;
  658|  29.3k|            if (len > 15 || len > state->wbits) {
  ------------------
  |  Branch (658:17): [True: 3, False: 29.3k]
  |  Branch (658:29): [True: 0, False: 29.3k]
  ------------------
  659|      3|                strm->msg = (z_const char *)"invalid window size";
  660|      3|                state->mode = BAD;
  661|      3|                break;
  662|      3|            }
  663|  29.3k|            state->dmax = 1U << len;
  664|  29.3k|            state->flags = 0;               /* indicate zlib header */
  665|  29.3k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  666|  29.3k|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  212|  29.3k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  667|  29.3k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (667:27): [True: 17, False: 29.3k]
  ------------------
  668|  29.3k|            INITBITS();
  ------------------
  |  |  467|  29.3k|    do { \
  |  |  468|  29.3k|        hold = 0; \
  |  |  469|  29.3k|        bits = 0; \
  |  |  470|  29.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  669|  29.3k|            break;
  670|      0|#ifdef GUNZIP
  671|      0|        case FLAGS:
  ------------------
  |  Branch (671:9): [True: 0, False: 7.97M]
  ------------------
  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: 7.97M]
  ------------------
  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: 7.97M]
  ------------------
  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: 7.97M]
  ------------------
  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: 7.97M]
  ------------------
  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: 7.97M]
  ------------------
  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: 7.97M]
  ------------------
  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: 7.97M]
  ------------------
  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|     33|        case DICTID:
  ------------------
  |  Branch (810:9): [True: 33, False: 7.97M]
  ------------------
  811|     33|            NEEDBITS(32);
  ------------------
  |  |  485|     33|    do { \
  |  |  486|    101|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 84, False: 17]
  |  |  ------------------
  |  |  487|     84|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|     84|    do { \
  |  |  |  |  476|     84|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 16, False: 68]
  |  |  |  |  ------------------
  |  |  |  |  477|     84|        have--; \
  |  |  |  |  478|     68|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|     68|        bits += 8; \
  |  |  |  |  480|     68|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|     33|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  812|     17|            strm->adler = state->check = ZSWAP32(hold);
  ------------------
  |  |  252|     17|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  253|     17|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
  813|     17|            INITBITS();
  ------------------
  |  |  467|     17|    do { \
  |  |  468|     17|        hold = 0; \
  |  |  469|     17|        bits = 0; \
  |  |  470|     17|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  814|     17|            state->mode = DICT;
  815|       |                /* fallthrough */
  816|     33|        case DICT:
  ------------------
  |  Branch (816:9): [True: 16, False: 7.97M]
  ------------------
  817|     33|            if (state->havedict == 0) {
  ------------------
  |  Branch (817:17): [True: 33, False: 0]
  ------------------
  818|     33|                RESTORE();
  ------------------
  |  |  456|     33|    do { \
  |  |  457|     33|        strm->next_out = put; \
  |  |  458|     33|        strm->avail_out = left; \
  |  |  459|     33|        strm->next_in = next; \
  |  |  460|     33|        strm->avail_in = have; \
  |  |  461|     33|        state->hold = hold; \
  |  |  462|     33|        state->bits = bits; \
  |  |  463|     33|    } while (0)
  |  |  ------------------
  |  |  |  Branch (463:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  819|     33|                return Z_NEED_DICT;
  ------------------
  |  |  179|     33|#define Z_NEED_DICT     2
  ------------------
  820|     33|            }
  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|  98.7k|        case TYPE:
  ------------------
  |  Branch (824:9): [True: 98.7k, False: 7.87M]
  ------------------
  825|  98.7k|            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  173|   197k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  174|  98.7k|#define Z_TREES         6
  ------------------
  |  Branch (825:17): [True: 0, False: 98.7k]
  |  Branch (825:37): [True: 0, False: 98.7k]
  ------------------
  826|       |                /* fallthrough */
  827|   100k|        case TYPEDO:
  ------------------
  |  Branch (827:9): [True: 1.63k, False: 7.97M]
  ------------------
  828|   100k|            if (state->last) {
  ------------------
  |  Branch (828:17): [True: 26.4k, False: 73.9k]
  ------------------
  829|  26.4k|                BYTEBITS();
  ------------------
  |  |  503|  26.4k|    do { \
  |  |  504|  26.4k|        hold >>= bits & 7; \
  |  |  505|  26.4k|        bits -= bits & 7; \
  |  |  506|  26.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (506:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  830|  26.4k|                state->mode = CHECK;
  831|  26.4k|                break;
  832|  26.4k|            }
  833|  73.9k|            NEEDBITS(3);
  ------------------
  |  |  485|  73.9k|    do { \
  |  |  486|   120k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 48.4k, False: 72.3k]
  |  |  ------------------
  |  |  487|  73.9k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  48.4k|    do { \
  |  |  |  |  476|  48.4k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 1.63k, False: 46.8k]
  |  |  |  |  ------------------
  |  |  |  |  477|  48.4k|        have--; \
  |  |  |  |  478|  46.8k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  46.8k|        bits += 8; \
  |  |  |  |  480|  46.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  73.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  834|  72.3k|            state->last = BITS(1);
  ------------------
  |  |  492|  72.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  835|  72.3k|            DROPBITS(1);
  ------------------
  |  |  496|  72.3k|    do { \
  |  |  497|  72.3k|        hold >>= (n); \
  |  |  498|  72.3k|        bits -= (unsigned)(n); \
  |  |  499|  72.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  836|  72.3k|            switch (BITS(2)) {
  ------------------
  |  |  492|  72.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (492:5): [True: 0, False: 72.3k]
  |  |  ------------------
  ------------------
  837|    410|            case 0:                             /* stored block */
  ------------------
  |  Branch (837:13): [True: 410, False: 71.9k]
  ------------------
  838|    410|                Tracev((stderr, "inflate:     stored block%s\n",
  839|    410|                        state->last ? " (last)" : ""));
  840|    410|                state->mode = STORED;
  841|    410|                break;
  842|  55.5k|            case 1:                             /* fixed block */
  ------------------
  |  Branch (842:13): [True: 55.5k, False: 16.7k]
  ------------------
  843|  55.5k|                fixedtables(state);
  844|  55.5k|                Tracev((stderr, "inflate:     fixed codes block%s\n",
  845|  55.5k|                        state->last ? " (last)" : ""));
  846|  55.5k|                state->mode = LEN_;             /* decode codes */
  847|  55.5k|                if (flush == Z_TREES) {
  ------------------
  |  |  174|  55.5k|#define Z_TREES         6
  ------------------
  |  Branch (847:21): [True: 0, False: 55.5k]
  ------------------
  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|  55.5k|                break;
  852|  55.5k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (852:13): [True: 16.2k, False: 56.0k]
  ------------------
  853|  16.2k|                Tracev((stderr, "inflate:     dynamic codes block%s\n",
  854|  16.2k|                        state->last ? " (last)" : ""));
  855|  16.2k|                state->mode = TABLE;
  856|  16.2k|                break;
  857|     56|            case 3:
  ------------------
  |  Branch (857:13): [True: 56, False: 72.2k]
  ------------------
  858|     56|                strm->msg = (z_const char *)"invalid block type";
  859|     56|                state->mode = BAD;
  860|  72.3k|            }
  861|  72.3k|            DROPBITS(2);
  ------------------
  |  |  496|  72.3k|    do { \
  |  |  497|  72.3k|        hold >>= (n); \
  |  |  498|  72.3k|        bits -= (unsigned)(n); \
  |  |  499|  72.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  862|  72.3k|            break;
  863|    475|        case STORED:
  ------------------
  |  Branch (863:9): [True: 475, False: 7.97M]
  ------------------
  864|    475|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  503|    475|    do { \
  |  |  504|    475|        hold >>= bits & 7; \
  |  |  505|    475|        bits -= bits & 7; \
  |  |  506|    475|    } while (0)
  |  |  ------------------
  |  |  |  Branch (506:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  865|    475|            NEEDBITS(32);
  ------------------
  |  |  485|    475|    do { \
  |  |  486|  2.06k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 1.67k, False: 389]
  |  |  ------------------
  |  |  487|  1.67k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  1.67k|    do { \
  |  |  |  |  476|  1.67k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 86, False: 1.59k]
  |  |  |  |  ------------------
  |  |  |  |  477|  1.67k|        have--; \
  |  |  |  |  478|  1.59k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  1.59k|        bits += 8; \
  |  |  |  |  480|  1.59k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|    475|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  866|    389|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (866:17): [True: 130, False: 259]
  ------------------
  867|    130|                strm->msg = (z_const char *)"invalid stored block lengths";
  868|    130|                state->mode = BAD;
  869|    130|                break;
  870|    130|            }
  871|    259|            state->length = (unsigned)hold & 0xffff;
  872|    259|            Tracev((stderr, "inflate:       stored length %u\n",
  873|    259|                    state->length));
  874|    259|            INITBITS();
  ------------------
  |  |  467|    259|    do { \
  |  |  468|    259|        hold = 0; \
  |  |  469|    259|        bits = 0; \
  |  |  470|    259|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  875|    259|            state->mode = COPY_;
  876|    259|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  174|    259|#define Z_TREES         6
  ------------------
  |  Branch (876:17): [True: 0, False: 259]
  ------------------
  877|       |                /* fallthrough */
  878|    259|        case COPY_:
  ------------------
  |  Branch (878:9): [True: 0, False: 7.97M]
  ------------------
  879|    259|            state->mode = COPY;
  880|       |                /* fallthrough */
  881|    451|        case COPY:
  ------------------
  |  Branch (881:9): [True: 192, False: 7.97M]
  ------------------
  882|    451|            copy = state->length;
  883|    451|            if (copy) {
  ------------------
  |  Branch (883:17): [True: 205, False: 246]
  ------------------
  884|    205|                if (copy > have) copy = have;
  ------------------
  |  Branch (884:21): [True: 39, False: 166]
  ------------------
  885|    205|                if (copy > left) copy = left;
  ------------------
  |  Branch (885:21): [True: 0, False: 205]
  ------------------
  886|    205|                if (copy == 0) goto inf_leave;
  ------------------
  |  Branch (886:21): [True: 26, False: 179]
  ------------------
  887|    179|                zmemcpy(put, next, copy);
  ------------------
  |  |  210|    179|#    define zmemcpy memcpy
  ------------------
  888|    179|                have -= copy;
  889|    179|                next += copy;
  890|    179|                left -= copy;
  891|    179|                put += copy;
  892|    179|                state->length -= copy;
  893|    179|                break;
  894|    205|            }
  895|    246|            Tracev((stderr, "inflate:       stored end\n"));
  896|    246|            state->mode = TYPE;
  897|    246|            break;
  898|  23.9k|        case TABLE:
  ------------------
  |  Branch (898:9): [True: 23.9k, False: 7.94M]
  ------------------
  899|  23.9k|            NEEDBITS(14);
  ------------------
  |  |  485|  23.9k|    do { \
  |  |  486|  56.4k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 40.1k, False: 16.2k]
  |  |  ------------------
  |  |  487|  40.1k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  40.1k|    do { \
  |  |  |  |  476|  40.1k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 7.71k, False: 32.4k]
  |  |  |  |  ------------------
  |  |  |  |  477|  40.1k|        have--; \
  |  |  |  |  478|  32.4k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  32.4k|        bits += 8; \
  |  |  |  |  480|  32.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  23.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  900|  16.2k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  492|  16.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  901|  16.2k|            DROPBITS(5);
  ------------------
  |  |  496|  16.2k|    do { \
  |  |  497|  16.2k|        hold >>= (n); \
  |  |  498|  16.2k|        bits -= (unsigned)(n); \
  |  |  499|  16.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  902|  16.2k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  492|  16.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  903|  16.2k|            DROPBITS(5);
  ------------------
  |  |  496|  16.2k|    do { \
  |  |  497|  16.2k|        hold >>= (n); \
  |  |  498|  16.2k|        bits -= (unsigned)(n); \
  |  |  499|  16.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  904|  16.2k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  492|  16.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  905|  16.2k|            DROPBITS(4);
  ------------------
  |  |  496|  16.2k|    do { \
  |  |  497|  16.2k|        hold >>= (n); \
  |  |  498|  16.2k|        bits -= (unsigned)(n); \
  |  |  499|  16.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  906|  16.2k|#ifndef PKZIP_BUG_WORKAROUND
  907|  16.2k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (907:17): [True: 8, False: 16.2k]
  |  Branch (907:38): [True: 11, False: 16.2k]
  ------------------
  908|     19|                strm->msg = (z_const char *)"too many length or distance symbols";
  909|     19|                state->mode = BAD;
  910|     19|                break;
  911|     19|            }
  912|  16.2k|#endif
  913|  16.2k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  914|  16.2k|            state->have = 0;
  915|  16.2k|            state->mode = LENLENS;
  916|       |                /* fallthrough */
  917|  23.9k|        case LENLENS:
  ------------------
  |  Branch (917:9): [True: 7.71k, False: 7.96M]
  ------------------
  918|   297k|            while (state->have < state->ncode) {
  ------------------
  |  Branch (918:20): [True: 280k, False: 16.2k]
  ------------------
  919|   280k|                NEEDBITS(3);
  ------------------
  |  |  485|   280k|    do { \
  |  |  486|   375k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 102k, False: 273k]
  |  |  ------------------
  |  |  487|   280k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|   102k|    do { \
  |  |  |  |  476|   102k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 7.74k, False: 94.4k]
  |  |  |  |  ------------------
  |  |  |  |  477|   102k|        have--; \
  |  |  |  |  478|  94.4k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  94.4k|        bits += 8; \
  |  |  |  |  480|  94.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|   280k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  920|   273k|                state->lens[order[state->have++]] = (unsigned short)BITS(3);
  ------------------
  |  |  492|   273k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  921|   273k|                DROPBITS(3);
  ------------------
  |  |  496|   273k|    do { \
  |  |  497|   273k|        hold >>= (n); \
  |  |  498|   273k|        bits -= (unsigned)(n); \
  |  |  499|   273k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  922|   273k|            }
  923|  51.6k|            while (state->have < 19)
  ------------------
  |  Branch (923:20): [True: 35.4k, False: 16.2k]
  ------------------
  924|  35.4k|                state->lens[order[state->have++]] = 0;
  925|  16.2k|            state->next = state->codes;
  926|  16.2k|            state->lencode = state->distcode = (const code FAR *)(state->next);
  927|  16.2k|            state->lenbits = 7;
  928|  16.2k|            ret = inflate_table(CODES, state->lens, 19, &(state->next),
  929|  16.2k|                                &(state->lenbits), state->work);
  930|  16.2k|            if (ret) {
  ------------------
  |  Branch (930:17): [True: 188, False: 16.0k]
  ------------------
  931|    188|                strm->msg = (z_const char *)"invalid code lengths set";
  932|    188|                state->mode = BAD;
  933|    188|                break;
  934|    188|            }
  935|  16.0k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  936|  16.0k|            state->have = 0;
  937|  16.0k|            state->mode = CODELENS;
  938|       |                /* fallthrough */
  939|  51.8k|        case CODELENS:
  ------------------
  |  Branch (939:9): [True: 35.8k, False: 7.93M]
  ------------------
  940|  1.26M|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (940:20): [True: 1.24M, False: 15.7k]
  ------------------
  941|  1.72M|                for (;;) {
  942|  1.72M|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  492|  1.72M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  943|  1.72M|                    if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (943:25): [True: 1.22M, False: 496k]
  ------------------
  944|   496k|                    PULLBYTE();
  ------------------
  |  |  475|   496k|    do { \
  |  |  476|   496k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (476:13): [True: 21.5k, False: 475k]
  |  |  ------------------
  |  |  477|   496k|        have--; \
  |  |  478|   475k|        hold += (unsigned long)(*next++) << bits; \
  |  |  479|   475k|        bits += 8; \
  |  |  480|   475k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  945|   496k|                }
  946|  1.22M|                if (here.val < 16) {
  ------------------
  |  Branch (946:21): [True: 1.04M, False: 177k]
  ------------------
  947|  1.04M|                    DROPBITS(here.bits);
  ------------------
  |  |  496|  1.04M|    do { \
  |  |  497|  1.04M|        hold >>= (n); \
  |  |  498|  1.04M|        bits -= (unsigned)(n); \
  |  |  499|  1.04M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  948|  1.04M|                    state->lens[state->have++] = here.val;
  949|  1.04M|                }
  950|   177k|                else {
  951|   177k|                    if (here.val == 16) {
  ------------------
  |  Branch (951:25): [True: 34.9k, False: 142k]
  ------------------
  952|  34.9k|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  485|  34.9k|    do { \
  |  |  486|  41.4k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 6.56k, False: 34.8k]
  |  |  ------------------
  |  |  487|  34.9k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  6.56k|    do { \
  |  |  |  |  476|  6.56k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 2, False: 6.56k]
  |  |  |  |  ------------------
  |  |  |  |  477|  6.56k|        have--; \
  |  |  |  |  478|  6.56k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  6.56k|        bits += 8; \
  |  |  |  |  480|  6.56k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  34.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  953|  34.8k|                        DROPBITS(here.bits);
  ------------------
  |  |  496|  34.8k|    do { \
  |  |  497|  34.8k|        hold >>= (n); \
  |  |  498|  34.8k|        bits -= (unsigned)(n); \
  |  |  499|  34.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  954|  34.8k|                        if (state->have == 0) {
  ------------------
  |  Branch (954:29): [True: 4, False: 34.8k]
  ------------------
  955|      4|                            strm->msg = (z_const char *)"invalid bit length repeat";
  956|      4|                            state->mode = BAD;
  957|      4|                            break;
  958|      4|                        }
  959|  34.8k|                        len = state->lens[state->have - 1];
  960|  34.8k|                        copy = 3 + BITS(2);
  ------------------
  |  |  492|  34.8k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  961|  34.8k|                        DROPBITS(2);
  ------------------
  |  |  496|  34.8k|    do { \
  |  |  497|  34.8k|        hold >>= (n); \
  |  |  498|  34.8k|        bits -= (unsigned)(n); \
  |  |  499|  34.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  962|  34.8k|                    }
  963|   142k|                    else if (here.val == 17) {
  ------------------
  |  Branch (963:30): [True: 64.3k, False: 78.6k]
  ------------------
  964|  64.3k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  485|  64.3k|    do { \
  |  |  486|  88.6k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 24.3k, False: 64.2k]
  |  |  ------------------
  |  |  487|  64.3k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  24.3k|    do { \
  |  |  |  |  476|  24.3k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 81, False: 24.2k]
  |  |  |  |  ------------------
  |  |  |  |  477|  24.3k|        have--; \
  |  |  |  |  478|  24.2k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  24.2k|        bits += 8; \
  |  |  |  |  480|  24.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  64.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  965|  64.2k|                        DROPBITS(here.bits);
  ------------------
  |  |  496|  64.2k|    do { \
  |  |  497|  64.2k|        hold >>= (n); \
  |  |  498|  64.2k|        bits -= (unsigned)(n); \
  |  |  499|  64.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  966|  64.2k|                        len = 0;
  967|  64.2k|                        copy = 3 + BITS(3);
  ------------------
  |  |  492|  64.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  968|  64.2k|                        DROPBITS(3);
  ------------------
  |  |  496|  64.2k|    do { \
  |  |  497|  64.2k|        hold >>= (n); \
  |  |  498|  64.2k|        bits -= (unsigned)(n); \
  |  |  499|  64.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  969|  64.2k|                    }
  970|  78.6k|                    else {
  971|  78.6k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  485|  78.6k|    do { \
  |  |  486|   126k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 62.1k, False: 64.2k]
  |  |  ------------------
  |  |  487|  78.6k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  62.1k|    do { \
  |  |  |  |  476|  62.1k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 14.3k, False: 47.7k]
  |  |  |  |  ------------------
  |  |  |  |  477|  62.1k|        have--; \
  |  |  |  |  478|  47.7k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  47.7k|        bits += 8; \
  |  |  |  |  480|  47.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  78.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  972|  64.2k|                        DROPBITS(here.bits);
  ------------------
  |  |  496|  64.2k|    do { \
  |  |  497|  64.2k|        hold >>= (n); \
  |  |  498|  64.2k|        bits -= (unsigned)(n); \
  |  |  499|  64.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  973|  64.2k|                        len = 0;
  974|  64.2k|                        copy = 11 + BITS(7);
  ------------------
  |  |  492|  64.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  975|  64.2k|                        DROPBITS(7);
  ------------------
  |  |  496|  64.2k|    do { \
  |  |  497|  64.2k|        hold >>= (n); \
  |  |  498|  64.2k|        bits -= (unsigned)(n); \
  |  |  499|  64.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  976|  64.2k|                    }
  977|   163k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (977:25): [True: 210, False: 163k]
  ------------------
  978|    210|                        strm->msg = (z_const char *)"invalid bit length repeat";
  979|    210|                        state->mode = BAD;
  980|    210|                        break;
  981|    210|                    }
  982|  3.87M|                    while (copy--)
  ------------------
  |  Branch (982:28): [True: 3.71M, False: 163k]
  ------------------
  983|  3.71M|                        state->lens[state->have++] = (unsigned short)len;
  984|   163k|                }
  985|  1.22M|            }
  986|       |
  987|       |            /* handle error breaks in while */
  988|  15.9k|            if (state->mode == BAD) break;
  ------------------
  |  Branch (988:17): [True: 214, False: 15.7k]
  ------------------
  989|       |
  990|       |            /* check for end-of-block code (better have one) */
  991|  15.7k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (991:17): [True: 48, False: 15.6k]
  ------------------
  992|     48|                strm->msg = (z_const char *)"invalid code -- missing end-of-block";
  993|     48|                state->mode = BAD;
  994|     48|                break;
  995|     48|            }
  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|  15.6k|            state->next = state->codes;
 1001|  15.6k|            state->lencode = (const code FAR *)(state->next);
 1002|  15.6k|            state->lenbits = 9;
 1003|  15.6k|            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
 1004|  15.6k|                                &(state->lenbits), state->work);
 1005|  15.6k|            if (ret) {
  ------------------
  |  Branch (1005:17): [True: 104, False: 15.5k]
  ------------------
 1006|    104|                strm->msg = (z_const char *)"invalid literal/lengths set";
 1007|    104|                state->mode = BAD;
 1008|    104|                break;
 1009|    104|            }
 1010|  15.5k|            state->distcode = (const code FAR *)(state->next);
 1011|  15.5k|            state->distbits = 6;
 1012|  15.5k|            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
 1013|  15.5k|                            &(state->next), &(state->distbits), state->work);
 1014|  15.5k|            if (ret) {
  ------------------
  |  Branch (1014:17): [True: 51, False: 15.5k]
  ------------------
 1015|     51|                strm->msg = (z_const char *)"invalid distances set";
 1016|     51|                state->mode = BAD;
 1017|     51|                break;
 1018|     51|            }
 1019|  15.5k|            Tracev((stderr, "inflate:       codes ok\n"));
 1020|  15.5k|            state->mode = LEN_;
 1021|  15.5k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  174|  15.5k|#define Z_TREES         6
  ------------------
  |  Branch (1021:17): [True: 0, False: 15.5k]
  ------------------
 1022|       |                /* fallthrough */
 1023|  71.0k|        case LEN_:
  ------------------
  |  Branch (1023:9): [True: 55.5k, False: 7.91M]
  ------------------
 1024|  71.0k|            state->mode = LEN;
 1025|       |                /* fallthrough */
 1026|  5.36M|        case LEN:
  ------------------
  |  Branch (1026:9): [True: 5.29M, False: 2.67M]
  ------------------
 1027|  5.36M|            if (have >= 6 && left >= 258) {
  ------------------
  |  Branch (1027:17): [True: 1.82M, False: 3.54M]
  |  Branch (1027:30): [True: 1.74M, False: 74.4k]
  ------------------
 1028|  1.74M|                RESTORE();
  ------------------
  |  |  456|  1.74M|    do { \
  |  |  457|  1.74M|        strm->next_out = put; \
  |  |  458|  1.74M|        strm->avail_out = left; \
  |  |  459|  1.74M|        strm->next_in = next; \
  |  |  460|  1.74M|        strm->avail_in = have; \
  |  |  461|  1.74M|        state->hold = hold; \
  |  |  462|  1.74M|        state->bits = bits; \
  |  |  463|  1.74M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (463:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1029|  1.74M|                inflate_fast(strm, out);
 1030|  1.74M|                LOAD();
  ------------------
  |  |  445|  1.74M|    do { \
  |  |  446|  1.74M|        put = strm->next_out; \
  |  |  447|  1.74M|        left = strm->avail_out; \
  |  |  448|  1.74M|        next = strm->next_in; \
  |  |  449|  1.74M|        have = strm->avail_in; \
  |  |  450|  1.74M|        hold = state->hold; \
  |  |  451|  1.74M|        bits = state->bits; \
  |  |  452|  1.74M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (452:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1031|  1.74M|                if (state->mode == TYPE)
  ------------------
  |  Branch (1031:21): [True: 31.4k, False: 1.71M]
  ------------------
 1032|  31.4k|                    state->back = -1;
 1033|  1.74M|                break;
 1034|  1.74M|            }
 1035|  3.61M|            state->back = 0;
 1036|  5.88M|            for (;;) {
 1037|  5.88M|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  492|  5.88M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1038|  5.88M|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (1038:21): [True: 3.24M, False: 2.64M]
  ------------------
 1039|  2.64M|                PULLBYTE();
  ------------------
  |  |  475|  2.64M|    do { \
  |  |  476|  2.64M|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (476:13): [True: 372k, False: 2.26M]
  |  |  ------------------
  |  |  477|  2.64M|        have--; \
  |  |  478|  2.26M|        hold += (unsigned long)(*next++) << bits; \
  |  |  479|  2.26M|        bits += 8; \
  |  |  480|  2.26M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1040|  2.64M|            }
 1041|  3.24M|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (1041:17): [True: 1.15M, False: 2.08M]
  |  Branch (1041:28): [True: 47.2k, False: 1.11M]
  ------------------
 1042|  47.2k|                last = here;
 1043|  65.0k|                for (;;) {
 1044|  65.0k|                    here = state->lencode[last.val +
 1045|  65.0k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  492|  65.0k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1046|  65.0k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (1046:25): [True: 47.1k, False: 17.8k]
  ------------------
 1047|  17.8k|                    PULLBYTE();
  ------------------
  |  |  475|  17.8k|    do { \
  |  |  476|  17.8k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (476:13): [True: 34, False: 17.8k]
  |  |  ------------------
  |  |  477|  17.8k|        have--; \
  |  |  478|  17.8k|        hold += (unsigned long)(*next++) << bits; \
  |  |  479|  17.8k|        bits += 8; \
  |  |  480|  17.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1048|  17.8k|                }
 1049|  47.1k|                DROPBITS(last.bits);
  ------------------
  |  |  496|  47.1k|    do { \
  |  |  497|  47.1k|        hold >>= (n); \
  |  |  498|  47.1k|        bits -= (unsigned)(n); \
  |  |  499|  47.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1050|  47.1k|                state->back += last.bits;
 1051|  47.1k|            }
 1052|  3.24M|            DROPBITS(here.bits);
  ------------------
  |  |  496|  3.24M|    do { \
  |  |  497|  3.24M|        hold >>= (n); \
  |  |  498|  3.24M|        bits -= (unsigned)(n); \
  |  |  499|  3.24M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1053|  3.24M|            state->back += here.bits;
 1054|  3.24M|            state->length = (unsigned)here.val;
 1055|  3.24M|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (1055:17): [True: 2.11M, False: 1.12M]
  ------------------
 1056|  2.11M|                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
 1057|  2.11M|                        "inflate:         literal '%c'\n" :
 1058|  2.11M|                        "inflate:         literal 0x%02x\n", here.val));
 1059|  2.11M|                state->mode = LIT;
 1060|  2.11M|                break;
 1061|  2.11M|            }
 1062|  1.12M|            if (here.op & 32) {
  ------------------
  |  Branch (1062:17): [True: 37.7k, False: 1.09M]
  ------------------
 1063|  37.7k|                Tracevv((stderr, "inflate:         end of block\n"));
 1064|  37.7k|                state->back = -1;
 1065|  37.7k|                state->mode = TYPE;
 1066|  37.7k|                break;
 1067|  37.7k|            }
 1068|  1.09M|            if (here.op & 64) {
  ------------------
  |  Branch (1068:17): [True: 8, False: 1.09M]
  ------------------
 1069|      8|                strm->msg = (z_const char *)"invalid literal/length code";
 1070|      8|                state->mode = BAD;
 1071|      8|                break;
 1072|      8|            }
 1073|  1.09M|            state->extra = (unsigned)(here.op) & 15;
 1074|  1.09M|            state->mode = LENEXT;
 1075|       |                /* fallthrough */
 1076|  1.09M|        case LENEXT:
  ------------------
  |  Branch (1076:9): [True: 2.31k, False: 7.96M]
  ------------------
 1077|  1.09M|            if (state->extra) {
  ------------------
  |  Branch (1077:17): [True: 94.2k, False: 998k]
  ------------------
 1078|  94.2k|                NEEDBITS(state->extra);
  ------------------
  |  |  485|  94.2k|    do { \
  |  |  486|   109k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 17.8k, False: 91.8k]
  |  |  ------------------
  |  |  487|  94.2k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|  17.8k|    do { \
  |  |  |  |  476|  17.8k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 2.38k, False: 15.4k]
  |  |  |  |  ------------------
  |  |  |  |  477|  17.8k|        have--; \
  |  |  |  |  478|  15.4k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|  15.4k|        bits += 8; \
  |  |  |  |  480|  15.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  94.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1079|  91.8k|                state->length += BITS(state->extra);
  ------------------
  |  |  492|  91.8k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1080|  91.8k|                DROPBITS(state->extra);
  ------------------
  |  |  496|  91.8k|    do { \
  |  |  497|  91.8k|        hold >>= (n); \
  |  |  498|  91.8k|        bits -= (unsigned)(n); \
  |  |  499|  91.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1081|  91.8k|                state->back += state->extra;
 1082|  91.8k|            }
 1083|  1.09M|            Tracevv((stderr, "inflate:         length %u\n", state->length));
 1084|  1.09M|            state->was = state->length;
 1085|  1.09M|            state->mode = DIST;
 1086|       |                /* fallthrough */
 1087|  1.11M|        case DIST:
  ------------------
  |  Branch (1087:9): [True: 28.9k, False: 7.94M]
  ------------------
 1088|  1.50M|            for (;;) {
 1089|  1.50M|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  492|  1.50M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1090|  1.50M|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (1090:21): [True: 1.09M, False: 410k]
  ------------------
 1091|   410k|                PULLBYTE();
  ------------------
  |  |  475|   410k|    do { \
  |  |  476|   410k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (476:13): [True: 29.0k, False: 381k]
  |  |  ------------------
  |  |  477|   410k|        have--; \
  |  |  478|   381k|        hold += (unsigned long)(*next++) << bits; \
  |  |  479|   381k|        bits += 8; \
  |  |  480|   381k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1092|   410k|            }
 1093|  1.09M|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (1093:17): [True: 1.50k, False: 1.08M]
  ------------------
 1094|  1.50k|                last = here;
 1095|  1.67k|                for (;;) {
 1096|  1.67k|                    here = state->distcode[last.val +
 1097|  1.67k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  492|  1.67k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1098|  1.67k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (1098:25): [True: 1.49k, False: 176]
  ------------------
 1099|    176|                    PULLBYTE();
  ------------------
  |  |  475|    176|    do { \
  |  |  476|    176|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (476:13): [True: 5, False: 171]
  |  |  ------------------
  |  |  477|    176|        have--; \
  |  |  478|    171|        hold += (unsigned long)(*next++) << bits; \
  |  |  479|    171|        bits += 8; \
  |  |  480|    171|    } while (0)
  |  |  ------------------
  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1100|    176|                }
 1101|  1.49k|                DROPBITS(last.bits);
  ------------------
  |  |  496|  1.49k|    do { \
  |  |  497|  1.49k|        hold >>= (n); \
  |  |  498|  1.49k|        bits -= (unsigned)(n); \
  |  |  499|  1.49k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1102|  1.49k|                state->back += last.bits;
 1103|  1.49k|            }
 1104|  1.09M|            DROPBITS(here.bits);
  ------------------
  |  |  496|  1.09M|    do { \
  |  |  497|  1.09M|        hold >>= (n); \
  |  |  498|  1.09M|        bits -= (unsigned)(n); \
  |  |  499|  1.09M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1105|  1.09M|            state->back += here.bits;
 1106|  1.09M|            if (here.op & 64) {
  ------------------
  |  Branch (1106:17): [True: 17, False: 1.09M]
  ------------------
 1107|     17|                strm->msg = (z_const char *)"invalid distance code";
 1108|     17|                state->mode = BAD;
 1109|     17|                break;
 1110|     17|            }
 1111|  1.09M|            state->offset = (unsigned)here.val;
 1112|  1.09M|            state->extra = (unsigned)(here.op) & 15;
 1113|  1.09M|            state->mode = DISTEXT;
 1114|       |                /* fallthrough */
 1115|  1.27M|        case DISTEXT:
  ------------------
  |  Branch (1115:9): [True: 187k, False: 7.78M]
  ------------------
 1116|  1.27M|            if (state->extra) {
  ------------------
  |  Branch (1116:17): [True: 1.01M, False: 259k]
  ------------------
 1117|  1.01M|                NEEDBITS(state->extra);
  ------------------
  |  |  485|  1.01M|    do { \
  |  |  486|  1.31M|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 485k, False: 830k]
  |  |  ------------------
  |  |  487|  1.01M|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|   485k|    do { \
  |  |  |  |  476|   485k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 187k, False: 297k]
  |  |  |  |  ------------------
  |  |  |  |  477|   485k|        have--; \
  |  |  |  |  478|   297k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|   297k|        bits += 8; \
  |  |  |  |  480|   297k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  1.01M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1118|   830k|                state->offset += BITS(state->extra);
  ------------------
  |  |  492|   830k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1119|   830k|                DROPBITS(state->extra);
  ------------------
  |  |  496|   830k|    do { \
  |  |  497|   830k|        hold >>= (n); \
  |  |  498|   830k|        bits -= (unsigned)(n); \
  |  |  499|   830k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (499:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1120|   830k|                state->back += state->extra;
 1121|   830k|            }
 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|  1.09M|            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 1130|  1.09M|            state->mode = MATCH;
 1131|       |                /* fallthrough */
 1132|  1.11M|        case MATCH:
  ------------------
  |  Branch (1132:9): [True: 25.5k, False: 7.94M]
  ------------------
 1133|  1.11M|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1133:17): [True: 946, False: 1.11M]
  ------------------
 1134|  1.11M|            copy = out - left;
 1135|  1.11M|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1135:17): [True: 327k, False: 787k]
  ------------------
 1136|   327k|                copy = state->offset - copy;
 1137|   327k|                if (copy > state->whave) {
  ------------------
  |  Branch (1137:21): [True: 28, False: 327k]
  ------------------
 1138|     28|                    if (state->sane) {
  ------------------
  |  Branch (1138:25): [True: 28, False: 0]
  ------------------
 1139|     28|                        strm->msg = (z_const char *)"invalid distance too far back";
 1140|     28|                        state->mode = BAD;
 1141|     28|                        break;
 1142|     28|                    }
 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|     28|                }
 1157|   327k|                if (copy > state->wnext) {
  ------------------
  |  Branch (1157:21): [True: 2.83k, False: 324k]
  ------------------
 1158|  2.83k|                    copy -= state->wnext;
 1159|  2.83k|                    from = state->window + (state->wsize - copy);
 1160|  2.83k|                }
 1161|   324k|                else
 1162|   324k|                    from = state->window + (state->wnext - copy);
 1163|   327k|                if (copy > state->length) copy = state->length;
  ------------------
  |  Branch (1163:21): [True: 302k, False: 25.1k]
  ------------------
 1164|   327k|            }
 1165|   787k|            else {                              /* copy from output */
 1166|   787k|                from = put - state->offset;
 1167|   787k|                copy = state->length;
 1168|   787k|            }
 1169|  1.11M|            if (copy > left) copy = left;
  ------------------
  |  Branch (1169:17): [True: 920, False: 1.11M]
  ------------------
 1170|  1.11M|            left -= copy;
 1171|  1.11M|            state->length -= copy;
 1172|  74.0M|            do {
 1173|  74.0M|                *put++ = *from++;
 1174|  74.0M|            } while (--copy);
  ------------------
  |  Branch (1174:22): [True: 72.9M, False: 1.11M]
  ------------------
 1175|  1.11M|            if (state->length == 0) state->mode = LEN;
  ------------------
  |  Branch (1175:17): [True: 1.09M, False: 24.6k]
  ------------------
 1176|  1.11M|            break;
 1177|  2.11M|        case LIT:
  ------------------
  |  Branch (1177:9): [True: 2.11M, False: 5.85M]
  ------------------
 1178|  2.11M|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1178:17): [True: 241, False: 2.11M]
  ------------------
 1179|  2.11M|            *put++ = (unsigned char)(state->length);
 1180|  2.11M|            left--;
 1181|  2.11M|            state->mode = LEN;
 1182|  2.11M|            break;
 1183|  33.2k|        case CHECK:
  ------------------
  |  Branch (1183:9): [True: 33.2k, False: 7.93M]
  ------------------
 1184|  33.2k|            if (state->wrap) {
  ------------------
  |  Branch (1184:17): [True: 33.2k, False: 0]
  ------------------
 1185|  33.2k|                NEEDBITS(32);
  ------------------
  |  |  485|  33.2k|    do { \
  |  |  486|   138k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (486:16): [True: 112k, False: 26.3k]
  |  |  ------------------
  |  |  487|   112k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  475|   112k|    do { \
  |  |  |  |  476|   112k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (476:13): [True: 6.84k, False: 105k]
  |  |  |  |  ------------------
  |  |  |  |  477|   112k|        have--; \
  |  |  |  |  478|   105k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  479|   105k|        bits += 8; \
  |  |  |  |  480|   105k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (480:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  33.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (488:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1186|  26.3k|                out -= left;
 1187|  26.3k|                strm->total_out += out;
 1188|  26.3k|                state->total += out;
 1189|  26.3k|                if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1189:21): [True: 26.3k, False: 0]
  |  Branch (1189:42): [True: 19.5k, False: 6.80k]
  ------------------
 1190|  19.5k|                    strm->adler = state->check =
 1191|  19.5k|                        UPDATE_CHECK(state->check, put - out, out);
  ------------------
  |  |  419|  19.5k|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (419:6): [True: 0, False: 19.5k]
  |  |  ------------------
  ------------------
 1192|  26.3k|                out = left;
 1193|  26.3k|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1193:21): [True: 26.3k, False: 0]
  |  Branch (1193:42): [True: 1.64k, False: 24.7k]
  ------------------
 1194|  26.3k|#ifdef GUNZIP
 1195|  26.3k|                     state->flags ? hold :
  ------------------
  |  Branch (1195:22): [True: 0, False: 26.3k]
  ------------------
 1196|  26.3k|#endif
 1197|  26.3k|                     ZSWAP32(hold)) != state->check) {
  ------------------
  |  |  252|  26.3k|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  253|  26.3k|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
 1198|  1.64k|                    strm->msg = (z_const char *)"incorrect data check";
 1199|  1.64k|                    state->mode = BAD;
 1200|  1.64k|                    break;
 1201|  1.64k|                }
 1202|  24.7k|                INITBITS();
  ------------------
  |  |  467|  24.7k|    do { \
  |  |  468|  24.7k|        hold = 0; \
  |  |  469|  24.7k|        bits = 0; \
  |  |  470|  24.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (470:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1203|  24.7k|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1204|  24.7k|            }
 1205|  24.7k|#ifdef GUNZIP
 1206|  24.7k|            state->mode = LENGTH;
 1207|       |                /* fallthrough */
 1208|  24.7k|        case LENGTH:
  ------------------
  |  Branch (1208:9): [True: 0, False: 7.97M]
  ------------------
 1209|  24.7k|            if (state->wrap && state->flags) {
  ------------------
  |  Branch (1209:17): [True: 24.7k, False: 0]
  |  Branch (1209:32): [True: 0, False: 24.7k]
  ------------------
 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|  24.7k|#endif
 1220|  24.7k|            state->mode = DONE;
 1221|       |                /* fallthrough */
 1222|  49.6k|        case DONE:
  ------------------
  |  Branch (1222:9): [True: 24.8k, False: 7.94M]
  ------------------
 1223|  49.6k|            ret = Z_STREAM_END;
  ------------------
  |  |  178|  49.6k|#define Z_STREAM_END    1
  ------------------
 1224|  49.6k|            goto inf_leave;
 1225|  8.12k|        case BAD:
  ------------------
  |  Branch (1225:9): [True: 8.12k, False: 7.96M]
  ------------------
 1226|  8.12k|            ret = Z_DATA_ERROR;
  ------------------
  |  |  182|  8.12k|#define Z_DATA_ERROR   (-3)
  ------------------
 1227|  8.12k|            goto inf_leave;
 1228|      0|        case MEM:
  ------------------
  |  Branch (1228:9): [True: 0, False: 7.97M]
  ------------------
 1229|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  183|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1230|      0|        case SYNC:
  ------------------
  |  Branch (1230:9): [True: 0, False: 7.97M]
  ------------------
 1231|       |                /* fallthrough */
 1232|      0|        default:
  ------------------
  |  Branch (1232:9): [True: 0, False: 7.97M]
  ------------------
 1233|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1234|  7.97M|        }
 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|   710k|  inf_leave:
 1243|   710k|    RESTORE();
  ------------------
  |  |  456|   710k|    do { \
  |  |  457|   710k|        strm->next_out = put; \
  |  |  458|   710k|        strm->avail_out = left; \
  |  |  459|   710k|        strm->next_in = next; \
  |  |  460|   710k|        strm->avail_in = have; \
  |  |  461|   710k|        state->hold = hold; \
  |  |  462|   710k|        state->bits = bits; \
  |  |  463|   710k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (463:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1244|   710k|    if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1244:9): [True: 607k, False: 103k]
  |  Branch (1244:26): [True: 9.24k, False: 94.2k]
  |  Branch (1244:52): [True: 8.45k, False: 789]
  ------------------
 1245|   103k|            (state->mode < CHECK || flush != Z_FINISH)))
  ------------------
  |  |  172|     17|#define Z_FINISH        4
  ------------------
  |  Branch (1245:14): [True: 8.43k, False: 17]
  |  Branch (1245:37): [True: 17, False: 0]
  ------------------
 1246|   615k|        if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
  ------------------
  |  Branch (1246:13): [True: 0, False: 615k]
  ------------------
 1247|      0|            state->mode = MEM;
 1248|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  183|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1249|      0|        }
 1250|   710k|    in -= strm->avail_in;
 1251|   710k|    out -= strm->avail_out;
 1252|   710k|    strm->total_in += in;
 1253|   710k|    strm->total_out += out;
 1254|   710k|    state->total += out;
 1255|   710k|    if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1255:9): [True: 710k, False: 0]
  |  Branch (1255:30): [True: 594k, False: 116k]
  ------------------
 1256|   594k|        strm->adler = state->check =
 1257|   594k|            UPDATE_CHECK(state->check, strm->next_out - out, out);
  ------------------
  |  |  419|   594k|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (419:6): [True: 0, False: 594k]
  |  |  ------------------
  ------------------
 1258|   710k|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1258:43): [True: 65.8k, False: 645k]
  ------------------
 1259|   710k|                      (state->mode == TYPE ? 128 : 0) +
  ------------------
  |  Branch (1259:24): [True: 1.63k, False: 709k]
  ------------------
 1260|   710k|                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1260:24): [True: 0, False: 710k]
  |  Branch (1260:47): [True: 0, False: 710k]
  ------------------
 1261|   710k|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  172|   680k|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  177|  30.7k|#define Z_OK            0
  ------------------
  |  Branch (1261:11): [True: 30.7k, False: 680k]
  |  Branch (1261:22): [True: 30.7k, False: 0]
  |  Branch (1261:35): [True: 0, False: 680k]
  |  Branch (1261:57): [True: 1.38k, False: 29.3k]
  ------------------
 1262|  1.38k|        ret = Z_BUF_ERROR;
  ------------------
  |  |  184|  1.38k|#define Z_BUF_ERROR    (-5)
  ------------------
 1263|   710k|    return ret;
 1264|   710k|}
inflateEnd:
 1266|  29.8k|int ZEXPORT inflateEnd(z_streamp strm) {
 1267|  29.8k|    struct inflate_state FAR *state;
 1268|  29.8k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1268:9): [True: 0, False: 29.8k]
  ------------------
 1269|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1270|  29.8k|    state = (struct inflate_state FAR *)strm->state;
 1271|  29.8k|    if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  212|  29.8k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  248|  8.45k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  |  Branch (1271:9): [True: 8.45k, False: 21.4k]
  ------------------
 1272|  29.8k|    ZFREE(strm, strm->state);
  ------------------
  |  |  248|  29.8k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
 1273|  29.8k|    strm->state = Z_NULL;
  ------------------
  |  |  212|  29.8k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1274|  29.8k|    Tracev((stderr, "inflate: end\n"));
 1275|  29.8k|    return Z_OK;
  ------------------
  |  |  177|  29.8k|#define Z_OK            0
  ------------------
 1276|  29.8k|}
inflate.c:inflateStateCheck:
   94|   830k|local int inflateStateCheck(z_streamp strm) {
   95|   830k|    struct inflate_state FAR *state;
   96|   830k|    if (strm == Z_NULL ||
  ------------------
  |  |  212|  1.66M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (96:9): [True: 0, False: 830k]
  ------------------
   97|   830k|        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (97:9): [True: 0, False: 830k]
  |  Branch (97:42): [True: 0, False: 830k]
  ------------------
   98|      0|        return 1;
   99|   830k|    state = (struct inflate_state FAR *)strm->state;
  100|   830k|    if (state == Z_NULL || state->strm != strm ||
  ------------------
  |  |  212|  1.66M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (100:9): [True: 0, False: 830k]
  |  Branch (100:28): [True: 0, False: 830k]
  ------------------
  101|   830k|        state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (101:9): [True: 0, False: 830k]
  |  Branch (101:31): [True: 0, False: 830k]
  ------------------
  102|      0|        return 1;
  103|   830k|    return 0;
  104|   830k|}
inflate.c:fixedtables:
  252|  55.5k|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|  55.5k|#   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|  55.5k|    static const code lenfix[512] = {
  |  |   11|  55.5k|        {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
  |  |   12|  55.5k|        {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
  |  |   13|  55.5k|        {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
  |  |   14|  55.5k|        {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
  |  |   15|  55.5k|        {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
  |  |   16|  55.5k|        {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
  |  |   17|  55.5k|        {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
  |  |   18|  55.5k|        {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
  |  |   19|  55.5k|        {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
  |  |   20|  55.5k|        {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
  |  |   21|  55.5k|        {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
  |  |   22|  55.5k|        {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
  |  |   23|  55.5k|        {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
  |  |   24|  55.5k|        {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
  |  |   25|  55.5k|        {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
  |  |   26|  55.5k|        {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
  |  |   27|  55.5k|        {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
  |  |   28|  55.5k|        {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
  |  |   29|  55.5k|        {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
  |  |   30|  55.5k|        {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
  |  |   31|  55.5k|        {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
  |  |   32|  55.5k|        {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
  |  |   33|  55.5k|        {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
  |  |   34|  55.5k|        {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
  |  |   35|  55.5k|        {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
  |  |   36|  55.5k|        {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
  |  |   37|  55.5k|        {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
  |  |   38|  55.5k|        {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
  |  |   39|  55.5k|        {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
  |  |   40|  55.5k|        {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
  |  |   41|  55.5k|        {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
  |  |   42|  55.5k|        {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
  |  |   43|  55.5k|        {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
  |  |   44|  55.5k|        {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
  |  |   45|  55.5k|        {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
  |  |   46|  55.5k|        {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
  |  |   47|  55.5k|        {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
  |  |   48|  55.5k|        {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
  |  |   49|  55.5k|        {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
  |  |   50|  55.5k|        {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
  |  |   51|  55.5k|        {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
  |  |   52|  55.5k|        {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
  |  |   53|  55.5k|        {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
  |  |   54|  55.5k|        {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
  |  |   55|  55.5k|        {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
  |  |   56|  55.5k|        {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
  |  |   57|  55.5k|        {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
  |  |   58|  55.5k|        {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
  |  |   59|  55.5k|        {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
  |  |   60|  55.5k|        {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
  |  |   61|  55.5k|        {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
  |  |   62|  55.5k|        {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
  |  |   63|  55.5k|        {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
  |  |   64|  55.5k|        {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
  |  |   65|  55.5k|        {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
  |  |   66|  55.5k|        {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
  |  |   67|  55.5k|        {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
  |  |   68|  55.5k|        {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
  |  |   69|  55.5k|        {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
  |  |   70|  55.5k|        {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
  |  |   71|  55.5k|        {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
  |  |   72|  55.5k|        {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
  |  |   73|  55.5k|        {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
  |  |   74|  55.5k|        {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
  |  |   75|  55.5k|        {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
  |  |   76|  55.5k|        {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
  |  |   77|  55.5k|        {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
  |  |   78|  55.5k|        {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
  |  |   79|  55.5k|        {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
  |  |   80|  55.5k|        {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
  |  |   81|  55.5k|        {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
  |  |   82|  55.5k|        {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
  |  |   83|  55.5k|        {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
  |  |   84|  55.5k|        {0,9,255}
  |  |   85|  55.5k|    };
  |  |   86|       |
  |  |   87|  55.5k|    static const code distfix[32] = {
  |  |   88|  55.5k|        {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
  |  |   89|  55.5k|        {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
  |  |   90|  55.5k|        {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
  |  |   91|  55.5k|        {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
  |  |   92|  55.5k|        {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
  |  |   93|  55.5k|        {22,5,193},{64,5,0}
  |  |   94|  55.5k|    };
  ------------------
  286|  55.5k|#endif /* BUILDFIXED */
  287|  55.5k|    state->lencode = lenfix;
  288|  55.5k|    state->lenbits = 9;
  289|  55.5k|    state->distcode = distfix;
  290|  55.5k|    state->distbits = 5;
  291|  55.5k|}
inflate.c:updatewindow:
  368|   615k|local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
  369|   615k|    struct inflate_state FAR *state;
  370|   615k|    unsigned dist;
  371|       |
  372|   615k|    state = (struct inflate_state FAR *)strm->state;
  373|       |
  374|       |    /* if it hasn't been done already, allocate space for the window */
  375|   615k|    if (state->window == Z_NULL) {
  ------------------
  |  |  212|   615k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (375:9): [True: 8.45k, False: 607k]
  ------------------
  376|  8.45k|        state->window = (unsigned char FAR *)
  377|  8.45k|                        ZALLOC(strm, 1U << state->wbits,
  ------------------
  |  |  247|  8.45k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  378|  8.45k|                               sizeof(unsigned char));
  379|  8.45k|        if (state->window == Z_NULL) return 1;
  ------------------
  |  |  212|  8.45k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (379:13): [True: 0, False: 8.45k]
  ------------------
  380|  8.45k|    }
  381|       |
  382|       |    /* if window not in use yet, initialize */
  383|   615k|    if (state->wsize == 0) {
  ------------------
  |  Branch (383:9): [True: 8.45k, False: 607k]
  ------------------
  384|  8.45k|        state->wsize = 1U << state->wbits;
  385|  8.45k|        state->wnext = 0;
  386|  8.45k|        state->whave = 0;
  387|  8.45k|    }
  388|       |
  389|       |    /* copy state->wsize or less output bytes into the circular window */
  390|   615k|    if (copy >= state->wsize) {
  ------------------
  |  Branch (390:9): [True: 1.30k, False: 614k]
  ------------------
  391|  1.30k|        zmemcpy(state->window, end - state->wsize, state->wsize);
  ------------------
  |  |  210|  1.30k|#    define zmemcpy memcpy
  ------------------
  392|  1.30k|        state->wnext = 0;
  393|  1.30k|        state->whave = state->wsize;
  394|  1.30k|    }
  395|   614k|    else {
  396|   614k|        dist = state->wsize - state->wnext;
  397|   614k|        if (dist > copy) dist = copy;
  ------------------
  |  Branch (397:13): [True: 613k, False: 1.04k]
  ------------------
  398|   614k|        zmemcpy(state->window + state->wnext, end - copy, dist);
  ------------------
  |  |  210|   614k|#    define zmemcpy memcpy
  ------------------
  399|   614k|        copy -= dist;
  400|   614k|        if (copy) {
  ------------------
  |  Branch (400:13): [True: 1.02k, False: 613k]
  ------------------
  401|  1.02k|            zmemcpy(state->window, end - copy, copy);
  ------------------
  |  |  210|  1.02k|#    define zmemcpy memcpy
  ------------------
  402|  1.02k|            state->wnext = copy;
  403|  1.02k|            state->whave = state->wsize;
  404|  1.02k|        }
  405|   613k|        else {
  406|   613k|            state->wnext += dist;
  407|   613k|            if (state->wnext == state->wsize) state->wnext = 0;
  ------------------
  |  Branch (407:17): [True: 28, False: 613k]
  ------------------
  408|   613k|            if (state->whave < state->wsize) state->whave += dist;
  ------------------
  |  Branch (408:17): [True: 126k, False: 486k]
  ------------------
  409|   613k|        }
  410|   614k|    }
  411|   615k|    return 0;
  412|   615k|}

inflate_table:
   34|  47.4k|                                unsigned FAR *bits, unsigned short FAR *work) {
   35|  47.4k|    unsigned len;               /* a code's length in bits */
   36|  47.4k|    unsigned sym;               /* index of code symbols */
   37|  47.4k|    unsigned min, max;          /* minimum and maximum code lengths */
   38|  47.4k|    unsigned root;              /* number of index bits for root table */
   39|  47.4k|    unsigned curr;              /* number of index bits for current table */
   40|  47.4k|    unsigned drop;              /* code bits to drop for sub-table */
   41|  47.4k|    int left;                   /* number of prefix codes available */
   42|  47.4k|    unsigned used;              /* code entries in table used */
   43|  47.4k|    unsigned huff;              /* Huffman code */
   44|  47.4k|    unsigned incr;              /* for incrementing code, index */
   45|  47.4k|    unsigned fill;              /* index for replicating entries */
   46|  47.4k|    unsigned low;               /* low bits for current root entry */
   47|  47.4k|    unsigned mask;              /* mask for low root bits */
   48|  47.4k|    code here;                  /* table entry for duplication */
   49|  47.4k|    code FAR *next;             /* next available space in table */
   50|  47.4k|    const unsigned short FAR *base;     /* base value table to use */
   51|  47.4k|    const unsigned short FAR *extra;    /* extra bits table to use */
   52|  47.4k|    unsigned match;             /* use base and extra for symbol >= match */
   53|  47.4k|    unsigned short count[MAXBITS+1];    /* number of codes of each length */
   54|  47.4k|    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
   55|  47.4k|    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
   56|  47.4k|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   57|  47.4k|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   58|  47.4k|    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
   59|  47.4k|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   60|  47.4k|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 200};
   61|  47.4k|    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
   62|  47.4k|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   63|  47.4k|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   64|  47.4k|        8193, 12289, 16385, 24577, 0, 0};
   65|  47.4k|    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
   66|  47.4k|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   67|  47.4k|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   68|  47.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|   806k|    for (len = 0; len <= MAXBITS; len++)
  ------------------
  |  |    9|   806k|#define MAXBITS 15
  ------------------
  |  Branch (102:19): [True: 758k, False: 47.4k]
  ------------------
  103|   758k|        count[len] = 0;
  104|  5.01M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (104:19): [True: 4.97M, False: 47.4k]
  ------------------
  105|  4.97M|        count[lens[sym]]++;
  106|       |
  107|       |    /* bound code lengths, force root to be within code lengths */
  108|  47.4k|    root = *bits;
  109|   490k|    for (max = MAXBITS; max >= 1; max--)
  ------------------
  |  |    9|  47.4k|#define MAXBITS 15
  ------------------
  |  Branch (109:25): [True: 490k, False: 8]
  ------------------
  110|   490k|        if (count[max] != 0) break;
  ------------------
  |  Branch (110:13): [True: 47.4k, False: 442k]
  ------------------
  111|  47.4k|    if (root > max) root = max;
  ------------------
  |  Branch (111:9): [True: 36.8k, False: 10.6k]
  ------------------
  112|  47.4k|    if (max == 0) {                     /* no symbols to code at all */
  ------------------
  |  Branch (112:9): [True: 8, False: 47.4k]
  ------------------
  113|      8|        here.op = (unsigned char)64;    /* invalid code marker */
  114|      8|        here.bits = (unsigned char)1;
  115|      8|        here.val = (unsigned short)0;
  116|      8|        *(*table)++ = here;             /* make a table to force an error */
  117|      8|        *(*table)++ = here;
  118|      8|        *bits = 1;
  119|      8|        return 0;     /* no symbols, but wait for decoding to report error */
  120|      8|    }
  121|  93.4k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (121:19): [True: 91.8k, False: 1.57k]
  ------------------
  122|  91.8k|        if (count[min] != 0) break;
  ------------------
  |  Branch (122:13): [True: 45.8k, False: 46.0k]
  ------------------
  123|  47.4k|    if (root < min) root = min;
  ------------------
  |  Branch (123:9): [True: 2, False: 47.4k]
  ------------------
  124|       |
  125|       |    /* check for an over-subscribed or incomplete set of lengths */
  126|  47.4k|    left = 1;
  127|   756k|    for (len = 1; len <= MAXBITS; len++) {
  ------------------
  |  |    9|   756k|#define MAXBITS 15
  ------------------
  |  Branch (127:19): [True: 709k, False: 47.2k]
  ------------------
  128|   709k|        left <<= 1;
  129|   709k|        left -= count[len];
  130|   709k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (130:13): [True: 182, False: 709k]
  ------------------
  131|   709k|    }
  132|  47.2k|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (132:9): [True: 161, False: 47.0k]
  |  Branch (132:22): [True: 66, False: 95]
  |  Branch (132:39): [True: 95, False: 0]
  ------------------
  133|    161|        return -1;                      /* incomplete set */
  134|       |
  135|       |    /* generate offsets into symbol table for each length for sorting */
  136|  47.0k|    offs[1] = 0;
  137|   706k|    for (len = 1; len < MAXBITS; len++)
  ------------------
  |  |    9|   706k|#define MAXBITS 15
  ------------------
  |  Branch (137:19): [True: 659k, False: 47.0k]
  ------------------
  138|   659k|        offs[len + 1] = offs[len] + count[len];
  139|       |
  140|       |    /* sort symbols by length, by symbol order within each length */
  141|  4.98M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (141:19): [True: 4.93M, False: 47.0k]
  ------------------
  142|  4.93M|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
  ------------------
  |  Branch (142:13): [True: 1.16M, False: 3.77M]
  ------------------
  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|  47.0k|    switch (type) {
  177|  16.0k|    case CODES:
  ------------------
  |  Branch (177:5): [True: 16.0k, False: 31.0k]
  ------------------
  178|  16.0k|        base = extra = work;    /* dummy value--not used */
  179|  16.0k|        match = 20;
  180|  16.0k|        break;
  181|  15.5k|    case LENS:
  ------------------
  |  Branch (181:5): [True: 15.5k, False: 31.5k]
  ------------------
  182|  15.5k|        base = lbase;
  183|  15.5k|        extra = lext;
  184|  15.5k|        match = 257;
  185|  15.5k|        break;
  186|  15.5k|    default:    /* DISTS */
  ------------------
  |  Branch (186:5): [True: 15.5k, False: 31.5k]
  ------------------
  187|  15.5k|        base = dbase;
  188|  15.5k|        extra = dext;
  189|  15.5k|        match = 0;
  190|  47.0k|    }
  191|       |
  192|       |    /* initialize state for loop */
  193|  47.0k|    huff = 0;                   /* starting code */
  194|  47.0k|    sym = 0;                    /* starting code symbol */
  195|  47.0k|    len = min;                  /* starting code length */
  196|  47.0k|    next = *table;              /* current table to fill in */
  197|  47.0k|    curr = root;                /* current table index bits */
  198|  47.0k|    drop = 0;                   /* current bits to drop from code for index */
  199|  47.0k|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  200|  47.0k|    used = 1U << root;          /* use root table entries */
  201|  47.0k|    mask = used - 1;            /* mask for comparing low */
  202|       |
  203|       |    /* check available table space */
  204|  47.0k|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   49|  15.5k|#define ENOUGH_LENS 852
  ------------------
  |  Branch (204:10): [True: 15.5k, False: 31.5k]
  |  Branch (204:26): [True: 0, False: 15.5k]
  ------------------
  205|  47.0k|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   50|  15.5k|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (205:10): [True: 15.5k, False: 31.5k]
  |  Branch (205:27): [True: 0, False: 15.5k]
  ------------------
  206|      0|        return 1;
  207|       |
  208|       |    /* process all codes and make table entries */
  209|  1.16M|    for (;;) {
  210|       |        /* create table entry */
  211|  1.16M|        here.bits = (unsigned char)(len - drop);
  212|  1.16M|        if (work[sym] + 1U < match) {
  ------------------
  |  Branch (212:13): [True: 845k, False: 320k]
  ------------------
  213|   845k|            here.op = (unsigned char)0;
  214|   845k|            here.val = work[sym];
  215|   845k|        }
  216|   320k|        else if (work[sym] >= match) {
  ------------------
  |  Branch (216:18): [True: 304k, False: 15.5k]
  ------------------
  217|   304k|            here.op = (unsigned char)(extra[work[sym] - match]);
  218|   304k|            here.val = base[work[sym] - match];
  219|   304k|        }
  220|  15.5k|        else {
  221|  15.5k|            here.op = (unsigned char)(32 + 64);         /* end of block */
  222|  15.5k|            here.val = 0;
  223|  15.5k|        }
  224|       |
  225|       |        /* replicate for those indices with low len bits equal to huff */
  226|  1.16M|        incr = 1U << (len - drop);
  227|  1.16M|        fill = 1U << curr;
  228|  1.16M|        min = fill;                 /* save offset to next table */
  229|  4.48M|        do {
  230|  4.48M|            fill -= incr;
  231|  4.48M|            next[(huff >> drop) + fill] = here;
  232|  4.48M|        } while (fill != 0);
  ------------------
  |  Branch (232:18): [True: 3.31M, False: 1.16M]
  ------------------
  233|       |
  234|       |        /* backwards increment the len-bit code huff */
  235|  1.16M|        incr = 1U << (len - 1);
  236|  2.28M|        while (huff & incr)
  ------------------
  |  Branch (236:16): [True: 1.11M, False: 1.16M]
  ------------------
  237|  1.11M|            incr >>= 1;
  238|  1.16M|        if (incr != 0) {
  ------------------
  |  Branch (238:13): [True: 1.11M, False: 47.0k]
  ------------------
  239|  1.11M|            huff &= incr - 1;
  240|  1.11M|            huff += incr;
  241|  1.11M|        }
  242|  47.0k|        else
  243|  47.0k|            huff = 0;
  244|       |
  245|       |        /* go to next symbol, update count, len */
  246|  1.16M|        sym++;
  247|  1.16M|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (247:13): [True: 202k, False: 963k]
  ------------------
  248|   202k|            if (len == max) break;
  ------------------
  |  Branch (248:17): [True: 47.0k, False: 155k]
  ------------------
  249|   155k|            len = lens[work[sym]];
  250|   155k|        }
  251|       |
  252|       |        /* create new sub-table if needed */
  253|  1.11M|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (253:13): [True: 205k, False: 913k]
  |  Branch (253:27): [True: 58.8k, False: 146k]
  ------------------
  254|       |            /* if first time, transition to sub-tables */
  255|  58.8k|            if (drop == 0)
  ------------------
  |  Branch (255:17): [True: 7.50k, False: 51.3k]
  ------------------
  256|  7.50k|                drop = root;
  257|       |
  258|       |            /* increment past last table */
  259|  58.8k|            next += min;            /* here min is 1 << curr */
  260|       |
  261|       |            /* determine length of next table */
  262|  58.8k|            curr = len - drop;
  263|  58.8k|            left = (int)(1 << curr);
  264|  65.1k|            while (curr + drop < max) {
  ------------------
  |  Branch (264:20): [True: 33.7k, False: 31.4k]
  ------------------
  265|  33.7k|                left -= count[curr + drop];
  266|  33.7k|                if (left <= 0) break;
  ------------------
  |  Branch (266:21): [True: 27.4k, False: 6.30k]
  ------------------
  267|  6.30k|                curr++;
  268|  6.30k|                left <<= 1;
  269|  6.30k|            }
  270|       |
  271|       |            /* check for enough space */
  272|  58.8k|            used += 1U << curr;
  273|  58.8k|            if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   49|  51.4k|#define ENOUGH_LENS 852
  ------------------
  |  Branch (273:18): [True: 51.4k, False: 7.39k]
  |  Branch (273:34): [True: 0, False: 51.4k]
  ------------------
  274|  58.8k|                (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   50|  7.39k|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (274:18): [True: 7.39k, False: 51.4k]
  |  Branch (274:35): [True: 0, False: 7.39k]
  ------------------
  275|      0|                return 1;
  276|       |
  277|       |            /* point entry in root table to sub-table */
  278|  58.8k|            low = huff & mask;
  279|  58.8k|            (*table)[low].op = (unsigned char)curr;
  280|  58.8k|            (*table)[low].bits = (unsigned char)root;
  281|  58.8k|            (*table)[low].val = (unsigned short)(next - *table);
  282|  58.8k|        }
  283|  1.11M|    }
  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|  47.0k|    if (huff != 0) {
  ------------------
  |  Branch (288:9): [True: 0, False: 47.0k]
  ------------------
  289|      0|        here.op = (unsigned char)64;            /* invalid code marker */
  290|      0|        here.bits = (unsigned char)(len - drop);
  291|      0|        here.val = (unsigned short)0;
  292|      0|        next[huff] = here;
  293|      0|    }
  294|       |
  295|       |    /* set return parameters */
  296|  47.0k|    *table += used;
  297|  47.0k|    *bits = root;
  298|  47.0k|    return 0;
  299|  47.0k|}

_tr_init:
  456|  41.2k|void ZLIB_INTERNAL _tr_init(deflate_state *s) {
  457|  41.2k|    tr_static_init();
  458|       |
  459|  41.2k|    s->l_desc.dyn_tree = s->dyn_ltree;
  460|  41.2k|    s->l_desc.stat_desc = &static_l_desc;
  461|       |
  462|  41.2k|    s->d_desc.dyn_tree = s->dyn_dtree;
  463|  41.2k|    s->d_desc.stat_desc = &static_d_desc;
  464|       |
  465|  41.2k|    s->bl_desc.dyn_tree = s->bl_tree;
  466|  41.2k|    s->bl_desc.stat_desc = &static_bl_desc;
  467|       |
  468|  41.2k|    s->bi_buf = 0;
  469|  41.2k|    s->bi_valid = 0;
  470|  41.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|  41.2k|    init_block(s);
  478|  41.2k|}
_tr_stored_block:
  861|    947|                                    ulg stored_len, int last) {
  862|    947|    send_bits(s, (STORED_BLOCK<<1) + last, 3);  /* send block type */
  ------------------
  |  |  274|    947|#define send_bits(s, value, length) \
  |  |  275|    947|{ int len = length;\
  |  |  276|    947|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|    947|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 0, False: 947]
  |  |  ------------------
  |  |  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|    947|  } else {\
  |  |  283|    947|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|    947|    s->bi_valid += len;\
  |  |  285|    947|  }\
  |  |  286|    947|}
  ------------------
  863|    947|    bi_windup(s);        /* align on byte boundary */
  864|    947|    put_short(s, (ush)stored_len);
  ------------------
  |  |  144|    947|#define put_short(s, w) { \
  |  |  145|    947|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  ------------------
  |  |  |  |  290|    947|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  146|    947|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  ------------------
  |  |  |  |  290|    947|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  147|    947|}
  ------------------
  865|    947|    put_short(s, (ush)~stored_len);
  ------------------
  |  |  144|    947|#define put_short(s, w) { \
  |  |  145|    947|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  ------------------
  |  |  |  |  290|    947|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  146|    947|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  ------------------
  |  |  |  |  290|    947|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  147|    947|}
  ------------------
  866|    947|    if (stored_len)
  ------------------
  |  Branch (866:9): [True: 947, False: 0]
  ------------------
  867|    947|        zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len);
  ------------------
  |  |  210|    947|#    define zmemcpy memcpy
  ------------------
  868|    947|    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|    947|}
_tr_flush_bits:
  880|   128k|void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s) {
  881|   128k|    bi_flush(s);
  882|   128k|}
_tr_flush_block:
  998|  45.5k|                                   ulg stored_len, int last) {
  999|  45.5k|    ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
 1000|  45.5k|    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|  45.5k|    if (s->level > 0) {
  ------------------
  |  Branch (1003:9): [True: 45.5k, False: 0]
  ------------------
 1004|       |
 1005|       |        /* Check if the file is binary or text */
 1006|  45.5k|        if (s->strm->data_type == Z_UNKNOWN)
  ------------------
  |  |  206|  45.5k|#define Z_UNKNOWN  2
  ------------------
  |  Branch (1006:13): [True: 40.9k, False: 4.55k]
  ------------------
 1007|  40.9k|            s->strm->data_type = detect_data_type(s);
 1008|       |
 1009|       |        /* Construct the literal and distance trees */
 1010|  45.5k|        build_tree(s, (tree_desc *)(&(s->l_desc)));
 1011|  45.5k|        Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
 1012|  45.5k|                s->static_len));
 1013|       |
 1014|  45.5k|        build_tree(s, (tree_desc *)(&(s->d_desc)));
 1015|  45.5k|        Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
 1016|  45.5k|                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|  45.5k|        max_blindex = build_bl_tree(s);
 1025|       |
 1026|       |        /* Determine the best encoding. Compute the block lengths in bytes. */
 1027|  45.5k|        opt_lenb = (s->opt_len + 3 + 7) >> 3;
 1028|  45.5k|        static_lenb = (s->static_len + 3 + 7) >> 3;
 1029|       |
 1030|  45.5k|        Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
 1031|  45.5k|                opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
 1032|  45.5k|                s->sym_next / 3));
 1033|       |
 1034|  45.5k|#ifndef FORCE_STATIC
 1035|  45.5k|        if (static_lenb <= opt_lenb || s->strategy == Z_FIXED)
  ------------------
  |  |  199|  16.2k|#define Z_FIXED               4
  ------------------
  |  Branch (1035:13): [True: 29.2k, False: 16.2k]
  |  Branch (1035:40): [True: 0, False: 16.2k]
  ------------------
 1036|  29.2k|#endif
 1037|  29.2k|            opt_lenb = static_lenb;
 1038|       |
 1039|  45.5k|    } 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|  45.5k|    if (stored_len + 4 <= opt_lenb && buf != (char*)0) {
  ------------------
  |  Branch (1047:9): [True: 947, False: 44.5k]
  |  Branch (1047:39): [True: 947, False: 0]
  ------------------
 1048|       |                       /* 4: two words for the lengths */
 1049|    947|#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|    947|        _tr_stored_block(s, buf, stored_len, last);
 1057|       |
 1058|  44.5k|    } else if (static_lenb == opt_lenb) {
  ------------------
  |  Branch (1058:16): [True: 28.8k, False: 15.7k]
  ------------------
 1059|  28.8k|        send_bits(s, (STATIC_TREES<<1) + last, 3);
  ------------------
  |  |  274|  28.8k|#define send_bits(s, value, length) \
  |  |  275|  28.8k|{ int len = length;\
  |  |  276|  28.8k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  28.8k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 0, False: 28.8k]
  |  |  ------------------
  |  |  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|  28.8k|  } else {\
  |  |  283|  28.8k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  28.8k|    s->bi_valid += len;\
  |  |  285|  28.8k|  }\
  |  |  286|  28.8k|}
  ------------------
 1060|  28.8k|        compress_block(s, (const ct_data *)static_ltree,
 1061|  28.8k|                       (const ct_data *)static_dtree);
 1062|       |#ifdef ZLIB_DEBUG
 1063|       |        s->compressed_len += 3 + s->static_len;
 1064|       |#endif
 1065|  28.8k|    } else {
 1066|  15.7k|        send_bits(s, (DYN_TREES<<1) + last, 3);
  ------------------
  |  |  274|  15.7k|#define send_bits(s, value, length) \
  |  |  275|  15.7k|{ int len = length;\
  |  |  276|  15.7k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  15.7k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 0, False: 15.7k]
  |  |  ------------------
  |  |  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|  15.7k|  } else {\
  |  |  283|  15.7k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  15.7k|    s->bi_valid += len;\
  |  |  285|  15.7k|  }\
  |  |  286|  15.7k|}
  ------------------
 1067|  15.7k|        send_all_trees(s, s->l_desc.max_code + 1, s->d_desc.max_code + 1,
 1068|  15.7k|                       max_blindex + 1);
 1069|  15.7k|        compress_block(s, (const ct_data *)s->dyn_ltree,
 1070|  15.7k|                       (const ct_data *)s->dyn_dtree);
 1071|       |#ifdef ZLIB_DEBUG
 1072|       |        s->compressed_len += 3 + s->opt_len;
 1073|       |#endif
 1074|  15.7k|    }
 1075|  45.5k|    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|  45.5k|    init_block(s);
 1080|       |
 1081|  45.5k|    if (last) {
  ------------------
  |  Branch (1081:9): [True: 40.9k, False: 4.59k]
  ------------------
 1082|  40.9k|        bi_windup(s);
 1083|       |#ifdef ZLIB_DEBUG
 1084|       |        s->compressed_len += 7;  /* align on byte boundary */
 1085|       |#endif
 1086|  40.9k|    }
 1087|  45.5k|    Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len >> 3,
 1088|  45.5k|           s->compressed_len - 7*last));
 1089|  45.5k|}
trees.c:tr_static_init:
  295|  41.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|  41.2k|}
trees.c:init_block:
  440|  86.8k|local void init_block(deflate_state *s) {
  441|  86.8k|    int n; /* iterates over tree elements */
  442|       |
  443|       |    /* Initialize the trees. */
  444|  24.9M|    for (n = 0; n < L_CODES;  n++) s->dyn_ltree[n].Freq = 0;
  ------------------
  |  |   40|  24.9M|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   37|  24.9M|#define LITERALS  256
  |  |  ------------------
  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   34|  24.9M|#define LENGTH_CODES 29
  |  |  ------------------
  ------------------
                  for (n = 0; n < L_CODES;  n++) s->dyn_ltree[n].Freq = 0;
  ------------------
  |  |   83|  24.8M|#define Freq fc.freq
  ------------------
  |  Branch (444:17): [True: 24.8M, False: 86.8k]
  ------------------
  445|  2.69M|    for (n = 0; n < D_CODES;  n++) s->dyn_dtree[n].Freq = 0;
  ------------------
  |  |   43|  2.69M|#define D_CODES   30
  ------------------
                  for (n = 0; n < D_CODES;  n++) s->dyn_dtree[n].Freq = 0;
  ------------------
  |  |   83|  2.60M|#define Freq fc.freq
  ------------------
  |  Branch (445:17): [True: 2.60M, False: 86.8k]
  ------------------
  446|  1.73M|    for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
  ------------------
  |  |   46|  1.73M|#define BL_CODES  19
  ------------------
                  for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
  ------------------
  |  |   83|  1.64M|#define Freq fc.freq
  ------------------
  |  Branch (446:17): [True: 1.64M, False: 86.8k]
  ------------------
  447|       |
  448|  86.8k|    s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |   50|  86.8k|#define END_BLOCK 256
  ------------------
                  s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |   83|  86.8k|#define Freq fc.freq
  ------------------
  449|  86.8k|    s->opt_len = s->static_len = 0L;
  450|  86.8k|    s->sym_next = s->matches = 0;
  451|  86.8k|}
trees.c:bi_windup:
  181|  41.8k|local void bi_windup(deflate_state *s) {
  182|  41.8k|    if (s->bi_valid > 8) {
  ------------------
  |  Branch (182:9): [True: 22.0k, False: 19.8k]
  ------------------
  183|  22.0k|        put_short(s, s->bi_buf);
  ------------------
  |  |  144|  22.0k|#define put_short(s, w) { \
  |  |  145|  22.0k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  ------------------
  |  |  |  |  290|  22.0k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  146|  22.0k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  ------------------
  |  |  |  |  290|  22.0k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  147|  22.0k|}
  ------------------
  184|  22.0k|    } else if (s->bi_valid > 0) {
  ------------------
  |  Branch (184:16): [True: 19.3k, False: 500]
  ------------------
  185|  19.3k|        put_byte(s, (Byte)s->bi_buf);
  ------------------
  |  |  290|  19.3k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
  186|  19.3k|    }
  187|  41.8k|    s->bi_used = ((s->bi_valid - 1) & 7) + 1;
  188|  41.8k|    s->bi_buf = 0;
  189|  41.8k|    s->bi_valid = 0;
  190|       |#ifdef ZLIB_DEBUG
  191|       |    s->bits_sent = (s->bits_sent + 7) & ~7;
  192|       |#endif
  193|  41.8k|}
trees.c:bi_flush:
  166|   128k|local void bi_flush(deflate_state *s) {
  167|   128k|    if (s->bi_valid == 16) {
  ------------------
  |  Branch (167:9): [True: 326, False: 128k]
  ------------------
  168|    326|        put_short(s, s->bi_buf);
  ------------------
  |  |  144|    326|#define put_short(s, w) { \
  |  |  145|    326|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  ------------------
  |  |  |  |  290|    326|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  146|    326|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  ------------------
  |  |  |  |  290|    326|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  ------------------
  |  |  147|    326|}
  ------------------
  169|    326|        s->bi_buf = 0;
  170|    326|        s->bi_valid = 0;
  171|   128k|    } else if (s->bi_valid >= 8) {
  ------------------
  |  Branch (171:16): [True: 1.88k, False: 126k]
  ------------------
  172|  1.88k|        put_byte(s, (Byte)s->bi_buf);
  ------------------
  |  |  290|  1.88k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  ------------------
  173|  1.88k|        s->bi_buf >>= 8;
  174|  1.88k|        s->bi_valid -= 8;
  175|  1.88k|    }
  176|   128k|}
trees.c:detect_data_type:
  966|  40.9k|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.9k|    unsigned long block_mask = 0xf3ffc07fUL;
  972|  40.9k|    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.2k]
  ------------------
  976|  1.04M|        if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
  ------------------
  |  |   83|   754k|#define Freq fc.freq
  ------------------
  |  Branch (976:13): [True: 754k, False: 292k]
  |  Branch (976:33): [True: 8.77k, False: 746k]
  ------------------
  977|  8.77k|            return Z_BINARY;
  ------------------
  |  |  203|  8.77k|#define Z_BINARY   0
  ------------------
  978|       |
  979|       |    /* Check for textual ("allow-listed") bytes. */
  980|  32.2k|    if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
  ------------------
  |  |   83|  32.2k|#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: 20, False: 32.1k]
  |  Branch (980:38): [True: 25.7k, False: 6.43k]
  ------------------
  981|  32.2k|            || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |   83|  6.43k|#define Freq fc.freq
  ------------------
  |  Branch (981:16): [True: 108, False: 6.32k]
  ------------------
  982|  25.8k|        return Z_TEXT;
  ------------------
  |  |  204|  25.8k|#define Z_TEXT     1
  ------------------
  983|   281k|    for (n = 32; n < LITERALS; n++)
  ------------------
  |  |   37|   281k|#define LITERALS  256
  ------------------
  |  Branch (983:18): [True: 281k, False: 4]
  ------------------
  984|   281k|        if (s->dyn_ltree[n].Freq != 0)
  ------------------
  |  |   83|   281k|#define Freq fc.freq
  ------------------
  |  Branch (984:13): [True: 6.32k, False: 274k]
  ------------------
  985|  6.32k|            return Z_TEXT;
  ------------------
  |  |  204|  12.6k|#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|      4|    return Z_BINARY;
  ------------------
  |  |  203|      4|#define Z_BINARY   0
  ------------------
  991|  6.32k|}
trees.c:build_tree:
  627|   136k|local void build_tree(deflate_state *s, tree_desc *desc) {
  628|   136k|    ct_data *tree         = desc->dyn_tree;
  629|   136k|    const ct_data *stree  = desc->stat_desc->static_tree;
  630|   136k|    int elems             = desc->stat_desc->elems;
  631|   136k|    int n, m;          /* iterate over heap elements */
  632|   136k|    int max_code = -1; /* largest code with non zero frequency */
  633|   136k|    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|   136k|    s->heap_len = 0, s->heap_max = HEAP_SIZE;
  ------------------
  |  |   49|   136k|#define HEAP_SIZE (2*L_CODES+1)
  |  |  ------------------
  |  |  |  |   40|   136k|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|   136k|#define LITERALS  256
  |  |  |  |  ------------------
  |  |  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|   136k|#define LENGTH_CODES 29
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  640|       |
  641|  15.3M|    for (n = 0; n < elems; n++) {
  ------------------
  |  Branch (641:17): [True: 15.2M, False: 136k]
  ------------------
  642|  15.2M|        if (tree[n].Freq != 0) {
  ------------------
  |  |   83|  15.2M|#define Freq fc.freq
  ------------------
  |  Branch (642:13): [True: 3.34M, False: 11.9M]
  ------------------
  643|  3.34M|            s->heap[++(s->heap_len)] = max_code = n;
  644|  3.34M|            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|  15.2M|    }
  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|   153k|    while (s->heap_len < 2) {
  ------------------
  |  Branch (655:12): [True: 16.6k, False: 136k]
  ------------------
  656|  16.6k|        node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
  ------------------
  |  Branch (656:44): [True: 13.0k, False: 3.60k]
  ------------------
  657|  16.6k|        tree[node].Freq = 1;
  ------------------
  |  |   83|  16.6k|#define Freq fc.freq
  ------------------
  658|  16.6k|        s->depth[node] = 0;
  659|  16.6k|        s->opt_len--; if (stree) s->static_len -= stree[node].Len;
  ------------------
  |  |   86|  16.6k|#define Len  dl.len
  ------------------
  |  Branch (659:27): [True: 16.6k, False: 0]
  ------------------
  660|       |        /* node is 0 or 1 so it does not have extra bits */
  661|  16.6k|    }
  662|   136k|    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.78M|    for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
  ------------------
  |  Branch (667:29): [True: 1.65M, False: 136k]
  ------------------
  668|       |
  669|       |    /* Construct the Huffman tree by repeatedly combining the least two
  670|       |     * frequent nodes.
  671|       |     */
  672|   136k|    node = elems;              /* next internal node of the tree */
  673|  3.22M|    do {
  674|  3.22M|        pqremove(s, tree, n);  /* n = node of least frequency */
  ------------------
  |  |  488|  3.22M|#define pqremove(s, tree, top) \
  |  |  489|  3.22M|{\
  |  |  490|  3.22M|    top = s->heap[SMALLEST]; \
  |  |  ------------------
  |  |  |  |  480|  3.22M|#define SMALLEST 1
  |  |  ------------------
  |  |  491|  3.22M|    s->heap[SMALLEST] = s->heap[s->heap_len--]; \
  |  |  ------------------
  |  |  |  |  480|  3.22M|#define SMALLEST 1
  |  |  ------------------
  |  |  492|  3.22M|    pqdownheap(s, tree, SMALLEST); \
  |  |  ------------------
  |  |  |  |  480|  3.22M|#define SMALLEST 1
  |  |  ------------------
  |  |  493|  3.22M|}
  ------------------
  675|  3.22M|        m = s->heap[SMALLEST]; /* m = node of next least frequency */
  ------------------
  |  |  480|  3.22M|#define SMALLEST 1
  ------------------
  676|       |
  677|  3.22M|        s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
  678|  3.22M|        s->heap[--(s->heap_max)] = m;
  679|       |
  680|       |        /* Create a new node father of n and m */
  681|  3.22M|        tree[node].Freq = tree[n].Freq + tree[m].Freq;
  ------------------
  |  |   83|  3.22M|#define Freq fc.freq
  ------------------
                      tree[node].Freq = tree[n].Freq + tree[m].Freq;
  ------------------
  |  |   83|  3.22M|#define Freq fc.freq
  ------------------
                      tree[node].Freq = tree[n].Freq + tree[m].Freq;
  ------------------
  |  |   83|  3.22M|#define Freq fc.freq
  ------------------
  682|  3.22M|        s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
  ------------------
  |  Branch (682:33): [True: 2.69M, False: 524k]
  ------------------
  683|  2.69M|                                s->depth[n] : s->depth[m]) + 1);
  684|  3.22M|        tree[n].Dad = tree[m].Dad = (ush)node;
  ------------------
  |  |   85|  3.22M|#define Dad  dl.dad
  ------------------
                      tree[n].Dad = tree[m].Dad = (ush)node;
  ------------------
  |  |   85|  3.22M|#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|  3.22M|        s->heap[SMALLEST] = node++;
  ------------------
  |  |  480|  3.22M|#define SMALLEST 1
  ------------------
  693|  3.22M|        pqdownheap(s, tree, SMALLEST);
  ------------------
  |  |  480|  3.22M|#define SMALLEST 1
  ------------------
  694|       |
  695|  3.22M|    } while (s->heap_len >= 2);
  ------------------
  |  Branch (695:14): [True: 3.08M, False: 136k]
  ------------------
  696|       |
  697|   136k|    s->heap[--(s->heap_max)] = s->heap[SMALLEST];
  ------------------
  |  |  480|   136k|#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|   136k|    gen_bitlen(s, (tree_desc *)desc);
  703|       |
  704|       |    /* The field len is now set, we can generate the bit codes */
  705|   136k|    gen_codes ((ct_data *)tree, max_code, s->bl_count);
  706|   136k|}
trees.c:pqdownheap:
  509|  8.09M|local void pqdownheap(deflate_state *s, ct_data *tree, int k) {
  510|  8.09M|    int v = s->heap[k];
  511|  8.09M|    int j = k << 1;  /* left son of k */
  512|  34.3M|    while (j <= s->heap_len) {
  ------------------
  |  Branch (512:12): [True: 28.3M, False: 6.01M]
  ------------------
  513|       |        /* Set j to the smallest of the two sons: */
  514|  28.3M|        if (j < s->heap_len &&
  ------------------
  |  Branch (514:13): [True: 27.5M, False: 839k]
  ------------------
  515|  28.3M|            smaller(tree, s->heap[j + 1], s->heap[j], s->depth)) {
  ------------------
  |  |  500|  27.5M|   (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |   83|  27.5M|#define Freq fc.freq
  |  |  ------------------
  |  |                  (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |   83|  55.0M|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (500:5): [True: 6.59M, False: 20.9M]
  |  |  ------------------
  |  |  501|  27.5M|   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |   83|  20.9M|#define Freq fc.freq
  |  |  ------------------
  |  |                  (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |   83|  41.8M|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (501:5): [True: 7.66M, False: 13.2M]
  |  |  |  Branch (501:37): [True: 6.55M, False: 1.11M]
  |  |  ------------------
  ------------------
  516|  13.1M|            j++;
  517|  13.1M|        }
  518|       |        /* Exit if v is smaller than both sons */
  519|  28.3M|        if (smaller(tree, v, s->heap[j], s->depth)) break;
  ------------------
  |  |  500|  28.3M|   (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |   83|  28.3M|#define Freq fc.freq
  |  |  ------------------
  |  |                  (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |   83|  56.7M|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (500:5): [True: 1.20M, False: 27.1M]
  |  |  ------------------
  |  |  501|  28.3M|   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |   83|  27.1M|#define Freq fc.freq
  |  |  ------------------
  |  |                  (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |   83|  54.3M|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (501:5): [True: 1.41M, False: 25.7M]
  |  |  |  Branch (501:37): [True: 875k, False: 536k]
  |  |  ------------------
  ------------------
  520|       |
  521|       |        /* Exchange v with the smallest son */
  522|  26.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|  26.2M|        j <<= 1;
  526|  26.2M|    }
  527|  8.09M|    s->heap[k] = v;
  528|  8.09M|}
trees.c:gen_bitlen:
  540|   136k|local void gen_bitlen(deflate_state *s, tree_desc *desc) {
  541|   136k|    ct_data *tree        = desc->dyn_tree;
  542|   136k|    int max_code         = desc->max_code;
  543|   136k|    const ct_data *stree = desc->stat_desc->static_tree;
  544|   136k|    const intf *extra    = desc->stat_desc->extra_bits;
  545|   136k|    int base             = desc->stat_desc->extra_base;
  546|   136k|    int max_length       = desc->stat_desc->max_length;
  547|   136k|    int h;              /* heap index */
  548|   136k|    int n, m;           /* iterate over the tree elements */
  549|   136k|    int bits;           /* bit length */
  550|   136k|    int xbits;          /* extra bits */
  551|   136k|    ush f;              /* frequency */
  552|   136k|    int overflow = 0;   /* number of elements with bit length too large */
  553|       |
  554|  2.32M|    for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
  ------------------
  |  |   52|  2.32M|#define MAX_BITS 15
  ------------------
  |  Branch (554:20): [True: 2.18M, False: 136k]
  ------------------
  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|   136k|    tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
  ------------------
  |  |   86|   136k|#define Len  dl.len
  ------------------
  560|       |
  561|  6.58M|    for (h = s->heap_max + 1; h < HEAP_SIZE; h++) {
  ------------------
  |  |   49|  6.58M|#define HEAP_SIZE (2*L_CODES+1)
  |  |  ------------------
  |  |  |  |   40|  6.58M|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  6.58M|#define LITERALS  256
  |  |  |  |  ------------------
  |  |  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  6.58M|#define LENGTH_CODES 29
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (561:31): [True: 6.44M, False: 136k]
  ------------------
  562|  6.44M|        n = s->heap[h];
  563|  6.44M|        bits = tree[tree[n].Dad].Len + 1;
  ------------------
  |  |   85|  6.44M|#define Dad  dl.dad
  ------------------
                      bits = tree[tree[n].Dad].Len + 1;
  ------------------
  |  |   86|  6.44M|#define Len  dl.len
  ------------------
  564|  6.44M|        if (bits > max_length) bits = max_length, overflow++;
  ------------------
  |  Branch (564:13): [True: 1.50k, False: 6.44M]
  ------------------
  565|  6.44M|        tree[n].Len = (ush)bits;
  ------------------
  |  |   86|  6.44M|#define Len  dl.len
  ------------------
  566|       |        /* We overwrite tree[n].Dad which is no longer needed */
  567|       |
  568|  6.44M|        if (n > max_code) continue; /* not a leaf node */
  ------------------
  |  Branch (568:13): [True: 3.08M, False: 3.36M]
  ------------------
  569|       |
  570|  3.36M|        s->bl_count[bits]++;
  571|  3.36M|        xbits = 0;
  572|  3.36M|        if (n >= base) xbits = extra[n - base];
  ------------------
  |  Branch (572:13): [True: 915k, False: 2.44M]
  ------------------
  573|  3.36M|        f = tree[n].Freq;
  ------------------
  |  |   83|  3.36M|#define Freq fc.freq
  ------------------
  574|  3.36M|        s->opt_len += (ulg)f * (unsigned)(bits + xbits);
  575|  3.36M|        if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits);
  ------------------
  |  |   86|  2.96M|#define Len  dl.len
  ------------------
  |  Branch (575:13): [True: 2.96M, False: 396k]
  ------------------
  576|  3.36M|    }
  577|   136k|    if (overflow == 0) return;
  ------------------
  |  Branch (577:9): [True: 136k, False: 591]
  ------------------
  578|       |
  579|    591|    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|    753|    do {
  584|    753|        bits = max_length - 1;
  585|    840|        while (s->bl_count[bits] == 0) bits--;
  ------------------
  |  Branch (585:16): [True: 87, False: 753]
  ------------------
  586|    753|        s->bl_count[bits]--;        /* move one leaf down the tree */
  587|    753|        s->bl_count[bits + 1] += 2; /* move one overflow item as its brother */
  588|    753|        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|    753|        overflow -= 2;
  593|    753|    } while (overflow > 0);
  ------------------
  |  Branch (593:14): [True: 162, False: 591]
  ------------------
  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|  4.72k|    for (bits = max_length; bits != 0; bits--) {
  ------------------
  |  Branch (600:29): [True: 4.13k, False: 591]
  ------------------
  601|  4.13k|        n = s->bl_count[bits];
  602|  17.5k|        while (n != 0) {
  ------------------
  |  Branch (602:16): [True: 13.3k, False: 4.13k]
  ------------------
  603|  13.3k|            m = s->heap[--h];
  604|  13.3k|            if (m > max_code) continue;
  ------------------
  |  Branch (604:17): [True: 5.35k, False: 8.03k]
  ------------------
  605|  8.03k|            if ((unsigned) tree[m].Len != (unsigned) bits) {
  ------------------
  |  |   86|  8.03k|#define Len  dl.len
  ------------------
  |  Branch (605:17): [True: 844, False: 7.18k]
  ------------------
  606|    844|                Tracev((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
  607|    844|                s->opt_len += ((ulg)bits - tree[m].Len) * tree[m].Freq;
  ------------------
  |  |   86|    844|#define Len  dl.len
  ------------------
                              s->opt_len += ((ulg)bits - tree[m].Len) * tree[m].Freq;
  ------------------
  |  |   83|    844|#define Freq fc.freq
  ------------------
  608|    844|                tree[m].Len = (ush)bits;
  ------------------
  |  |   86|    844|#define Len  dl.len
  ------------------
  609|    844|            }
  610|  8.03k|            n--;
  611|  8.03k|        }
  612|  4.13k|    }
  613|    591|}
trees.c:gen_codes:
  203|   136k|local void gen_codes(ct_data *tree, int max_code, ushf *bl_count) {
  204|   136k|    ush next_code[MAX_BITS+1]; /* next code value for each bit length */
  205|   136k|    unsigned code = 0;         /* running code value */
  206|   136k|    int bits;                  /* bit index */
  207|   136k|    int n;                     /* code index */
  208|       |
  209|       |    /* The distribution counts are first used to generate the code values
  210|       |     * without bit reversal.
  211|       |     */
  212|  2.18M|    for (bits = 1; bits <= MAX_BITS; bits++) {
  ------------------
  |  |   52|  2.18M|#define MAX_BITS 15
  ------------------
  |  Branch (212:20): [True: 2.04M, False: 136k]
  ------------------
  213|  2.04M|        code = (code + bl_count[bits - 1]) << 1;
  214|  2.04M|        next_code[bits] = (ush)code;
  215|  2.04M|    }
  216|       |    /* Check that the bit counts in bl_count are consistent. The last code
  217|       |     * must be all ones.
  218|       |     */
  219|   136k|    Assert (code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1,
  220|   136k|            "inconsistent bit counts");
  221|   136k|    Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
  222|       |
  223|  13.6M|    for (n = 0;  n <= max_code; n++) {
  ------------------
  |  Branch (223:18): [True: 13.5M, False: 136k]
  ------------------
  224|  13.5M|        int len = tree[n].Len;
  ------------------
  |  |   86|  13.5M|#define Len  dl.len
  ------------------
  225|  13.5M|        if (len == 0) continue;
  ------------------
  |  Branch (225:13): [True: 10.1M, False: 3.36M]
  ------------------
  226|       |        /* Now reverse the bits */
  227|  3.36M|        tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
  ------------------
  |  |   84|  3.36M|#define Code fc.code
  ------------------
  228|       |
  229|  3.36M|        Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
  230|  3.36M|            n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1));
  231|  3.36M|    }
  232|   136k|}
trees.c:bi_reverse:
  154|  3.36M|local unsigned bi_reverse(unsigned code, int len) {
  155|  3.36M|    register unsigned res = 0;
  156|  21.9M|    do {
  157|  21.9M|        res |= code & 1;
  158|  21.9M|        code >>= 1, res <<= 1;
  159|  21.9M|    } while (--len > 0);
  ------------------
  |  Branch (159:14): [True: 18.5M, False: 3.36M]
  ------------------
  160|  3.36M|    return res >> 1;
  161|  3.36M|}
trees.c:build_bl_tree:
  800|  45.5k|local int build_bl_tree(deflate_state *s) {
  801|  45.5k|    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|  45.5k|    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
  805|  45.5k|    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
  806|       |
  807|       |    /* Build the bit length tree: */
  808|  45.5k|    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|   113k|    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
  ------------------
  |  |   46|  45.5k|#define BL_CODES  19
  ------------------
  |  Branch (817:36): [True: 113k, False: 0]
  ------------------
  818|   113k|        if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
  ------------------
  |  |   86|   113k|#define Len  dl.len
  ------------------
  |  Branch (818:13): [True: 45.5k, False: 67.8k]
  ------------------
  819|   113k|    }
  820|       |    /* Update opt_len to include the bit length tree and counts */
  821|  45.5k|    s->opt_len += 3*((ulg)max_blindex + 1) + 5 + 5 + 4;
  822|  45.5k|    Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
  823|  45.5k|            s->opt_len, s->static_len));
  824|       |
  825|  45.5k|    return max_blindex;
  826|  45.5k|}
trees.c:scan_tree:
  712|  91.0k|local void scan_tree(deflate_state *s, ct_data *tree, int max_code) {
  713|  91.0k|    int n;                     /* iterates over all tree elements */
  714|  91.0k|    int prevlen = -1;          /* last emitted length */
  715|  91.0k|    int curlen;                /* length of current code */
  716|  91.0k|    int nextlen = tree[0].Len; /* length of next code */
  ------------------
  |  |   86|  91.0k|#define Len  dl.len
  ------------------
  717|  91.0k|    int count = 0;             /* repeat count of the current code */
  718|  91.0k|    int max_count = 7;         /* max repeat count */
  719|  91.0k|    int min_count = 4;         /* min repeat count */
  720|       |
  721|  91.0k|    if (nextlen == 0) max_count = 138, min_count = 3;
  ------------------
  |  Branch (721:9): [True: 55.5k, False: 35.5k]
  ------------------
  722|  91.0k|    tree[max_code + 1].Len = (ush)0xffff; /* guard */
  ------------------
  |  |   86|  91.0k|#define Len  dl.len
  ------------------
  723|       |
  724|  12.7M|    for (n = 0; n <= max_code; n++) {
  ------------------
  |  Branch (724:17): [True: 12.6M, False: 91.0k]
  ------------------
  725|  12.6M|        curlen = nextlen; nextlen = tree[n + 1].Len;
  ------------------
  |  |   86|  12.6M|#define Len  dl.len
  ------------------
  726|  12.6M|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (726:13): [True: 12.5M, False: 176k]
  |  Branch (726:36): [True: 10.3M, False: 2.14M]
  ------------------
  727|  10.3M|            continue;
  728|  10.3M|        } else if (count < min_count) {
  ------------------
  |  Branch (728:20): [True: 1.68M, False: 638k]
  ------------------
  729|  1.68M|            s->bl_tree[curlen].Freq += (ush)count;
  ------------------
  |  |   83|  1.68M|#define Freq fc.freq
  ------------------
  730|  1.68M|        } else if (curlen != 0) {
  ------------------
  |  Branch (730:20): [True: 214k, False: 423k]
  ------------------
  731|   214k|            if (curlen != prevlen) s->bl_tree[curlen].Freq++;
  ------------------
  |  |   83|  79.1k|#define Freq fc.freq
  ------------------
  |  Branch (731:17): [True: 79.1k, False: 135k]
  ------------------
  732|   214k|            s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |   53|   214k|#define REP_3_6      16
  ------------------
                          s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |   83|   214k|#define Freq fc.freq
  ------------------
  733|   423k|        } else if (count <= 10) {
  ------------------
  |  Branch (733:20): [True: 253k, False: 170k]
  ------------------
  734|   253k|            s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |   56|   253k|#define REPZ_3_10    17
  ------------------
                          s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |   83|   253k|#define Freq fc.freq
  ------------------
  735|   253k|        } else {
  736|   170k|            s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |   59|   170k|#define REPZ_11_138  18
  ------------------
                          s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |   83|   170k|#define Freq fc.freq
  ------------------
  737|   170k|        }
  738|  2.32M|        count = 0; prevlen = curlen;
  739|  2.32M|        if (nextlen == 0) {
  ------------------
  |  Branch (739:13): [True: 691k, False: 1.63M]
  ------------------
  740|   691k|            max_count = 138, min_count = 3;
  741|  1.63M|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (741:20): [True: 149k, False: 1.48M]
  ------------------
  742|   149k|            max_count = 6, min_count = 3;
  743|  1.48M|        } else {
  744|  1.48M|            max_count = 7, min_count = 4;
  745|  1.48M|        }
  746|  2.32M|    }
  747|  91.0k|}
trees.c:compress_block:
  901|  44.5k|                          const ct_data *dtree) {
  902|  44.5k|    unsigned dist;      /* distance of matched string */
  903|  44.5k|    int lc;             /* match length or unmatched char (if dist == 0) */
  904|  44.5k|    unsigned sx = 0;    /* running index in symbol buffers */
  905|  44.5k|    unsigned code;      /* the code to send */
  906|  44.5k|    int extra;          /* number of extra bits to send */
  907|       |
  908|  78.2M|    if (s->sym_next != 0) do {
  ------------------
  |  Branch (908:9): [True: 44.5k, False: 0]
  ------------------
  909|       |#ifdef LIT_MEM
  910|       |        dist = s->d_buf[sx];
  911|       |        lc = s->l_buf[sx++];
  912|       |#else
  913|  78.2M|        dist = s->sym_buf[sx++] & 0xff;
  914|  78.2M|        dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
  915|  78.2M|        lc = s->sym_buf[sx++];
  916|  78.2M|#endif
  917|  78.2M|        if (dist == 0) {
  ------------------
  |  Branch (917:13): [True: 68.3M, False: 9.88M]
  ------------------
  918|  68.3M|            send_code(s, lc, ltree); /* send a literal byte */
  ------------------
  |  |  239|  68.3M|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  68.3M|#define send_bits(s, value, length) \
  |  |  |  |  275|  68.3M|{ int len = length;\
  |  |  |  |  276|  68.3M|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  68.3M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 33.9M, False: 34.3M]
  |  |  |  |  ------------------
  |  |  |  |  277|  33.9M|    int val = (int)value;\
  |  |  |  |  278|  33.9M|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  33.9M|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  33.9M|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  33.9M|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  33.9M|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  33.9M|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  33.9M|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  33.9M|}
  |  |  |  |  ------------------
  |  |  |  |  280|  33.9M|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  33.9M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  33.9M|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  33.9M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  34.3M|  } else {\
  |  |  |  |  283|  34.3M|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  34.3M|    s->bi_valid += len;\
  |  |  |  |  285|  34.3M|  }\
  |  |  |  |  286|  68.3M|}
  |  |  ------------------
  ------------------
  919|  68.3M|            Tracecv(isgraph(lc), (stderr," '%c' ", lc));
  920|  68.3M|        } else {
  921|       |            /* Here, lc is the match length - MIN_MATCH */
  922|  9.88M|            code = _length_code[lc];
  923|  9.88M|            send_code(s, code + LITERALS + 1, ltree);   /* send length code */
  ------------------
  |  |  239|  9.88M|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  9.88M|#define send_bits(s, value, length) \
  |  |  |  |  275|  9.88M|{ int len = length;\
  |  |  |  |  276|  9.88M|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  9.88M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 2.02M, False: 7.86M]
  |  |  |  |  ------------------
  |  |  |  |  277|  2.02M|    int val = (int)value;\
  |  |  |  |  278|  2.02M|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  2.02M|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  2.02M|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  2.02M|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  2.02M|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.02M|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  2.02M|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.02M|}
  |  |  |  |  ------------------
  |  |  |  |  280|  2.02M|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  2.02M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  2.02M|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  2.02M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  7.86M|  } else {\
  |  |  |  |  283|  7.86M|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  7.86M|    s->bi_valid += len;\
  |  |  |  |  285|  7.86M|  }\
  |  |  |  |  286|  9.88M|}
  |  |  ------------------
  ------------------
  924|  9.88M|            extra = extra_lbits[code];
  925|  9.88M|            if (extra != 0) {
  ------------------
  |  Branch (925:17): [True: 1.56M, False: 8.32M]
  ------------------
  926|  1.56M|                lc -= base_length[code];
  927|  1.56M|                send_bits(s, lc, extra);       /* send the extra length bits */
  ------------------
  |  |  274|  1.56M|#define send_bits(s, value, length) \
  |  |  275|  1.56M|{ int len = length;\
  |  |  276|  1.56M|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  1.56M|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 267k, False: 1.29M]
  |  |  ------------------
  |  |  277|   267k|    int val = (int)value;\
  |  |  278|   267k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|   267k|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|   267k|#define put_short(s, w) { \
  |  |  |  |  145|   267k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|   267k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|   267k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|   267k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|   267k|}
  |  |  ------------------
  |  |  280|   267k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|   267k|#define Buf_size 16
  |  |  ------------------
  |  |  281|   267k|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|   267k|#define Buf_size 16
  |  |  ------------------
  |  |  282|  1.29M|  } else {\
  |  |  283|  1.29M|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  1.29M|    s->bi_valid += len;\
  |  |  285|  1.29M|  }\
  |  |  286|  1.56M|}
  ------------------
  928|  1.56M|            }
  929|  9.88M|            dist--; /* dist is now the match distance - 1 */
  930|  9.88M|            code = d_code(dist);
  ------------------
  |  |  318|  9.88M|   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
  |  |  ------------------
  |  |  |  Branch (318:5): [True: 7.67M, False: 2.21M]
  |  |  ------------------
  ------------------
  931|  9.88M|            Assert (code < D_CODES, "bad d_code");
  932|       |
  933|  9.88M|            send_code(s, code, dtree);       /* send the distance code */
  ------------------
  |  |  239|  9.88M|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  9.88M|#define send_bits(s, value, length) \
  |  |  |  |  275|  9.88M|{ int len = length;\
  |  |  |  |  276|  9.88M|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  9.88M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 1.24M, False: 8.64M]
  |  |  |  |  ------------------
  |  |  |  |  277|  1.24M|    int val = (int)value;\
  |  |  |  |  278|  1.24M|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  1.24M|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  1.24M|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  1.24M|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  1.24M|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.24M|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  1.24M|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.24M|}
  |  |  |  |  ------------------
  |  |  |  |  280|  1.24M|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  1.24M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  1.24M|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  1.24M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  8.64M|  } else {\
  |  |  |  |  283|  8.64M|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  8.64M|    s->bi_valid += len;\
  |  |  |  |  285|  8.64M|  }\
  |  |  |  |  286|  9.88M|}
  |  |  ------------------
  ------------------
  934|  9.88M|            extra = extra_dbits[code];
  935|  9.88M|            if (extra != 0) {
  ------------------
  |  Branch (935:17): [True: 3.09M, False: 6.79M]
  ------------------
  936|  3.09M|                dist -= (unsigned)base_dist[code];
  937|  3.09M|                send_bits(s, dist, extra);   /* send the extra distance bits */
  ------------------
  |  |  274|  3.09M|#define send_bits(s, value, length) \
  |  |  275|  3.09M|{ int len = length;\
  |  |  276|  3.09M|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  3.09M|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 1.59M, False: 1.50M]
  |  |  ------------------
  |  |  277|  1.59M|    int val = (int)value;\
  |  |  278|  1.59M|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|  1.59M|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|  1.59M|#define put_short(s, w) { \
  |  |  |  |  145|  1.59M|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  1.59M|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|  1.59M|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  1.59M|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|  1.59M|}
  |  |  ------------------
  |  |  280|  1.59M|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|  1.59M|#define Buf_size 16
  |  |  ------------------
  |  |  281|  1.59M|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|  1.59M|#define Buf_size 16
  |  |  ------------------
  |  |  282|  1.59M|  } else {\
  |  |  283|  1.50M|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  1.50M|    s->bi_valid += len;\
  |  |  285|  1.50M|  }\
  |  |  286|  3.09M|}
  ------------------
  938|  3.09M|            }
  939|  9.88M|        } /* 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|  78.2M|        Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
  946|  78.2M|#endif
  947|       |
  948|  78.2M|    } while (sx < s->sym_next);
  ------------------
  |  Branch (948:14): [True: 78.2M, False: 44.5k]
  ------------------
  949|       |
  950|  44.5k|    send_code(s, END_BLOCK, ltree);
  ------------------
  |  |  239|  44.5k|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  44.5k|#define send_bits(s, value, length) \
  |  |  |  |  275|  44.5k|{ int len = length;\
  |  |  |  |  276|  44.5k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  44.5k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 20.4k, False: 24.1k]
  |  |  |  |  ------------------
  |  |  |  |  277|  20.4k|    int val = (int)value;\
  |  |  |  |  278|  20.4k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  20.4k|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  20.4k|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  20.4k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  20.4k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  20.4k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  20.4k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  20.4k|}
  |  |  |  |  ------------------
  |  |  |  |  280|  20.4k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  20.4k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  20.4k|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  20.4k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  24.1k|  } else {\
  |  |  |  |  283|  24.1k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  24.1k|    s->bi_valid += len;\
  |  |  |  |  285|  24.1k|  }\
  |  |  |  |  286|  44.5k|}
  |  |  ------------------
  ------------------
  951|  44.5k|}
trees.c:send_all_trees:
  834|  15.7k|                          int blcodes) {
  835|  15.7k|    int rank;                    /* index in bl_order */
  836|       |
  837|  15.7k|    Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
  838|  15.7k|    Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
  839|  15.7k|            "too many codes");
  840|  15.7k|    Tracev((stderr, "\nbl counts: "));
  841|  15.7k|    send_bits(s, lcodes - 257, 5);  /* not +255 as stated in appnote.txt */
  ------------------
  |  |  274|  15.7k|#define send_bits(s, value, length) \
  |  |  275|  15.7k|{ int len = length;\
  |  |  276|  15.7k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  15.7k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 0, False: 15.7k]
  |  |  ------------------
  |  |  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|  15.7k|  } else {\
  |  |  283|  15.7k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  15.7k|    s->bi_valid += len;\
  |  |  285|  15.7k|  }\
  |  |  286|  15.7k|}
  ------------------
  842|  15.7k|    send_bits(s, dcodes - 1,   5);
  ------------------
  |  |  274|  15.7k|#define send_bits(s, value, length) \
  |  |  275|  15.7k|{ int len = length;\
  |  |  276|  15.7k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  15.7k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 2.04k, False: 13.6k]
  |  |  ------------------
  |  |  277|  2.04k|    int val = (int)value;\
  |  |  278|  2.04k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|  2.04k|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|  2.04k|#define put_short(s, w) { \
  |  |  |  |  145|  2.04k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  2.04k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|  2.04k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  2.04k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|  2.04k|}
  |  |  ------------------
  |  |  280|  2.04k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|  2.04k|#define Buf_size 16
  |  |  ------------------
  |  |  281|  2.04k|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|  2.04k|#define Buf_size 16
  |  |  ------------------
  |  |  282|  13.6k|  } else {\
  |  |  283|  13.6k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  13.6k|    s->bi_valid += len;\
  |  |  285|  13.6k|  }\
  |  |  286|  15.7k|}
  ------------------
  843|  15.7k|    send_bits(s, blcodes - 4,  4);  /* not -3 as stated in appnote.txt */
  ------------------
  |  |  274|  15.7k|#define send_bits(s, value, length) \
  |  |  275|  15.7k|{ int len = length;\
  |  |  276|  15.7k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  15.7k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 13.6k, False: 2.04k]
  |  |  ------------------
  |  |  277|  13.6k|    int val = (int)value;\
  |  |  278|  13.6k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|  13.6k|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|  13.6k|#define put_short(s, w) { \
  |  |  |  |  145|  13.6k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  13.6k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|  13.6k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  13.6k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|  13.6k|}
  |  |  ------------------
  |  |  280|  13.6k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|  13.6k|#define Buf_size 16
  |  |  ------------------
  |  |  281|  13.6k|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|  13.6k|#define Buf_size 16
  |  |  ------------------
  |  |  282|  13.6k|  } else {\
  |  |  283|  2.04k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  2.04k|    s->bi_valid += len;\
  |  |  285|  2.04k|  }\
  |  |  286|  15.7k|}
  ------------------
  844|   283k|    for (rank = 0; rank < blcodes; rank++) {
  ------------------
  |  Branch (844:20): [True: 267k, False: 15.7k]
  ------------------
  845|   267k|        Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
  846|   267k|        send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
  ------------------
  |  |  274|   267k|#define send_bits(s, value, length) \
  |  |  275|   267k|{ int len = length;\
  |  |  276|   267k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|   267k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 45.3k, False: 222k]
  |  |  ------------------
  |  |  277|  45.3k|    int val = (int)value;\
  |  |  278|  45.3k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|  45.3k|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|  45.3k|#define put_short(s, w) { \
  |  |  |  |  145|  45.3k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  45.3k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|  45.3k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  45.3k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|  45.3k|}
  |  |  ------------------
  |  |  280|  45.3k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|  45.3k|#define Buf_size 16
  |  |  ------------------
  |  |  281|  45.3k|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|  45.3k|#define Buf_size 16
  |  |  ------------------
  |  |  282|   222k|  } else {\
  |  |  283|   222k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|   222k|    s->bi_valid += len;\
  |  |  285|   222k|  }\
  |  |  286|   267k|}
  ------------------
  847|   267k|    }
  848|  15.7k|    Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
  849|       |
  850|  15.7k|    send_tree(s, (ct_data *)s->dyn_ltree, lcodes - 1);  /* literal tree */
  851|  15.7k|    Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
  852|       |
  853|  15.7k|    send_tree(s, (ct_data *)s->dyn_dtree, dcodes - 1);  /* distance tree */
  854|  15.7k|    Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
  855|  15.7k|}
trees.c:send_tree:
  753|  31.4k|local void send_tree(deflate_state *s, ct_data *tree, int max_code) {
  754|  31.4k|    int n;                     /* iterates over all tree elements */
  755|  31.4k|    int prevlen = -1;          /* last emitted length */
  756|  31.4k|    int curlen;                /* length of current code */
  757|  31.4k|    int nextlen = tree[0].Len; /* length of next code */
  ------------------
  |  |   86|  31.4k|#define Len  dl.len
  ------------------
  758|  31.4k|    int count = 0;             /* repeat count of the current code */
  759|  31.4k|    int max_count = 7;         /* max repeat count */
  760|  31.4k|    int min_count = 4;         /* min repeat count */
  761|       |
  762|       |    /* tree[max_code + 1].Len = -1; */  /* guard already set */
  763|  31.4k|    if (nextlen == 0) max_count = 138, min_count = 3;
  ------------------
  |  Branch (763:9): [True: 11.6k, False: 19.8k]
  ------------------
  764|       |
  765|  4.77M|    for (n = 0; n <= max_code; n++) {
  ------------------
  |  Branch (765:17): [True: 4.73M, False: 31.4k]
  ------------------
  766|  4.73M|        curlen = nextlen; nextlen = tree[n + 1].Len;
  ------------------
  |  |   86|  4.73M|#define Len  dl.len
  ------------------
  767|  4.73M|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (767:13): [True: 4.59M, False: 139k]
  |  Branch (767:36): [True: 3.61M, False: 987k]
  ------------------
  768|  3.61M|            continue;
  769|  3.61M|        } else if (count < min_count) {
  ------------------
  |  Branch (769:20): [True: 824k, False: 303k]
  ------------------
  770|  1.04M|            do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
  ------------------
  |  |  239|  1.04M|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  1.04M|#define send_bits(s, value, length) \
  |  |  |  |  275|  1.04M|{ int len = length;\
  |  |  |  |  276|  1.04M|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  1.04M|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 204k, False: 840k]
  |  |  |  |  ------------------
  |  |  |  |  277|   204k|    int val = (int)value;\
  |  |  |  |  278|   204k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|   204k|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|   204k|#define put_short(s, w) { \
  |  |  |  |  |  |  145|   204k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|   204k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   204k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|   204k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   204k|}
  |  |  |  |  ------------------
  |  |  |  |  280|   204k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   204k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|   204k|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   204k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|   840k|  } else {\
  |  |  |  |  283|   840k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|   840k|    s->bi_valid += len;\
  |  |  |  |  285|   840k|  }\
  |  |  |  |  286|  1.04M|}
  |  |  ------------------
  ------------------
  |  Branch (770:61): [True: 220k, False: 824k]
  ------------------
  771|       |
  772|   824k|        } else if (curlen != 0) {
  ------------------
  |  Branch (772:20): [True: 181k, False: 121k]
  ------------------
  773|   181k|            if (curlen != prevlen) {
  ------------------
  |  Branch (773:17): [True: 64.0k, False: 117k]
  ------------------
  774|  64.0k|                send_code(s, curlen, s->bl_tree); count--;
  ------------------
  |  |  239|  64.0k|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  64.0k|#define send_bits(s, value, length) \
  |  |  |  |  275|  64.0k|{ int len = length;\
  |  |  |  |  276|  64.0k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  64.0k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 10.5k, False: 53.4k]
  |  |  |  |  ------------------
  |  |  |  |  277|  10.5k|    int val = (int)value;\
  |  |  |  |  278|  10.5k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  10.5k|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  10.5k|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  10.5k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  10.5k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  10.5k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  10.5k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  10.5k|}
  |  |  |  |  ------------------
  |  |  |  |  280|  10.5k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  10.5k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  10.5k|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  10.5k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  53.4k|  } else {\
  |  |  |  |  283|  53.4k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  53.4k|    s->bi_valid += len;\
  |  |  |  |  285|  53.4k|  }\
  |  |  |  |  286|  64.0k|}
  |  |  ------------------
  ------------------
  775|  64.0k|            }
  776|   181k|            Assert(count >= 3 && count <= 6, " 3_6?");
  777|   181k|            send_code(s, REP_3_6, s->bl_tree); send_bits(s, count - 3, 2);
  ------------------
  |  |  239|   181k|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|   181k|#define send_bits(s, value, length) \
  |  |  |  |  275|   181k|{ int len = length;\
  |  |  |  |  276|   181k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   181k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 20.2k, False: 161k]
  |  |  |  |  ------------------
  |  |  |  |  277|  20.2k|    int val = (int)value;\
  |  |  |  |  278|  20.2k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  20.2k|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  20.2k|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  20.2k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  20.2k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  20.2k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  20.2k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  20.2k|}
  |  |  |  |  ------------------
  |  |  |  |  280|  20.2k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  20.2k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  20.2k|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  20.2k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|   161k|  } else {\
  |  |  |  |  283|   161k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|   161k|    s->bi_valid += len;\
  |  |  |  |  285|   161k|  }\
  |  |  |  |  286|   181k|}
  |  |  ------------------
  ------------------
                          send_code(s, REP_3_6, s->bl_tree); send_bits(s, count - 3, 2);
  ------------------
  |  |  274|   181k|#define send_bits(s, value, length) \
  |  |  275|   181k|{ int len = length;\
  |  |  276|   181k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|   181k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 22.2k, False: 159k]
  |  |  ------------------
  |  |  277|  22.2k|    int val = (int)value;\
  |  |  278|  22.2k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|  22.2k|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|  22.2k|#define put_short(s, w) { \
  |  |  |  |  145|  22.2k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  22.2k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|  22.2k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  22.2k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|  22.2k|}
  |  |  ------------------
  |  |  280|  22.2k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|  22.2k|#define Buf_size 16
  |  |  ------------------
  |  |  281|  22.2k|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|  22.2k|#define Buf_size 16
  |  |  ------------------
  |  |  282|   159k|  } else {\
  |  |  283|   159k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|   159k|    s->bi_valid += len;\
  |  |  285|   159k|  }\
  |  |  286|   181k|}
  ------------------
  778|       |
  779|   181k|        } else if (count <= 10) {
  ------------------
  |  Branch (779:20): [True: 70.8k, False: 50.8k]
  ------------------
  780|  70.8k|            send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count - 3, 3);
  ------------------
  |  |  239|  70.8k|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  70.8k|#define send_bits(s, value, length) \
  |  |  |  |  275|  70.8k|{ int len = length;\
  |  |  |  |  276|  70.8k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  70.8k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 11.0k, False: 59.8k]
  |  |  |  |  ------------------
  |  |  |  |  277|  11.0k|    int val = (int)value;\
  |  |  |  |  278|  11.0k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  11.0k|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  11.0k|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  11.0k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  11.0k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  11.0k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  11.0k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  11.0k|}
  |  |  |  |  ------------------
  |  |  |  |  280|  11.0k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  11.0k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  11.0k|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  11.0k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  59.8k|  } else {\
  |  |  |  |  283|  59.8k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  59.8k|    s->bi_valid += len;\
  |  |  |  |  285|  59.8k|  }\
  |  |  |  |  286|  70.8k|}
  |  |  ------------------
  ------------------
                          send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count - 3, 3);
  ------------------
  |  |  274|  70.8k|#define send_bits(s, value, length) \
  |  |  275|  70.8k|{ int len = length;\
  |  |  276|  70.8k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  70.8k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 14.7k, False: 56.0k]
  |  |  ------------------
  |  |  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|  56.0k|  } else {\
  |  |  283|  56.0k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  284|  56.0k|    s->bi_valid += len;\
  |  |  285|  56.0k|  }\
  |  |  286|  70.8k|}
  ------------------
  781|       |
  782|  70.8k|        } else {
  783|  50.8k|            send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count - 11, 7);
  ------------------
  |  |  239|  50.8k|#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
  |  |  ------------------
  |  |  |  |  274|  50.8k|#define send_bits(s, value, length) \
  |  |  |  |  275|  50.8k|{ int len = length;\
  |  |  |  |  276|  50.8k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  50.8k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (276:7): [True: 10.9k, False: 39.9k]
  |  |  |  |  ------------------
  |  |  |  |  277|  10.9k|    int val = (int)value;\
  |  |  |  |  278|  10.9k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  |  |  279|  10.9k|    put_short(s, s->bi_buf);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  10.9k|#define put_short(s, w) { \
  |  |  |  |  |  |  145|  10.9k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  10.9k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  10.9k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  290|  10.9k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  10.9k|}
  |  |  |  |  ------------------
  |  |  |  |  280|  10.9k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  10.9k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  281|  10.9k|    s->bi_valid += len - Buf_size;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  10.9k|#define Buf_size 16
  |  |  |  |  ------------------
  |  |  |  |  282|  39.9k|  } else {\
  |  |  |  |  283|  39.9k|    s->bi_buf |= (ush)(value) << s->bi_valid;\
  |  |  |  |  284|  39.9k|    s->bi_valid += len;\
  |  |  |  |  285|  39.9k|  }\
  |  |  |  |  286|  50.8k|}
  |  |  ------------------
  ------------------
                          send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count - 11, 7);
  ------------------
  |  |  274|  50.8k|#define send_bits(s, value, length) \
  |  |  275|  50.8k|{ int len = length;\
  |  |  276|  50.8k|  if (s->bi_valid > (int)Buf_size - len) {\
  |  |  ------------------
  |  |  |  |   55|  50.8k|#define Buf_size 16
  |  |  ------------------
  |  |  |  Branch (276:7): [True: 21.7k, False: 29.1k]
  |  |  ------------------
  |  |  277|  21.7k|    int val = (int)value;\
  |  |  278|  21.7k|    s->bi_buf |= (ush)val << s->bi_valid;\
  |  |  279|  21.7k|    put_short(s, s->bi_buf);\
  |  |  ------------------
  |  |  |  |  144|  21.7k|#define put_short(s, w) { \
  |  |  |  |  145|  21.7k|    put_byte(s, (uch)((w) & 0xff)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  21.7k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  146|  21.7k|    put_byte(s, (uch)((ush)(w) >> 8)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  290|  21.7k|#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
  |  |  |  |  ------------------
  |  |  |  |  147|  21.7k|}
  |  |  ------------------
  |  |  280|  21.7k|    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
  |  |  ------------------
  |  |  |  |   55|  21.7k|#define Buf_size 16
  |  |  ------------------
  |  |  281|  21.7k|    s->bi_valid += len - Buf_size;\
  |  |  ------------------
  |  |  |  |   55|  21.7k|#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|  50.8k|}
  ------------------
  784|  50.8k|        }
  785|  1.12M|        count = 0; prevlen = curlen;
  786|  1.12M|        if (nextlen == 0) {
  ------------------
  |  Branch (786:13): [True: 230k, False: 897k]
  ------------------
  787|   230k|            max_count = 138, min_count = 3;
  788|   897k|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (788:20): [True: 130k, False: 767k]
  ------------------
  789|   130k|            max_count = 6, min_count = 3;
  790|   767k|        } else {
  791|   767k|            max_count = 7, min_count = 4;
  792|   767k|        }
  793|  1.12M|    }
  794|  31.4k|}

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

